diff options
259 files changed, 3051 insertions, 2759 deletions
diff --git a/Documentation/DocBook/sh.tmpl b/Documentation/DocBook/sh.tmpl index d858d92cf6d9..4a38f604fa66 100644 --- a/Documentation/DocBook/sh.tmpl +++ b/Documentation/DocBook/sh.tmpl | |||
| @@ -79,10 +79,6 @@ | |||
| 79 | </sect2> | 79 | </sect2> |
| 80 | </sect1> | 80 | </sect1> |
| 81 | </chapter> | 81 | </chapter> |
| 82 | <chapter id="clk"> | ||
| 83 | <title>Clock Framework Extensions</title> | ||
| 84 | !Iinclude/linux/sh_clk.h | ||
| 85 | </chapter> | ||
| 86 | <chapter id="mach"> | 82 | <chapter id="mach"> |
| 87 | <title>Machine Specific Interfaces</title> | 83 | <title>Machine Specific Interfaces</title> |
| 88 | <sect1 id="dreamcast"> | 84 | <sect1 id="dreamcast"> |
diff --git a/Documentation/fb/00-INDEX b/Documentation/fb/00-INDEX index a618fd99c9f0..30a70542e823 100644 --- a/Documentation/fb/00-INDEX +++ b/Documentation/fb/00-INDEX | |||
| @@ -4,33 +4,41 @@ please mail me. | |||
| 4 | Geert Uytterhoeven <geert@linux-m68k.org> | 4 | Geert Uytterhoeven <geert@linux-m68k.org> |
| 5 | 5 | ||
| 6 | 00-INDEX | 6 | 00-INDEX |
| 7 | - this file | 7 | - this file. |
| 8 | arkfb.txt | 8 | arkfb.txt |
| 9 | - info on the fbdev driver for ARK Logic chips. | 9 | - info on the fbdev driver for ARK Logic chips. |
| 10 | aty128fb.txt | 10 | aty128fb.txt |
| 11 | - info on the ATI Rage128 frame buffer driver. | 11 | - info on the ATI Rage128 frame buffer driver. |
| 12 | cirrusfb.txt | 12 | cirrusfb.txt |
| 13 | - info on the driver for Cirrus Logic chipsets. | 13 | - info on the driver for Cirrus Logic chipsets. |
| 14 | cmap_xfbdev.txt | ||
| 15 | - an introduction to fbdev's cmap structures. | ||
| 14 | deferred_io.txt | 16 | deferred_io.txt |
| 15 | - an introduction to deferred IO. | 17 | - an introduction to deferred IO. |
| 18 | efifb.txt | ||
| 19 | - info on the EFI platform driver for Intel based Apple computers. | ||
| 20 | ep93xx-fb.txt | ||
| 21 | - info on the driver for EP93xx LCD controller. | ||
| 16 | fbcon.txt | 22 | fbcon.txt |
| 17 | - intro to and usage guide for the framebuffer console (fbcon). | 23 | - intro to and usage guide for the framebuffer console (fbcon). |
| 18 | framebuffer.txt | 24 | framebuffer.txt |
| 19 | - introduction to frame buffer devices. | 25 | - introduction to frame buffer devices. |
| 20 | imacfb.txt | 26 | gxfb.txt |
| 21 | - info on the generic EFI platform driver for Intel based Macs. | 27 | - info on the framebuffer driver for AMD Geode GX2 based processors. |
| 22 | intel810.txt | 28 | intel810.txt |
| 23 | - documentation for the Intel 810/815 framebuffer driver. | 29 | - documentation for the Intel 810/815 framebuffer driver. |
| 24 | intelfb.txt | 30 | intelfb.txt |
| 25 | - docs for Intel 830M/845G/852GM/855GM/865G/915G/945G fb driver. | 31 | - docs for Intel 830M/845G/852GM/855GM/865G/915G/945G fb driver. |
| 26 | internals.txt | 32 | internals.txt |
| 27 | - quick overview of frame buffer device internals. | 33 | - quick overview of frame buffer device internals. |
| 34 | lxfb.txt | ||
| 35 | - info on the framebuffer driver for AMD Geode LX based processors. | ||
| 28 | matroxfb.txt | 36 | matroxfb.txt |
| 29 | - info on the Matrox framebuffer driver for Alpha, Intel and PPC. | 37 | - info on the Matrox framebuffer driver for Alpha, Intel and PPC. |
| 38 | metronomefb.txt | ||
| 39 | - info on the driver for the Metronome display controller. | ||
| 30 | modedb.txt | 40 | modedb.txt |
| 31 | - info on the video mode database. | 41 | - info on the video mode database. |
| 32 | matroxfb.txt | ||
| 33 | - info on the Matrox frame buffer driver. | ||
| 34 | pvr2fb.txt | 42 | pvr2fb.txt |
| 35 | - info on the PowerVR 2 frame buffer driver. | 43 | - info on the PowerVR 2 frame buffer driver. |
| 36 | pxafb.txt | 44 | pxafb.txt |
| @@ -39,13 +47,23 @@ s3fb.txt | |||
| 39 | - info on the fbdev driver for S3 Trio/Virge chips. | 47 | - info on the fbdev driver for S3 Trio/Virge chips. |
| 40 | sa1100fb.txt | 48 | sa1100fb.txt |
| 41 | - information about the driver for the SA-1100 LCD controller. | 49 | - information about the driver for the SA-1100 LCD controller. |
| 50 | sh7760fb.txt | ||
| 51 | - info on the SH7760/SH7763 integrated LCDC Framebuffer driver. | ||
| 42 | sisfb.txt | 52 | sisfb.txt |
| 43 | - info on the framebuffer device driver for various SiS chips. | 53 | - info on the framebuffer device driver for various SiS chips. |
| 44 | sstfb.txt | 54 | sstfb.txt |
| 45 | - info on the frame buffer driver for 3dfx' Voodoo Graphics boards. | 55 | - info on the frame buffer driver for 3dfx' Voodoo Graphics boards. |
| 46 | tgafb.txt | 56 | tgafb.txt |
| 47 | - info on the TGA (DECChip 21030) frame buffer driver | 57 | - info on the TGA (DECChip 21030) frame buffer driver. |
| 58 | tridentfb.txt | ||
| 59 | info on the framebuffer driver for some Trident chip based cards. | ||
| 60 | uvesafb.txt | ||
| 61 | - info on the userspace VESA (VBE2+ compliant) frame buffer device. | ||
| 48 | vesafb.txt | 62 | vesafb.txt |
| 49 | - info on the VESA frame buffer device | 63 | - info on the VESA frame buffer device. |
| 64 | viafb.modes | ||
| 65 | - list of modes for VIA Integration Graphic Chip. | ||
| 66 | viafb.txt | ||
| 67 | - info on the VIA Integration Graphic Chip console framebuffer driver. | ||
| 50 | vt8623fb.txt | 68 | vt8623fb.txt |
| 51 | - info on the fb driver for the graphics core in VIA VT8623 chipsets. | 69 | - info on the fb driver for the graphics core in VIA VT8623 chipsets. |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 92e83e53148f..cdd2a6e8a3b7 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -2385,6 +2385,11 @@ and is between 256 and 4096 characters. It is defined in the file | |||
| 2385 | improve throughput, but will also increase the | 2385 | improve throughput, but will also increase the |
| 2386 | amount of memory reserved for use by the client. | 2386 | amount of memory reserved for use by the client. |
| 2387 | 2387 | ||
| 2388 | swapaccount[=0|1] | ||
| 2389 | [KNL] Enable accounting of swap in memory resource | ||
| 2390 | controller if no parameter or 1 is given or disable | ||
| 2391 | it if 0 is given (See Documentation/cgroups/memory.txt) | ||
| 2392 | |||
| 2388 | swiotlb= [IA-64] Number of I/O TLB slabs | 2393 | swiotlb= [IA-64] Number of I/O TLB slabs |
| 2389 | 2394 | ||
| 2390 | switches= [HW,M68k] | 2395 | switches= [HW,M68k] |
diff --git a/Documentation/sh/clk.txt b/Documentation/sh/clk.txt deleted file mode 100644 index 114b595cfa97..000000000000 --- a/Documentation/sh/clk.txt +++ /dev/null | |||
| @@ -1,32 +0,0 @@ | |||
| 1 | Clock framework on SuperH architecture | ||
| 2 | |||
| 3 | The framework on SH extends existing API by the function clk_set_rate_ex, | ||
| 4 | which prototype is as follows: | ||
| 5 | |||
| 6 | clk_set_rate_ex (struct clk *clk, unsigned long rate, int algo_id) | ||
| 7 | |||
| 8 | The algo_id parameter is used to specify algorithm used to recalculate clocks, | ||
| 9 | adjanced to clock, specified as first argument. It is assumed that algo_id==0 | ||
| 10 | means no changes to adjanced clock | ||
| 11 | |||
| 12 | Internally, the clk_set_rate_ex forwards request to clk->ops->set_rate method, | ||
| 13 | if it is present in ops structure. The method should set the clock rate and adjust | ||
| 14 | all needed clocks according to the passed algo_id. | ||
| 15 | Exact values for algo_id are machine-dependent. For the sh7722, the following | ||
| 16 | values are defined: | ||
| 17 | |||
| 18 | NO_CHANGE = 0, | ||
| 19 | IUS_N1_N1, /* I:U = N:1, U:Sh = N:1 */ | ||
| 20 | IUS_322, /* I:U:Sh = 3:2:2 */ | ||
| 21 | IUS_522, /* I:U:Sh = 5:2:2 */ | ||
| 22 | IUS_N11, /* I:U:Sh = N:1:1 */ | ||
| 23 | SB_N1, /* Sh:B = N:1 */ | ||
| 24 | SB3_N1, /* Sh:B3 = N:1 */ | ||
| 25 | SB3_32, /* Sh:B3 = 3:2 */ | ||
| 26 | SB3_43, /* Sh:B3 = 4:3 */ | ||
| 27 | SB3_54, /* Sh:B3 = 5:4 */ | ||
| 28 | BP_N1, /* B:P = N:1 */ | ||
| 29 | IP_N1 /* I:P = N:1 */ | ||
| 30 | |||
| 31 | Each of these constants means relation between clocks that can be set via the FRQCR | ||
| 32 | register | ||
diff --git a/MAINTAINERS b/MAINTAINERS index f51ec0a22ff9..98fc0450d7e1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -1359,7 +1359,7 @@ F: include/net/bluetooth/ | |||
| 1359 | 1359 | ||
| 1360 | BONDING DRIVER | 1360 | BONDING DRIVER |
| 1361 | M: Jay Vosburgh <fubar@us.ibm.com> | 1361 | M: Jay Vosburgh <fubar@us.ibm.com> |
| 1362 | L: bonding-devel@lists.sourceforge.net | 1362 | L: netdev@vger.kernel.org |
| 1363 | W: http://sourceforge.net/projects/bonding/ | 1363 | W: http://sourceforge.net/projects/bonding/ |
| 1364 | S: Supported | 1364 | S: Supported |
| 1365 | F: drivers/net/bonding/ | 1365 | F: drivers/net/bonding/ |
| @@ -1829,6 +1829,13 @@ W: http://www.chelsio.com | |||
| 1829 | S: Supported | 1829 | S: Supported |
| 1830 | F: drivers/net/cxgb4vf/ | 1830 | F: drivers/net/cxgb4vf/ |
| 1831 | 1831 | ||
| 1832 | STMMAC ETHERNET DRIVER | ||
| 1833 | M: Giuseppe Cavallaro <peppe.cavallaro@st.com> | ||
| 1834 | L: netdev@vger.kernel.org | ||
| 1835 | W: http://www.stlinux.com | ||
| 1836 | S: Supported | ||
| 1837 | F: drivers/net/stmmac/ | ||
| 1838 | |||
| 1832 | CYBERPRO FB DRIVER | 1839 | CYBERPRO FB DRIVER |
| 1833 | M: Russell King <linux@arm.linux.org.uk> | 1840 | M: Russell King <linux@arm.linux.org.uk> |
| 1834 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1841 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| @@ -2437,10 +2444,12 @@ F: drivers/net/wan/sdla.c | |||
| 2437 | FRAMEBUFFER LAYER | 2444 | FRAMEBUFFER LAYER |
| 2438 | L: linux-fbdev@vger.kernel.org | 2445 | L: linux-fbdev@vger.kernel.org |
| 2439 | W: http://linux-fbdev.sourceforge.net/ | 2446 | W: http://linux-fbdev.sourceforge.net/ |
| 2447 | Q: http://patchwork.kernel.org/project/linux-fbdev/list/ | ||
| 2440 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/lethal/fbdev-2.6.git | 2448 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/lethal/fbdev-2.6.git |
| 2441 | S: Orphan | 2449 | S: Orphan |
| 2442 | F: Documentation/fb/ | 2450 | F: Documentation/fb/ |
| 2443 | F: drivers/video/fb* | 2451 | F: drivers/video/ |
| 2452 | F: include/video/ | ||
| 2444 | F: include/linux/fb.h | 2453 | F: include/linux/fb.h |
| 2445 | 2454 | ||
| 2446 | FREESCALE DMA DRIVER | 2455 | FREESCALE DMA DRIVER |
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 2 | 1 | VERSION = 2 |
| 2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
| 3 | SUBLEVEL = 37 | 3 | SUBLEVEL = 37 |
| 4 | EXTRAVERSION = -rc2 | 4 | EXTRAVERSION = -rc3 |
| 5 | NAME = Flesh-Eating Bats with Fangs | 5 | NAME = Flesh-Eating Bats with Fangs |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c index 9be261beae7d..2652af124acd 100644 --- a/arch/arm/mach-davinci/dm355.c +++ b/arch/arm/mach-davinci/dm355.c | |||
| @@ -359,8 +359,8 @@ static struct clk_lookup dm355_clks[] = { | |||
| 359 | CLK(NULL, "uart1", &uart1_clk), | 359 | CLK(NULL, "uart1", &uart1_clk), |
| 360 | CLK(NULL, "uart2", &uart2_clk), | 360 | CLK(NULL, "uart2", &uart2_clk), |
| 361 | CLK("i2c_davinci.1", NULL, &i2c_clk), | 361 | CLK("i2c_davinci.1", NULL, &i2c_clk), |
| 362 | CLK("davinci-asp.0", NULL, &asp0_clk), | 362 | CLK("davinci-mcbsp.0", NULL, &asp0_clk), |
| 363 | CLK("davinci-asp.1", NULL, &asp1_clk), | 363 | CLK("davinci-mcbsp.1", NULL, &asp1_clk), |
| 364 | CLK("davinci_mmc.0", NULL, &mmcsd0_clk), | 364 | CLK("davinci_mmc.0", NULL, &mmcsd0_clk), |
| 365 | CLK("davinci_mmc.1", NULL, &mmcsd1_clk), | 365 | CLK("davinci_mmc.1", NULL, &mmcsd1_clk), |
| 366 | CLK("spi_davinci.0", NULL, &spi0_clk), | 366 | CLK("spi_davinci.0", NULL, &spi0_clk), |
| @@ -664,7 +664,7 @@ static struct resource dm355_asp1_resources[] = { | |||
| 664 | }; | 664 | }; |
| 665 | 665 | ||
| 666 | static struct platform_device dm355_asp1_device = { | 666 | static struct platform_device dm355_asp1_device = { |
| 667 | .name = "davinci-asp", | 667 | .name = "davinci-mcbsp", |
| 668 | .id = 1, | 668 | .id = 1, |
| 669 | .num_resources = ARRAY_SIZE(dm355_asp1_resources), | 669 | .num_resources = ARRAY_SIZE(dm355_asp1_resources), |
| 670 | .resource = dm355_asp1_resources, | 670 | .resource = dm355_asp1_resources, |
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index a12065e87266..c466d710d3c1 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c | |||
| @@ -459,7 +459,7 @@ static struct clk_lookup dm365_clks[] = { | |||
| 459 | CLK(NULL, "usb", &usb_clk), | 459 | CLK(NULL, "usb", &usb_clk), |
| 460 | CLK("davinci_emac.1", NULL, &emac_clk), | 460 | CLK("davinci_emac.1", NULL, &emac_clk), |
| 461 | CLK("davinci_voicecodec", NULL, &voicecodec_clk), | 461 | CLK("davinci_voicecodec", NULL, &voicecodec_clk), |
| 462 | CLK("davinci-asp.0", NULL, &asp0_clk), | 462 | CLK("davinci-mcbsp", NULL, &asp0_clk), |
| 463 | CLK(NULL, "rto", &rto_clk), | 463 | CLK(NULL, "rto", &rto_clk), |
| 464 | CLK(NULL, "mjcp", &mjcp_clk), | 464 | CLK(NULL, "mjcp", &mjcp_clk), |
| 465 | CLK(NULL, NULL, NULL), | 465 | CLK(NULL, NULL, NULL), |
| @@ -922,8 +922,8 @@ static struct resource dm365_asp_resources[] = { | |||
| 922 | }; | 922 | }; |
| 923 | 923 | ||
| 924 | static struct platform_device dm365_asp_device = { | 924 | static struct platform_device dm365_asp_device = { |
| 925 | .name = "davinci-asp", | 925 | .name = "davinci-mcbsp", |
| 926 | .id = 0, | 926 | .id = -1, |
| 927 | .num_resources = ARRAY_SIZE(dm365_asp_resources), | 927 | .num_resources = ARRAY_SIZE(dm365_asp_resources), |
| 928 | .resource = dm365_asp_resources, | 928 | .resource = dm365_asp_resources, |
| 929 | }; | 929 | }; |
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c index 0608dd776a16..9a2376b3137c 100644 --- a/arch/arm/mach-davinci/dm644x.c +++ b/arch/arm/mach-davinci/dm644x.c | |||
| @@ -302,7 +302,7 @@ static struct clk_lookup dm644x_clks[] = { | |||
| 302 | CLK("davinci_emac.1", NULL, &emac_clk), | 302 | CLK("davinci_emac.1", NULL, &emac_clk), |
| 303 | CLK("i2c_davinci.1", NULL, &i2c_clk), | 303 | CLK("i2c_davinci.1", NULL, &i2c_clk), |
| 304 | CLK("palm_bk3710", NULL, &ide_clk), | 304 | CLK("palm_bk3710", NULL, &ide_clk), |
| 305 | CLK("davinci-asp", NULL, &asp_clk), | 305 | CLK("davinci-mcbsp", NULL, &asp_clk), |
| 306 | CLK("davinci_mmc.0", NULL, &mmcsd_clk), | 306 | CLK("davinci_mmc.0", NULL, &mmcsd_clk), |
| 307 | CLK(NULL, "spi", &spi_clk), | 307 | CLK(NULL, "spi", &spi_clk), |
| 308 | CLK(NULL, "gpio", &gpio_clk), | 308 | CLK(NULL, "gpio", &gpio_clk), |
| @@ -580,7 +580,7 @@ static struct resource dm644x_asp_resources[] = { | |||
| 580 | }; | 580 | }; |
| 581 | 581 | ||
| 582 | static struct platform_device dm644x_asp_device = { | 582 | static struct platform_device dm644x_asp_device = { |
| 583 | .name = "davinci-asp", | 583 | .name = "davinci-mcbsp", |
| 584 | .id = -1, | 584 | .id = -1, |
| 585 | .num_resources = ARRAY_SIZE(dm644x_asp_resources), | 585 | .num_resources = ARRAY_SIZE(dm644x_asp_resources), |
| 586 | .resource = dm644x_asp_resources, | 586 | .resource = dm644x_asp_resources, |
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c index 7db31e6c6bf2..b25ce90a346e 100644 --- a/arch/arm/mach-shmobile/clock-sh7372.c +++ b/arch/arm/mach-shmobile/clock-sh7372.c | |||
| @@ -220,8 +220,7 @@ static void pllc2_disable(struct clk *clk) | |||
| 220 | __raw_writel(__raw_readl(PLLC2CR) & ~0x80000000, PLLC2CR); | 220 | __raw_writel(__raw_readl(PLLC2CR) & ~0x80000000, PLLC2CR); |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | static int pllc2_set_rate(struct clk *clk, | 223 | static int pllc2_set_rate(struct clk *clk, unsigned long rate) |
| 224 | unsigned long rate, int algo_id) | ||
| 225 | { | 224 | { |
| 226 | unsigned long value; | 225 | unsigned long value; |
| 227 | int idx; | 226 | int idx; |
| @@ -463,8 +462,7 @@ static int fsidiv_enable(struct clk *clk) | |||
| 463 | return 0; | 462 | return 0; |
| 464 | } | 463 | } |
| 465 | 464 | ||
| 466 | static int fsidiv_set_rate(struct clk *clk, | 465 | static int fsidiv_set_rate(struct clk *clk, unsigned long rate) |
| 467 | unsigned long rate, int algo_id) | ||
| 468 | { | 466 | { |
| 469 | int idx; | 467 | int idx; |
| 470 | 468 | ||
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h index 46d5179c9f49..e3c73cdd8c90 100644 --- a/arch/sh/include/asm/processor_32.h +++ b/arch/sh/include/asm/processor_32.h | |||
| @@ -199,10 +199,13 @@ extern unsigned long get_wchan(struct task_struct *p); | |||
| 199 | #define ARCH_HAS_PREFETCHW | 199 | #define ARCH_HAS_PREFETCHW |
| 200 | static inline void prefetch(void *x) | 200 | static inline void prefetch(void *x) |
| 201 | { | 201 | { |
| 202 | __asm__ __volatile__ ("pref @%0\n\t" : : "r" (x) : "memory"); | 202 | __builtin_prefetch(x, 0, 3); |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | #define prefetchw(x) prefetch(x) | 205 | static inline void prefetchw(void *x) |
| 206 | { | ||
| 207 | __builtin_prefetch(x, 1, 3); | ||
| 208 | } | ||
| 206 | #endif | 209 | #endif |
| 207 | 210 | ||
| 208 | #endif /* __KERNEL__ */ | 211 | #endif /* __KERNEL__ */ |
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c index 4eabc68cd753..b601fa3978d1 100644 --- a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c +++ b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c | |||
| @@ -110,7 +110,7 @@ static int shoc_clk_verify_rate(struct clk *clk, unsigned long rate) | |||
| 110 | return 0; | 110 | return 0; |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | static int shoc_clk_set_rate(struct clk *clk, unsigned long rate, int algo_id) | 113 | static int shoc_clk_set_rate(struct clk *clk, unsigned long rate) |
| 114 | { | 114 | { |
| 115 | unsigned long frqcr3; | 115 | unsigned long frqcr3; |
| 116 | unsigned int tmp; | 116 | unsigned int tmp; |
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c index 81f58371613d..8c6a350df751 100644 --- a/arch/sh/kernel/sys_sh.c +++ b/arch/sh/kernel/sys_sh.c | |||
| @@ -88,7 +88,7 @@ asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, int op) | |||
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | if (op & CACHEFLUSH_I) | 90 | if (op & CACHEFLUSH_I) |
| 91 | flush_cache_all(); | 91 | flush_icache_range(addr, addr+len); |
| 92 | 92 | ||
| 93 | up_read(¤t->mm->mmap_sem); | 93 | up_read(¤t->mm->mmap_sem); |
| 94 | return 0; | 94 | return 0; |
diff --git a/arch/sh/kernel/vsyscall/vsyscall-trapa.S b/arch/sh/kernel/vsyscall/vsyscall-trapa.S index 3b6eb34c43fa..3e70f851cdc6 100644 --- a/arch/sh/kernel/vsyscall/vsyscall-trapa.S +++ b/arch/sh/kernel/vsyscall/vsyscall-trapa.S | |||
| @@ -8,9 +8,9 @@ __kernel_vsyscall: | |||
| 8 | * fill out .eh_frame -- PFM. */ | 8 | * fill out .eh_frame -- PFM. */ |
| 9 | .LEND_vsyscall: | 9 | .LEND_vsyscall: |
| 10 | .size __kernel_vsyscall,.-.LSTART_vsyscall | 10 | .size __kernel_vsyscall,.-.LSTART_vsyscall |
| 11 | .previous | ||
| 12 | 11 | ||
| 13 | .section .eh_frame,"a",@progbits | 12 | .section .eh_frame,"a",@progbits |
| 13 | .previous | ||
| 14 | .LCIE: | 14 | .LCIE: |
| 15 | .ualong .LCIE_end - .LCIE_start | 15 | .ualong .LCIE_end - .LCIE_start |
| 16 | .LCIE_start: | 16 | .LCIE_start: |
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 7f7338c90784..1664cce7b0ac 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c | |||
| @@ -727,6 +727,9 @@ struct winch { | |||
| 727 | 727 | ||
| 728 | static void free_winch(struct winch *winch, int free_irq_ok) | 728 | static void free_winch(struct winch *winch, int free_irq_ok) |
| 729 | { | 729 | { |
| 730 | if (free_irq_ok) | ||
| 731 | free_irq(WINCH_IRQ, winch); | ||
| 732 | |||
| 730 | list_del(&winch->list); | 733 | list_del(&winch->list); |
| 731 | 734 | ||
| 732 | if (winch->pid != -1) | 735 | if (winch->pid != -1) |
| @@ -735,8 +738,6 @@ static void free_winch(struct winch *winch, int free_irq_ok) | |||
| 735 | os_close_file(winch->fd); | 738 | os_close_file(winch->fd); |
| 736 | if (winch->stack != 0) | 739 | if (winch->stack != 0) |
| 737 | free_stack(winch->stack, 0); | 740 | free_stack(winch->stack, 0); |
| 738 | if (free_irq_ok) | ||
| 739 | free_irq(WINCH_IRQ, winch); | ||
| 740 | kfree(winch); | 741 | kfree(winch); |
| 741 | } | 742 | } |
| 742 | 743 | ||
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h index 4d293dced62f..9479a037419f 100644 --- a/arch/x86/include/asm/fixmap.h +++ b/arch/x86/include/asm/fixmap.h | |||
| @@ -216,8 +216,8 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr) | |||
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | /* Return an pointer with offset calculated */ | 218 | /* Return an pointer with offset calculated */ |
| 219 | static inline unsigned long __set_fixmap_offset(enum fixed_addresses idx, | 219 | static __always_inline unsigned long |
| 220 | phys_addr_t phys, pgprot_t flags) | 220 | __set_fixmap_offset(enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags) |
| 221 | { | 221 | { |
| 222 | __set_fixmap(idx, phys, flags); | 222 | __set_fixmap(idx, phys, flags); |
| 223 | return fix_to_virt(idx) + (phys & (PAGE_SIZE - 1)); | 223 | return fix_to_virt(idx) + (phys & (PAGE_SIZE - 1)); |
diff --git a/arch/x86/include/asm/xen/interface.h b/arch/x86/include/asm/xen/interface.h index e8506c1f0c55..1c10c88ee4e1 100644 --- a/arch/x86/include/asm/xen/interface.h +++ b/arch/x86/include/asm/xen/interface.h | |||
| @@ -61,9 +61,9 @@ DEFINE_GUEST_HANDLE(void); | |||
| 61 | #define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START) | 61 | #define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START) |
| 62 | #endif | 62 | #endif |
| 63 | 63 | ||
| 64 | #ifndef machine_to_phys_mapping | 64 | #define MACH2PHYS_VIRT_START mk_unsigned_long(__MACH2PHYS_VIRT_START) |
| 65 | #define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START) | 65 | #define MACH2PHYS_VIRT_END mk_unsigned_long(__MACH2PHYS_VIRT_END) |
| 66 | #endif | 66 | #define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>__MACH2PHYS_SHIFT) |
| 67 | 67 | ||
| 68 | /* Maximum number of virtual CPUs in multi-processor guests. */ | 68 | /* Maximum number of virtual CPUs in multi-processor guests. */ |
| 69 | #define MAX_VIRT_CPUS 32 | 69 | #define MAX_VIRT_CPUS 32 |
diff --git a/arch/x86/include/asm/xen/interface_32.h b/arch/x86/include/asm/xen/interface_32.h index 42a7e004ae5c..8413688b2571 100644 --- a/arch/x86/include/asm/xen/interface_32.h +++ b/arch/x86/include/asm/xen/interface_32.h | |||
| @@ -32,6 +32,11 @@ | |||
| 32 | /* And the trap vector is... */ | 32 | /* And the trap vector is... */ |
| 33 | #define TRAP_INSTR "int $0x82" | 33 | #define TRAP_INSTR "int $0x82" |
| 34 | 34 | ||
| 35 | #define __MACH2PHYS_VIRT_START 0xF5800000 | ||
| 36 | #define __MACH2PHYS_VIRT_END 0xF6800000 | ||
| 37 | |||
| 38 | #define __MACH2PHYS_SHIFT 2 | ||
| 39 | |||
| 35 | /* | 40 | /* |
| 36 | * Virtual addresses beyond this are not modifiable by guest OSes. The | 41 | * Virtual addresses beyond this are not modifiable by guest OSes. The |
| 37 | * machine->physical mapping table starts at this address, read-only. | 42 | * machine->physical mapping table starts at this address, read-only. |
diff --git a/arch/x86/include/asm/xen/interface_64.h b/arch/x86/include/asm/xen/interface_64.h index 100d2662b97c..839a4811cf98 100644 --- a/arch/x86/include/asm/xen/interface_64.h +++ b/arch/x86/include/asm/xen/interface_64.h | |||
| @@ -39,18 +39,7 @@ | |||
| 39 | #define __HYPERVISOR_VIRT_END 0xFFFF880000000000 | 39 | #define __HYPERVISOR_VIRT_END 0xFFFF880000000000 |
| 40 | #define __MACH2PHYS_VIRT_START 0xFFFF800000000000 | 40 | #define __MACH2PHYS_VIRT_START 0xFFFF800000000000 |
| 41 | #define __MACH2PHYS_VIRT_END 0xFFFF804000000000 | 41 | #define __MACH2PHYS_VIRT_END 0xFFFF804000000000 |
| 42 | 42 | #define __MACH2PHYS_SHIFT 3 | |
| 43 | #ifndef HYPERVISOR_VIRT_START | ||
| 44 | #define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START) | ||
| 45 | #define HYPERVISOR_VIRT_END mk_unsigned_long(__HYPERVISOR_VIRT_END) | ||
| 46 | #endif | ||
| 47 | |||
| 48 | #define MACH2PHYS_VIRT_START mk_unsigned_long(__MACH2PHYS_VIRT_START) | ||
| 49 | #define MACH2PHYS_VIRT_END mk_unsigned_long(__MACH2PHYS_VIRT_END) | ||
| 50 | #define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>3) | ||
| 51 | #ifndef machine_to_phys_mapping | ||
| 52 | #define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START) | ||
| 53 | #endif | ||
| 54 | 43 | ||
| 55 | /* | 44 | /* |
| 56 | * int HYPERVISOR_set_segment_base(unsigned int which, unsigned long base) | 45 | * int HYPERVISOR_set_segment_base(unsigned int which, unsigned long base) |
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h index dd8c1414b3d5..8760cc60a21c 100644 --- a/arch/x86/include/asm/xen/page.h +++ b/arch/x86/include/asm/xen/page.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
| 6 | #include <linux/spinlock.h> | 6 | #include <linux/spinlock.h> |
| 7 | #include <linux/pfn.h> | 7 | #include <linux/pfn.h> |
| 8 | #include <linux/mm.h> | ||
| 8 | 9 | ||
| 9 | #include <asm/uaccess.h> | 10 | #include <asm/uaccess.h> |
| 10 | #include <asm/page.h> | 11 | #include <asm/page.h> |
| @@ -35,6 +36,8 @@ typedef struct xpaddr { | |||
| 35 | #define MAX_DOMAIN_PAGES \ | 36 | #define MAX_DOMAIN_PAGES \ |
| 36 | ((unsigned long)((u64)CONFIG_XEN_MAX_DOMAIN_MEMORY * 1024 * 1024 * 1024 / PAGE_SIZE)) | 37 | ((unsigned long)((u64)CONFIG_XEN_MAX_DOMAIN_MEMORY * 1024 * 1024 * 1024 / PAGE_SIZE)) |
| 37 | 38 | ||
| 39 | extern unsigned long *machine_to_phys_mapping; | ||
| 40 | extern unsigned int machine_to_phys_order; | ||
| 38 | 41 | ||
| 39 | extern unsigned long get_phys_to_machine(unsigned long pfn); | 42 | extern unsigned long get_phys_to_machine(unsigned long pfn); |
| 40 | extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn); | 43 | extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn); |
| @@ -69,10 +72,8 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn) | |||
| 69 | if (xen_feature(XENFEAT_auto_translated_physmap)) | 72 | if (xen_feature(XENFEAT_auto_translated_physmap)) |
| 70 | return mfn; | 73 | return mfn; |
| 71 | 74 | ||
| 72 | #if 0 | ||
| 73 | if (unlikely((mfn >> machine_to_phys_order) != 0)) | 75 | if (unlikely((mfn >> machine_to_phys_order) != 0)) |
| 74 | return max_mapnr; | 76 | return ~0; |
| 75 | #endif | ||
| 76 | 77 | ||
| 77 | pfn = 0; | 78 | pfn = 0; |
| 78 | /* | 79 | /* |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 235c0f4d3861..7250bef7f49e 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
| @@ -75,6 +75,11 @@ DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info); | |||
| 75 | enum xen_domain_type xen_domain_type = XEN_NATIVE; | 75 | enum xen_domain_type xen_domain_type = XEN_NATIVE; |
| 76 | EXPORT_SYMBOL_GPL(xen_domain_type); | 76 | EXPORT_SYMBOL_GPL(xen_domain_type); |
| 77 | 77 | ||
| 78 | unsigned long *machine_to_phys_mapping = (void *)MACH2PHYS_VIRT_START; | ||
| 79 | EXPORT_SYMBOL(machine_to_phys_mapping); | ||
| 80 | unsigned int machine_to_phys_order; | ||
| 81 | EXPORT_SYMBOL(machine_to_phys_order); | ||
| 82 | |||
| 78 | struct start_info *xen_start_info; | 83 | struct start_info *xen_start_info; |
| 79 | EXPORT_SYMBOL_GPL(xen_start_info); | 84 | EXPORT_SYMBOL_GPL(xen_start_info); |
| 80 | 85 | ||
| @@ -1090,6 +1095,8 @@ static void __init xen_setup_stackprotector(void) | |||
| 1090 | /* First C function to be called on Xen boot */ | 1095 | /* First C function to be called on Xen boot */ |
| 1091 | asmlinkage void __init xen_start_kernel(void) | 1096 | asmlinkage void __init xen_start_kernel(void) |
| 1092 | { | 1097 | { |
| 1098 | struct physdev_set_iopl set_iopl; | ||
| 1099 | int rc; | ||
| 1093 | pgd_t *pgd; | 1100 | pgd_t *pgd; |
| 1094 | 1101 | ||
| 1095 | if (!xen_start_info) | 1102 | if (!xen_start_info) |
| @@ -1097,6 +1104,8 @@ asmlinkage void __init xen_start_kernel(void) | |||
| 1097 | 1104 | ||
| 1098 | xen_domain_type = XEN_PV_DOMAIN; | 1105 | xen_domain_type = XEN_PV_DOMAIN; |
| 1099 | 1106 | ||
| 1107 | xen_setup_machphys_mapping(); | ||
| 1108 | |||
| 1100 | /* Install Xen paravirt ops */ | 1109 | /* Install Xen paravirt ops */ |
| 1101 | pv_info = xen_info; | 1110 | pv_info = xen_info; |
| 1102 | pv_init_ops = xen_init_ops; | 1111 | pv_init_ops = xen_init_ops; |
| @@ -1202,10 +1211,18 @@ asmlinkage void __init xen_start_kernel(void) | |||
| 1202 | #else | 1211 | #else |
| 1203 | pv_info.kernel_rpl = 0; | 1212 | pv_info.kernel_rpl = 0; |
| 1204 | #endif | 1213 | #endif |
| 1205 | |||
| 1206 | /* set the limit of our address space */ | 1214 | /* set the limit of our address space */ |
| 1207 | xen_reserve_top(); | 1215 | xen_reserve_top(); |
| 1208 | 1216 | ||
| 1217 | /* We used to do this in xen_arch_setup, but that is too late on AMD | ||
| 1218 | * were early_cpu_init (run before ->arch_setup()) calls early_amd_init | ||
| 1219 | * which pokes 0xcf8 port. | ||
| 1220 | */ | ||
| 1221 | set_iopl.iopl = 1; | ||
| 1222 | rc = HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl); | ||
| 1223 | if (rc != 0) | ||
| 1224 | xen_raw_printk("physdev_op failed %d\n", rc); | ||
| 1225 | |||
| 1209 | #ifdef CONFIG_X86_32 | 1226 | #ifdef CONFIG_X86_32 |
| 1210 | /* set up basic CPUID stuff */ | 1227 | /* set up basic CPUID stuff */ |
| 1211 | cpu_detect(&new_cpu_data); | 1228 | cpu_detect(&new_cpu_data); |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 21ed8d7f75a5..790af908284e 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
| @@ -2034,6 +2034,20 @@ static __init void xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn) | |||
| 2034 | set_page_prot(pmd, PAGE_KERNEL_RO); | 2034 | set_page_prot(pmd, PAGE_KERNEL_RO); |
| 2035 | } | 2035 | } |
| 2036 | 2036 | ||
| 2037 | void __init xen_setup_machphys_mapping(void) | ||
| 2038 | { | ||
| 2039 | struct xen_machphys_mapping mapping; | ||
| 2040 | unsigned long machine_to_phys_nr_ents; | ||
| 2041 | |||
| 2042 | if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) { | ||
| 2043 | machine_to_phys_mapping = (unsigned long *)mapping.v_start; | ||
| 2044 | machine_to_phys_nr_ents = mapping.max_mfn + 1; | ||
| 2045 | } else { | ||
| 2046 | machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES; | ||
| 2047 | } | ||
| 2048 | machine_to_phys_order = fls(machine_to_phys_nr_ents - 1); | ||
| 2049 | } | ||
| 2050 | |||
| 2037 | #ifdef CONFIG_X86_64 | 2051 | #ifdef CONFIG_X86_64 |
| 2038 | static void convert_pfn_mfn(void *v) | 2052 | static void convert_pfn_mfn(void *v) |
| 2039 | { | 2053 | { |
| @@ -2627,7 +2641,8 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma, | |||
| 2627 | 2641 | ||
| 2628 | prot = __pgprot(pgprot_val(prot) | _PAGE_IOMAP); | 2642 | prot = __pgprot(pgprot_val(prot) | _PAGE_IOMAP); |
| 2629 | 2643 | ||
| 2630 | vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP; | 2644 | BUG_ON(!((vma->vm_flags & (VM_PFNMAP | VM_RESERVED | VM_IO)) == |
| 2645 | (VM_PFNMAP | VM_RESERVED | VM_IO))); | ||
| 2631 | 2646 | ||
| 2632 | rmd.mfn = mfn; | 2647 | rmd.mfn = mfn; |
| 2633 | rmd.prot = prot; | 2648 | rmd.prot = prot; |
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 769c4b01fa32..38fdffaa71d3 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
| @@ -248,8 +248,7 @@ char * __init xen_memory_setup(void) | |||
| 248 | else | 248 | else |
| 249 | extra_pages = 0; | 249 | extra_pages = 0; |
| 250 | 250 | ||
| 251 | if (!xen_initial_domain()) | 251 | xen_add_extra_mem(extra_pages); |
| 252 | xen_add_extra_mem(extra_pages); | ||
| 253 | 252 | ||
| 254 | return "Xen"; | 253 | return "Xen"; |
| 255 | } | 254 | } |
| @@ -337,9 +336,6 @@ void __cpuinit xen_enable_syscall(void) | |||
| 337 | 336 | ||
| 338 | void __init xen_arch_setup(void) | 337 | void __init xen_arch_setup(void) |
| 339 | { | 338 | { |
| 340 | struct physdev_set_iopl set_iopl; | ||
| 341 | int rc; | ||
| 342 | |||
| 343 | xen_panic_handler_init(); | 339 | xen_panic_handler_init(); |
| 344 | 340 | ||
| 345 | HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); | 341 | HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); |
| @@ -356,11 +352,6 @@ void __init xen_arch_setup(void) | |||
| 356 | xen_enable_sysenter(); | 352 | xen_enable_sysenter(); |
| 357 | xen_enable_syscall(); | 353 | xen_enable_syscall(); |
| 358 | 354 | ||
| 359 | set_iopl.iopl = 1; | ||
| 360 | rc = HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl); | ||
| 361 | if (rc != 0) | ||
| 362 | printk(KERN_INFO "physdev_op failed %d\n", rc); | ||
| 363 | |||
| 364 | #ifdef CONFIG_ACPI | 355 | #ifdef CONFIG_ACPI |
| 365 | if (!(xen_start_info->flags & SIF_INITDOMAIN)) { | 356 | if (!(xen_start_info->flags & SIF_INITDOMAIN)) { |
| 366 | printk(KERN_INFO "ACPI in unprivileged domain disabled\n"); | 357 | printk(KERN_INFO "ACPI in unprivileged domain disabled\n"); |
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index c21589986c69..8b677bbf2d37 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
| @@ -538,7 +538,7 @@ static int vt8251_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) | |||
| 538 | return 0; | 538 | return 0; |
| 539 | } | 539 | } |
| 540 | 540 | ||
| 541 | static void svia_configure(struct pci_dev *pdev) | 541 | static void svia_configure(struct pci_dev *pdev, int board_id) |
| 542 | { | 542 | { |
| 543 | u8 tmp8; | 543 | u8 tmp8; |
| 544 | 544 | ||
| @@ -577,7 +577,7 @@ static void svia_configure(struct pci_dev *pdev) | |||
| 577 | } | 577 | } |
| 578 | 578 | ||
| 579 | /* | 579 | /* |
| 580 | * vt6421 has problems talking to some drives. The following | 580 | * vt6420/1 has problems talking to some drives. The following |
| 581 | * is the fix from Joseph Chan <JosephChan@via.com.tw>. | 581 | * is the fix from Joseph Chan <JosephChan@via.com.tw>. |
| 582 | * | 582 | * |
| 583 | * When host issues HOLD, device may send up to 20DW of data | 583 | * When host issues HOLD, device may send up to 20DW of data |
| @@ -596,8 +596,9 @@ static void svia_configure(struct pci_dev *pdev) | |||
| 596 | * | 596 | * |
| 597 | * https://bugzilla.kernel.org/show_bug.cgi?id=15173 | 597 | * https://bugzilla.kernel.org/show_bug.cgi?id=15173 |
| 598 | * http://article.gmane.org/gmane.linux.ide/46352 | 598 | * http://article.gmane.org/gmane.linux.ide/46352 |
| 599 | * http://thread.gmane.org/gmane.linux.kernel/1062139 | ||
| 599 | */ | 600 | */ |
| 600 | if (pdev->device == 0x3249) { | 601 | if (board_id == vt6420 || board_id == vt6421) { |
| 601 | pci_read_config_byte(pdev, 0x52, &tmp8); | 602 | pci_read_config_byte(pdev, 0x52, &tmp8); |
| 602 | tmp8 |= 1 << 2; | 603 | tmp8 |= 1 << 2; |
| 603 | pci_write_config_byte(pdev, 0x52, tmp8); | 604 | pci_write_config_byte(pdev, 0x52, tmp8); |
| @@ -652,7 +653,7 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 652 | if (rc) | 653 | if (rc) |
| 653 | return rc; | 654 | return rc; |
| 654 | 655 | ||
| 655 | svia_configure(pdev); | 656 | svia_configure(pdev, board_id); |
| 656 | 657 | ||
| 657 | pci_set_master(pdev); | 658 | pci_set_master(pdev); |
| 658 | return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, | 659 | return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 6c1b676643a9..896a2ced1d27 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
| @@ -1547,31 +1547,16 @@ static int init_vqs(struct ports_device *portdev) | |||
| 1547 | nr_queues = use_multiport(portdev) ? (nr_ports + 1) * 2 : 2; | 1547 | nr_queues = use_multiport(portdev) ? (nr_ports + 1) * 2 : 2; |
| 1548 | 1548 | ||
| 1549 | vqs = kmalloc(nr_queues * sizeof(struct virtqueue *), GFP_KERNEL); | 1549 | vqs = kmalloc(nr_queues * sizeof(struct virtqueue *), GFP_KERNEL); |
| 1550 | if (!vqs) { | ||
| 1551 | err = -ENOMEM; | ||
| 1552 | goto fail; | ||
| 1553 | } | ||
| 1554 | io_callbacks = kmalloc(nr_queues * sizeof(vq_callback_t *), GFP_KERNEL); | 1550 | io_callbacks = kmalloc(nr_queues * sizeof(vq_callback_t *), GFP_KERNEL); |
| 1555 | if (!io_callbacks) { | ||
| 1556 | err = -ENOMEM; | ||
| 1557 | goto free_vqs; | ||
| 1558 | } | ||
| 1559 | io_names = kmalloc(nr_queues * sizeof(char *), GFP_KERNEL); | 1551 | io_names = kmalloc(nr_queues * sizeof(char *), GFP_KERNEL); |
| 1560 | if (!io_names) { | ||
| 1561 | err = -ENOMEM; | ||
| 1562 | goto free_callbacks; | ||
| 1563 | } | ||
| 1564 | portdev->in_vqs = kmalloc(nr_ports * sizeof(struct virtqueue *), | 1552 | portdev->in_vqs = kmalloc(nr_ports * sizeof(struct virtqueue *), |
| 1565 | GFP_KERNEL); | 1553 | GFP_KERNEL); |
| 1566 | if (!portdev->in_vqs) { | ||
| 1567 | err = -ENOMEM; | ||
| 1568 | goto free_names; | ||
| 1569 | } | ||
| 1570 | portdev->out_vqs = kmalloc(nr_ports * sizeof(struct virtqueue *), | 1554 | portdev->out_vqs = kmalloc(nr_ports * sizeof(struct virtqueue *), |
| 1571 | GFP_KERNEL); | 1555 | GFP_KERNEL); |
| 1572 | if (!portdev->out_vqs) { | 1556 | if (!vqs || !io_callbacks || !io_names || !portdev->in_vqs || |
| 1557 | !portdev->out_vqs) { | ||
| 1573 | err = -ENOMEM; | 1558 | err = -ENOMEM; |
| 1574 | goto free_invqs; | 1559 | goto free; |
| 1575 | } | 1560 | } |
| 1576 | 1561 | ||
| 1577 | /* | 1562 | /* |
| @@ -1605,7 +1590,7 @@ static int init_vqs(struct ports_device *portdev) | |||
| 1605 | io_callbacks, | 1590 | io_callbacks, |
| 1606 | (const char **)io_names); | 1591 | (const char **)io_names); |
| 1607 | if (err) | 1592 | if (err) |
| 1608 | goto free_outvqs; | 1593 | goto free; |
| 1609 | 1594 | ||
| 1610 | j = 0; | 1595 | j = 0; |
| 1611 | portdev->in_vqs[0] = vqs[0]; | 1596 | portdev->in_vqs[0] = vqs[0]; |
| @@ -1621,23 +1606,19 @@ static int init_vqs(struct ports_device *portdev) | |||
| 1621 | portdev->out_vqs[i] = vqs[j + 1]; | 1606 | portdev->out_vqs[i] = vqs[j + 1]; |
| 1622 | } | 1607 | } |
| 1623 | } | 1608 | } |
| 1624 | kfree(io_callbacks); | ||
| 1625 | kfree(io_names); | 1609 | kfree(io_names); |
| 1610 | kfree(io_callbacks); | ||
| 1626 | kfree(vqs); | 1611 | kfree(vqs); |
| 1627 | 1612 | ||
| 1628 | return 0; | 1613 | return 0; |
| 1629 | 1614 | ||
| 1630 | free_names: | 1615 | free: |
| 1631 | kfree(io_names); | ||
| 1632 | free_callbacks: | ||
| 1633 | kfree(io_callbacks); | ||
| 1634 | free_outvqs: | ||
| 1635 | kfree(portdev->out_vqs); | 1616 | kfree(portdev->out_vqs); |
| 1636 | free_invqs: | ||
| 1637 | kfree(portdev->in_vqs); | 1617 | kfree(portdev->in_vqs); |
| 1638 | free_vqs: | 1618 | kfree(io_names); |
| 1619 | kfree(io_callbacks); | ||
| 1639 | kfree(vqs); | 1620 | kfree(vqs); |
| 1640 | fail: | 1621 | |
| 1641 | return err; | 1622 | return err; |
| 1642 | } | 1623 | } |
| 1643 | 1624 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 80745f85902c..f737960712e6 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
| @@ -150,7 +150,8 @@ static const struct intel_device_info intel_ironlake_d_info = { | |||
| 150 | 150 | ||
| 151 | static const struct intel_device_info intel_ironlake_m_info = { | 151 | static const struct intel_device_info intel_ironlake_m_info = { |
| 152 | .gen = 5, .is_mobile = 1, | 152 | .gen = 5, .is_mobile = 1, |
| 153 | .need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1, .has_hotplug = 1, | 153 | .need_gfx_hws = 1, .has_rc6 = 1, .has_hotplug = 1, |
| 154 | .has_fbc = 0, /* disabled due to buggy hardware */ | ||
| 154 | .has_bsd_ring = 1, | 155 | .has_bsd_ring = 1, |
| 155 | }; | 156 | }; |
| 156 | 157 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 90414ae86afc..409826da3099 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
| @@ -1045,6 +1045,8 @@ void i915_gem_clflush_object(struct drm_gem_object *obj); | |||
| 1045 | int i915_gem_object_set_domain(struct drm_gem_object *obj, | 1045 | int i915_gem_object_set_domain(struct drm_gem_object *obj, |
| 1046 | uint32_t read_domains, | 1046 | uint32_t read_domains, |
| 1047 | uint32_t write_domain); | 1047 | uint32_t write_domain); |
| 1048 | int i915_gem_object_flush_gpu(struct drm_i915_gem_object *obj, | ||
| 1049 | bool interruptible); | ||
| 1048 | int i915_gem_init_ringbuffer(struct drm_device *dev); | 1050 | int i915_gem_init_ringbuffer(struct drm_device *dev); |
| 1049 | void i915_gem_cleanup_ringbuffer(struct drm_device *dev); | 1051 | void i915_gem_cleanup_ringbuffer(struct drm_device *dev); |
| 1050 | int i915_gem_do_init(struct drm_device *dev, unsigned long start, | 1052 | int i915_gem_do_init(struct drm_device *dev, unsigned long start, |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index ef188e391406..17b1cba3b5f1 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
| @@ -547,6 +547,19 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, | |||
| 547 | struct drm_i915_gem_object *obj_priv; | 547 | struct drm_i915_gem_object *obj_priv; |
| 548 | int ret = 0; | 548 | int ret = 0; |
| 549 | 549 | ||
| 550 | if (args->size == 0) | ||
| 551 | return 0; | ||
| 552 | |||
| 553 | if (!access_ok(VERIFY_WRITE, | ||
| 554 | (char __user *)(uintptr_t)args->data_ptr, | ||
| 555 | args->size)) | ||
| 556 | return -EFAULT; | ||
| 557 | |||
| 558 | ret = fault_in_pages_writeable((char __user *)(uintptr_t)args->data_ptr, | ||
| 559 | args->size); | ||
| 560 | if (ret) | ||
| 561 | return -EFAULT; | ||
| 562 | |||
| 550 | ret = i915_mutex_lock_interruptible(dev); | 563 | ret = i915_mutex_lock_interruptible(dev); |
| 551 | if (ret) | 564 | if (ret) |
| 552 | return ret; | 565 | return ret; |
| @@ -564,23 +577,6 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, | |||
| 564 | goto out; | 577 | goto out; |
| 565 | } | 578 | } |
| 566 | 579 | ||
| 567 | if (args->size == 0) | ||
| 568 | goto out; | ||
| 569 | |||
| 570 | if (!access_ok(VERIFY_WRITE, | ||
| 571 | (char __user *)(uintptr_t)args->data_ptr, | ||
| 572 | args->size)) { | ||
| 573 | ret = -EFAULT; | ||
| 574 | goto out; | ||
| 575 | } | ||
| 576 | |||
| 577 | ret = fault_in_pages_writeable((char __user *)(uintptr_t)args->data_ptr, | ||
| 578 | args->size); | ||
| 579 | if (ret) { | ||
| 580 | ret = -EFAULT; | ||
| 581 | goto out; | ||
| 582 | } | ||
| 583 | |||
| 584 | ret = i915_gem_object_get_pages_or_evict(obj); | 580 | ret = i915_gem_object_get_pages_or_evict(obj); |
| 585 | if (ret) | 581 | if (ret) |
| 586 | goto out; | 582 | goto out; |
| @@ -981,7 +977,20 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, | |||
| 981 | struct drm_i915_gem_pwrite *args = data; | 977 | struct drm_i915_gem_pwrite *args = data; |
| 982 | struct drm_gem_object *obj; | 978 | struct drm_gem_object *obj; |
| 983 | struct drm_i915_gem_object *obj_priv; | 979 | struct drm_i915_gem_object *obj_priv; |
| 984 | int ret = 0; | 980 | int ret; |
| 981 | |||
| 982 | if (args->size == 0) | ||
| 983 | return 0; | ||
| 984 | |||
| 985 | if (!access_ok(VERIFY_READ, | ||
| 986 | (char __user *)(uintptr_t)args->data_ptr, | ||
| 987 | args->size)) | ||
| 988 | return -EFAULT; | ||
| 989 | |||
| 990 | ret = fault_in_pages_readable((char __user *)(uintptr_t)args->data_ptr, | ||
| 991 | args->size); | ||
| 992 | if (ret) | ||
| 993 | return -EFAULT; | ||
| 985 | 994 | ||
| 986 | ret = i915_mutex_lock_interruptible(dev); | 995 | ret = i915_mutex_lock_interruptible(dev); |
| 987 | if (ret) | 996 | if (ret) |
| @@ -994,30 +1003,12 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, | |||
| 994 | } | 1003 | } |
| 995 | obj_priv = to_intel_bo(obj); | 1004 | obj_priv = to_intel_bo(obj); |
| 996 | 1005 | ||
| 997 | |||
| 998 | /* Bounds check destination. */ | 1006 | /* Bounds check destination. */ |
| 999 | if (args->offset > obj->size || args->size > obj->size - args->offset) { | 1007 | if (args->offset > obj->size || args->size > obj->size - args->offset) { |
| 1000 | ret = -EINVAL; | 1008 | ret = -EINVAL; |
| 1001 | goto out; | 1009 | goto out; |
| 1002 | } | 1010 | } |
| 1003 | 1011 | ||
| 1004 | if (args->size == 0) | ||
| 1005 | goto out; | ||
| 1006 | |||
| 1007 | if (!access_ok(VERIFY_READ, | ||
| 1008 | (char __user *)(uintptr_t)args->data_ptr, | ||
| 1009 | args->size)) { | ||
| 1010 | ret = -EFAULT; | ||
| 1011 | goto out; | ||
| 1012 | } | ||
| 1013 | |||
| 1014 | ret = fault_in_pages_readable((char __user *)(uintptr_t)args->data_ptr, | ||
| 1015 | args->size); | ||
| 1016 | if (ret) { | ||
| 1017 | ret = -EFAULT; | ||
| 1018 | goto out; | ||
| 1019 | } | ||
| 1020 | |||
| 1021 | /* We can only do the GTT pwrite on untiled buffers, as otherwise | 1012 | /* We can only do the GTT pwrite on untiled buffers, as otherwise |
| 1022 | * it would end up going through the fenced access, and we'll get | 1013 | * it would end up going through the fenced access, and we'll get |
| 1023 | * different detiling behavior between reading and writing. | 1014 | * different detiling behavior between reading and writing. |
| @@ -2907,6 +2898,20 @@ i915_gem_object_set_to_display_plane(struct drm_gem_object *obj, | |||
| 2907 | return 0; | 2898 | return 0; |
| 2908 | } | 2899 | } |
| 2909 | 2900 | ||
| 2901 | int | ||
| 2902 | i915_gem_object_flush_gpu(struct drm_i915_gem_object *obj, | ||
| 2903 | bool interruptible) | ||
| 2904 | { | ||
| 2905 | if (!obj->active) | ||
| 2906 | return 0; | ||
| 2907 | |||
| 2908 | if (obj->base.write_domain & I915_GEM_GPU_DOMAINS) | ||
| 2909 | i915_gem_flush_ring(obj->base.dev, NULL, obj->ring, | ||
| 2910 | 0, obj->base.write_domain); | ||
| 2911 | |||
| 2912 | return i915_gem_object_wait_rendering(&obj->base, interruptible); | ||
| 2913 | } | ||
| 2914 | |||
| 2910 | /** | 2915 | /** |
| 2911 | * Moves a single object to the CPU read, and possibly write domain. | 2916 | * Moves a single object to the CPU read, and possibly write domain. |
| 2912 | * | 2917 | * |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index c55c77043357..8df574316063 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
| @@ -34,6 +34,25 @@ | |||
| 34 | #include "i915_drm.h" | 34 | #include "i915_drm.h" |
| 35 | #include "i915_drv.h" | 35 | #include "i915_drv.h" |
| 36 | 36 | ||
| 37 | /* Here's the desired hotplug mode */ | ||
| 38 | #define ADPA_HOTPLUG_BITS (ADPA_CRT_HOTPLUG_PERIOD_128 | \ | ||
| 39 | ADPA_CRT_HOTPLUG_WARMUP_10MS | \ | ||
| 40 | ADPA_CRT_HOTPLUG_SAMPLE_4S | \ | ||
| 41 | ADPA_CRT_HOTPLUG_VOLTAGE_50 | \ | ||
| 42 | ADPA_CRT_HOTPLUG_VOLREF_325MV | \ | ||
| 43 | ADPA_CRT_HOTPLUG_ENABLE) | ||
| 44 | |||
| 45 | struct intel_crt { | ||
| 46 | struct intel_encoder base; | ||
| 47 | bool force_hotplug_required; | ||
| 48 | }; | ||
| 49 | |||
| 50 | static struct intel_crt *intel_attached_crt(struct drm_connector *connector) | ||
| 51 | { | ||
| 52 | return container_of(intel_attached_encoder(connector), | ||
| 53 | struct intel_crt, base); | ||
| 54 | } | ||
| 55 | |||
| 37 | static void intel_crt_dpms(struct drm_encoder *encoder, int mode) | 56 | static void intel_crt_dpms(struct drm_encoder *encoder, int mode) |
| 38 | { | 57 | { |
| 39 | struct drm_device *dev = encoder->dev; | 58 | struct drm_device *dev = encoder->dev; |
| @@ -129,7 +148,7 @@ static void intel_crt_mode_set(struct drm_encoder *encoder, | |||
| 129 | dpll_md & ~DPLL_MD_UDI_MULTIPLIER_MASK); | 148 | dpll_md & ~DPLL_MD_UDI_MULTIPLIER_MASK); |
| 130 | } | 149 | } |
| 131 | 150 | ||
| 132 | adpa = 0; | 151 | adpa = ADPA_HOTPLUG_BITS; |
| 133 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | 152 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) |
| 134 | adpa |= ADPA_HSYNC_ACTIVE_HIGH; | 153 | adpa |= ADPA_HSYNC_ACTIVE_HIGH; |
| 135 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) | 154 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) |
| @@ -157,53 +176,44 @@ static void intel_crt_mode_set(struct drm_encoder *encoder, | |||
| 157 | static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector) | 176 | static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector) |
| 158 | { | 177 | { |
| 159 | struct drm_device *dev = connector->dev; | 178 | struct drm_device *dev = connector->dev; |
| 179 | struct intel_crt *crt = intel_attached_crt(connector); | ||
| 160 | struct drm_i915_private *dev_priv = dev->dev_private; | 180 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 161 | u32 adpa, temp; | 181 | u32 adpa; |
| 162 | bool ret; | 182 | bool ret; |
| 163 | bool turn_off_dac = false; | ||
| 164 | 183 | ||
| 165 | temp = adpa = I915_READ(PCH_ADPA); | 184 | /* The first time through, trigger an explicit detection cycle */ |
| 185 | if (crt->force_hotplug_required) { | ||
| 186 | bool turn_off_dac = HAS_PCH_SPLIT(dev); | ||
| 187 | u32 save_adpa; | ||
| 166 | 188 | ||
| 167 | if (HAS_PCH_SPLIT(dev)) | 189 | crt->force_hotplug_required = 0; |
| 168 | turn_off_dac = true; | 190 | |
| 169 | 191 | save_adpa = adpa = I915_READ(PCH_ADPA); | |
| 170 | adpa &= ~ADPA_CRT_HOTPLUG_MASK; | 192 | DRM_DEBUG_KMS("trigger hotplug detect cycle: adpa=0x%x\n", adpa); |
| 171 | if (turn_off_dac) | 193 | |
| 172 | adpa &= ~ADPA_DAC_ENABLE; | 194 | adpa |= ADPA_CRT_HOTPLUG_FORCE_TRIGGER; |
| 173 | 195 | if (turn_off_dac) | |
| 174 | /* disable HPD first */ | 196 | adpa &= ~ADPA_DAC_ENABLE; |
| 175 | I915_WRITE(PCH_ADPA, adpa); | 197 | |
| 176 | (void)I915_READ(PCH_ADPA); | 198 | I915_WRITE(PCH_ADPA, adpa); |
| 177 | 199 | ||
| 178 | adpa |= (ADPA_CRT_HOTPLUG_PERIOD_128 | | 200 | if (wait_for((I915_READ(PCH_ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0, |
| 179 | ADPA_CRT_HOTPLUG_WARMUP_10MS | | 201 | 1000)) |
| 180 | ADPA_CRT_HOTPLUG_SAMPLE_4S | | 202 | DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER"); |
| 181 | ADPA_CRT_HOTPLUG_VOLTAGE_50 | /* default */ | 203 | |
| 182 | ADPA_CRT_HOTPLUG_VOLREF_325MV | | 204 | if (turn_off_dac) { |
| 183 | ADPA_CRT_HOTPLUG_ENABLE | | 205 | I915_WRITE(PCH_ADPA, save_adpa); |
| 184 | ADPA_CRT_HOTPLUG_FORCE_TRIGGER); | 206 | POSTING_READ(PCH_ADPA); |
| 185 | 207 | } | |
| 186 | DRM_DEBUG_KMS("pch crt adpa 0x%x", adpa); | ||
| 187 | I915_WRITE(PCH_ADPA, adpa); | ||
| 188 | |||
| 189 | if (wait_for((I915_READ(PCH_ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0, | ||
| 190 | 1000)) | ||
| 191 | DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER"); | ||
| 192 | |||
| 193 | if (turn_off_dac) { | ||
| 194 | /* Make sure hotplug is enabled */ | ||
| 195 | I915_WRITE(PCH_ADPA, temp | ADPA_CRT_HOTPLUG_ENABLE); | ||
| 196 | (void)I915_READ(PCH_ADPA); | ||
| 197 | } | 208 | } |
| 198 | 209 | ||
| 199 | /* Check the status to see if both blue and green are on now */ | 210 | /* Check the status to see if both blue and green are on now */ |
| 200 | adpa = I915_READ(PCH_ADPA); | 211 | adpa = I915_READ(PCH_ADPA); |
| 201 | adpa &= ADPA_CRT_HOTPLUG_MONITOR_MASK; | 212 | if ((adpa & ADPA_CRT_HOTPLUG_MONITOR_MASK) != 0) |
| 202 | if ((adpa == ADPA_CRT_HOTPLUG_MONITOR_COLOR) || | ||
| 203 | (adpa == ADPA_CRT_HOTPLUG_MONITOR_MONO)) | ||
| 204 | ret = true; | 213 | ret = true; |
| 205 | else | 214 | else |
| 206 | ret = false; | 215 | ret = false; |
| 216 | DRM_DEBUG_KMS("ironlake hotplug adpa=0x%x, result %d\n", adpa, ret); | ||
| 207 | 217 | ||
| 208 | return ret; | 218 | return ret; |
| 209 | } | 219 | } |
| @@ -277,13 +287,12 @@ static bool intel_crt_ddc_probe(struct drm_i915_private *dev_priv, int ddc_bus) | |||
| 277 | return i2c_transfer(&dev_priv->gmbus[ddc_bus].adapter, msgs, 1) == 1; | 287 | return i2c_transfer(&dev_priv->gmbus[ddc_bus].adapter, msgs, 1) == 1; |
| 278 | } | 288 | } |
| 279 | 289 | ||
| 280 | static bool intel_crt_detect_ddc(struct drm_encoder *encoder) | 290 | static bool intel_crt_detect_ddc(struct intel_crt *crt) |
| 281 | { | 291 | { |
| 282 | struct intel_encoder *intel_encoder = to_intel_encoder(encoder); | 292 | struct drm_i915_private *dev_priv = crt->base.base.dev->dev_private; |
| 283 | struct drm_i915_private *dev_priv = encoder->dev->dev_private; | ||
| 284 | 293 | ||
| 285 | /* CRT should always be at 0, but check anyway */ | 294 | /* CRT should always be at 0, but check anyway */ |
| 286 | if (intel_encoder->type != INTEL_OUTPUT_ANALOG) | 295 | if (crt->base.type != INTEL_OUTPUT_ANALOG) |
| 287 | return false; | 296 | return false; |
| 288 | 297 | ||
| 289 | if (intel_crt_ddc_probe(dev_priv, dev_priv->crt_ddc_pin)) { | 298 | if (intel_crt_ddc_probe(dev_priv, dev_priv->crt_ddc_pin)) { |
| @@ -291,7 +300,7 @@ static bool intel_crt_detect_ddc(struct drm_encoder *encoder) | |||
| 291 | return true; | 300 | return true; |
| 292 | } | 301 | } |
| 293 | 302 | ||
| 294 | if (intel_ddc_probe(intel_encoder, dev_priv->crt_ddc_pin)) { | 303 | if (intel_ddc_probe(&crt->base, dev_priv->crt_ddc_pin)) { |
| 295 | DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n"); | 304 | DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n"); |
| 296 | return true; | 305 | return true; |
| 297 | } | 306 | } |
| @@ -300,9 +309,9 @@ static bool intel_crt_detect_ddc(struct drm_encoder *encoder) | |||
| 300 | } | 309 | } |
| 301 | 310 | ||
| 302 | static enum drm_connector_status | 311 | static enum drm_connector_status |
| 303 | intel_crt_load_detect(struct drm_crtc *crtc, struct intel_encoder *intel_encoder) | 312 | intel_crt_load_detect(struct drm_crtc *crtc, struct intel_crt *crt) |
| 304 | { | 313 | { |
| 305 | struct drm_encoder *encoder = &intel_encoder->base; | 314 | struct drm_encoder *encoder = &crt->base.base; |
| 306 | struct drm_device *dev = encoder->dev; | 315 | struct drm_device *dev = encoder->dev; |
| 307 | struct drm_i915_private *dev_priv = dev->dev_private; | 316 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 308 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 317 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| @@ -434,7 +443,7 @@ static enum drm_connector_status | |||
| 434 | intel_crt_detect(struct drm_connector *connector, bool force) | 443 | intel_crt_detect(struct drm_connector *connector, bool force) |
| 435 | { | 444 | { |
| 436 | struct drm_device *dev = connector->dev; | 445 | struct drm_device *dev = connector->dev; |
| 437 | struct intel_encoder *encoder = intel_attached_encoder(connector); | 446 | struct intel_crt *crt = intel_attached_crt(connector); |
| 438 | struct drm_crtc *crtc; | 447 | struct drm_crtc *crtc; |
| 439 | int dpms_mode; | 448 | int dpms_mode; |
| 440 | enum drm_connector_status status; | 449 | enum drm_connector_status status; |
| @@ -443,28 +452,31 @@ intel_crt_detect(struct drm_connector *connector, bool force) | |||
| 443 | if (intel_crt_detect_hotplug(connector)) { | 452 | if (intel_crt_detect_hotplug(connector)) { |
| 444 | DRM_DEBUG_KMS("CRT detected via hotplug\n"); | 453 | DRM_DEBUG_KMS("CRT detected via hotplug\n"); |
| 445 | return connector_status_connected; | 454 | return connector_status_connected; |
| 446 | } else | 455 | } else { |
| 456 | DRM_DEBUG_KMS("CRT not detected via hotplug\n"); | ||
| 447 | return connector_status_disconnected; | 457 | return connector_status_disconnected; |
| 458 | } | ||
| 448 | } | 459 | } |
| 449 | 460 | ||
| 450 | if (intel_crt_detect_ddc(&encoder->base)) | 461 | if (intel_crt_detect_ddc(crt)) |
| 451 | return connector_status_connected; | 462 | return connector_status_connected; |
| 452 | 463 | ||
| 453 | if (!force) | 464 | if (!force) |
| 454 | return connector->status; | 465 | return connector->status; |
| 455 | 466 | ||
| 456 | /* for pre-945g platforms use load detect */ | 467 | /* for pre-945g platforms use load detect */ |
| 457 | if (encoder->base.crtc && encoder->base.crtc->enabled) { | 468 | crtc = crt->base.base.crtc; |
| 458 | status = intel_crt_load_detect(encoder->base.crtc, encoder); | 469 | if (crtc && crtc->enabled) { |
| 470 | status = intel_crt_load_detect(crtc, crt); | ||
| 459 | } else { | 471 | } else { |
| 460 | crtc = intel_get_load_detect_pipe(encoder, connector, | 472 | crtc = intel_get_load_detect_pipe(&crt->base, connector, |
| 461 | NULL, &dpms_mode); | 473 | NULL, &dpms_mode); |
| 462 | if (crtc) { | 474 | if (crtc) { |
| 463 | if (intel_crt_detect_ddc(&encoder->base)) | 475 | if (intel_crt_detect_ddc(crt)) |
| 464 | status = connector_status_connected; | 476 | status = connector_status_connected; |
| 465 | else | 477 | else |
| 466 | status = intel_crt_load_detect(crtc, encoder); | 478 | status = intel_crt_load_detect(crtc, crt); |
| 467 | intel_release_load_detect_pipe(encoder, | 479 | intel_release_load_detect_pipe(&crt->base, |
| 468 | connector, dpms_mode); | 480 | connector, dpms_mode); |
| 469 | } else | 481 | } else |
| 470 | status = connector_status_unknown; | 482 | status = connector_status_unknown; |
| @@ -536,17 +548,17 @@ static const struct drm_encoder_funcs intel_crt_enc_funcs = { | |||
| 536 | void intel_crt_init(struct drm_device *dev) | 548 | void intel_crt_init(struct drm_device *dev) |
| 537 | { | 549 | { |
| 538 | struct drm_connector *connector; | 550 | struct drm_connector *connector; |
| 539 | struct intel_encoder *intel_encoder; | 551 | struct intel_crt *crt; |
| 540 | struct intel_connector *intel_connector; | 552 | struct intel_connector *intel_connector; |
| 541 | struct drm_i915_private *dev_priv = dev->dev_private; | 553 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 542 | 554 | ||
| 543 | intel_encoder = kzalloc(sizeof(struct intel_encoder), GFP_KERNEL); | 555 | crt = kzalloc(sizeof(struct intel_crt), GFP_KERNEL); |
| 544 | if (!intel_encoder) | 556 | if (!crt) |
| 545 | return; | 557 | return; |
| 546 | 558 | ||
| 547 | intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); | 559 | intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); |
| 548 | if (!intel_connector) { | 560 | if (!intel_connector) { |
| 549 | kfree(intel_encoder); | 561 | kfree(crt); |
| 550 | return; | 562 | return; |
| 551 | } | 563 | } |
| 552 | 564 | ||
| @@ -554,20 +566,20 @@ void intel_crt_init(struct drm_device *dev) | |||
| 554 | drm_connector_init(dev, &intel_connector->base, | 566 | drm_connector_init(dev, &intel_connector->base, |
| 555 | &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); | 567 | &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); |
| 556 | 568 | ||
| 557 | drm_encoder_init(dev, &intel_encoder->base, &intel_crt_enc_funcs, | 569 | drm_encoder_init(dev, &crt->base.base, &intel_crt_enc_funcs, |
| 558 | DRM_MODE_ENCODER_DAC); | 570 | DRM_MODE_ENCODER_DAC); |
| 559 | 571 | ||
| 560 | intel_connector_attach_encoder(intel_connector, intel_encoder); | 572 | intel_connector_attach_encoder(intel_connector, &crt->base); |
| 561 | 573 | ||
| 562 | intel_encoder->type = INTEL_OUTPUT_ANALOG; | 574 | crt->base.type = INTEL_OUTPUT_ANALOG; |
| 563 | intel_encoder->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | | 575 | crt->base.clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT | |
| 564 | (1 << INTEL_ANALOG_CLONE_BIT) | | 576 | 1 << INTEL_ANALOG_CLONE_BIT | |
| 565 | (1 << INTEL_SDVO_LVDS_CLONE_BIT); | 577 | 1 << INTEL_SDVO_LVDS_CLONE_BIT); |
| 566 | intel_encoder->crtc_mask = (1 << 0) | (1 << 1); | 578 | crt->base.crtc_mask = (1 << 0) | (1 << 1); |
| 567 | connector->interlace_allowed = 1; | 579 | connector->interlace_allowed = 1; |
| 568 | connector->doublescan_allowed = 0; | 580 | connector->doublescan_allowed = 0; |
| 569 | 581 | ||
| 570 | drm_encoder_helper_add(&intel_encoder->base, &intel_crt_helper_funcs); | 582 | drm_encoder_helper_add(&crt->base.base, &intel_crt_helper_funcs); |
| 571 | drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); | 583 | drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); |
| 572 | 584 | ||
| 573 | drm_sysfs_connector_add(connector); | 585 | drm_sysfs_connector_add(connector); |
| @@ -577,5 +589,22 @@ void intel_crt_init(struct drm_device *dev) | |||
| 577 | else | 589 | else |
| 578 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; | 590 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; |
| 579 | 591 | ||
| 592 | /* | ||
| 593 | * Configure the automatic hotplug detection stuff | ||
| 594 | */ | ||
| 595 | crt->force_hotplug_required = 0; | ||
| 596 | if (HAS_PCH_SPLIT(dev)) { | ||
| 597 | u32 adpa; | ||
| 598 | |||
| 599 | adpa = I915_READ(PCH_ADPA); | ||
| 600 | adpa &= ~ADPA_CRT_HOTPLUG_MASK; | ||
| 601 | adpa |= ADPA_HOTPLUG_BITS; | ||
| 602 | I915_WRITE(PCH_ADPA, adpa); | ||
| 603 | POSTING_READ(PCH_ADPA); | ||
| 604 | |||
| 605 | DRM_DEBUG_KMS("pch crt adpa set to 0x%x\n", adpa); | ||
| 606 | crt->force_hotplug_required = 1; | ||
| 607 | } | ||
| 608 | |||
| 580 | dev_priv->hotplug_supported_mask |= CRT_HOTPLUG_INT_STATUS; | 609 | dev_priv->hotplug_supported_mask |= CRT_HOTPLUG_INT_STATUS; |
| 581 | } | 610 | } |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 48d8fd686ea9..bee24b1a58e8 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -1611,6 +1611,18 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
| 1611 | 1611 | ||
| 1612 | wait_event(dev_priv->pending_flip_queue, | 1612 | wait_event(dev_priv->pending_flip_queue, |
| 1613 | atomic_read(&obj_priv->pending_flip) == 0); | 1613 | atomic_read(&obj_priv->pending_flip) == 0); |
| 1614 | |||
| 1615 | /* Big Hammer, we also need to ensure that any pending | ||
| 1616 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the | ||
| 1617 | * current scanout is retired before unpinning the old | ||
| 1618 | * framebuffer. | ||
| 1619 | */ | ||
| 1620 | ret = i915_gem_object_flush_gpu(obj_priv, false); | ||
| 1621 | if (ret) { | ||
| 1622 | i915_gem_object_unpin(to_intel_framebuffer(crtc->fb)->obj); | ||
| 1623 | mutex_unlock(&dev->struct_mutex); | ||
| 1624 | return ret; | ||
| 1625 | } | ||
| 1614 | } | 1626 | } |
| 1615 | 1627 | ||
| 1616 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, | 1628 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, |
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index 2be4f728ed0c..3dba086e7eea 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c | |||
| @@ -160,7 +160,7 @@ intel_gpio_create(struct drm_i915_private *dev_priv, u32 pin) | |||
| 160 | }; | 160 | }; |
| 161 | struct intel_gpio *gpio; | 161 | struct intel_gpio *gpio; |
| 162 | 162 | ||
| 163 | if (pin < 1 || pin > 7) | 163 | if (pin >= ARRAY_SIZE(map_pin_to_reg) || !map_pin_to_reg[pin]) |
| 164 | return NULL; | 164 | return NULL; |
| 165 | 165 | ||
| 166 | gpio = kzalloc(sizeof(struct intel_gpio), GFP_KERNEL); | 166 | gpio = kzalloc(sizeof(struct intel_gpio), GFP_KERNEL); |
| @@ -172,7 +172,8 @@ intel_gpio_create(struct drm_i915_private *dev_priv, u32 pin) | |||
| 172 | gpio->reg += PCH_GPIOA - GPIOA; | 172 | gpio->reg += PCH_GPIOA - GPIOA; |
| 173 | gpio->dev_priv = dev_priv; | 173 | gpio->dev_priv = dev_priv; |
| 174 | 174 | ||
| 175 | snprintf(gpio->adapter.name, I2C_NAME_SIZE, "GPIO%c", "?BACDEF?"[pin]); | 175 | snprintf(gpio->adapter.name, sizeof(gpio->adapter.name), |
| 176 | "i915 GPIO%c", "?BACDE?F"[pin]); | ||
| 176 | gpio->adapter.owner = THIS_MODULE; | 177 | gpio->adapter.owner = THIS_MODULE; |
| 177 | gpio->adapter.algo_data = &gpio->algo; | 178 | gpio->adapter.algo_data = &gpio->algo; |
| 178 | gpio->adapter.dev.parent = &dev_priv->dev->pdev->dev; | 179 | gpio->adapter.dev.parent = &dev_priv->dev->pdev->dev; |
| @@ -349,7 +350,7 @@ int intel_setup_gmbus(struct drm_device *dev) | |||
| 349 | "panel", | 350 | "panel", |
| 350 | "dpc", | 351 | "dpc", |
| 351 | "dpb", | 352 | "dpb", |
| 352 | "reserved" | 353 | "reserved", |
| 353 | "dpd", | 354 | "dpd", |
| 354 | }; | 355 | }; |
| 355 | struct drm_i915_private *dev_priv = dev->dev_private; | 356 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -366,8 +367,8 @@ int intel_setup_gmbus(struct drm_device *dev) | |||
| 366 | bus->adapter.owner = THIS_MODULE; | 367 | bus->adapter.owner = THIS_MODULE; |
| 367 | bus->adapter.class = I2C_CLASS_DDC; | 368 | bus->adapter.class = I2C_CLASS_DDC; |
| 368 | snprintf(bus->adapter.name, | 369 | snprintf(bus->adapter.name, |
| 369 | I2C_NAME_SIZE, | 370 | sizeof(bus->adapter.name), |
| 370 | "gmbus %s", | 371 | "i915 gmbus %s", |
| 371 | names[i]); | 372 | names[i]); |
| 372 | 373 | ||
| 373 | bus->adapter.dev.parent = &dev->pdev->dev; | 374 | bus->adapter.dev.parent = &dev->pdev->dev; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c index 406228f4a2a0..b14c81110575 100644 --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | */ | 31 | */ |
| 32 | 32 | ||
| 33 | #include <linux/backlight.h> | 33 | #include <linux/backlight.h> |
| 34 | #include <linux/acpi.h> | ||
| 34 | 35 | ||
| 35 | #include "drmP.h" | 36 | #include "drmP.h" |
| 36 | #include "nouveau_drv.h" | 37 | #include "nouveau_drv.h" |
| @@ -136,6 +137,14 @@ int nouveau_backlight_init(struct drm_device *dev) | |||
| 136 | { | 137 | { |
| 137 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 138 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 138 | 139 | ||
| 140 | #ifdef CONFIG_ACPI | ||
| 141 | if (acpi_video_backlight_support()) { | ||
| 142 | NV_INFO(dev, "ACPI backlight interface available, " | ||
| 143 | "not registering our own\n"); | ||
| 144 | return 0; | ||
| 145 | } | ||
| 146 | #endif | ||
| 147 | |||
| 139 | switch (dev_priv->card_type) { | 148 | switch (dev_priv->card_type) { |
| 140 | case NV_40: | 149 | case NV_40: |
| 141 | return nouveau_nv40_backlight_init(dev); | 150 | return nouveau_nv40_backlight_init(dev); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 5f21030a293b..b2293576f278 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
| @@ -6829,7 +6829,7 @@ nouveau_bios_posted(struct drm_device *dev) | |||
| 6829 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 6829 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 6830 | unsigned htotal; | 6830 | unsigned htotal; |
| 6831 | 6831 | ||
| 6832 | if (dev_priv->chipset >= NV_50) { | 6832 | if (dev_priv->card_type >= NV_50) { |
| 6833 | if (NVReadVgaCrtc(dev, 0, 0x00) == 0 && | 6833 | if (NVReadVgaCrtc(dev, 0, 0x00) == 0 && |
| 6834 | NVReadVgaCrtc(dev, 0, 0x1a) == 0) | 6834 | NVReadVgaCrtc(dev, 0, 0x1a) == 0) |
| 6835 | return false; | 6835 | return false; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 80353e2b8409..c41e1c200ef5 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
| @@ -143,8 +143,10 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan, | |||
| 143 | nvbo->no_vm = no_vm; | 143 | nvbo->no_vm = no_vm; |
| 144 | nvbo->tile_mode = tile_mode; | 144 | nvbo->tile_mode = tile_mode; |
| 145 | nvbo->tile_flags = tile_flags; | 145 | nvbo->tile_flags = tile_flags; |
| 146 | nvbo->bo.bdev = &dev_priv->ttm.bdev; | ||
| 146 | 147 | ||
| 147 | nouveau_bo_fixup_align(dev, tile_mode, tile_flags, &align, &size); | 148 | nouveau_bo_fixup_align(dev, tile_mode, nouveau_bo_tile_layout(nvbo), |
| 149 | &align, &size); | ||
| 148 | align >>= PAGE_SHIFT; | 150 | align >>= PAGE_SHIFT; |
| 149 | 151 | ||
| 150 | nouveau_bo_placement_set(nvbo, flags, 0); | 152 | nouveau_bo_placement_set(nvbo, flags, 0); |
| @@ -176,6 +178,31 @@ set_placement_list(uint32_t *pl, unsigned *n, uint32_t type, uint32_t flags) | |||
| 176 | pl[(*n)++] = TTM_PL_FLAG_SYSTEM | flags; | 178 | pl[(*n)++] = TTM_PL_FLAG_SYSTEM | flags; |
| 177 | } | 179 | } |
| 178 | 180 | ||
| 181 | static void | ||
| 182 | set_placement_range(struct nouveau_bo *nvbo, uint32_t type) | ||
| 183 | { | ||
| 184 | struct drm_nouveau_private *dev_priv = nouveau_bdev(nvbo->bo.bdev); | ||
| 185 | |||
| 186 | if (dev_priv->card_type == NV_10 && | ||
| 187 | nvbo->tile_mode && (type & TTM_PL_FLAG_VRAM)) { | ||
| 188 | /* | ||
| 189 | * Make sure that the color and depth buffers are handled | ||
| 190 | * by independent memory controller units. Up to a 9x | ||
| 191 | * speed up when alpha-blending and depth-test are enabled | ||
| 192 | * at the same time. | ||
| 193 | */ | ||
| 194 | int vram_pages = dev_priv->vram_size >> PAGE_SHIFT; | ||
| 195 | |||
| 196 | if (nvbo->tile_flags & NOUVEAU_GEM_TILE_ZETA) { | ||
| 197 | nvbo->placement.fpfn = vram_pages / 2; | ||
| 198 | nvbo->placement.lpfn = ~0; | ||
| 199 | } else { | ||
| 200 | nvbo->placement.fpfn = 0; | ||
| 201 | nvbo->placement.lpfn = vram_pages / 2; | ||
| 202 | } | ||
| 203 | } | ||
| 204 | } | ||
| 205 | |||
| 179 | void | 206 | void |
| 180 | nouveau_bo_placement_set(struct nouveau_bo *nvbo, uint32_t type, uint32_t busy) | 207 | nouveau_bo_placement_set(struct nouveau_bo *nvbo, uint32_t type, uint32_t busy) |
| 181 | { | 208 | { |
| @@ -190,6 +217,8 @@ nouveau_bo_placement_set(struct nouveau_bo *nvbo, uint32_t type, uint32_t busy) | |||
| 190 | pl->busy_placement = nvbo->busy_placements; | 217 | pl->busy_placement = nvbo->busy_placements; |
| 191 | set_placement_list(nvbo->busy_placements, &pl->num_busy_placement, | 218 | set_placement_list(nvbo->busy_placements, &pl->num_busy_placement, |
| 192 | type | busy, flags); | 219 | type | busy, flags); |
| 220 | |||
| 221 | set_placement_range(nvbo, type); | ||
| 193 | } | 222 | } |
| 194 | 223 | ||
| 195 | int | 224 | int |
| @@ -525,7 +554,8 @@ nv50_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo, | |||
| 525 | stride = 16 * 4; | 554 | stride = 16 * 4; |
| 526 | height = amount / stride; | 555 | height = amount / stride; |
| 527 | 556 | ||
| 528 | if (new_mem->mem_type == TTM_PL_VRAM && nvbo->tile_flags) { | 557 | if (new_mem->mem_type == TTM_PL_VRAM && |
| 558 | nouveau_bo_tile_layout(nvbo)) { | ||
| 529 | ret = RING_SPACE(chan, 8); | 559 | ret = RING_SPACE(chan, 8); |
| 530 | if (ret) | 560 | if (ret) |
| 531 | return ret; | 561 | return ret; |
| @@ -546,7 +576,8 @@ nv50_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo, | |||
| 546 | BEGIN_RING(chan, NvSubM2MF, 0x0200, 1); | 576 | BEGIN_RING(chan, NvSubM2MF, 0x0200, 1); |
| 547 | OUT_RING (chan, 1); | 577 | OUT_RING (chan, 1); |
| 548 | } | 578 | } |
| 549 | if (old_mem->mem_type == TTM_PL_VRAM && nvbo->tile_flags) { | 579 | if (old_mem->mem_type == TTM_PL_VRAM && |
| 580 | nouveau_bo_tile_layout(nvbo)) { | ||
| 550 | ret = RING_SPACE(chan, 8); | 581 | ret = RING_SPACE(chan, 8); |
| 551 | if (ret) | 582 | if (ret) |
| 552 | return ret; | 583 | return ret; |
| @@ -753,7 +784,8 @@ nouveau_bo_vm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem, | |||
| 753 | if (dev_priv->card_type == NV_50) { | 784 | if (dev_priv->card_type == NV_50) { |
| 754 | ret = nv50_mem_vm_bind_linear(dev, | 785 | ret = nv50_mem_vm_bind_linear(dev, |
| 755 | offset + dev_priv->vm_vram_base, | 786 | offset + dev_priv->vm_vram_base, |
| 756 | new_mem->size, nvbo->tile_flags, | 787 | new_mem->size, |
| 788 | nouveau_bo_tile_layout(nvbo), | ||
| 757 | offset); | 789 | offset); |
| 758 | if (ret) | 790 | if (ret) |
| 759 | return ret; | 791 | return ret; |
| @@ -894,7 +926,8 @@ nouveau_ttm_fault_reserve_notify(struct ttm_buffer_object *bo) | |||
| 894 | * nothing to do here. | 926 | * nothing to do here. |
| 895 | */ | 927 | */ |
| 896 | if (bo->mem.mem_type != TTM_PL_VRAM) { | 928 | if (bo->mem.mem_type != TTM_PL_VRAM) { |
| 897 | if (dev_priv->card_type < NV_50 || !nvbo->tile_flags) | 929 | if (dev_priv->card_type < NV_50 || |
| 930 | !nouveau_bo_tile_layout(nvbo)) | ||
| 898 | return 0; | 931 | return 0; |
| 899 | } | 932 | } |
| 900 | 933 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 0871495096fa..52c356e9a3d1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c | |||
| @@ -281,7 +281,7 @@ detect_analog: | |||
| 281 | nv_encoder = find_encoder_by_type(connector, OUTPUT_ANALOG); | 281 | nv_encoder = find_encoder_by_type(connector, OUTPUT_ANALOG); |
| 282 | if (!nv_encoder && !nouveau_tv_disable) | 282 | if (!nv_encoder && !nouveau_tv_disable) |
| 283 | nv_encoder = find_encoder_by_type(connector, OUTPUT_TV); | 283 | nv_encoder = find_encoder_by_type(connector, OUTPUT_TV); |
| 284 | if (nv_encoder) { | 284 | if (nv_encoder && force) { |
| 285 | struct drm_encoder *encoder = to_drm_encoder(nv_encoder); | 285 | struct drm_encoder *encoder = to_drm_encoder(nv_encoder); |
| 286 | struct drm_encoder_helper_funcs *helper = | 286 | struct drm_encoder_helper_funcs *helper = |
| 287 | encoder->helper_private; | 287 | encoder->helper_private; |
| @@ -641,11 +641,28 @@ nouveau_connector_get_modes(struct drm_connector *connector) | |||
| 641 | return ret; | 641 | return ret; |
| 642 | } | 642 | } |
| 643 | 643 | ||
| 644 | static unsigned | ||
| 645 | get_tmds_link_bandwidth(struct drm_connector *connector) | ||
| 646 | { | ||
| 647 | struct nouveau_connector *nv_connector = nouveau_connector(connector); | ||
| 648 | struct drm_nouveau_private *dev_priv = connector->dev->dev_private; | ||
| 649 | struct dcb_entry *dcb = nv_connector->detected_encoder->dcb; | ||
| 650 | |||
| 651 | if (dcb->location != DCB_LOC_ON_CHIP || | ||
| 652 | dev_priv->chipset >= 0x46) | ||
| 653 | return 165000; | ||
| 654 | else if (dev_priv->chipset >= 0x40) | ||
| 655 | return 155000; | ||
| 656 | else if (dev_priv->chipset >= 0x18) | ||
| 657 | return 135000; | ||
| 658 | else | ||
| 659 | return 112000; | ||
| 660 | } | ||
| 661 | |||
| 644 | static int | 662 | static int |
| 645 | nouveau_connector_mode_valid(struct drm_connector *connector, | 663 | nouveau_connector_mode_valid(struct drm_connector *connector, |
| 646 | struct drm_display_mode *mode) | 664 | struct drm_display_mode *mode) |
| 647 | { | 665 | { |
| 648 | struct drm_nouveau_private *dev_priv = connector->dev->dev_private; | ||
| 649 | struct nouveau_connector *nv_connector = nouveau_connector(connector); | 666 | struct nouveau_connector *nv_connector = nouveau_connector(connector); |
| 650 | struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; | 667 | struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; |
| 651 | struct drm_encoder *encoder = to_drm_encoder(nv_encoder); | 668 | struct drm_encoder *encoder = to_drm_encoder(nv_encoder); |
| @@ -663,11 +680,9 @@ nouveau_connector_mode_valid(struct drm_connector *connector, | |||
| 663 | max_clock = 400000; | 680 | max_clock = 400000; |
| 664 | break; | 681 | break; |
| 665 | case OUTPUT_TMDS: | 682 | case OUTPUT_TMDS: |
| 666 | if ((dev_priv->card_type >= NV_50 && !nouveau_duallink) || | 683 | max_clock = get_tmds_link_bandwidth(connector); |
| 667 | !nv_encoder->dcb->duallink_possible) | 684 | if (nouveau_duallink && nv_encoder->dcb->duallink_possible) |
| 668 | max_clock = 165000; | 685 | max_clock *= 2; |
| 669 | else | ||
| 670 | max_clock = 330000; | ||
| 671 | break; | 686 | break; |
| 672 | case OUTPUT_ANALOG: | 687 | case OUTPUT_ANALOG: |
| 673 | max_clock = nv_encoder->dcb->crtconf.maxfreq; | 688 | max_clock = nv_encoder->dcb->crtconf.maxfreq; |
| @@ -709,44 +724,6 @@ nouveau_connector_best_encoder(struct drm_connector *connector) | |||
| 709 | return NULL; | 724 | return NULL; |
| 710 | } | 725 | } |
| 711 | 726 | ||
| 712 | void | ||
| 713 | nouveau_connector_set_polling(struct drm_connector *connector) | ||
| 714 | { | ||
| 715 | struct drm_device *dev = connector->dev; | ||
| 716 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
| 717 | struct drm_crtc *crtc; | ||
| 718 | bool spare_crtc = false; | ||
| 719 | |||
| 720 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) | ||
| 721 | spare_crtc |= !crtc->enabled; | ||
| 722 | |||
| 723 | connector->polled = 0; | ||
| 724 | |||
| 725 | switch (connector->connector_type) { | ||
| 726 | case DRM_MODE_CONNECTOR_VGA: | ||
| 727 | case DRM_MODE_CONNECTOR_TV: | ||
| 728 | if (dev_priv->card_type >= NV_50 || | ||
| 729 | (nv_gf4_disp_arch(dev) && spare_crtc)) | ||
| 730 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; | ||
| 731 | break; | ||
| 732 | |||
| 733 | case DRM_MODE_CONNECTOR_DVII: | ||
| 734 | case DRM_MODE_CONNECTOR_DVID: | ||
| 735 | case DRM_MODE_CONNECTOR_HDMIA: | ||
| 736 | case DRM_MODE_CONNECTOR_DisplayPort: | ||
| 737 | case DRM_MODE_CONNECTOR_eDP: | ||
| 738 | if (dev_priv->card_type >= NV_50) | ||
| 739 | connector->polled = DRM_CONNECTOR_POLL_HPD; | ||
| 740 | else if (connector->connector_type == DRM_MODE_CONNECTOR_DVID || | ||
| 741 | spare_crtc) | ||
| 742 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; | ||
| 743 | break; | ||
| 744 | |||
| 745 | default: | ||
| 746 | break; | ||
| 747 | } | ||
| 748 | } | ||
| 749 | |||
| 750 | static const struct drm_connector_helper_funcs | 727 | static const struct drm_connector_helper_funcs |
| 751 | nouveau_connector_helper_funcs = { | 728 | nouveau_connector_helper_funcs = { |
| 752 | .get_modes = nouveau_connector_get_modes, | 729 | .get_modes = nouveau_connector_get_modes, |
| @@ -872,6 +849,7 @@ nouveau_connector_create(struct drm_device *dev, int index) | |||
| 872 | dev->mode_config.scaling_mode_property, | 849 | dev->mode_config.scaling_mode_property, |
| 873 | nv_connector->scaling_mode); | 850 | nv_connector->scaling_mode); |
| 874 | } | 851 | } |
| 852 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; | ||
| 875 | /* fall-through */ | 853 | /* fall-through */ |
| 876 | case DCB_CONNECTOR_TV_0: | 854 | case DCB_CONNECTOR_TV_0: |
| 877 | case DCB_CONNECTOR_TV_1: | 855 | case DCB_CONNECTOR_TV_1: |
| @@ -888,11 +866,16 @@ nouveau_connector_create(struct drm_device *dev, int index) | |||
| 888 | dev->mode_config.dithering_mode_property, | 866 | dev->mode_config.dithering_mode_property, |
| 889 | nv_connector->use_dithering ? | 867 | nv_connector->use_dithering ? |
| 890 | DRM_MODE_DITHERING_ON : DRM_MODE_DITHERING_OFF); | 868 | DRM_MODE_DITHERING_ON : DRM_MODE_DITHERING_OFF); |
| 869 | |||
| 870 | if (dcb->type != DCB_CONNECTOR_LVDS) { | ||
| 871 | if (dev_priv->card_type >= NV_50) | ||
| 872 | connector->polled = DRM_CONNECTOR_POLL_HPD; | ||
| 873 | else | ||
| 874 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; | ||
| 875 | } | ||
| 891 | break; | 876 | break; |
| 892 | } | 877 | } |
| 893 | 878 | ||
| 894 | nouveau_connector_set_polling(connector); | ||
| 895 | |||
| 896 | drm_sysfs_connector_add(connector); | 879 | drm_sysfs_connector_add(connector); |
| 897 | dcb->drm = connector; | 880 | dcb->drm = connector; |
| 898 | return dcb->drm; | 881 | return dcb->drm; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.h b/drivers/gpu/drm/nouveau/nouveau_connector.h index c21ed6b16f88..711b1e9203af 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.h +++ b/drivers/gpu/drm/nouveau/nouveau_connector.h | |||
| @@ -52,9 +52,6 @@ static inline struct nouveau_connector *nouveau_connector( | |||
| 52 | struct drm_connector * | 52 | struct drm_connector * |
| 53 | nouveau_connector_create(struct drm_device *, int index); | 53 | nouveau_connector_create(struct drm_device *, int index); |
| 54 | 54 | ||
| 55 | void | ||
| 56 | nouveau_connector_set_polling(struct drm_connector *); | ||
| 57 | |||
| 58 | int | 55 | int |
| 59 | nouveau_connector_bpp(struct drm_connector *); | 56 | nouveau_connector_bpp(struct drm_connector *); |
| 60 | 57 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 3a07e580d27a..1c7db64c03bf 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
| @@ -100,6 +100,9 @@ struct nouveau_bo { | |||
| 100 | int pin_refcnt; | 100 | int pin_refcnt; |
| 101 | }; | 101 | }; |
| 102 | 102 | ||
| 103 | #define nouveau_bo_tile_layout(nvbo) \ | ||
| 104 | ((nvbo)->tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK) | ||
| 105 | |||
| 103 | static inline struct nouveau_bo * | 106 | static inline struct nouveau_bo * |
| 104 | nouveau_bo(struct ttm_buffer_object *bo) | 107 | nouveau_bo(struct ttm_buffer_object *bo) |
| 105 | { | 108 | { |
| @@ -304,6 +307,7 @@ struct nouveau_fifo_engine { | |||
| 304 | void (*destroy_context)(struct nouveau_channel *); | 307 | void (*destroy_context)(struct nouveau_channel *); |
| 305 | int (*load_context)(struct nouveau_channel *); | 308 | int (*load_context)(struct nouveau_channel *); |
| 306 | int (*unload_context)(struct drm_device *); | 309 | int (*unload_context)(struct drm_device *); |
| 310 | void (*tlb_flush)(struct drm_device *dev); | ||
| 307 | }; | 311 | }; |
| 308 | 312 | ||
| 309 | struct nouveau_pgraph_object_method { | 313 | struct nouveau_pgraph_object_method { |
| @@ -336,6 +340,7 @@ struct nouveau_pgraph_engine { | |||
| 336 | void (*destroy_context)(struct nouveau_channel *); | 340 | void (*destroy_context)(struct nouveau_channel *); |
| 337 | int (*load_context)(struct nouveau_channel *); | 341 | int (*load_context)(struct nouveau_channel *); |
| 338 | int (*unload_context)(struct drm_device *); | 342 | int (*unload_context)(struct drm_device *); |
| 343 | void (*tlb_flush)(struct drm_device *dev); | ||
| 339 | 344 | ||
| 340 | void (*set_region_tiling)(struct drm_device *dev, int i, uint32_t addr, | 345 | void (*set_region_tiling)(struct drm_device *dev, int i, uint32_t addr, |
| 341 | uint32_t size, uint32_t pitch); | 346 | uint32_t size, uint32_t pitch); |
| @@ -485,13 +490,13 @@ enum nv04_fp_display_regs { | |||
| 485 | }; | 490 | }; |
| 486 | 491 | ||
| 487 | struct nv04_crtc_reg { | 492 | struct nv04_crtc_reg { |
| 488 | unsigned char MiscOutReg; /* */ | 493 | unsigned char MiscOutReg; |
| 489 | uint8_t CRTC[0xa0]; | 494 | uint8_t CRTC[0xa0]; |
| 490 | uint8_t CR58[0x10]; | 495 | uint8_t CR58[0x10]; |
| 491 | uint8_t Sequencer[5]; | 496 | uint8_t Sequencer[5]; |
| 492 | uint8_t Graphics[9]; | 497 | uint8_t Graphics[9]; |
| 493 | uint8_t Attribute[21]; | 498 | uint8_t Attribute[21]; |
| 494 | unsigned char DAC[768]; /* Internal Colorlookuptable */ | 499 | unsigned char DAC[768]; |
| 495 | 500 | ||
| 496 | /* PCRTC regs */ | 501 | /* PCRTC regs */ |
| 497 | uint32_t fb_start; | 502 | uint32_t fb_start; |
| @@ -539,43 +544,9 @@ struct nv04_output_reg { | |||
| 539 | }; | 544 | }; |
| 540 | 545 | ||
| 541 | struct nv04_mode_state { | 546 | struct nv04_mode_state { |
| 542 | uint32_t bpp; | 547 | struct nv04_crtc_reg crtc_reg[2]; |
| 543 | uint32_t width; | ||
| 544 | uint32_t height; | ||
| 545 | uint32_t interlace; | ||
| 546 | uint32_t repaint0; | ||
| 547 | uint32_t repaint1; | ||
| 548 | uint32_t screen; | ||
| 549 | uint32_t scale; | ||
| 550 | uint32_t dither; | ||
| 551 | uint32_t extra; | ||
| 552 | uint32_t fifo; | ||
| 553 | uint32_t pixel; | ||
| 554 | uint32_t horiz; | ||
| 555 | int arbitration0; | ||
| 556 | int arbitration1; | ||
| 557 | uint32_t pll; | ||
| 558 | uint32_t pllB; | ||
| 559 | uint32_t vpll; | ||
| 560 | uint32_t vpll2; | ||
| 561 | uint32_t vpllB; | ||
| 562 | uint32_t vpll2B; | ||
| 563 | uint32_t pllsel; | 548 | uint32_t pllsel; |
| 564 | uint32_t sel_clk; | 549 | uint32_t sel_clk; |
| 565 | uint32_t general; | ||
| 566 | uint32_t crtcOwner; | ||
| 567 | uint32_t head; | ||
| 568 | uint32_t head2; | ||
| 569 | uint32_t cursorConfig; | ||
| 570 | uint32_t cursor0; | ||
| 571 | uint32_t cursor1; | ||
| 572 | uint32_t cursor2; | ||
| 573 | uint32_t timingH; | ||
| 574 | uint32_t timingV; | ||
| 575 | uint32_t displayV; | ||
| 576 | uint32_t crtcSync; | ||
| 577 | |||
| 578 | struct nv04_crtc_reg crtc_reg[2]; | ||
| 579 | }; | 550 | }; |
| 580 | 551 | ||
| 581 | enum nouveau_card_type { | 552 | enum nouveau_card_type { |
| @@ -613,6 +584,12 @@ struct drm_nouveau_private { | |||
| 613 | struct work_struct irq_work; | 584 | struct work_struct irq_work; |
| 614 | struct work_struct hpd_work; | 585 | struct work_struct hpd_work; |
| 615 | 586 | ||
| 587 | struct { | ||
| 588 | spinlock_t lock; | ||
| 589 | uint32_t hpd0_bits; | ||
| 590 | uint32_t hpd1_bits; | ||
| 591 | } hpd_state; | ||
| 592 | |||
| 616 | struct list_head vbl_waiting; | 593 | struct list_head vbl_waiting; |
| 617 | 594 | ||
| 618 | struct { | 595 | struct { |
| @@ -1045,6 +1022,7 @@ extern int nv50_fifo_create_context(struct nouveau_channel *); | |||
| 1045 | extern void nv50_fifo_destroy_context(struct nouveau_channel *); | 1022 | extern void nv50_fifo_destroy_context(struct nouveau_channel *); |
| 1046 | extern int nv50_fifo_load_context(struct nouveau_channel *); | 1023 | extern int nv50_fifo_load_context(struct nouveau_channel *); |
| 1047 | extern int nv50_fifo_unload_context(struct drm_device *); | 1024 | extern int nv50_fifo_unload_context(struct drm_device *); |
| 1025 | extern void nv50_fifo_tlb_flush(struct drm_device *dev); | ||
| 1048 | 1026 | ||
| 1049 | /* nvc0_fifo.c */ | 1027 | /* nvc0_fifo.c */ |
| 1050 | extern int nvc0_fifo_init(struct drm_device *); | 1028 | extern int nvc0_fifo_init(struct drm_device *); |
| @@ -1122,6 +1100,8 @@ extern int nv50_graph_load_context(struct nouveau_channel *); | |||
| 1122 | extern int nv50_graph_unload_context(struct drm_device *); | 1100 | extern int nv50_graph_unload_context(struct drm_device *); |
| 1123 | extern void nv50_graph_context_switch(struct drm_device *); | 1101 | extern void nv50_graph_context_switch(struct drm_device *); |
| 1124 | extern int nv50_grctx_init(struct nouveau_grctx *); | 1102 | extern int nv50_grctx_init(struct nouveau_grctx *); |
| 1103 | extern void nv50_graph_tlb_flush(struct drm_device *dev); | ||
| 1104 | extern void nv86_graph_tlb_flush(struct drm_device *dev); | ||
| 1125 | 1105 | ||
| 1126 | /* nvc0_graph.c */ | 1106 | /* nvc0_graph.c */ |
| 1127 | extern int nvc0_graph_init(struct drm_device *); | 1107 | extern int nvc0_graph_init(struct drm_device *); |
| @@ -1239,7 +1219,6 @@ extern u16 nouveau_bo_rd16(struct nouveau_bo *nvbo, unsigned index); | |||
| 1239 | extern void nouveau_bo_wr16(struct nouveau_bo *nvbo, unsigned index, u16 val); | 1219 | extern void nouveau_bo_wr16(struct nouveau_bo *nvbo, unsigned index, u16 val); |
| 1240 | extern u32 nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index); | 1220 | extern u32 nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index); |
| 1241 | extern void nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val); | 1221 | extern void nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val); |
| 1242 | extern int nouveau_bo_sync_gpu(struct nouveau_bo *, struct nouveau_channel *); | ||
| 1243 | 1222 | ||
| 1244 | /* nouveau_fence.c */ | 1223 | /* nouveau_fence.c */ |
| 1245 | struct nouveau_fence; | 1224 | struct nouveau_fence; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index 441b12420bb1..ab1bbfbf266e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c | |||
| @@ -249,6 +249,7 @@ alloc_semaphore(struct drm_device *dev) | |||
| 249 | { | 249 | { |
| 250 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 250 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 251 | struct nouveau_semaphore *sema; | 251 | struct nouveau_semaphore *sema; |
| 252 | int ret; | ||
| 252 | 253 | ||
| 253 | if (!USE_SEMA(dev)) | 254 | if (!USE_SEMA(dev)) |
| 254 | return NULL; | 255 | return NULL; |
| @@ -257,10 +258,14 @@ alloc_semaphore(struct drm_device *dev) | |||
| 257 | if (!sema) | 258 | if (!sema) |
| 258 | goto fail; | 259 | goto fail; |
| 259 | 260 | ||
| 261 | ret = drm_mm_pre_get(&dev_priv->fence.heap); | ||
| 262 | if (ret) | ||
| 263 | goto fail; | ||
| 264 | |||
| 260 | spin_lock(&dev_priv->fence.lock); | 265 | spin_lock(&dev_priv->fence.lock); |
| 261 | sema->mem = drm_mm_search_free(&dev_priv->fence.heap, 4, 0, 0); | 266 | sema->mem = drm_mm_search_free(&dev_priv->fence.heap, 4, 0, 0); |
| 262 | if (sema->mem) | 267 | if (sema->mem) |
| 263 | sema->mem = drm_mm_get_block(sema->mem, 4, 0); | 268 | sema->mem = drm_mm_get_block_atomic(sema->mem, 4, 0); |
| 264 | spin_unlock(&dev_priv->fence.lock); | 269 | spin_unlock(&dev_priv->fence.lock); |
| 265 | 270 | ||
| 266 | if (!sema->mem) | 271 | if (!sema->mem) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 5c4c929d7f74..9a1fdcf400c2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
| @@ -107,23 +107,29 @@ nouveau_gem_info(struct drm_gem_object *gem, struct drm_nouveau_gem_info *rep) | |||
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | static bool | 109 | static bool |
| 110 | nouveau_gem_tile_flags_valid(struct drm_device *dev, uint32_t tile_flags) { | 110 | nouveau_gem_tile_flags_valid(struct drm_device *dev, uint32_t tile_flags) |
| 111 | switch (tile_flags) { | 111 | { |
| 112 | case 0x0000: | 112 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 113 | case 0x1800: | 113 | |
| 114 | case 0x2800: | 114 | if (dev_priv->card_type >= NV_50) { |
| 115 | case 0x4800: | 115 | switch (tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK) { |
| 116 | case 0x7000: | 116 | case 0x0000: |
| 117 | case 0x7400: | 117 | case 0x1800: |
| 118 | case 0x7a00: | 118 | case 0x2800: |
| 119 | case 0xe000: | 119 | case 0x4800: |
| 120 | break; | 120 | case 0x7000: |
| 121 | default: | 121 | case 0x7400: |
| 122 | NV_ERROR(dev, "bad page flags: 0x%08x\n", tile_flags); | 122 | case 0x7a00: |
| 123 | return false; | 123 | case 0xe000: |
| 124 | return true; | ||
| 125 | } | ||
| 126 | } else { | ||
| 127 | if (!(tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK)) | ||
| 128 | return true; | ||
| 124 | } | 129 | } |
| 125 | 130 | ||
| 126 | return true; | 131 | NV_ERROR(dev, "bad page flags: 0x%08x\n", tile_flags); |
| 132 | return false; | ||
| 127 | } | 133 | } |
| 128 | 134 | ||
| 129 | int | 135 | int |
diff --git a/drivers/gpu/drm/nouveau/nouveau_hw.c b/drivers/gpu/drm/nouveau/nouveau_hw.c index bed669a54a2d..b9672a05c411 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hw.c +++ b/drivers/gpu/drm/nouveau/nouveau_hw.c | |||
| @@ -519,11 +519,11 @@ nouveau_hw_fix_bad_vpll(struct drm_device *dev, int head) | |||
| 519 | 519 | ||
| 520 | struct pll_lims pll_lim; | 520 | struct pll_lims pll_lim; |
| 521 | struct nouveau_pll_vals pv; | 521 | struct nouveau_pll_vals pv; |
| 522 | uint32_t pllreg = head ? NV_RAMDAC_VPLL2 : NV_PRAMDAC_VPLL_COEFF; | 522 | enum pll_types pll = head ? PLL_VPLL1 : PLL_VPLL0; |
| 523 | 523 | ||
| 524 | if (get_pll_limits(dev, pllreg, &pll_lim)) | 524 | if (get_pll_limits(dev, pll, &pll_lim)) |
| 525 | return; | 525 | return; |
| 526 | nouveau_hw_get_pllvals(dev, pllreg, &pv); | 526 | nouveau_hw_get_pllvals(dev, pll, &pv); |
| 527 | 527 | ||
| 528 | if (pv.M1 >= pll_lim.vco1.min_m && pv.M1 <= pll_lim.vco1.max_m && | 528 | if (pv.M1 >= pll_lim.vco1.min_m && pv.M1 <= pll_lim.vco1.max_m && |
| 529 | pv.N1 >= pll_lim.vco1.min_n && pv.N1 <= pll_lim.vco1.max_n && | 529 | pv.N1 >= pll_lim.vco1.min_n && pv.N1 <= pll_lim.vco1.max_n && |
| @@ -536,7 +536,7 @@ nouveau_hw_fix_bad_vpll(struct drm_device *dev, int head) | |||
| 536 | pv.M1 = pll_lim.vco1.max_m; | 536 | pv.M1 = pll_lim.vco1.max_m; |
| 537 | pv.N1 = pll_lim.vco1.min_n; | 537 | pv.N1 = pll_lim.vco1.min_n; |
| 538 | pv.log2P = pll_lim.max_usable_log2p; | 538 | pv.log2P = pll_lim.max_usable_log2p; |
| 539 | nouveau_hw_setpll(dev, pllreg, &pv); | 539 | nouveau_hw_setpll(dev, pll_lim.reg, &pv); |
| 540 | } | 540 | } |
| 541 | 541 | ||
| 542 | /* | 542 | /* |
diff --git a/drivers/gpu/drm/nouveau/nouveau_hw.h b/drivers/gpu/drm/nouveau/nouveau_hw.h index 869130f83602..2989090b9434 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hw.h +++ b/drivers/gpu/drm/nouveau/nouveau_hw.h | |||
| @@ -416,6 +416,25 @@ nv_fix_nv40_hw_cursor(struct drm_device *dev, int head) | |||
| 416 | } | 416 | } |
| 417 | 417 | ||
| 418 | static inline void | 418 | static inline void |
| 419 | nv_set_crtc_base(struct drm_device *dev, int head, uint32_t offset) | ||
| 420 | { | ||
| 421 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
| 422 | |||
| 423 | NVWriteCRTC(dev, head, NV_PCRTC_START, offset); | ||
| 424 | |||
| 425 | if (dev_priv->card_type == NV_04) { | ||
| 426 | /* | ||
| 427 | * Hilarious, the 24th bit doesn't want to stick to | ||
| 428 | * PCRTC_START... | ||
| 429 | */ | ||
| 430 | int cre_heb = NVReadVgaCrtc(dev, head, NV_CIO_CRE_HEB__INDEX); | ||
| 431 | |||
| 432 | NVWriteVgaCrtc(dev, head, NV_CIO_CRE_HEB__INDEX, | ||
| 433 | (cre_heb & ~0x40) | ((offset >> 18) & 0x40)); | ||
| 434 | } | ||
| 435 | } | ||
| 436 | |||
| 437 | static inline void | ||
| 419 | nv_show_cursor(struct drm_device *dev, int head, bool show) | 438 | nv_show_cursor(struct drm_device *dev, int head, bool show) |
| 420 | { | 439 | { |
| 421 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 440 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_i2c.c b/drivers/gpu/drm/nouveau/nouveau_i2c.c index fdd7e3de79c8..cb389d014326 100644 --- a/drivers/gpu/drm/nouveau/nouveau_i2c.c +++ b/drivers/gpu/drm/nouveau/nouveau_i2c.c | |||
| @@ -256,7 +256,7 @@ nouveau_i2c_find(struct drm_device *dev, int index) | |||
| 256 | if (index >= DCB_MAX_NUM_I2C_ENTRIES) | 256 | if (index >= DCB_MAX_NUM_I2C_ENTRIES) |
| 257 | return NULL; | 257 | return NULL; |
| 258 | 258 | ||
| 259 | if (dev_priv->chipset >= NV_50 && (i2c->entry & 0x00000100)) { | 259 | if (dev_priv->card_type >= NV_50 && (i2c->entry & 0x00000100)) { |
| 260 | uint32_t reg = 0xe500, val; | 260 | uint32_t reg = 0xe500, val; |
| 261 | 261 | ||
| 262 | if (i2c->port_type == 6) { | 262 | if (i2c->port_type == 6) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c index 6fd51a51c608..7bfd9e6c9d67 100644 --- a/drivers/gpu/drm/nouveau/nouveau_irq.c +++ b/drivers/gpu/drm/nouveau/nouveau_irq.c | |||
| @@ -42,6 +42,13 @@ | |||
| 42 | #include "nouveau_connector.h" | 42 | #include "nouveau_connector.h" |
| 43 | #include "nv50_display.h" | 43 | #include "nv50_display.h" |
| 44 | 44 | ||
| 45 | static DEFINE_RATELIMIT_STATE(nouveau_ratelimit_state, 3 * HZ, 20); | ||
| 46 | |||
| 47 | static int nouveau_ratelimit(void) | ||
| 48 | { | ||
| 49 | return __ratelimit(&nouveau_ratelimit_state); | ||
| 50 | } | ||
| 51 | |||
| 45 | void | 52 | void |
| 46 | nouveau_irq_preinstall(struct drm_device *dev) | 53 | nouveau_irq_preinstall(struct drm_device *dev) |
| 47 | { | 54 | { |
| @@ -53,6 +60,7 @@ nouveau_irq_preinstall(struct drm_device *dev) | |||
| 53 | if (dev_priv->card_type >= NV_50) { | 60 | if (dev_priv->card_type >= NV_50) { |
| 54 | INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh); | 61 | INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh); |
| 55 | INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh); | 62 | INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh); |
| 63 | spin_lock_init(&dev_priv->hpd_state.lock); | ||
| 56 | INIT_LIST_HEAD(&dev_priv->vbl_waiting); | 64 | INIT_LIST_HEAD(&dev_priv->vbl_waiting); |
| 57 | } | 65 | } |
| 58 | } | 66 | } |
| @@ -202,8 +210,8 @@ nouveau_fifo_irq_handler(struct drm_device *dev) | |||
| 202 | } | 210 | } |
| 203 | 211 | ||
| 204 | if (status & NV_PFIFO_INTR_DMA_PUSHER) { | 212 | if (status & NV_PFIFO_INTR_DMA_PUSHER) { |
| 205 | u32 get = nv_rd32(dev, 0x003244); | 213 | u32 dma_get = nv_rd32(dev, 0x003244); |
| 206 | u32 put = nv_rd32(dev, 0x003240); | 214 | u32 dma_put = nv_rd32(dev, 0x003240); |
| 207 | u32 push = nv_rd32(dev, 0x003220); | 215 | u32 push = nv_rd32(dev, 0x003220); |
| 208 | u32 state = nv_rd32(dev, 0x003228); | 216 | u32 state = nv_rd32(dev, 0x003228); |
| 209 | 217 | ||
| @@ -213,16 +221,18 @@ nouveau_fifo_irq_handler(struct drm_device *dev) | |||
| 213 | u32 ib_get = nv_rd32(dev, 0x003334); | 221 | u32 ib_get = nv_rd32(dev, 0x003334); |
| 214 | u32 ib_put = nv_rd32(dev, 0x003330); | 222 | u32 ib_put = nv_rd32(dev, 0x003330); |
| 215 | 223 | ||
| 216 | NV_INFO(dev, "PFIFO_DMA_PUSHER - Ch %d Get 0x%02x%08x " | 224 | if (nouveau_ratelimit()) |
| 225 | NV_INFO(dev, "PFIFO_DMA_PUSHER - Ch %d Get 0x%02x%08x " | ||
| 217 | "Put 0x%02x%08x IbGet 0x%08x IbPut 0x%08x " | 226 | "Put 0x%02x%08x IbGet 0x%08x IbPut 0x%08x " |
| 218 | "State 0x%08x Push 0x%08x\n", | 227 | "State 0x%08x Push 0x%08x\n", |
| 219 | chid, ho_get, get, ho_put, put, ib_get, ib_put, | 228 | chid, ho_get, dma_get, ho_put, |
| 220 | state, push); | 229 | dma_put, ib_get, ib_put, state, |
| 230 | push); | ||
| 221 | 231 | ||
| 222 | /* METHOD_COUNT, in DMA_STATE on earlier chipsets */ | 232 | /* METHOD_COUNT, in DMA_STATE on earlier chipsets */ |
| 223 | nv_wr32(dev, 0x003364, 0x00000000); | 233 | nv_wr32(dev, 0x003364, 0x00000000); |
| 224 | if (get != put || ho_get != ho_put) { | 234 | if (dma_get != dma_put || ho_get != ho_put) { |
| 225 | nv_wr32(dev, 0x003244, put); | 235 | nv_wr32(dev, 0x003244, dma_put); |
| 226 | nv_wr32(dev, 0x003328, ho_put); | 236 | nv_wr32(dev, 0x003328, ho_put); |
| 227 | } else | 237 | } else |
| 228 | if (ib_get != ib_put) { | 238 | if (ib_get != ib_put) { |
| @@ -231,10 +241,10 @@ nouveau_fifo_irq_handler(struct drm_device *dev) | |||
| 231 | } else { | 241 | } else { |
| 232 | NV_INFO(dev, "PFIFO_DMA_PUSHER - Ch %d Get 0x%08x " | 242 | NV_INFO(dev, "PFIFO_DMA_PUSHER - Ch %d Get 0x%08x " |
| 233 | "Put 0x%08x State 0x%08x Push 0x%08x\n", | 243 | "Put 0x%08x State 0x%08x Push 0x%08x\n", |
| 234 | chid, get, put, state, push); | 244 | chid, dma_get, dma_put, state, push); |
| 235 | 245 | ||
| 236 | if (get != put) | 246 | if (dma_get != dma_put) |
| 237 | nv_wr32(dev, 0x003244, put); | 247 | nv_wr32(dev, 0x003244, dma_put); |
| 238 | } | 248 | } |
| 239 | 249 | ||
| 240 | nv_wr32(dev, 0x003228, 0x00000000); | 250 | nv_wr32(dev, 0x003228, 0x00000000); |
| @@ -266,8 +276,9 @@ nouveau_fifo_irq_handler(struct drm_device *dev) | |||
| 266 | } | 276 | } |
| 267 | 277 | ||
| 268 | if (status) { | 278 | if (status) { |
| 269 | NV_INFO(dev, "PFIFO_INTR 0x%08x - Ch %d\n", | 279 | if (nouveau_ratelimit()) |
| 270 | status, chid); | 280 | NV_INFO(dev, "PFIFO_INTR 0x%08x - Ch %d\n", |
| 281 | status, chid); | ||
| 271 | nv_wr32(dev, NV03_PFIFO_INTR_0, status); | 282 | nv_wr32(dev, NV03_PFIFO_INTR_0, status); |
| 272 | status = 0; | 283 | status = 0; |
| 273 | } | 284 | } |
| @@ -544,13 +555,6 @@ nouveau_pgraph_intr_notify(struct drm_device *dev, uint32_t nsource) | |||
| 544 | nouveau_graph_dump_trap_info(dev, "PGRAPH_NOTIFY", &trap); | 555 | nouveau_graph_dump_trap_info(dev, "PGRAPH_NOTIFY", &trap); |
| 545 | } | 556 | } |
| 546 | 557 | ||
| 547 | static DEFINE_RATELIMIT_STATE(nouveau_ratelimit_state, 3 * HZ, 20); | ||
| 548 | |||
| 549 | static int nouveau_ratelimit(void) | ||
| 550 | { | ||
| 551 | return __ratelimit(&nouveau_ratelimit_state); | ||
| 552 | } | ||
| 553 | |||
| 554 | 558 | ||
| 555 | static inline void | 559 | static inline void |
| 556 | nouveau_pgraph_intr_error(struct drm_device *dev, uint32_t nsource) | 560 | nouveau_pgraph_intr_error(struct drm_device *dev, uint32_t nsource) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index a163c7c612e7..fe4a30dc4b42 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
| @@ -33,9 +33,9 @@ | |||
| 33 | #include "drmP.h" | 33 | #include "drmP.h" |
| 34 | #include "drm.h" | 34 | #include "drm.h" |
| 35 | #include "drm_sarea.h" | 35 | #include "drm_sarea.h" |
| 36 | #include "nouveau_drv.h" | ||
| 37 | 36 | ||
| 38 | #define MIN(a,b) a < b ? a : b | 37 | #include "nouveau_drv.h" |
| 38 | #include "nouveau_pm.h" | ||
| 39 | 39 | ||
| 40 | /* | 40 | /* |
| 41 | * NV10-NV40 tiling helpers | 41 | * NV10-NV40 tiling helpers |
| @@ -175,11 +175,10 @@ nv50_mem_vm_bind_linear(struct drm_device *dev, uint64_t virt, uint32_t size, | |||
| 175 | } | 175 | } |
| 176 | } | 176 | } |
| 177 | } | 177 | } |
| 178 | dev_priv->engine.instmem.flush(dev); | ||
| 179 | 178 | ||
| 180 | nv50_vm_flush(dev, 5); | 179 | dev_priv->engine.instmem.flush(dev); |
| 181 | nv50_vm_flush(dev, 0); | 180 | dev_priv->engine.fifo.tlb_flush(dev); |
| 182 | nv50_vm_flush(dev, 4); | 181 | dev_priv->engine.graph.tlb_flush(dev); |
| 183 | nv50_vm_flush(dev, 6); | 182 | nv50_vm_flush(dev, 6); |
| 184 | return 0; | 183 | return 0; |
| 185 | } | 184 | } |
| @@ -209,11 +208,10 @@ nv50_mem_vm_unbind(struct drm_device *dev, uint64_t virt, uint32_t size) | |||
| 209 | pte++; | 208 | pte++; |
| 210 | } | 209 | } |
| 211 | } | 210 | } |
| 212 | dev_priv->engine.instmem.flush(dev); | ||
| 213 | 211 | ||
| 214 | nv50_vm_flush(dev, 5); | 212 | dev_priv->engine.instmem.flush(dev); |
| 215 | nv50_vm_flush(dev, 0); | 213 | dev_priv->engine.fifo.tlb_flush(dev); |
| 216 | nv50_vm_flush(dev, 4); | 214 | dev_priv->engine.graph.tlb_flush(dev); |
| 217 | nv50_vm_flush(dev, 6); | 215 | nv50_vm_flush(dev, 6); |
| 218 | } | 216 | } |
| 219 | 217 | ||
| @@ -653,6 +651,7 @@ nouveau_mem_gart_init(struct drm_device *dev) | |||
| 653 | void | 651 | void |
| 654 | nouveau_mem_timing_init(struct drm_device *dev) | 652 | nouveau_mem_timing_init(struct drm_device *dev) |
| 655 | { | 653 | { |
| 654 | /* cards < NVC0 only */ | ||
| 656 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 655 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 657 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; | 656 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; |
| 658 | struct nouveau_pm_memtimings *memtimings = &pm->memtimings; | 657 | struct nouveau_pm_memtimings *memtimings = &pm->memtimings; |
| @@ -719,14 +718,14 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
| 719 | tUNK_19 = 1; | 718 | tUNK_19 = 1; |
| 720 | tUNK_20 = 0; | 719 | tUNK_20 = 0; |
| 721 | tUNK_21 = 0; | 720 | tUNK_21 = 0; |
| 722 | switch (MIN(recordlen,21)) { | 721 | switch (min(recordlen, 22)) { |
| 723 | case 21: | 722 | case 22: |
| 724 | tUNK_21 = entry[21]; | 723 | tUNK_21 = entry[21]; |
| 725 | case 20: | 724 | case 21: |
| 726 | tUNK_20 = entry[20]; | 725 | tUNK_20 = entry[20]; |
| 727 | case 19: | 726 | case 20: |
| 728 | tUNK_19 = entry[19]; | 727 | tUNK_19 = entry[19]; |
| 729 | case 18: | 728 | case 19: |
| 730 | tUNK_18 = entry[18]; | 729 | tUNK_18 = entry[18]; |
| 731 | default: | 730 | default: |
| 732 | tUNK_0 = entry[0]; | 731 | tUNK_0 = entry[0]; |
| @@ -756,24 +755,30 @@ nouveau_mem_timing_init(struct drm_device *dev) | |||
| 756 | timing->reg_100228 = (tUNK_12 << 16 | tUNK_11 << 8 | tUNK_10); | 755 | timing->reg_100228 = (tUNK_12 << 16 | tUNK_11 << 8 | tUNK_10); |
| 757 | if(recordlen > 19) { | 756 | if(recordlen > 19) { |
| 758 | timing->reg_100228 += (tUNK_19 - 1) << 24; | 757 | timing->reg_100228 += (tUNK_19 - 1) << 24; |
| 759 | } else { | 758 | }/* I cannot back-up this else-statement right now |
| 759 | else { | ||
| 760 | timing->reg_100228 += tUNK_12 << 24; | 760 | timing->reg_100228 += tUNK_12 << 24; |
| 761 | } | 761 | }*/ |
| 762 | 762 | ||
| 763 | /* XXX: reg_10022c */ | 763 | /* XXX: reg_10022c */ |
| 764 | timing->reg_10022c = tUNK_2 - 1; | ||
| 764 | 765 | ||
| 765 | timing->reg_100230 = (tUNK_20 << 24 | tUNK_21 << 16 | | 766 | timing->reg_100230 = (tUNK_20 << 24 | tUNK_21 << 16 | |
| 766 | tUNK_13 << 8 | tUNK_13); | 767 | tUNK_13 << 8 | tUNK_13); |
| 767 | 768 | ||
| 768 | /* XXX: +6? */ | 769 | /* XXX: +6? */ |
| 769 | timing->reg_100234 = (tRAS << 24 | (tUNK_19 + 6) << 8 | tRC); | 770 | timing->reg_100234 = (tRAS << 24 | (tUNK_19 + 6) << 8 | tRC); |
| 770 | if(tUNK_10 > tUNK_11) { | 771 | timing->reg_100234 += max(tUNK_10,tUNK_11) << 16; |
| 771 | timing->reg_100234 += tUNK_10 << 16; | 772 | |
| 772 | } else { | 773 | /* XXX; reg_100238, reg_10023c |
| 773 | timing->reg_100234 += tUNK_11 << 16; | 774 | * reg: 0x00?????? |
| 775 | * reg_10023c: | ||
| 776 | * 0 for pre-NV50 cards | ||
| 777 | * 0x????0202 for NV50+ cards (empirical evidence) */ | ||
| 778 | if(dev_priv->card_type >= NV_50) { | ||
| 779 | timing->reg_10023c = 0x202; | ||
| 774 | } | 780 | } |
| 775 | 781 | ||
| 776 | /* XXX; reg_100238, reg_10023c */ | ||
| 777 | NV_DEBUG(dev, "Entry %d: 220: %08x %08x %08x %08x\n", i, | 782 | NV_DEBUG(dev, "Entry %d: 220: %08x %08x %08x %08x\n", i, |
| 778 | timing->reg_100220, timing->reg_100224, | 783 | timing->reg_100220, timing->reg_100224, |
| 779 | timing->reg_100228, timing->reg_10022c); | 784 | timing->reg_100228, timing->reg_10022c); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c index 896cf8634144..dd572adca02a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_object.c +++ b/drivers/gpu/drm/nouveau/nouveau_object.c | |||
| @@ -129,7 +129,7 @@ nouveau_gpuobj_new(struct drm_device *dev, struct nouveau_channel *chan, | |||
| 129 | if (ramin == NULL) { | 129 | if (ramin == NULL) { |
| 130 | spin_unlock(&dev_priv->ramin_lock); | 130 | spin_unlock(&dev_priv->ramin_lock); |
| 131 | nouveau_gpuobj_ref(NULL, &gpuobj); | 131 | nouveau_gpuobj_ref(NULL, &gpuobj); |
| 132 | return ret; | 132 | return -ENOMEM; |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | ramin = drm_mm_get_block_atomic(ramin, size, align); | 135 | ramin = drm_mm_get_block_atomic(ramin, size, align); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index 1c99c55d6d46..9f7b158f5825 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c | |||
| @@ -284,6 +284,7 @@ nouveau_sysfs_fini(struct drm_device *dev) | |||
| 284 | } | 284 | } |
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | #ifdef CONFIG_HWMON | ||
| 287 | static ssize_t | 288 | static ssize_t |
| 288 | nouveau_hwmon_show_temp(struct device *d, struct device_attribute *a, char *buf) | 289 | nouveau_hwmon_show_temp(struct device *d, struct device_attribute *a, char *buf) |
| 289 | { | 290 | { |
| @@ -395,10 +396,12 @@ static struct attribute *hwmon_attributes[] = { | |||
| 395 | static const struct attribute_group hwmon_attrgroup = { | 396 | static const struct attribute_group hwmon_attrgroup = { |
| 396 | .attrs = hwmon_attributes, | 397 | .attrs = hwmon_attributes, |
| 397 | }; | 398 | }; |
| 399 | #endif | ||
| 398 | 400 | ||
| 399 | static int | 401 | static int |
| 400 | nouveau_hwmon_init(struct drm_device *dev) | 402 | nouveau_hwmon_init(struct drm_device *dev) |
| 401 | { | 403 | { |
| 404 | #ifdef CONFIG_HWMON | ||
| 402 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 405 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 403 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; | 406 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; |
| 404 | struct device *hwmon_dev; | 407 | struct device *hwmon_dev; |
| @@ -425,13 +428,14 @@ nouveau_hwmon_init(struct drm_device *dev) | |||
| 425 | } | 428 | } |
| 426 | 429 | ||
| 427 | pm->hwmon = hwmon_dev; | 430 | pm->hwmon = hwmon_dev; |
| 428 | 431 | #endif | |
| 429 | return 0; | 432 | return 0; |
| 430 | } | 433 | } |
| 431 | 434 | ||
| 432 | static void | 435 | static void |
| 433 | nouveau_hwmon_fini(struct drm_device *dev) | 436 | nouveau_hwmon_fini(struct drm_device *dev) |
| 434 | { | 437 | { |
| 438 | #ifdef CONFIG_HWMON | ||
| 435 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 439 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 436 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; | 440 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; |
| 437 | 441 | ||
| @@ -439,6 +443,7 @@ nouveau_hwmon_fini(struct drm_device *dev) | |||
| 439 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_attrgroup); | 443 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_attrgroup); |
| 440 | hwmon_device_unregister(pm->hwmon); | 444 | hwmon_device_unregister(pm->hwmon); |
| 441 | } | 445 | } |
| 446 | #endif | ||
| 442 | } | 447 | } |
| 443 | 448 | ||
| 444 | int | 449 | int |
diff --git a/drivers/gpu/drm/nouveau/nouveau_ramht.c b/drivers/gpu/drm/nouveau/nouveau_ramht.c index 7f16697cc96c..2d8580927ca4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_ramht.c +++ b/drivers/gpu/drm/nouveau/nouveau_ramht.c | |||
| @@ -153,26 +153,42 @@ nouveau_ramht_insert(struct nouveau_channel *chan, u32 handle, | |||
| 153 | return -ENOMEM; | 153 | return -ENOMEM; |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | static struct nouveau_ramht_entry * | ||
| 157 | nouveau_ramht_remove_entry(struct nouveau_channel *chan, u32 handle) | ||
| 158 | { | ||
| 159 | struct nouveau_ramht *ramht = chan ? chan->ramht : NULL; | ||
| 160 | struct nouveau_ramht_entry *entry; | ||
| 161 | unsigned long flags; | ||
| 162 | |||
| 163 | if (!ramht) | ||
| 164 | return NULL; | ||
| 165 | |||
| 166 | spin_lock_irqsave(&ramht->lock, flags); | ||
| 167 | list_for_each_entry(entry, &ramht->entries, head) { | ||
| 168 | if (entry->channel == chan && | ||
| 169 | (!handle || entry->handle == handle)) { | ||
| 170 | list_del(&entry->head); | ||
| 171 | spin_unlock_irqrestore(&ramht->lock, flags); | ||
| 172 | |||
| 173 | return entry; | ||
| 174 | } | ||
| 175 | } | ||
| 176 | spin_unlock_irqrestore(&ramht->lock, flags); | ||
| 177 | |||
| 178 | return NULL; | ||
| 179 | } | ||
| 180 | |||
| 156 | static void | 181 | static void |
| 157 | nouveau_ramht_remove_locked(struct nouveau_channel *chan, u32 handle) | 182 | nouveau_ramht_remove_hash(struct nouveau_channel *chan, u32 handle) |
| 158 | { | 183 | { |
| 159 | struct drm_device *dev = chan->dev; | 184 | struct drm_device *dev = chan->dev; |
| 160 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 185 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 161 | struct nouveau_instmem_engine *instmem = &dev_priv->engine.instmem; | 186 | struct nouveau_instmem_engine *instmem = &dev_priv->engine.instmem; |
| 162 | struct nouveau_gpuobj *ramht = chan->ramht->gpuobj; | 187 | struct nouveau_gpuobj *ramht = chan->ramht->gpuobj; |
| 163 | struct nouveau_ramht_entry *entry, *tmp; | 188 | unsigned long flags; |
| 164 | u32 co, ho; | 189 | u32 co, ho; |
| 165 | 190 | ||
| 166 | list_for_each_entry_safe(entry, tmp, &chan->ramht->entries, head) { | 191 | spin_lock_irqsave(&chan->ramht->lock, flags); |
| 167 | if (entry->channel != chan || entry->handle != handle) | ||
| 168 | continue; | ||
| 169 | |||
| 170 | nouveau_gpuobj_ref(NULL, &entry->gpuobj); | ||
| 171 | list_del(&entry->head); | ||
| 172 | kfree(entry); | ||
| 173 | break; | ||
| 174 | } | ||
| 175 | |||
| 176 | co = ho = nouveau_ramht_hash_handle(chan, handle); | 192 | co = ho = nouveau_ramht_hash_handle(chan, handle); |
| 177 | do { | 193 | do { |
| 178 | if (nouveau_ramht_entry_valid(dev, ramht, co) && | 194 | if (nouveau_ramht_entry_valid(dev, ramht, co) && |
| @@ -184,7 +200,7 @@ nouveau_ramht_remove_locked(struct nouveau_channel *chan, u32 handle) | |||
| 184 | nv_wo32(ramht, co + 0, 0x00000000); | 200 | nv_wo32(ramht, co + 0, 0x00000000); |
| 185 | nv_wo32(ramht, co + 4, 0x00000000); | 201 | nv_wo32(ramht, co + 4, 0x00000000); |
| 186 | instmem->flush(dev); | 202 | instmem->flush(dev); |
| 187 | return; | 203 | goto out; |
| 188 | } | 204 | } |
| 189 | 205 | ||
| 190 | co += 8; | 206 | co += 8; |
| @@ -194,17 +210,22 @@ nouveau_ramht_remove_locked(struct nouveau_channel *chan, u32 handle) | |||
| 194 | 210 | ||
| 195 | NV_ERROR(dev, "RAMHT entry not found. ch=%d, handle=0x%08x\n", | 211 | NV_ERROR(dev, "RAMHT entry not found. ch=%d, handle=0x%08x\n", |
| 196 | chan->id, handle); | 212 | chan->id, handle); |
| 213 | out: | ||
| 214 | spin_unlock_irqrestore(&chan->ramht->lock, flags); | ||
| 197 | } | 215 | } |
| 198 | 216 | ||
| 199 | void | 217 | void |
| 200 | nouveau_ramht_remove(struct nouveau_channel *chan, u32 handle) | 218 | nouveau_ramht_remove(struct nouveau_channel *chan, u32 handle) |
| 201 | { | 219 | { |
| 202 | struct nouveau_ramht *ramht = chan->ramht; | 220 | struct nouveau_ramht_entry *entry; |
| 203 | unsigned long flags; | ||
| 204 | 221 | ||
| 205 | spin_lock_irqsave(&ramht->lock, flags); | 222 | entry = nouveau_ramht_remove_entry(chan, handle); |
| 206 | nouveau_ramht_remove_locked(chan, handle); | 223 | if (!entry) |
| 207 | spin_unlock_irqrestore(&ramht->lock, flags); | 224 | return; |
| 225 | |||
| 226 | nouveau_ramht_remove_hash(chan, entry->handle); | ||
| 227 | nouveau_gpuobj_ref(NULL, &entry->gpuobj); | ||
| 228 | kfree(entry); | ||
| 208 | } | 229 | } |
| 209 | 230 | ||
| 210 | struct nouveau_gpuobj * | 231 | struct nouveau_gpuobj * |
| @@ -265,23 +286,19 @@ void | |||
| 265 | nouveau_ramht_ref(struct nouveau_ramht *ref, struct nouveau_ramht **ptr, | 286 | nouveau_ramht_ref(struct nouveau_ramht *ref, struct nouveau_ramht **ptr, |
| 266 | struct nouveau_channel *chan) | 287 | struct nouveau_channel *chan) |
| 267 | { | 288 | { |
| 268 | struct nouveau_ramht_entry *entry, *tmp; | 289 | struct nouveau_ramht_entry *entry; |
| 269 | struct nouveau_ramht *ramht; | 290 | struct nouveau_ramht *ramht; |
| 270 | unsigned long flags; | ||
| 271 | 291 | ||
| 272 | if (ref) | 292 | if (ref) |
| 273 | kref_get(&ref->refcount); | 293 | kref_get(&ref->refcount); |
| 274 | 294 | ||
| 275 | ramht = *ptr; | 295 | ramht = *ptr; |
| 276 | if (ramht) { | 296 | if (ramht) { |
| 277 | spin_lock_irqsave(&ramht->lock, flags); | 297 | while ((entry = nouveau_ramht_remove_entry(chan, 0))) { |
| 278 | list_for_each_entry_safe(entry, tmp, &ramht->entries, head) { | 298 | nouveau_ramht_remove_hash(chan, entry->handle); |
| 279 | if (entry->channel != chan) | 299 | nouveau_gpuobj_ref(NULL, &entry->gpuobj); |
| 280 | continue; | 300 | kfree(entry); |
| 281 | |||
| 282 | nouveau_ramht_remove_locked(chan, entry->handle); | ||
| 283 | } | 301 | } |
| 284 | spin_unlock_irqrestore(&ramht->lock, flags); | ||
| 285 | 302 | ||
| 286 | kref_put(&ramht->refcount, nouveau_ramht_del); | 303 | kref_put(&ramht->refcount, nouveau_ramht_del); |
| 287 | } | 304 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index 288bacac7e5a..d4ac97007038 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c | |||
| @@ -120,8 +120,8 @@ nouveau_sgdma_bind(struct ttm_backend *be, struct ttm_mem_reg *mem) | |||
| 120 | dev_priv->engine.instmem.flush(nvbe->dev); | 120 | dev_priv->engine.instmem.flush(nvbe->dev); |
| 121 | 121 | ||
| 122 | if (dev_priv->card_type == NV_50) { | 122 | if (dev_priv->card_type == NV_50) { |
| 123 | nv50_vm_flush(dev, 5); /* PGRAPH */ | 123 | dev_priv->engine.fifo.tlb_flush(dev); |
| 124 | nv50_vm_flush(dev, 0); /* PFIFO */ | 124 | dev_priv->engine.graph.tlb_flush(dev); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | nvbe->bound = true; | 127 | nvbe->bound = true; |
| @@ -162,8 +162,8 @@ nouveau_sgdma_unbind(struct ttm_backend *be) | |||
| 162 | dev_priv->engine.instmem.flush(nvbe->dev); | 162 | dev_priv->engine.instmem.flush(nvbe->dev); |
| 163 | 163 | ||
| 164 | if (dev_priv->card_type == NV_50) { | 164 | if (dev_priv->card_type == NV_50) { |
| 165 | nv50_vm_flush(dev, 5); | 165 | dev_priv->engine.fifo.tlb_flush(dev); |
| 166 | nv50_vm_flush(dev, 0); | 166 | dev_priv->engine.graph.tlb_flush(dev); |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | nvbe->bound = false; | 169 | nvbe->bound = false; |
| @@ -224,7 +224,11 @@ nouveau_sgdma_init(struct drm_device *dev) | |||
| 224 | int i, ret; | 224 | int i, ret; |
| 225 | 225 | ||
| 226 | if (dev_priv->card_type < NV_50) { | 226 | if (dev_priv->card_type < NV_50) { |
| 227 | aper_size = (64 * 1024 * 1024); | 227 | if(dev_priv->ramin_rsvd_vram < 2 * 1024 * 1024) |
| 228 | aper_size = 64 * 1024 * 1024; | ||
| 229 | else | ||
| 230 | aper_size = 512 * 1024 * 1024; | ||
| 231 | |||
| 228 | obj_size = (aper_size >> NV_CTXDMA_PAGE_SHIFT) * 4; | 232 | obj_size = (aper_size >> NV_CTXDMA_PAGE_SHIFT) * 4; |
| 229 | obj_size += 8; /* ctxdma header */ | 233 | obj_size += 8; /* ctxdma header */ |
| 230 | } else { | 234 | } else { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index ed7757f14083..049f755567e5 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
| @@ -354,6 +354,15 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
| 354 | engine->graph.destroy_context = nv50_graph_destroy_context; | 354 | engine->graph.destroy_context = nv50_graph_destroy_context; |
| 355 | engine->graph.load_context = nv50_graph_load_context; | 355 | engine->graph.load_context = nv50_graph_load_context; |
| 356 | engine->graph.unload_context = nv50_graph_unload_context; | 356 | engine->graph.unload_context = nv50_graph_unload_context; |
| 357 | if (dev_priv->chipset != 0x86) | ||
| 358 | engine->graph.tlb_flush = nv50_graph_tlb_flush; | ||
| 359 | else { | ||
| 360 | /* from what i can see nvidia do this on every | ||
| 361 | * pre-NVA3 board except NVAC, but, we've only | ||
| 362 | * ever seen problems on NV86 | ||
| 363 | */ | ||
| 364 | engine->graph.tlb_flush = nv86_graph_tlb_flush; | ||
| 365 | } | ||
| 357 | engine->fifo.channels = 128; | 366 | engine->fifo.channels = 128; |
| 358 | engine->fifo.init = nv50_fifo_init; | 367 | engine->fifo.init = nv50_fifo_init; |
| 359 | engine->fifo.takedown = nv50_fifo_takedown; | 368 | engine->fifo.takedown = nv50_fifo_takedown; |
| @@ -365,6 +374,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
| 365 | engine->fifo.destroy_context = nv50_fifo_destroy_context; | 374 | engine->fifo.destroy_context = nv50_fifo_destroy_context; |
| 366 | engine->fifo.load_context = nv50_fifo_load_context; | 375 | engine->fifo.load_context = nv50_fifo_load_context; |
| 367 | engine->fifo.unload_context = nv50_fifo_unload_context; | 376 | engine->fifo.unload_context = nv50_fifo_unload_context; |
| 377 | engine->fifo.tlb_flush = nv50_fifo_tlb_flush; | ||
| 368 | engine->display.early_init = nv50_display_early_init; | 378 | engine->display.early_init = nv50_display_early_init; |
| 369 | engine->display.late_takedown = nv50_display_late_takedown; | 379 | engine->display.late_takedown = nv50_display_late_takedown; |
| 370 | engine->display.create = nv50_display_create; | 380 | engine->display.create = nv50_display_create; |
| @@ -1041,6 +1051,9 @@ int nouveau_ioctl_getparam(struct drm_device *dev, void *data, | |||
| 1041 | case NOUVEAU_GETPARAM_PTIMER_TIME: | 1051 | case NOUVEAU_GETPARAM_PTIMER_TIME: |
| 1042 | getparam->value = dev_priv->engine.timer.read(dev); | 1052 | getparam->value = dev_priv->engine.timer.read(dev); |
| 1043 | break; | 1053 | break; |
| 1054 | case NOUVEAU_GETPARAM_HAS_BO_USAGE: | ||
| 1055 | getparam->value = 1; | ||
| 1056 | break; | ||
| 1044 | case NOUVEAU_GETPARAM_GRAPH_UNITS: | 1057 | case NOUVEAU_GETPARAM_GRAPH_UNITS: |
| 1045 | /* NV40 and NV50 versions are quite different, but register | 1058 | /* NV40 and NV50 versions are quite different, but register |
| 1046 | * address is the same. User is supposed to know the card | 1059 | * address is the same. User is supposed to know the card |
| @@ -1051,7 +1064,7 @@ int nouveau_ioctl_getparam(struct drm_device *dev, void *data, | |||
| 1051 | } | 1064 | } |
| 1052 | /* FALLTHRU */ | 1065 | /* FALLTHRU */ |
| 1053 | default: | 1066 | default: |
| 1054 | NV_ERROR(dev, "unknown parameter %lld\n", getparam->param); | 1067 | NV_DEBUG(dev, "unknown parameter %lld\n", getparam->param); |
| 1055 | return -EINVAL; | 1068 | return -EINVAL; |
| 1056 | } | 1069 | } |
| 1057 | 1070 | ||
| @@ -1066,7 +1079,7 @@ nouveau_ioctl_setparam(struct drm_device *dev, void *data, | |||
| 1066 | 1079 | ||
| 1067 | switch (setparam->param) { | 1080 | switch (setparam->param) { |
| 1068 | default: | 1081 | default: |
| 1069 | NV_ERROR(dev, "unknown parameter %lld\n", setparam->param); | 1082 | NV_DEBUG(dev, "unknown parameter %lld\n", setparam->param); |
| 1070 | return -EINVAL; | 1083 | return -EINVAL; |
| 1071 | } | 1084 | } |
| 1072 | 1085 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_temp.c b/drivers/gpu/drm/nouveau/nouveau_temp.c index 16bbbf1eff63..7ecc4adc1e45 100644 --- a/drivers/gpu/drm/nouveau/nouveau_temp.c +++ b/drivers/gpu/drm/nouveau/nouveau_temp.c | |||
| @@ -191,7 +191,7 @@ nv40_temp_get(struct drm_device *dev) | |||
| 191 | int offset = sensor->offset_mult / sensor->offset_div; | 191 | int offset = sensor->offset_mult / sensor->offset_div; |
| 192 | int core_temp; | 192 | int core_temp; |
| 193 | 193 | ||
| 194 | if (dev_priv->chipset >= 0x50) { | 194 | if (dev_priv->card_type >= NV_50) { |
| 195 | core_temp = nv_rd32(dev, 0x20008); | 195 | core_temp = nv_rd32(dev, 0x20008); |
| 196 | } else { | 196 | } else { |
| 197 | core_temp = nv_rd32(dev, 0x0015b4) & 0x1fff; | 197 | core_temp = nv_rd32(dev, 0x0015b4) & 0x1fff; |
diff --git a/drivers/gpu/drm/nouveau/nv04_crtc.c b/drivers/gpu/drm/nouveau/nv04_crtc.c index c71abc2a34d5..40e180741629 100644 --- a/drivers/gpu/drm/nouveau/nv04_crtc.c +++ b/drivers/gpu/drm/nouveau/nv04_crtc.c | |||
| @@ -158,7 +158,6 @@ nv_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
| 158 | { | 158 | { |
| 159 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 159 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
| 160 | struct drm_device *dev = crtc->dev; | 160 | struct drm_device *dev = crtc->dev; |
| 161 | struct drm_connector *connector; | ||
| 162 | unsigned char seq1 = 0, crtc17 = 0; | 161 | unsigned char seq1 = 0, crtc17 = 0; |
| 163 | unsigned char crtc1A; | 162 | unsigned char crtc1A; |
| 164 | 163 | ||
| @@ -213,10 +212,6 @@ nv_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
| 213 | NVVgaSeqReset(dev, nv_crtc->index, false); | 212 | NVVgaSeqReset(dev, nv_crtc->index, false); |
| 214 | 213 | ||
| 215 | NVWriteVgaCrtc(dev, nv_crtc->index, NV_CIO_CRE_RPC1_INDEX, crtc1A); | 214 | NVWriteVgaCrtc(dev, nv_crtc->index, NV_CIO_CRE_RPC1_INDEX, crtc1A); |
| 216 | |||
| 217 | /* Update connector polling modes */ | ||
| 218 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) | ||
| 219 | nouveau_connector_set_polling(connector); | ||
| 220 | } | 215 | } |
| 221 | 216 | ||
| 222 | static bool | 217 | static bool |
| @@ -831,7 +826,7 @@ nv04_crtc_do_mode_set_base(struct drm_crtc *crtc, | |||
| 831 | /* Update the framebuffer location. */ | 826 | /* Update the framebuffer location. */ |
| 832 | regp->fb_start = nv_crtc->fb.offset & ~3; | 827 | regp->fb_start = nv_crtc->fb.offset & ~3; |
| 833 | regp->fb_start += (y * drm_fb->pitch) + (x * drm_fb->bits_per_pixel / 8); | 828 | regp->fb_start += (y * drm_fb->pitch) + (x * drm_fb->bits_per_pixel / 8); |
| 834 | NVWriteCRTC(dev, nv_crtc->index, NV_PCRTC_START, regp->fb_start); | 829 | nv_set_crtc_base(dev, nv_crtc->index, regp->fb_start); |
| 835 | 830 | ||
| 836 | /* Update the arbitration parameters. */ | 831 | /* Update the arbitration parameters. */ |
| 837 | nouveau_calc_arb(dev, crtc->mode.clock, drm_fb->bits_per_pixel, | 832 | nouveau_calc_arb(dev, crtc->mode.clock, drm_fb->bits_per_pixel, |
diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c index c936403b26e2..ef23550407b5 100644 --- a/drivers/gpu/drm/nouveau/nv04_dfp.c +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c | |||
| @@ -185,14 +185,15 @@ static bool nv04_dfp_mode_fixup(struct drm_encoder *encoder, | |||
| 185 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); | 185 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); |
| 186 | struct nouveau_connector *nv_connector = nouveau_encoder_connector_get(nv_encoder); | 186 | struct nouveau_connector *nv_connector = nouveau_encoder_connector_get(nv_encoder); |
| 187 | 187 | ||
| 188 | /* For internal panels and gpu scaling on DVI we need the native mode */ | 188 | if (!nv_connector->native_mode || |
| 189 | if (nv_connector->scaling_mode != DRM_MODE_SCALE_NONE) { | 189 | nv_connector->scaling_mode == DRM_MODE_SCALE_NONE || |
| 190 | if (!nv_connector->native_mode) | 190 | mode->hdisplay > nv_connector->native_mode->hdisplay || |
| 191 | return false; | 191 | mode->vdisplay > nv_connector->native_mode->vdisplay) { |
| 192 | nv_encoder->mode = *adjusted_mode; | ||
| 193 | |||
| 194 | } else { | ||
| 192 | nv_encoder->mode = *nv_connector->native_mode; | 195 | nv_encoder->mode = *nv_connector->native_mode; |
| 193 | adjusted_mode->clock = nv_connector->native_mode->clock; | 196 | adjusted_mode->clock = nv_connector->native_mode->clock; |
| 194 | } else { | ||
| 195 | nv_encoder->mode = *adjusted_mode; | ||
| 196 | } | 197 | } |
| 197 | 198 | ||
| 198 | return true; | 199 | return true; |
diff --git a/drivers/gpu/drm/nouveau/nv04_pm.c b/drivers/gpu/drm/nouveau/nv04_pm.c index 6a6eb697d38e..eb1c70dd82ed 100644 --- a/drivers/gpu/drm/nouveau/nv04_pm.c +++ b/drivers/gpu/drm/nouveau/nv04_pm.c | |||
| @@ -76,6 +76,15 @@ nv04_pm_clock_set(struct drm_device *dev, void *pre_state) | |||
| 76 | reg += 4; | 76 | reg += 4; |
| 77 | 77 | ||
| 78 | nouveau_hw_setpll(dev, reg, &state->calc); | 78 | nouveau_hw_setpll(dev, reg, &state->calc); |
| 79 | |||
| 80 | if (dev_priv->card_type < NV_30 && reg == NV_PRAMDAC_MPLL_COEFF) { | ||
| 81 | if (dev_priv->card_type == NV_20) | ||
| 82 | nv_mask(dev, 0x1002c4, 0, 1 << 20); | ||
| 83 | |||
| 84 | /* Reset the DLLs */ | ||
| 85 | nv_mask(dev, 0x1002c0, 0, 1 << 8); | ||
| 86 | } | ||
| 87 | |||
| 79 | kfree(state); | 88 | kfree(state); |
| 80 | } | 89 | } |
| 81 | 90 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_calc.c b/drivers/gpu/drm/nouveau/nv50_calc.c index 2cdc2bfe7179..de81151648f8 100644 --- a/drivers/gpu/drm/nouveau/nv50_calc.c +++ b/drivers/gpu/drm/nouveau/nv50_calc.c | |||
| @@ -51,24 +51,28 @@ nv50_calc_pll2(struct drm_device *dev, struct pll_lims *pll, int clk, | |||
| 51 | int *N, int *fN, int *M, int *P) | 51 | int *N, int *fN, int *M, int *P) |
| 52 | { | 52 | { |
| 53 | fixed20_12 fb_div, a, b; | 53 | fixed20_12 fb_div, a, b; |
| 54 | u32 refclk = pll->refclk / 10; | ||
| 55 | u32 max_vco_freq = pll->vco1.maxfreq / 10; | ||
| 56 | u32 max_vco_inputfreq = pll->vco1.max_inputfreq / 10; | ||
| 57 | clk /= 10; | ||
| 54 | 58 | ||
| 55 | *P = pll->vco1.maxfreq / clk; | 59 | *P = max_vco_freq / clk; |
| 56 | if (*P > pll->max_p) | 60 | if (*P > pll->max_p) |
| 57 | *P = pll->max_p; | 61 | *P = pll->max_p; |
| 58 | if (*P < pll->min_p) | 62 | if (*P < pll->min_p) |
| 59 | *P = pll->min_p; | 63 | *P = pll->min_p; |
| 60 | 64 | ||
| 61 | /* *M = ceil(refclk / pll->vco.max_inputfreq); */ | 65 | /* *M = floor((refclk + max_vco_inputfreq) / max_vco_inputfreq); */ |
| 62 | a.full = dfixed_const(pll->refclk); | 66 | a.full = dfixed_const(refclk + max_vco_inputfreq); |
| 63 | b.full = dfixed_const(pll->vco1.max_inputfreq); | 67 | b.full = dfixed_const(max_vco_inputfreq); |
| 64 | a.full = dfixed_div(a, b); | 68 | a.full = dfixed_div(a, b); |
| 65 | a.full = dfixed_ceil(a); | 69 | a.full = dfixed_floor(a); |
| 66 | *M = dfixed_trunc(a); | 70 | *M = dfixed_trunc(a); |
| 67 | 71 | ||
| 68 | /* fb_div = (vco * *M) / refclk; */ | 72 | /* fb_div = (vco * *M) / refclk; */ |
| 69 | fb_div.full = dfixed_const(clk * *P); | 73 | fb_div.full = dfixed_const(clk * *P); |
| 70 | fb_div.full = dfixed_mul(fb_div, a); | 74 | fb_div.full = dfixed_mul(fb_div, a); |
| 71 | a.full = dfixed_const(pll->refclk); | 75 | a.full = dfixed_const(refclk); |
| 72 | fb_div.full = dfixed_div(fb_div, a); | 76 | fb_div.full = dfixed_div(fb_div, a); |
| 73 | 77 | ||
| 74 | /* *N = floor(fb_div); */ | 78 | /* *N = floor(fb_div); */ |
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c index 16380d52cd88..56476d0c6de8 100644 --- a/drivers/gpu/drm/nouveau/nv50_crtc.c +++ b/drivers/gpu/drm/nouveau/nv50_crtc.c | |||
| @@ -546,7 +546,7 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc, | |||
| 546 | } | 546 | } |
| 547 | 547 | ||
| 548 | nv_crtc->fb.offset = fb->nvbo->bo.offset - dev_priv->vm_vram_base; | 548 | nv_crtc->fb.offset = fb->nvbo->bo.offset - dev_priv->vm_vram_base; |
| 549 | nv_crtc->fb.tile_flags = fb->nvbo->tile_flags; | 549 | nv_crtc->fb.tile_flags = nouveau_bo_tile_layout(fb->nvbo); |
| 550 | nv_crtc->fb.cpp = drm_fb->bits_per_pixel / 8; | 550 | nv_crtc->fb.cpp = drm_fb->bits_per_pixel / 8; |
| 551 | if (!nv_crtc->fb.blanked && dev_priv->chipset != 0x50) { | 551 | if (!nv_crtc->fb.blanked && dev_priv->chipset != 0x50) { |
| 552 | ret = RING_SPACE(evo, 2); | 552 | ret = RING_SPACE(evo, 2); |
| @@ -578,7 +578,7 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc, | |||
| 578 | fb->nvbo->tile_mode); | 578 | fb->nvbo->tile_mode); |
| 579 | } | 579 | } |
| 580 | if (dev_priv->chipset == 0x50) | 580 | if (dev_priv->chipset == 0x50) |
| 581 | OUT_RING(evo, (fb->nvbo->tile_flags << 8) | format); | 581 | OUT_RING(evo, (nv_crtc->fb.tile_flags << 8) | format); |
| 582 | else | 582 | else |
| 583 | OUT_RING(evo, format); | 583 | OUT_RING(evo, format); |
| 584 | 584 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 55c9663ef2bf..f624c611ddea 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
| @@ -1032,11 +1032,18 @@ nv50_display_irq_hotplug_bh(struct work_struct *work) | |||
| 1032 | struct drm_connector *connector; | 1032 | struct drm_connector *connector; |
| 1033 | const uint32_t gpio_reg[4] = { 0xe104, 0xe108, 0xe280, 0xe284 }; | 1033 | const uint32_t gpio_reg[4] = { 0xe104, 0xe108, 0xe280, 0xe284 }; |
| 1034 | uint32_t unplug_mask, plug_mask, change_mask; | 1034 | uint32_t unplug_mask, plug_mask, change_mask; |
| 1035 | uint32_t hpd0, hpd1 = 0; | 1035 | uint32_t hpd0, hpd1; |
| 1036 | 1036 | ||
| 1037 | hpd0 = nv_rd32(dev, 0xe054) & nv_rd32(dev, 0xe050); | 1037 | spin_lock_irq(&dev_priv->hpd_state.lock); |
| 1038 | hpd0 = dev_priv->hpd_state.hpd0_bits; | ||
| 1039 | dev_priv->hpd_state.hpd0_bits = 0; | ||
| 1040 | hpd1 = dev_priv->hpd_state.hpd1_bits; | ||
| 1041 | dev_priv->hpd_state.hpd1_bits = 0; | ||
| 1042 | spin_unlock_irq(&dev_priv->hpd_state.lock); | ||
| 1043 | |||
| 1044 | hpd0 &= nv_rd32(dev, 0xe050); | ||
| 1038 | if (dev_priv->chipset >= 0x90) | 1045 | if (dev_priv->chipset >= 0x90) |
| 1039 | hpd1 = nv_rd32(dev, 0xe074) & nv_rd32(dev, 0xe070); | 1046 | hpd1 &= nv_rd32(dev, 0xe070); |
| 1040 | 1047 | ||
| 1041 | plug_mask = (hpd0 & 0x0000ffff) | (hpd1 << 16); | 1048 | plug_mask = (hpd0 & 0x0000ffff) | (hpd1 << 16); |
| 1042 | unplug_mask = (hpd0 >> 16) | (hpd1 & 0xffff0000); | 1049 | unplug_mask = (hpd0 >> 16) | (hpd1 & 0xffff0000); |
| @@ -1078,10 +1085,6 @@ nv50_display_irq_hotplug_bh(struct work_struct *work) | |||
| 1078 | helper->dpms(connector->encoder, DRM_MODE_DPMS_OFF); | 1085 | helper->dpms(connector->encoder, DRM_MODE_DPMS_OFF); |
| 1079 | } | 1086 | } |
| 1080 | 1087 | ||
| 1081 | nv_wr32(dev, 0xe054, nv_rd32(dev, 0xe054)); | ||
| 1082 | if (dev_priv->chipset >= 0x90) | ||
| 1083 | nv_wr32(dev, 0xe074, nv_rd32(dev, 0xe074)); | ||
| 1084 | |||
| 1085 | drm_helper_hpd_irq_event(dev); | 1088 | drm_helper_hpd_irq_event(dev); |
| 1086 | } | 1089 | } |
| 1087 | 1090 | ||
| @@ -1092,8 +1095,22 @@ nv50_display_irq_handler(struct drm_device *dev) | |||
| 1092 | uint32_t delayed = 0; | 1095 | uint32_t delayed = 0; |
| 1093 | 1096 | ||
| 1094 | if (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_HOTPLUG) { | 1097 | if (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_HOTPLUG) { |
| 1095 | if (!work_pending(&dev_priv->hpd_work)) | 1098 | uint32_t hpd0_bits, hpd1_bits = 0; |
| 1096 | queue_work(dev_priv->wq, &dev_priv->hpd_work); | 1099 | |
| 1100 | hpd0_bits = nv_rd32(dev, 0xe054); | ||
| 1101 | nv_wr32(dev, 0xe054, hpd0_bits); | ||
| 1102 | |||
| 1103 | if (dev_priv->chipset >= 0x90) { | ||
| 1104 | hpd1_bits = nv_rd32(dev, 0xe074); | ||
| 1105 | nv_wr32(dev, 0xe074, hpd1_bits); | ||
| 1106 | } | ||
| 1107 | |||
| 1108 | spin_lock(&dev_priv->hpd_state.lock); | ||
| 1109 | dev_priv->hpd_state.hpd0_bits |= hpd0_bits; | ||
| 1110 | dev_priv->hpd_state.hpd1_bits |= hpd1_bits; | ||
| 1111 | spin_unlock(&dev_priv->hpd_state.lock); | ||
| 1112 | |||
| 1113 | queue_work(dev_priv->wq, &dev_priv->hpd_work); | ||
| 1097 | } | 1114 | } |
| 1098 | 1115 | ||
| 1099 | while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) { | 1116 | while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) { |
diff --git a/drivers/gpu/drm/nouveau/nv50_fifo.c b/drivers/gpu/drm/nouveau/nv50_fifo.c index a46a961102f3..1da65bd60c10 100644 --- a/drivers/gpu/drm/nouveau/nv50_fifo.c +++ b/drivers/gpu/drm/nouveau/nv50_fifo.c | |||
| @@ -464,3 +464,8 @@ nv50_fifo_unload_context(struct drm_device *dev) | |||
| 464 | return 0; | 464 | return 0; |
| 465 | } | 465 | } |
| 466 | 466 | ||
| 467 | void | ||
| 468 | nv50_fifo_tlb_flush(struct drm_device *dev) | ||
| 469 | { | ||
| 470 | nv50_vm_flush(dev, 5); | ||
| 471 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c index cbf5ae2f67d4..8b669d0af610 100644 --- a/drivers/gpu/drm/nouveau/nv50_graph.c +++ b/drivers/gpu/drm/nouveau/nv50_graph.c | |||
| @@ -402,3 +402,55 @@ struct nouveau_pgraph_object_class nv50_graph_grclass[] = { | |||
| 402 | { 0x8597, false, NULL }, /* tesla (nva3, nva5, nva8) */ | 402 | { 0x8597, false, NULL }, /* tesla (nva3, nva5, nva8) */ |
| 403 | {} | 403 | {} |
| 404 | }; | 404 | }; |
| 405 | |||
| 406 | void | ||
| 407 | nv50_graph_tlb_flush(struct drm_device *dev) | ||
| 408 | { | ||
| 409 | nv50_vm_flush(dev, 0); | ||
| 410 | } | ||
| 411 | |||
| 412 | void | ||
| 413 | nv86_graph_tlb_flush(struct drm_device *dev) | ||
| 414 | { | ||
| 415 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
| 416 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; | ||
| 417 | bool idle, timeout = false; | ||
| 418 | unsigned long flags; | ||
| 419 | u64 start; | ||
| 420 | u32 tmp; | ||
| 421 | |||
| 422 | spin_lock_irqsave(&dev_priv->context_switch_lock, flags); | ||
| 423 | nv_mask(dev, 0x400500, 0x00000001, 0x00000000); | ||
| 424 | |||
| 425 | start = ptimer->read(dev); | ||
| 426 | do { | ||
| 427 | idle = true; | ||
| 428 | |||
| 429 | for (tmp = nv_rd32(dev, 0x400380); tmp && idle; tmp >>= 3) { | ||
| 430 | if ((tmp & 7) == 1) | ||
| 431 | idle = false; | ||
| 432 | } | ||
| 433 | |||
| 434 | for (tmp = nv_rd32(dev, 0x400384); tmp && idle; tmp >>= 3) { | ||
| 435 | if ((tmp & 7) == 1) | ||
| 436 | idle = false; | ||
| 437 | } | ||
| 438 | |||
| 439 | for (tmp = nv_rd32(dev, 0x400388); tmp && idle; tmp >>= 3) { | ||
| 440 | if ((tmp & 7) == 1) | ||
| 441 | idle = false; | ||
| 442 | } | ||
| 443 | } while (!idle && !(timeout = ptimer->read(dev) - start > 2000000000)); | ||
| 444 | |||
| 445 | if (timeout) { | ||
| 446 | NV_ERROR(dev, "PGRAPH TLB flush idle timeout fail: " | ||
| 447 | "0x%08x 0x%08x 0x%08x 0x%08x\n", | ||
| 448 | nv_rd32(dev, 0x400700), nv_rd32(dev, 0x400380), | ||
| 449 | nv_rd32(dev, 0x400384), nv_rd32(dev, 0x400388)); | ||
| 450 | } | ||
| 451 | |||
| 452 | nv50_vm_flush(dev, 0); | ||
| 453 | |||
| 454 | nv_mask(dev, 0x400500, 0x00000001, 0x00000001); | ||
| 455 | spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags); | ||
| 456 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_instmem.c b/drivers/gpu/drm/nouveau/nv50_instmem.c index a53fc974332b..b773229b7647 100644 --- a/drivers/gpu/drm/nouveau/nv50_instmem.c +++ b/drivers/gpu/drm/nouveau/nv50_instmem.c | |||
| @@ -402,7 +402,6 @@ nv50_instmem_bind(struct drm_device *dev, struct nouveau_gpuobj *gpuobj) | |||
| 402 | } | 402 | } |
| 403 | dev_priv->engine.instmem.flush(dev); | 403 | dev_priv->engine.instmem.flush(dev); |
| 404 | 404 | ||
| 405 | nv50_vm_flush(dev, 4); | ||
| 406 | nv50_vm_flush(dev, 6); | 405 | nv50_vm_flush(dev, 6); |
| 407 | 406 | ||
| 408 | gpuobj->im_bound = 1; | 407 | gpuobj->im_bound = 1; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 488c36c8f5e6..4dc5b4714c5a 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
| @@ -1650,7 +1650,36 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
| 1650 | } | 1650 | } |
| 1651 | } | 1651 | } |
| 1652 | 1652 | ||
| 1653 | rdev->config.evergreen.tile_config = gb_addr_config; | 1653 | /* setup tiling info dword. gb_addr_config is not adequate since it does |
| 1654 | * not have bank info, so create a custom tiling dword. | ||
| 1655 | * bits 3:0 num_pipes | ||
| 1656 | * bits 7:4 num_banks | ||
| 1657 | * bits 11:8 group_size | ||
| 1658 | * bits 15:12 row_size | ||
| 1659 | */ | ||
| 1660 | rdev->config.evergreen.tile_config = 0; | ||
| 1661 | switch (rdev->config.evergreen.max_tile_pipes) { | ||
| 1662 | case 1: | ||
| 1663 | default: | ||
| 1664 | rdev->config.evergreen.tile_config |= (0 << 0); | ||
| 1665 | break; | ||
| 1666 | case 2: | ||
| 1667 | rdev->config.evergreen.tile_config |= (1 << 0); | ||
| 1668 | break; | ||
| 1669 | case 4: | ||
| 1670 | rdev->config.evergreen.tile_config |= (2 << 0); | ||
| 1671 | break; | ||
| 1672 | case 8: | ||
| 1673 | rdev->config.evergreen.tile_config |= (3 << 0); | ||
| 1674 | break; | ||
| 1675 | } | ||
| 1676 | rdev->config.evergreen.tile_config |= | ||
| 1677 | ((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) << 4; | ||
| 1678 | rdev->config.evergreen.tile_config |= | ||
| 1679 | ((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT) << 8; | ||
| 1680 | rdev->config.evergreen.tile_config |= | ||
| 1681 | ((gb_addr_config & 0x30000000) >> 28) << 12; | ||
| 1682 | |||
| 1654 | WREG32(GB_BACKEND_MAP, gb_backend_map); | 1683 | WREG32(GB_BACKEND_MAP, gb_backend_map); |
| 1655 | WREG32(GB_ADDR_CONFIG, gb_addr_config); | 1684 | WREG32(GB_ADDR_CONFIG, gb_addr_config); |
| 1656 | WREG32(DMIF_ADDR_CONFIG, gb_addr_config); | 1685 | WREG32(DMIF_ADDR_CONFIG, gb_addr_config); |
diff --git a/drivers/gpu/drm/radeon/evergreen_blit_kms.c b/drivers/gpu/drm/radeon/evergreen_blit_kms.c index ac3b6dde23db..e0e590110dd4 100644 --- a/drivers/gpu/drm/radeon/evergreen_blit_kms.c +++ b/drivers/gpu/drm/radeon/evergreen_blit_kms.c | |||
| @@ -459,7 +459,7 @@ int evergreen_blit_init(struct radeon_device *rdev) | |||
| 459 | obj_size += evergreen_ps_size * 4; | 459 | obj_size += evergreen_ps_size * 4; |
| 460 | obj_size = ALIGN(obj_size, 256); | 460 | obj_size = ALIGN(obj_size, 256); |
| 461 | 461 | ||
| 462 | r = radeon_bo_create(rdev, NULL, obj_size, true, RADEON_GEM_DOMAIN_VRAM, | 462 | r = radeon_bo_create(rdev, NULL, obj_size, PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, |
| 463 | &rdev->r600_blit.shader_obj); | 463 | &rdev->r600_blit.shader_obj); |
| 464 | if (r) { | 464 | if (r) { |
| 465 | DRM_ERROR("evergreen failed to allocate shader\n"); | 465 | DRM_ERROR("evergreen failed to allocate shader\n"); |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 0f806cc7dc75..a3552594ccc4 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
| @@ -2718,7 +2718,7 @@ static int r600_ih_ring_alloc(struct radeon_device *rdev) | |||
| 2718 | /* Allocate ring buffer */ | 2718 | /* Allocate ring buffer */ |
| 2719 | if (rdev->ih.ring_obj == NULL) { | 2719 | if (rdev->ih.ring_obj == NULL) { |
| 2720 | r = radeon_bo_create(rdev, NULL, rdev->ih.ring_size, | 2720 | r = radeon_bo_create(rdev, NULL, rdev->ih.ring_size, |
| 2721 | true, | 2721 | PAGE_SIZE, true, |
| 2722 | RADEON_GEM_DOMAIN_GTT, | 2722 | RADEON_GEM_DOMAIN_GTT, |
| 2723 | &rdev->ih.ring_obj); | 2723 | &rdev->ih.ring_obj); |
| 2724 | if (r) { | 2724 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index 8362974ef41a..86e5aa07f0db 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c | |||
| @@ -501,7 +501,7 @@ int r600_blit_init(struct radeon_device *rdev) | |||
| 501 | obj_size += r6xx_ps_size * 4; | 501 | obj_size += r6xx_ps_size * 4; |
| 502 | obj_size = ALIGN(obj_size, 256); | 502 | obj_size = ALIGN(obj_size, 256); |
| 503 | 503 | ||
| 504 | r = radeon_bo_create(rdev, NULL, obj_size, true, RADEON_GEM_DOMAIN_VRAM, | 504 | r = radeon_bo_create(rdev, NULL, obj_size, PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, |
| 505 | &rdev->r600_blit.shader_obj); | 505 | &rdev->r600_blit.shader_obj); |
| 506 | if (r) { | 506 | if (r) { |
| 507 | DRM_ERROR("r600 failed to allocate shader\n"); | 507 | DRM_ERROR("r600 failed to allocate shader\n"); |
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 37cc2aa9f923..9bebac1ec006 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
| @@ -50,6 +50,7 @@ struct r600_cs_track { | |||
| 50 | u32 nsamples; | 50 | u32 nsamples; |
| 51 | u32 cb_color_base_last[8]; | 51 | u32 cb_color_base_last[8]; |
| 52 | struct radeon_bo *cb_color_bo[8]; | 52 | struct radeon_bo *cb_color_bo[8]; |
| 53 | u64 cb_color_bo_mc[8]; | ||
| 53 | u32 cb_color_bo_offset[8]; | 54 | u32 cb_color_bo_offset[8]; |
| 54 | struct radeon_bo *cb_color_frag_bo[8]; | 55 | struct radeon_bo *cb_color_frag_bo[8]; |
| 55 | struct radeon_bo *cb_color_tile_bo[8]; | 56 | struct radeon_bo *cb_color_tile_bo[8]; |
| @@ -67,6 +68,7 @@ struct r600_cs_track { | |||
| 67 | u32 db_depth_size; | 68 | u32 db_depth_size; |
| 68 | u32 db_offset; | 69 | u32 db_offset; |
| 69 | struct radeon_bo *db_bo; | 70 | struct radeon_bo *db_bo; |
| 71 | u64 db_bo_mc; | ||
| 70 | }; | 72 | }; |
| 71 | 73 | ||
| 72 | static inline int r600_bpe_from_format(u32 *bpe, u32 format) | 74 | static inline int r600_bpe_from_format(u32 *bpe, u32 format) |
| @@ -140,6 +142,68 @@ static inline int r600_bpe_from_format(u32 *bpe, u32 format) | |||
| 140 | return 0; | 142 | return 0; |
| 141 | } | 143 | } |
| 142 | 144 | ||
| 145 | struct array_mode_checker { | ||
| 146 | int array_mode; | ||
| 147 | u32 group_size; | ||
| 148 | u32 nbanks; | ||
| 149 | u32 npipes; | ||
| 150 | u32 nsamples; | ||
| 151 | u32 bpe; | ||
| 152 | }; | ||
| 153 | |||
| 154 | /* returns alignment in pixels for pitch/height/depth and bytes for base */ | ||
| 155 | static inline int r600_get_array_mode_alignment(struct array_mode_checker *values, | ||
| 156 | u32 *pitch_align, | ||
| 157 | u32 *height_align, | ||
| 158 | u32 *depth_align, | ||
| 159 | u64 *base_align) | ||
| 160 | { | ||
| 161 | u32 tile_width = 8; | ||
| 162 | u32 tile_height = 8; | ||
| 163 | u32 macro_tile_width = values->nbanks; | ||
| 164 | u32 macro_tile_height = values->npipes; | ||
| 165 | u32 tile_bytes = tile_width * tile_height * values->bpe * values->nsamples; | ||
| 166 | u32 macro_tile_bytes = macro_tile_width * macro_tile_height * tile_bytes; | ||
| 167 | |||
| 168 | switch (values->array_mode) { | ||
| 169 | case ARRAY_LINEAR_GENERAL: | ||
| 170 | /* technically tile_width/_height for pitch/height */ | ||
| 171 | *pitch_align = 1; /* tile_width */ | ||
| 172 | *height_align = 1; /* tile_height */ | ||
| 173 | *depth_align = 1; | ||
| 174 | *base_align = 1; | ||
| 175 | break; | ||
| 176 | case ARRAY_LINEAR_ALIGNED: | ||
| 177 | *pitch_align = max((u32)64, (u32)(values->group_size / values->bpe)); | ||
| 178 | *height_align = tile_height; | ||
| 179 | *depth_align = 1; | ||
| 180 | *base_align = values->group_size; | ||
| 181 | break; | ||
| 182 | case ARRAY_1D_TILED_THIN1: | ||
| 183 | *pitch_align = max((u32)tile_width, | ||
| 184 | (u32)(values->group_size / | ||
| 185 | (tile_height * values->bpe * values->nsamples))); | ||
| 186 | *height_align = tile_height; | ||
| 187 | *depth_align = 1; | ||
| 188 | *base_align = values->group_size; | ||
| 189 | break; | ||
| 190 | case ARRAY_2D_TILED_THIN1: | ||
| 191 | *pitch_align = max((u32)macro_tile_width, | ||
| 192 | (u32)(((values->group_size / tile_height) / | ||
| 193 | (values->bpe * values->nsamples)) * | ||
| 194 | values->nbanks)) * tile_width; | ||
| 195 | *height_align = macro_tile_height * tile_height; | ||
| 196 | *depth_align = 1; | ||
| 197 | *base_align = max(macro_tile_bytes, | ||
| 198 | (*pitch_align) * values->bpe * (*height_align) * values->nsamples); | ||
| 199 | break; | ||
| 200 | default: | ||
| 201 | return -EINVAL; | ||
| 202 | } | ||
| 203 | |||
| 204 | return 0; | ||
| 205 | } | ||
| 206 | |||
| 143 | static void r600_cs_track_init(struct r600_cs_track *track) | 207 | static void r600_cs_track_init(struct r600_cs_track *track) |
| 144 | { | 208 | { |
| 145 | int i; | 209 | int i; |
| @@ -153,10 +217,12 @@ static void r600_cs_track_init(struct r600_cs_track *track) | |||
| 153 | track->cb_color_info[i] = 0; | 217 | track->cb_color_info[i] = 0; |
| 154 | track->cb_color_bo[i] = NULL; | 218 | track->cb_color_bo[i] = NULL; |
| 155 | track->cb_color_bo_offset[i] = 0xFFFFFFFF; | 219 | track->cb_color_bo_offset[i] = 0xFFFFFFFF; |
| 220 | track->cb_color_bo_mc[i] = 0xFFFFFFFF; | ||
| 156 | } | 221 | } |
| 157 | track->cb_target_mask = 0xFFFFFFFF; | 222 | track->cb_target_mask = 0xFFFFFFFF; |
| 158 | track->cb_shader_mask = 0xFFFFFFFF; | 223 | track->cb_shader_mask = 0xFFFFFFFF; |
| 159 | track->db_bo = NULL; | 224 | track->db_bo = NULL; |
| 225 | track->db_bo_mc = 0xFFFFFFFF; | ||
| 160 | /* assume the biggest format and that htile is enabled */ | 226 | /* assume the biggest format and that htile is enabled */ |
| 161 | track->db_depth_info = 7 | (1 << 25); | 227 | track->db_depth_info = 7 | (1 << 25); |
| 162 | track->db_depth_view = 0xFFFFC000; | 228 | track->db_depth_view = 0xFFFFC000; |
| @@ -168,7 +234,10 @@ static void r600_cs_track_init(struct r600_cs_track *track) | |||
| 168 | static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | 234 | static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) |
| 169 | { | 235 | { |
| 170 | struct r600_cs_track *track = p->track; | 236 | struct r600_cs_track *track = p->track; |
| 171 | u32 bpe = 0, pitch, slice_tile_max, size, tmp, height, pitch_align; | 237 | u32 bpe = 0, slice_tile_max, size, tmp; |
| 238 | u32 height, height_align, pitch, pitch_align, depth_align; | ||
| 239 | u64 base_offset, base_align; | ||
| 240 | struct array_mode_checker array_check; | ||
| 172 | volatile u32 *ib = p->ib->ptr; | 241 | volatile u32 *ib = p->ib->ptr; |
| 173 | unsigned array_mode; | 242 | unsigned array_mode; |
| 174 | 243 | ||
| @@ -183,60 +252,40 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
| 183 | i, track->cb_color_info[i]); | 252 | i, track->cb_color_info[i]); |
| 184 | return -EINVAL; | 253 | return -EINVAL; |
| 185 | } | 254 | } |
| 186 | /* pitch is the number of 8x8 tiles per row */ | 255 | /* pitch in pixels */ |
| 187 | pitch = G_028060_PITCH_TILE_MAX(track->cb_color_size[i]) + 1; | 256 | pitch = (G_028060_PITCH_TILE_MAX(track->cb_color_size[i]) + 1) * 8; |
| 188 | slice_tile_max = G_028060_SLICE_TILE_MAX(track->cb_color_size[i]) + 1; | 257 | slice_tile_max = G_028060_SLICE_TILE_MAX(track->cb_color_size[i]) + 1; |
| 189 | slice_tile_max *= 64; | 258 | slice_tile_max *= 64; |
| 190 | height = slice_tile_max / (pitch * 8); | 259 | height = slice_tile_max / pitch; |
| 191 | if (height > 8192) | 260 | if (height > 8192) |
| 192 | height = 8192; | 261 | height = 8192; |
| 193 | array_mode = G_0280A0_ARRAY_MODE(track->cb_color_info[i]); | 262 | array_mode = G_0280A0_ARRAY_MODE(track->cb_color_info[i]); |
| 263 | |||
| 264 | base_offset = track->cb_color_bo_mc[i] + track->cb_color_bo_offset[i]; | ||
| 265 | array_check.array_mode = array_mode; | ||
| 266 | array_check.group_size = track->group_size; | ||
| 267 | array_check.nbanks = track->nbanks; | ||
| 268 | array_check.npipes = track->npipes; | ||
| 269 | array_check.nsamples = track->nsamples; | ||
| 270 | array_check.bpe = bpe; | ||
| 271 | if (r600_get_array_mode_alignment(&array_check, | ||
| 272 | &pitch_align, &height_align, &depth_align, &base_align)) { | ||
| 273 | dev_warn(p->dev, "%s invalid tiling %d for %d (0x%08X)\n", __func__, | ||
| 274 | G_0280A0_ARRAY_MODE(track->cb_color_info[i]), i, | ||
| 275 | track->cb_color_info[i]); | ||
| 276 | return -EINVAL; | ||
| 277 | } | ||
| 194 | switch (array_mode) { | 278 | switch (array_mode) { |
| 195 | case V_0280A0_ARRAY_LINEAR_GENERAL: | 279 | case V_0280A0_ARRAY_LINEAR_GENERAL: |
| 196 | /* technically height & 0x7 */ | ||
| 197 | break; | 280 | break; |
| 198 | case V_0280A0_ARRAY_LINEAR_ALIGNED: | 281 | case V_0280A0_ARRAY_LINEAR_ALIGNED: |
| 199 | pitch_align = max((u32)64, (u32)(track->group_size / bpe)) / 8; | ||
| 200 | if (!IS_ALIGNED(pitch, pitch_align)) { | ||
| 201 | dev_warn(p->dev, "%s:%d cb pitch (%d) invalid\n", | ||
| 202 | __func__, __LINE__, pitch); | ||
| 203 | return -EINVAL; | ||
| 204 | } | ||
| 205 | if (!IS_ALIGNED(height, 8)) { | ||
| 206 | dev_warn(p->dev, "%s:%d cb height (%d) invalid\n", | ||
| 207 | __func__, __LINE__, height); | ||
| 208 | return -EINVAL; | ||
| 209 | } | ||
| 210 | break; | 282 | break; |
| 211 | case V_0280A0_ARRAY_1D_TILED_THIN1: | 283 | case V_0280A0_ARRAY_1D_TILED_THIN1: |
| 212 | pitch_align = max((u32)8, (u32)(track->group_size / (8 * bpe * track->nsamples))) / 8; | ||
| 213 | if (!IS_ALIGNED(pitch, pitch_align)) { | ||
| 214 | dev_warn(p->dev, "%s:%d cb pitch (%d) invalid\n", | ||
| 215 | __func__, __LINE__, pitch); | ||
| 216 | return -EINVAL; | ||
| 217 | } | ||
| 218 | /* avoid breaking userspace */ | 284 | /* avoid breaking userspace */ |
| 219 | if (height > 7) | 285 | if (height > 7) |
| 220 | height &= ~0x7; | 286 | height &= ~0x7; |
| 221 | if (!IS_ALIGNED(height, 8)) { | ||
| 222 | dev_warn(p->dev, "%s:%d cb height (%d) invalid\n", | ||
| 223 | __func__, __LINE__, height); | ||
| 224 | return -EINVAL; | ||
| 225 | } | ||
| 226 | break; | 287 | break; |
| 227 | case V_0280A0_ARRAY_2D_TILED_THIN1: | 288 | case V_0280A0_ARRAY_2D_TILED_THIN1: |
| 228 | pitch_align = max((u32)track->nbanks, | ||
| 229 | (u32)(((track->group_size / 8) / (bpe * track->nsamples)) * track->nbanks)) / 8; | ||
| 230 | if (!IS_ALIGNED(pitch, pitch_align)) { | ||
| 231 | dev_warn(p->dev, "%s:%d cb pitch (%d) invalid\n", | ||
| 232 | __func__, __LINE__, pitch); | ||
| 233 | return -EINVAL; | ||
| 234 | } | ||
| 235 | if (!IS_ALIGNED((height / 8), track->npipes)) { | ||
| 236 | dev_warn(p->dev, "%s:%d cb height (%d) invalid\n", | ||
| 237 | __func__, __LINE__, height); | ||
| 238 | return -EINVAL; | ||
| 239 | } | ||
| 240 | break; | 289 | break; |
| 241 | default: | 290 | default: |
| 242 | dev_warn(p->dev, "%s invalid tiling %d for %d (0x%08X)\n", __func__, | 291 | dev_warn(p->dev, "%s invalid tiling %d for %d (0x%08X)\n", __func__, |
| @@ -244,13 +293,29 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
| 244 | track->cb_color_info[i]); | 293 | track->cb_color_info[i]); |
| 245 | return -EINVAL; | 294 | return -EINVAL; |
| 246 | } | 295 | } |
| 296 | |||
| 297 | if (!IS_ALIGNED(pitch, pitch_align)) { | ||
| 298 | dev_warn(p->dev, "%s:%d cb pitch (%d) invalid\n", | ||
| 299 | __func__, __LINE__, pitch); | ||
| 300 | return -EINVAL; | ||
| 301 | } | ||
| 302 | if (!IS_ALIGNED(height, height_align)) { | ||
| 303 | dev_warn(p->dev, "%s:%d cb height (%d) invalid\n", | ||
| 304 | __func__, __LINE__, height); | ||
| 305 | return -EINVAL; | ||
| 306 | } | ||
| 307 | if (!IS_ALIGNED(base_offset, base_align)) { | ||
| 308 | dev_warn(p->dev, "%s offset[%d] 0x%llx not aligned\n", __func__, i, base_offset); | ||
| 309 | return -EINVAL; | ||
| 310 | } | ||
| 311 | |||
| 247 | /* check offset */ | 312 | /* check offset */ |
| 248 | tmp = height * pitch * 8 * bpe; | 313 | tmp = height * pitch * bpe; |
| 249 | if ((tmp + track->cb_color_bo_offset[i]) > radeon_bo_size(track->cb_color_bo[i])) { | 314 | if ((tmp + track->cb_color_bo_offset[i]) > radeon_bo_size(track->cb_color_bo[i])) { |
| 250 | if (array_mode == V_0280A0_ARRAY_LINEAR_GENERAL) { | 315 | if (array_mode == V_0280A0_ARRAY_LINEAR_GENERAL) { |
| 251 | /* the initial DDX does bad things with the CB size occasionally */ | 316 | /* the initial DDX does bad things with the CB size occasionally */ |
| 252 | /* it rounds up height too far for slice tile max but the BO is smaller */ | 317 | /* it rounds up height too far for slice tile max but the BO is smaller */ |
| 253 | tmp = (height - 7) * 8 * bpe; | 318 | tmp = (height - 7) * pitch * bpe; |
| 254 | if ((tmp + track->cb_color_bo_offset[i]) > radeon_bo_size(track->cb_color_bo[i])) { | 319 | if ((tmp + track->cb_color_bo_offset[i]) > radeon_bo_size(track->cb_color_bo[i])) { |
| 255 | dev_warn(p->dev, "%s offset[%d] %d %d %lu too big\n", __func__, i, track->cb_color_bo_offset[i], tmp, radeon_bo_size(track->cb_color_bo[i])); | 320 | dev_warn(p->dev, "%s offset[%d] %d %d %lu too big\n", __func__, i, track->cb_color_bo_offset[i], tmp, radeon_bo_size(track->cb_color_bo[i])); |
| 256 | return -EINVAL; | 321 | return -EINVAL; |
| @@ -260,15 +325,11 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
| 260 | return -EINVAL; | 325 | return -EINVAL; |
| 261 | } | 326 | } |
| 262 | } | 327 | } |
| 263 | if (!IS_ALIGNED(track->cb_color_bo_offset[i], track->group_size)) { | ||
| 264 | dev_warn(p->dev, "%s offset[%d] %d not aligned\n", __func__, i, track->cb_color_bo_offset[i]); | ||
| 265 | return -EINVAL; | ||
| 266 | } | ||
| 267 | /* limit max tile */ | 328 | /* limit max tile */ |
| 268 | tmp = (height * pitch * 8) >> 6; | 329 | tmp = (height * pitch) >> 6; |
| 269 | if (tmp < slice_tile_max) | 330 | if (tmp < slice_tile_max) |
| 270 | slice_tile_max = tmp; | 331 | slice_tile_max = tmp; |
| 271 | tmp = S_028060_PITCH_TILE_MAX(pitch - 1) | | 332 | tmp = S_028060_PITCH_TILE_MAX((pitch / 8) - 1) | |
| 272 | S_028060_SLICE_TILE_MAX(slice_tile_max - 1); | 333 | S_028060_SLICE_TILE_MAX(slice_tile_max - 1); |
| 273 | ib[track->cb_color_size_idx[i]] = tmp; | 334 | ib[track->cb_color_size_idx[i]] = tmp; |
| 274 | return 0; | 335 | return 0; |
| @@ -310,7 +371,12 @@ static int r600_cs_track_check(struct radeon_cs_parser *p) | |||
| 310 | /* Check depth buffer */ | 371 | /* Check depth buffer */ |
| 311 | if (G_028800_STENCIL_ENABLE(track->db_depth_control) || | 372 | if (G_028800_STENCIL_ENABLE(track->db_depth_control) || |
| 312 | G_028800_Z_ENABLE(track->db_depth_control)) { | 373 | G_028800_Z_ENABLE(track->db_depth_control)) { |
| 313 | u32 nviews, bpe, ntiles, pitch, pitch_align, height, size, slice_tile_max; | 374 | u32 nviews, bpe, ntiles, size, slice_tile_max; |
| 375 | u32 height, height_align, pitch, pitch_align, depth_align; | ||
| 376 | u64 base_offset, base_align; | ||
| 377 | struct array_mode_checker array_check; | ||
| 378 | int array_mode; | ||
| 379 | |||
| 314 | if (track->db_bo == NULL) { | 380 | if (track->db_bo == NULL) { |
| 315 | dev_warn(p->dev, "z/stencil with no depth buffer\n"); | 381 | dev_warn(p->dev, "z/stencil with no depth buffer\n"); |
| 316 | return -EINVAL; | 382 | return -EINVAL; |
| @@ -353,41 +419,34 @@ static int r600_cs_track_check(struct radeon_cs_parser *p) | |||
| 353 | ib[track->db_depth_size_idx] = S_028000_SLICE_TILE_MAX(tmp - 1) | (track->db_depth_size & 0x3FF); | 419 | ib[track->db_depth_size_idx] = S_028000_SLICE_TILE_MAX(tmp - 1) | (track->db_depth_size & 0x3FF); |
| 354 | } else { | 420 | } else { |
| 355 | size = radeon_bo_size(track->db_bo); | 421 | size = radeon_bo_size(track->db_bo); |
| 356 | pitch = G_028000_PITCH_TILE_MAX(track->db_depth_size) + 1; | 422 | /* pitch in pixels */ |
| 423 | pitch = (G_028000_PITCH_TILE_MAX(track->db_depth_size) + 1) * 8; | ||
| 357 | slice_tile_max = G_028000_SLICE_TILE_MAX(track->db_depth_size) + 1; | 424 | slice_tile_max = G_028000_SLICE_TILE_MAX(track->db_depth_size) + 1; |
| 358 | slice_tile_max *= 64; | 425 | slice_tile_max *= 64; |
| 359 | height = slice_tile_max / (pitch * 8); | 426 | height = slice_tile_max / pitch; |
| 360 | if (height > 8192) | 427 | if (height > 8192) |
| 361 | height = 8192; | 428 | height = 8192; |
| 362 | switch (G_028010_ARRAY_MODE(track->db_depth_info)) { | 429 | base_offset = track->db_bo_mc + track->db_offset; |
| 430 | array_mode = G_028010_ARRAY_MODE(track->db_depth_info); | ||
| 431 | array_check.array_mode = array_mode; | ||
| 432 | array_check.group_size = track->group_size; | ||
| 433 | array_check.nbanks = track->nbanks; | ||
| 434 | array_check.npipes = track->npipes; | ||
| 435 | array_check.nsamples = track->nsamples; | ||
| 436 | array_check.bpe = bpe; | ||
| 437 | if (r600_get_array_mode_alignment(&array_check, | ||
| 438 | &pitch_align, &height_align, &depth_align, &base_align)) { | ||
| 439 | dev_warn(p->dev, "%s invalid tiling %d (0x%08X)\n", __func__, | ||
| 440 | G_028010_ARRAY_MODE(track->db_depth_info), | ||
| 441 | track->db_depth_info); | ||
| 442 | return -EINVAL; | ||
| 443 | } | ||
| 444 | switch (array_mode) { | ||
| 363 | case V_028010_ARRAY_1D_TILED_THIN1: | 445 | case V_028010_ARRAY_1D_TILED_THIN1: |
| 364 | pitch_align = (max((u32)8, (u32)(track->group_size / (8 * bpe))) / 8); | ||
| 365 | if (!IS_ALIGNED(pitch, pitch_align)) { | ||
| 366 | dev_warn(p->dev, "%s:%d db pitch (%d) invalid\n", | ||
| 367 | __func__, __LINE__, pitch); | ||
| 368 | return -EINVAL; | ||
| 369 | } | ||
| 370 | /* don't break userspace */ | 446 | /* don't break userspace */ |
| 371 | height &= ~0x7; | 447 | height &= ~0x7; |
| 372 | if (!IS_ALIGNED(height, 8)) { | ||
| 373 | dev_warn(p->dev, "%s:%d db height (%d) invalid\n", | ||
| 374 | __func__, __LINE__, height); | ||
| 375 | return -EINVAL; | ||
| 376 | } | ||
| 377 | break; | 448 | break; |
| 378 | case V_028010_ARRAY_2D_TILED_THIN1: | 449 | case V_028010_ARRAY_2D_TILED_THIN1: |
| 379 | pitch_align = max((u32)track->nbanks, | ||
| 380 | (u32)(((track->group_size / 8) / bpe) * track->nbanks)) / 8; | ||
| 381 | if (!IS_ALIGNED(pitch, pitch_align)) { | ||
| 382 | dev_warn(p->dev, "%s:%d db pitch (%d) invalid\n", | ||
| 383 | __func__, __LINE__, pitch); | ||
| 384 | return -EINVAL; | ||
| 385 | } | ||
| 386 | if (!IS_ALIGNED((height / 8), track->npipes)) { | ||
| 387 | dev_warn(p->dev, "%s:%d db height (%d) invalid\n", | ||
| 388 | __func__, __LINE__, height); | ||
| 389 | return -EINVAL; | ||
| 390 | } | ||
| 391 | break; | 450 | break; |
| 392 | default: | 451 | default: |
| 393 | dev_warn(p->dev, "%s invalid tiling %d (0x%08X)\n", __func__, | 452 | dev_warn(p->dev, "%s invalid tiling %d (0x%08X)\n", __func__, |
| @@ -395,15 +454,27 @@ static int r600_cs_track_check(struct radeon_cs_parser *p) | |||
| 395 | track->db_depth_info); | 454 | track->db_depth_info); |
| 396 | return -EINVAL; | 455 | return -EINVAL; |
| 397 | } | 456 | } |
| 398 | if (!IS_ALIGNED(track->db_offset, track->group_size)) { | 457 | |
| 399 | dev_warn(p->dev, "%s offset[%d] %d not aligned\n", __func__, i, track->db_offset); | 458 | if (!IS_ALIGNED(pitch, pitch_align)) { |
| 459 | dev_warn(p->dev, "%s:%d db pitch (%d) invalid\n", | ||
| 460 | __func__, __LINE__, pitch); | ||
| 461 | return -EINVAL; | ||
| 462 | } | ||
| 463 | if (!IS_ALIGNED(height, height_align)) { | ||
| 464 | dev_warn(p->dev, "%s:%d db height (%d) invalid\n", | ||
| 465 | __func__, __LINE__, height); | ||
| 400 | return -EINVAL; | 466 | return -EINVAL; |
| 401 | } | 467 | } |
| 468 | if (!IS_ALIGNED(base_offset, base_align)) { | ||
| 469 | dev_warn(p->dev, "%s offset[%d] 0x%llx not aligned\n", __func__, i, base_offset); | ||
| 470 | return -EINVAL; | ||
| 471 | } | ||
| 472 | |||
| 402 | ntiles = G_028000_SLICE_TILE_MAX(track->db_depth_size) + 1; | 473 | ntiles = G_028000_SLICE_TILE_MAX(track->db_depth_size) + 1; |
| 403 | nviews = G_028004_SLICE_MAX(track->db_depth_view) + 1; | 474 | nviews = G_028004_SLICE_MAX(track->db_depth_view) + 1; |
| 404 | tmp = ntiles * bpe * 64 * nviews; | 475 | tmp = ntiles * bpe * 64 * nviews; |
| 405 | if ((tmp + track->db_offset) > radeon_bo_size(track->db_bo)) { | 476 | if ((tmp + track->db_offset) > radeon_bo_size(track->db_bo)) { |
| 406 | dev_warn(p->dev, "z/stencil buffer too small (0x%08X %d %d %d -> %d have %ld)\n", | 477 | dev_warn(p->dev, "z/stencil buffer too small (0x%08X %d %d %d -> %u have %lu)\n", |
| 407 | track->db_depth_size, ntiles, nviews, bpe, tmp + track->db_offset, | 478 | track->db_depth_size, ntiles, nviews, bpe, tmp + track->db_offset, |
| 408 | radeon_bo_size(track->db_bo)); | 479 | radeon_bo_size(track->db_bo)); |
| 409 | return -EINVAL; | 480 | return -EINVAL; |
| @@ -954,6 +1025,7 @@ static inline int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx | |||
| 954 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 1025 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
| 955 | track->cb_color_base_last[tmp] = ib[idx]; | 1026 | track->cb_color_base_last[tmp] = ib[idx]; |
| 956 | track->cb_color_bo[tmp] = reloc->robj; | 1027 | track->cb_color_bo[tmp] = reloc->robj; |
| 1028 | track->cb_color_bo_mc[tmp] = reloc->lobj.gpu_offset; | ||
| 957 | break; | 1029 | break; |
| 958 | case DB_DEPTH_BASE: | 1030 | case DB_DEPTH_BASE: |
| 959 | r = r600_cs_packet_next_reloc(p, &reloc); | 1031 | r = r600_cs_packet_next_reloc(p, &reloc); |
| @@ -965,6 +1037,7 @@ static inline int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx | |||
| 965 | track->db_offset = radeon_get_ib_value(p, idx) << 8; | 1037 | track->db_offset = radeon_get_ib_value(p, idx) << 8; |
| 966 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 1038 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
| 967 | track->db_bo = reloc->robj; | 1039 | track->db_bo = reloc->robj; |
| 1040 | track->db_bo_mc = reloc->lobj.gpu_offset; | ||
| 968 | break; | 1041 | break; |
| 969 | case DB_HTILE_DATA_BASE: | 1042 | case DB_HTILE_DATA_BASE: |
| 970 | case SQ_PGM_START_FS: | 1043 | case SQ_PGM_START_FS: |
| @@ -1086,16 +1159,25 @@ static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned nlevels | |||
| 1086 | static inline int r600_check_texture_resource(struct radeon_cs_parser *p, u32 idx, | 1159 | static inline int r600_check_texture_resource(struct radeon_cs_parser *p, u32 idx, |
| 1087 | struct radeon_bo *texture, | 1160 | struct radeon_bo *texture, |
| 1088 | struct radeon_bo *mipmap, | 1161 | struct radeon_bo *mipmap, |
| 1162 | u64 base_offset, | ||
| 1163 | u64 mip_offset, | ||
| 1089 | u32 tiling_flags) | 1164 | u32 tiling_flags) |
| 1090 | { | 1165 | { |
| 1091 | struct r600_cs_track *track = p->track; | 1166 | struct r600_cs_track *track = p->track; |
| 1092 | u32 nfaces, nlevels, blevel, w0, h0, d0, bpe = 0; | 1167 | u32 nfaces, nlevels, blevel, w0, h0, d0, bpe = 0; |
| 1093 | u32 word0, word1, l0_size, mipmap_size, pitch, pitch_align; | 1168 | u32 word0, word1, l0_size, mipmap_size; |
| 1169 | u32 height_align, pitch, pitch_align, depth_align; | ||
| 1170 | u64 base_align; | ||
| 1171 | struct array_mode_checker array_check; | ||
| 1094 | 1172 | ||
| 1095 | /* on legacy kernel we don't perform advanced check */ | 1173 | /* on legacy kernel we don't perform advanced check */ |
| 1096 | if (p->rdev == NULL) | 1174 | if (p->rdev == NULL) |
| 1097 | return 0; | 1175 | return 0; |
| 1098 | 1176 | ||
| 1177 | /* convert to bytes */ | ||
| 1178 | base_offset <<= 8; | ||
| 1179 | mip_offset <<= 8; | ||
| 1180 | |||
| 1099 | word0 = radeon_get_ib_value(p, idx + 0); | 1181 | word0 = radeon_get_ib_value(p, idx + 0); |
| 1100 | if (tiling_flags & RADEON_TILING_MACRO) | 1182 | if (tiling_flags & RADEON_TILING_MACRO) |
| 1101 | word0 |= S_038000_TILE_MODE(V_038000_ARRAY_2D_TILED_THIN1); | 1183 | word0 |= S_038000_TILE_MODE(V_038000_ARRAY_2D_TILED_THIN1); |
| @@ -1128,46 +1210,38 @@ static inline int r600_check_texture_resource(struct radeon_cs_parser *p, u32 i | |||
| 1128 | return -EINVAL; | 1210 | return -EINVAL; |
| 1129 | } | 1211 | } |
| 1130 | 1212 | ||
| 1131 | pitch = G_038000_PITCH(word0) + 1; | 1213 | /* pitch in texels */ |
| 1132 | switch (G_038000_TILE_MODE(word0)) { | 1214 | pitch = (G_038000_PITCH(word0) + 1) * 8; |
| 1133 | case V_038000_ARRAY_LINEAR_GENERAL: | 1215 | array_check.array_mode = G_038000_TILE_MODE(word0); |
| 1134 | pitch_align = 1; | 1216 | array_check.group_size = track->group_size; |
| 1135 | /* XXX check height align */ | 1217 | array_check.nbanks = track->nbanks; |
| 1136 | break; | 1218 | array_check.npipes = track->npipes; |
| 1137 | case V_038000_ARRAY_LINEAR_ALIGNED: | 1219 | array_check.nsamples = 1; |
| 1138 | pitch_align = max((u32)64, (u32)(track->group_size / bpe)) / 8; | 1220 | array_check.bpe = bpe; |
| 1139 | if (!IS_ALIGNED(pitch, pitch_align)) { | 1221 | if (r600_get_array_mode_alignment(&array_check, |
| 1140 | dev_warn(p->dev, "%s:%d tex pitch (%d) invalid\n", | 1222 | &pitch_align, &height_align, &depth_align, &base_align)) { |
| 1141 | __func__, __LINE__, pitch); | 1223 | dev_warn(p->dev, "%s:%d tex array mode (%d) invalid\n", |
| 1142 | return -EINVAL; | 1224 | __func__, __LINE__, G_038000_TILE_MODE(word0)); |
| 1143 | } | 1225 | return -EINVAL; |
| 1144 | /* XXX check height align */ | 1226 | } |
| 1145 | break; | 1227 | |
| 1146 | case V_038000_ARRAY_1D_TILED_THIN1: | 1228 | /* XXX check height as well... */ |
| 1147 | pitch_align = max((u32)8, (u32)(track->group_size / (8 * bpe))) / 8; | 1229 | |
| 1148 | if (!IS_ALIGNED(pitch, pitch_align)) { | 1230 | if (!IS_ALIGNED(pitch, pitch_align)) { |
| 1149 | dev_warn(p->dev, "%s:%d tex pitch (%d) invalid\n", | 1231 | dev_warn(p->dev, "%s:%d tex pitch (%d) invalid\n", |
| 1150 | __func__, __LINE__, pitch); | 1232 | __func__, __LINE__, pitch); |
| 1151 | return -EINVAL; | 1233 | return -EINVAL; |
| 1152 | } | 1234 | } |
| 1153 | /* XXX check height align */ | 1235 | if (!IS_ALIGNED(base_offset, base_align)) { |
| 1154 | break; | 1236 | dev_warn(p->dev, "%s:%d tex base offset (0x%llx) invalid\n", |
| 1155 | case V_038000_ARRAY_2D_TILED_THIN1: | 1237 | __func__, __LINE__, base_offset); |
| 1156 | pitch_align = max((u32)track->nbanks, | 1238 | return -EINVAL; |
| 1157 | (u32)(((track->group_size / 8) / bpe) * track->nbanks)) / 8; | 1239 | } |
| 1158 | if (!IS_ALIGNED(pitch, pitch_align)) { | 1240 | if (!IS_ALIGNED(mip_offset, base_align)) { |
| 1159 | dev_warn(p->dev, "%s:%d tex pitch (%d) invalid\n", | 1241 | dev_warn(p->dev, "%s:%d tex mip offset (0x%llx) invalid\n", |
| 1160 | __func__, __LINE__, pitch); | 1242 | __func__, __LINE__, mip_offset); |
| 1161 | return -EINVAL; | ||
| 1162 | } | ||
| 1163 | /* XXX check height align */ | ||
| 1164 | break; | ||
| 1165 | default: | ||
| 1166 | dev_warn(p->dev, "%s invalid tiling %d (0x%08X)\n", __func__, | ||
| 1167 | G_038000_TILE_MODE(word0), word0); | ||
| 1168 | return -EINVAL; | 1243 | return -EINVAL; |
| 1169 | } | 1244 | } |
| 1170 | /* XXX check offset align */ | ||
| 1171 | 1245 | ||
| 1172 | word0 = radeon_get_ib_value(p, idx + 4); | 1246 | word0 = radeon_get_ib_value(p, idx + 4); |
| 1173 | word1 = radeon_get_ib_value(p, idx + 5); | 1247 | word1 = radeon_get_ib_value(p, idx + 5); |
| @@ -1402,7 +1476,10 @@ static int r600_packet3_check(struct radeon_cs_parser *p, | |||
| 1402 | mip_offset = (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 1476 | mip_offset = (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
| 1403 | mipmap = reloc->robj; | 1477 | mipmap = reloc->robj; |
| 1404 | r = r600_check_texture_resource(p, idx+(i*7)+1, | 1478 | r = r600_check_texture_resource(p, idx+(i*7)+1, |
| 1405 | texture, mipmap, reloc->lobj.tiling_flags); | 1479 | texture, mipmap, |
| 1480 | base_offset + radeon_get_ib_value(p, idx+1+(i*7)+2), | ||
| 1481 | mip_offset + radeon_get_ib_value(p, idx+1+(i*7)+3), | ||
| 1482 | reloc->lobj.tiling_flags); | ||
| 1406 | if (r) | 1483 | if (r) |
| 1407 | return r; | 1484 | return r; |
| 1408 | ib[idx+1+(i*7)+2] += base_offset; | 1485 | ib[idx+1+(i*7)+2] += base_offset; |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index 966a793e225b..bff4dc4f410f 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
| @@ -51,6 +51,12 @@ | |||
| 51 | #define PTE_READABLE (1 << 5) | 51 | #define PTE_READABLE (1 << 5) |
| 52 | #define PTE_WRITEABLE (1 << 6) | 52 | #define PTE_WRITEABLE (1 << 6) |
| 53 | 53 | ||
| 54 | /* tiling bits */ | ||
| 55 | #define ARRAY_LINEAR_GENERAL 0x00000000 | ||
| 56 | #define ARRAY_LINEAR_ALIGNED 0x00000001 | ||
| 57 | #define ARRAY_1D_TILED_THIN1 0x00000002 | ||
| 58 | #define ARRAY_2D_TILED_THIN1 0x00000004 | ||
| 59 | |||
| 54 | /* Registers */ | 60 | /* Registers */ |
| 55 | #define ARB_POP 0x2418 | 61 | #define ARB_POP 0x2418 |
| 56 | #define ENABLE_TC128 (1 << 30) | 62 | #define ENABLE_TC128 (1 << 30) |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 73f600d39ad4..3a7095743d44 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
| @@ -1262,6 +1262,10 @@ void r100_pll_errata_after_index(struct radeon_device *rdev); | |||
| 1262 | (rdev->family == CHIP_RS400) || \ | 1262 | (rdev->family == CHIP_RS400) || \ |
| 1263 | (rdev->family == CHIP_RS480)) | 1263 | (rdev->family == CHIP_RS480)) |
| 1264 | #define ASIC_IS_AVIVO(rdev) ((rdev->family >= CHIP_RS600)) | 1264 | #define ASIC_IS_AVIVO(rdev) ((rdev->family >= CHIP_RS600)) |
| 1265 | #define ASIC_IS_DCE2(rdev) ((rdev->family == CHIP_RS600) || \ | ||
| 1266 | (rdev->family == CHIP_RS690) || \ | ||
| 1267 | (rdev->family == CHIP_RS740) || \ | ||
| 1268 | (rdev->family >= CHIP_R600)) | ||
| 1265 | #define ASIC_IS_DCE3(rdev) ((rdev->family >= CHIP_RV620)) | 1269 | #define ASIC_IS_DCE3(rdev) ((rdev->family >= CHIP_RV620)) |
| 1266 | #define ASIC_IS_DCE32(rdev) ((rdev->family >= CHIP_RV730)) | 1270 | #define ASIC_IS_DCE32(rdev) ((rdev->family >= CHIP_RV730)) |
| 1267 | #define ASIC_IS_DCE4(rdev) ((rdev->family >= CHIP_CEDAR)) | 1271 | #define ASIC_IS_DCE4(rdev) ((rdev->family >= CHIP_CEDAR)) |
diff --git a/drivers/gpu/drm/radeon/radeon_benchmark.c b/drivers/gpu/drm/radeon/radeon_benchmark.c index 7932dc4d6b90..c558685cc637 100644 --- a/drivers/gpu/drm/radeon/radeon_benchmark.c +++ b/drivers/gpu/drm/radeon/radeon_benchmark.c | |||
| @@ -41,7 +41,7 @@ void radeon_benchmark_move(struct radeon_device *rdev, unsigned bsize, | |||
| 41 | 41 | ||
| 42 | size = bsize; | 42 | size = bsize; |
| 43 | n = 1024; | 43 | n = 1024; |
| 44 | r = radeon_bo_create(rdev, NULL, size, true, sdomain, &sobj); | 44 | r = radeon_bo_create(rdev, NULL, size, PAGE_SIZE, true, sdomain, &sobj); |
| 45 | if (r) { | 45 | if (r) { |
| 46 | goto out_cleanup; | 46 | goto out_cleanup; |
| 47 | } | 47 | } |
| @@ -53,7 +53,7 @@ void radeon_benchmark_move(struct radeon_device *rdev, unsigned bsize, | |||
| 53 | if (r) { | 53 | if (r) { |
| 54 | goto out_cleanup; | 54 | goto out_cleanup; |
| 55 | } | 55 | } |
| 56 | r = radeon_bo_create(rdev, NULL, size, true, ddomain, &dobj); | 56 | r = radeon_bo_create(rdev, NULL, size, PAGE_SIZE, true, ddomain, &dobj); |
| 57 | if (r) { | 57 | if (r) { |
| 58 | goto out_cleanup; | 58 | goto out_cleanup; |
| 59 | } | 59 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 7b7ea269549c..3bddea5b5295 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
| @@ -571,6 +571,7 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde | |||
| 571 | } | 571 | } |
| 572 | 572 | ||
| 573 | if (clk_mask && data_mask) { | 573 | if (clk_mask && data_mask) { |
| 574 | /* system specific masks */ | ||
| 574 | i2c.mask_clk_mask = clk_mask; | 575 | i2c.mask_clk_mask = clk_mask; |
| 575 | i2c.mask_data_mask = data_mask; | 576 | i2c.mask_data_mask = data_mask; |
| 576 | i2c.a_clk_mask = clk_mask; | 577 | i2c.a_clk_mask = clk_mask; |
| @@ -579,7 +580,19 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde | |||
| 579 | i2c.en_data_mask = data_mask; | 580 | i2c.en_data_mask = data_mask; |
| 580 | i2c.y_clk_mask = clk_mask; | 581 | i2c.y_clk_mask = clk_mask; |
| 581 | i2c.y_data_mask = data_mask; | 582 | i2c.y_data_mask = data_mask; |
| 583 | } else if ((ddc_line == RADEON_GPIOPAD_MASK) || | ||
| 584 | (ddc_line == RADEON_MDGPIO_MASK)) { | ||
| 585 | /* default gpiopad masks */ | ||
| 586 | i2c.mask_clk_mask = (0x20 << 8); | ||
| 587 | i2c.mask_data_mask = 0x80; | ||
| 588 | i2c.a_clk_mask = (0x20 << 8); | ||
| 589 | i2c.a_data_mask = 0x80; | ||
| 590 | i2c.en_clk_mask = (0x20 << 8); | ||
| 591 | i2c.en_data_mask = 0x80; | ||
| 592 | i2c.y_clk_mask = (0x20 << 8); | ||
| 593 | i2c.y_data_mask = 0x80; | ||
| 582 | } else { | 594 | } else { |
| 595 | /* default masks for ddc pads */ | ||
| 583 | i2c.mask_clk_mask = RADEON_GPIO_EN_1; | 596 | i2c.mask_clk_mask = RADEON_GPIO_EN_1; |
| 584 | i2c.mask_data_mask = RADEON_GPIO_EN_0; | 597 | i2c.mask_data_mask = RADEON_GPIO_EN_0; |
| 585 | i2c.a_clk_mask = RADEON_GPIO_A_1; | 598 | i2c.a_clk_mask = RADEON_GPIO_A_1; |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index fe6c74780f18..3bef9f6d66fd 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
| @@ -1008,9 +1008,21 @@ static void radeon_dp_connector_destroy(struct drm_connector *connector) | |||
| 1008 | static int radeon_dp_get_modes(struct drm_connector *connector) | 1008 | static int radeon_dp_get_modes(struct drm_connector *connector) |
| 1009 | { | 1009 | { |
| 1010 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 1010 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 1011 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; | ||
| 1011 | int ret; | 1012 | int ret; |
| 1012 | 1013 | ||
| 1014 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | ||
| 1015 | if (!radeon_dig_connector->edp_on) | ||
| 1016 | atombios_set_edp_panel_power(connector, | ||
| 1017 | ATOM_TRANSMITTER_ACTION_POWER_ON); | ||
| 1018 | } | ||
| 1013 | ret = radeon_ddc_get_modes(radeon_connector); | 1019 | ret = radeon_ddc_get_modes(radeon_connector); |
| 1020 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | ||
| 1021 | if (!radeon_dig_connector->edp_on) | ||
| 1022 | atombios_set_edp_panel_power(connector, | ||
| 1023 | ATOM_TRANSMITTER_ACTION_POWER_OFF); | ||
| 1024 | } | ||
| 1025 | |||
| 1014 | return ret; | 1026 | return ret; |
| 1015 | } | 1027 | } |
| 1016 | 1028 | ||
| @@ -1029,8 +1041,14 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | |||
| 1029 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { | 1041 | if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { |
| 1030 | /* eDP is always DP */ | 1042 | /* eDP is always DP */ |
| 1031 | radeon_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT; | 1043 | radeon_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT; |
| 1044 | if (!radeon_dig_connector->edp_on) | ||
| 1045 | atombios_set_edp_panel_power(connector, | ||
| 1046 | ATOM_TRANSMITTER_ACTION_POWER_ON); | ||
| 1032 | if (radeon_dp_getdpcd(radeon_connector)) | 1047 | if (radeon_dp_getdpcd(radeon_connector)) |
| 1033 | ret = connector_status_connected; | 1048 | ret = connector_status_connected; |
| 1049 | if (!radeon_dig_connector->edp_on) | ||
| 1050 | atombios_set_edp_panel_power(connector, | ||
| 1051 | ATOM_TRANSMITTER_ACTION_POWER_OFF); | ||
| 1034 | } else { | 1052 | } else { |
| 1035 | radeon_dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector); | 1053 | radeon_dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector); |
| 1036 | if (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) { | 1054 | if (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) { |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 8adfedfe547f..d8ac1849180d 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
| @@ -180,7 +180,7 @@ int radeon_wb_init(struct radeon_device *rdev) | |||
| 180 | int r; | 180 | int r; |
| 181 | 181 | ||
| 182 | if (rdev->wb.wb_obj == NULL) { | 182 | if (rdev->wb.wb_obj == NULL) { |
| 183 | r = radeon_bo_create(rdev, NULL, RADEON_GPU_PAGE_SIZE, true, | 183 | r = radeon_bo_create(rdev, NULL, RADEON_GPU_PAGE_SIZE, PAGE_SIZE, true, |
| 184 | RADEON_GEM_DOMAIN_GTT, &rdev->wb.wb_obj); | 184 | RADEON_GEM_DOMAIN_GTT, &rdev->wb.wb_obj); |
| 185 | if (r) { | 185 | if (r) { |
| 186 | dev_warn(rdev->dev, "(%d) create WB bo failed\n", r); | 186 | dev_warn(rdev->dev, "(%d) create WB bo failed\n", r); |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index f678257c42e6..041943df966b 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
| @@ -176,6 +176,7 @@ static inline bool radeon_encoder_is_digital(struct drm_encoder *encoder) | |||
| 176 | return false; | 176 | return false; |
| 177 | } | 177 | } |
| 178 | } | 178 | } |
| 179 | |||
| 179 | void | 180 | void |
| 180 | radeon_link_encoder_connector(struct drm_device *dev) | 181 | radeon_link_encoder_connector(struct drm_device *dev) |
| 181 | { | 182 | { |
| @@ -228,6 +229,27 @@ radeon_get_connector_for_encoder(struct drm_encoder *encoder) | |||
| 228 | return NULL; | 229 | return NULL; |
| 229 | } | 230 | } |
| 230 | 231 | ||
| 232 | struct drm_encoder *radeon_atom_get_external_encoder(struct drm_encoder *encoder) | ||
| 233 | { | ||
| 234 | struct drm_device *dev = encoder->dev; | ||
| 235 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
| 236 | struct drm_encoder *other_encoder; | ||
| 237 | struct radeon_encoder *other_radeon_encoder; | ||
| 238 | |||
| 239 | if (radeon_encoder->is_ext_encoder) | ||
| 240 | return NULL; | ||
| 241 | |||
| 242 | list_for_each_entry(other_encoder, &dev->mode_config.encoder_list, head) { | ||
| 243 | if (other_encoder == encoder) | ||
| 244 | continue; | ||
| 245 | other_radeon_encoder = to_radeon_encoder(other_encoder); | ||
| 246 | if (other_radeon_encoder->is_ext_encoder && | ||
| 247 | (radeon_encoder->devices & other_radeon_encoder->devices)) | ||
| 248 | return other_encoder; | ||
| 249 | } | ||
| 250 | return NULL; | ||
| 251 | } | ||
| 252 | |||
| 231 | void radeon_panel_mode_fixup(struct drm_encoder *encoder, | 253 | void radeon_panel_mode_fixup(struct drm_encoder *encoder, |
| 232 | struct drm_display_mode *adjusted_mode) | 254 | struct drm_display_mode *adjusted_mode) |
| 233 | { | 255 | { |
| @@ -426,52 +448,49 @@ atombios_tv_setup(struct drm_encoder *encoder, int action) | |||
| 426 | 448 | ||
| 427 | } | 449 | } |
| 428 | 450 | ||
| 429 | void | 451 | union dvo_encoder_control { |
| 430 | atombios_external_tmds_setup(struct drm_encoder *encoder, int action) | 452 | ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION ext_tmds; |
| 431 | { | 453 | DVO_ENCODER_CONTROL_PS_ALLOCATION dvo; |
| 432 | struct drm_device *dev = encoder->dev; | 454 | DVO_ENCODER_CONTROL_PS_ALLOCATION_V3 dvo_v3; |
| 433 | struct radeon_device *rdev = dev->dev_private; | 455 | }; |
| 434 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
| 435 | ENABLE_EXTERNAL_TMDS_ENCODER_PS_ALLOCATION args; | ||
| 436 | int index = 0; | ||
| 437 | |||
| 438 | memset(&args, 0, sizeof(args)); | ||
| 439 | |||
| 440 | index = GetIndexIntoMasterTable(COMMAND, DVOEncoderControl); | ||
| 441 | |||
| 442 | args.sXTmdsEncoder.ucEnable = action; | ||
| 443 | |||
| 444 | if (radeon_encoder->pixel_clock > 165000) | ||
| 445 | args.sXTmdsEncoder.ucMisc = PANEL_ENCODER_MISC_DUAL; | ||
| 446 | |||
| 447 | /*if (pScrn->rgbBits == 8)*/ | ||
| 448 | args.sXTmdsEncoder.ucMisc |= (1 << 1); | ||
| 449 | |||
| 450 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
| 451 | |||
| 452 | } | ||
| 453 | 456 | ||
| 454 | static void | 457 | void |
| 455 | atombios_ddia_setup(struct drm_encoder *encoder, int action) | 458 | atombios_dvo_setup(struct drm_encoder *encoder, int action) |
| 456 | { | 459 | { |
| 457 | struct drm_device *dev = encoder->dev; | 460 | struct drm_device *dev = encoder->dev; |
| 458 | struct radeon_device *rdev = dev->dev_private; | 461 | struct radeon_device *rdev = dev->dev_private; |
| 459 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 462 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 460 | DVO_ENCODER_CONTROL_PS_ALLOCATION args; | 463 | union dvo_encoder_control args; |
| 461 | int index = 0; | 464 | int index = GetIndexIntoMasterTable(COMMAND, DVOEncoderControl); |
| 462 | 465 | ||
| 463 | memset(&args, 0, sizeof(args)); | 466 | memset(&args, 0, sizeof(args)); |
| 464 | 467 | ||
| 465 | index = GetIndexIntoMasterTable(COMMAND, DVOEncoderControl); | 468 | if (ASIC_IS_DCE3(rdev)) { |
| 469 | /* DCE3+ */ | ||
| 470 | args.dvo_v3.ucAction = action; | ||
| 471 | args.dvo_v3.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); | ||
| 472 | args.dvo_v3.ucDVOConfig = 0; /* XXX */ | ||
| 473 | } else if (ASIC_IS_DCE2(rdev)) { | ||
| 474 | /* DCE2 (pre-DCE3 R6xx, RS600/690/740 */ | ||
| 475 | args.dvo.sDVOEncoder.ucAction = action; | ||
| 476 | args.dvo.sDVOEncoder.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); | ||
| 477 | /* DFP1, CRT1, TV1 depending on the type of port */ | ||
| 478 | args.dvo.sDVOEncoder.ucDeviceType = ATOM_DEVICE_DFP1_INDEX; | ||
| 479 | |||
| 480 | if (radeon_encoder->pixel_clock > 165000) | ||
| 481 | args.dvo.sDVOEncoder.usDevAttr.sDigAttrib.ucAttribute |= PANEL_ENCODER_MISC_DUAL; | ||
| 482 | } else { | ||
| 483 | /* R4xx, R5xx */ | ||
| 484 | args.ext_tmds.sXTmdsEncoder.ucEnable = action; | ||
| 466 | 485 | ||
| 467 | args.sDVOEncoder.ucAction = action; | 486 | if (radeon_encoder->pixel_clock > 165000) |
| 468 | args.sDVOEncoder.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); | 487 | args.ext_tmds.sXTmdsEncoder.ucMisc |= PANEL_ENCODER_MISC_DUAL; |
| 469 | 488 | ||
| 470 | if (radeon_encoder->pixel_clock > 165000) | 489 | /*if (pScrn->rgbBits == 8)*/ |
| 471 | args.sDVOEncoder.usDevAttr.sDigAttrib.ucAttribute = PANEL_ENCODER_MISC_DUAL; | 490 | args.ext_tmds.sXTmdsEncoder.ucMisc |= ATOM_PANEL_MISC_888RGB; |
| 491 | } | ||
| 472 | 492 | ||
| 473 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 493 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
| 474 | |||
| 475 | } | 494 | } |
| 476 | 495 | ||
| 477 | union lvds_encoder_control { | 496 | union lvds_encoder_control { |
| @@ -532,14 +551,14 @@ atombios_digital_setup(struct drm_encoder *encoder, int action) | |||
| 532 | if (dig->lcd_misc & ATOM_PANEL_MISC_DUAL) | 551 | if (dig->lcd_misc & ATOM_PANEL_MISC_DUAL) |
| 533 | args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; | 552 | args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; |
| 534 | if (dig->lcd_misc & ATOM_PANEL_MISC_888RGB) | 553 | if (dig->lcd_misc & ATOM_PANEL_MISC_888RGB) |
| 535 | args.v1.ucMisc |= (1 << 1); | 554 | args.v1.ucMisc |= ATOM_PANEL_MISC_888RGB; |
| 536 | } else { | 555 | } else { |
| 537 | if (dig->linkb) | 556 | if (dig->linkb) |
| 538 | args.v1.ucMisc |= PANEL_ENCODER_MISC_TMDS_LINKB; | 557 | args.v1.ucMisc |= PANEL_ENCODER_MISC_TMDS_LINKB; |
| 539 | if (radeon_encoder->pixel_clock > 165000) | 558 | if (radeon_encoder->pixel_clock > 165000) |
| 540 | args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; | 559 | args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; |
| 541 | /*if (pScrn->rgbBits == 8) */ | 560 | /*if (pScrn->rgbBits == 8) */ |
| 542 | args.v1.ucMisc |= (1 << 1); | 561 | args.v1.ucMisc |= ATOM_PANEL_MISC_888RGB; |
| 543 | } | 562 | } |
| 544 | break; | 563 | break; |
| 545 | case 2: | 564 | case 2: |
| @@ -595,6 +614,7 @@ atombios_digital_setup(struct drm_encoder *encoder, int action) | |||
| 595 | int | 614 | int |
| 596 | atombios_get_encoder_mode(struct drm_encoder *encoder) | 615 | atombios_get_encoder_mode(struct drm_encoder *encoder) |
| 597 | { | 616 | { |
| 617 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
| 598 | struct drm_device *dev = encoder->dev; | 618 | struct drm_device *dev = encoder->dev; |
| 599 | struct radeon_device *rdev = dev->dev_private; | 619 | struct radeon_device *rdev = dev->dev_private; |
| 600 | struct drm_connector *connector; | 620 | struct drm_connector *connector; |
| @@ -602,9 +622,20 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
| 602 | struct radeon_connector_atom_dig *dig_connector; | 622 | struct radeon_connector_atom_dig *dig_connector; |
| 603 | 623 | ||
| 604 | connector = radeon_get_connector_for_encoder(encoder); | 624 | connector = radeon_get_connector_for_encoder(encoder); |
| 605 | if (!connector) | 625 | if (!connector) { |
| 606 | return 0; | 626 | switch (radeon_encoder->encoder_id) { |
| 607 | 627 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: | |
| 628 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: | ||
| 629 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: | ||
| 630 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: | ||
| 631 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | ||
| 632 | return ATOM_ENCODER_MODE_DVI; | ||
| 633 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: | ||
| 634 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: | ||
| 635 | default: | ||
| 636 | return ATOM_ENCODER_MODE_CRT; | ||
| 637 | } | ||
| 638 | } | ||
| 608 | radeon_connector = to_radeon_connector(connector); | 639 | radeon_connector = to_radeon_connector(connector); |
| 609 | 640 | ||
| 610 | switch (connector->connector_type) { | 641 | switch (connector->connector_type) { |
| @@ -834,6 +865,9 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
| 834 | memset(&args, 0, sizeof(args)); | 865 | memset(&args, 0, sizeof(args)); |
| 835 | 866 | ||
| 836 | switch (radeon_encoder->encoder_id) { | 867 | switch (radeon_encoder->encoder_id) { |
| 868 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | ||
| 869 | index = GetIndexIntoMasterTable(COMMAND, DVOOutputControl); | ||
| 870 | break; | ||
| 837 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: | 871 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: |
| 838 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: | 872 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: |
| 839 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: | 873 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: |
| @@ -978,6 +1012,105 @@ atombios_dig_transmitter_setup(struct drm_encoder *encoder, int action, uint8_t | |||
| 978 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 1012 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
| 979 | } | 1013 | } |
| 980 | 1014 | ||
| 1015 | void | ||
| 1016 | atombios_set_edp_panel_power(struct drm_connector *connector, int action) | ||
| 1017 | { | ||
| 1018 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | ||
| 1019 | struct drm_device *dev = radeon_connector->base.dev; | ||
| 1020 | struct radeon_device *rdev = dev->dev_private; | ||
| 1021 | union dig_transmitter_control args; | ||
| 1022 | int index = GetIndexIntoMasterTable(COMMAND, UNIPHYTransmitterControl); | ||
| 1023 | uint8_t frev, crev; | ||
| 1024 | |||
| 1025 | if (connector->connector_type != DRM_MODE_CONNECTOR_eDP) | ||
| 1026 | return; | ||
| 1027 | |||
| 1028 | if (!ASIC_IS_DCE4(rdev)) | ||
| 1029 | return; | ||
| 1030 | |||
| 1031 | if ((action != ATOM_TRANSMITTER_ACTION_POWER_ON) || | ||
| 1032 | (action != ATOM_TRANSMITTER_ACTION_POWER_OFF)) | ||
| 1033 | return; | ||
| 1034 | |||
| 1035 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) | ||
| 1036 | return; | ||
| 1037 | |||
| 1038 | memset(&args, 0, sizeof(args)); | ||
| 1039 | |||
| 1040 | args.v1.ucAction = action; | ||
| 1041 | |||
| 1042 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
| 1043 | } | ||
| 1044 | |||
| 1045 | union external_encoder_control { | ||
| 1046 | EXTERNAL_ENCODER_CONTROL_PS_ALLOCATION v1; | ||
| 1047 | }; | ||
| 1048 | |||
| 1049 | static void | ||
| 1050 | atombios_external_encoder_setup(struct drm_encoder *encoder, | ||
| 1051 | struct drm_encoder *ext_encoder, | ||
| 1052 | int action) | ||
| 1053 | { | ||
| 1054 | struct drm_device *dev = encoder->dev; | ||
| 1055 | struct radeon_device *rdev = dev->dev_private; | ||
| 1056 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | ||
| 1057 | union external_encoder_control args; | ||
| 1058 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | ||
| 1059 | int index = GetIndexIntoMasterTable(COMMAND, ExternalEncoderControl); | ||
| 1060 | u8 frev, crev; | ||
| 1061 | int dp_clock = 0; | ||
| 1062 | int dp_lane_count = 0; | ||
| 1063 | int connector_object_id = 0; | ||
| 1064 | |||
| 1065 | if (connector) { | ||
| 1066 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | ||
| 1067 | struct radeon_connector_atom_dig *dig_connector = | ||
| 1068 | radeon_connector->con_priv; | ||
| 1069 | |||
| 1070 | dp_clock = dig_connector->dp_clock; | ||
| 1071 | dp_lane_count = dig_connector->dp_lane_count; | ||
| 1072 | connector_object_id = | ||
| 1073 | (radeon_connector->connector_object_id & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; | ||
| 1074 | } | ||
| 1075 | |||
| 1076 | memset(&args, 0, sizeof(args)); | ||
| 1077 | |||
| 1078 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) | ||
| 1079 | return; | ||
| 1080 | |||
| 1081 | switch (frev) { | ||
| 1082 | case 1: | ||
| 1083 | /* no params on frev 1 */ | ||
| 1084 | break; | ||
| 1085 | case 2: | ||
| 1086 | switch (crev) { | ||
| 1087 | case 1: | ||
| 1088 | case 2: | ||
| 1089 | args.v1.sDigEncoder.ucAction = action; | ||
| 1090 | args.v1.sDigEncoder.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); | ||
| 1091 | args.v1.sDigEncoder.ucEncoderMode = atombios_get_encoder_mode(encoder); | ||
| 1092 | |||
| 1093 | if (args.v1.sDigEncoder.ucEncoderMode == ATOM_ENCODER_MODE_DP) { | ||
| 1094 | if (dp_clock == 270000) | ||
| 1095 | args.v1.sDigEncoder.ucConfig |= ATOM_ENCODER_CONFIG_DPLINKRATE_2_70GHZ; | ||
| 1096 | args.v1.sDigEncoder.ucLaneNum = dp_lane_count; | ||
| 1097 | } else if (radeon_encoder->pixel_clock > 165000) | ||
| 1098 | args.v1.sDigEncoder.ucLaneNum = 8; | ||
| 1099 | else | ||
| 1100 | args.v1.sDigEncoder.ucLaneNum = 4; | ||
| 1101 | break; | ||
| 1102 | default: | ||
| 1103 | DRM_ERROR("Unknown table version: %d, %d\n", frev, crev); | ||
| 1104 | return; | ||
| 1105 | } | ||
| 1106 | break; | ||
| 1107 | default: | ||
| 1108 | DRM_ERROR("Unknown table version: %d, %d\n", frev, crev); | ||
| 1109 | return; | ||
| 1110 | } | ||
| 1111 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
| 1112 | } | ||
| 1113 | |||
| 981 | static void | 1114 | static void |
| 982 | atombios_yuv_setup(struct drm_encoder *encoder, bool enable) | 1115 | atombios_yuv_setup(struct drm_encoder *encoder, bool enable) |
| 983 | { | 1116 | { |
| @@ -1021,6 +1154,7 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
| 1021 | struct drm_device *dev = encoder->dev; | 1154 | struct drm_device *dev = encoder->dev; |
| 1022 | struct radeon_device *rdev = dev->dev_private; | 1155 | struct radeon_device *rdev = dev->dev_private; |
| 1023 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1156 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 1157 | struct drm_encoder *ext_encoder = radeon_atom_get_external_encoder(encoder); | ||
| 1024 | DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; | 1158 | DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; |
| 1025 | int index = 0; | 1159 | int index = 0; |
| 1026 | bool is_dig = false; | 1160 | bool is_dig = false; |
| @@ -1043,9 +1177,14 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
| 1043 | break; | 1177 | break; |
| 1044 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: | 1178 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: |
| 1045 | case ENCODER_OBJECT_ID_INTERNAL_DDI: | 1179 | case ENCODER_OBJECT_ID_INTERNAL_DDI: |
| 1046 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | ||
| 1047 | index = GetIndexIntoMasterTable(COMMAND, DVOOutputControl); | 1180 | index = GetIndexIntoMasterTable(COMMAND, DVOOutputControl); |
| 1048 | break; | 1181 | break; |
| 1182 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | ||
| 1183 | if (ASIC_IS_DCE3(rdev)) | ||
| 1184 | is_dig = true; | ||
| 1185 | else | ||
| 1186 | index = GetIndexIntoMasterTable(COMMAND, DVOOutputControl); | ||
| 1187 | break; | ||
| 1049 | case ENCODER_OBJECT_ID_INTERNAL_LVDS: | 1188 | case ENCODER_OBJECT_ID_INTERNAL_LVDS: |
| 1050 | index = GetIndexIntoMasterTable(COMMAND, LCD1OutputControl); | 1189 | index = GetIndexIntoMasterTable(COMMAND, LCD1OutputControl); |
| 1051 | break; | 1190 | break; |
| @@ -1082,34 +1221,85 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
| 1082 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) { | 1221 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) { |
| 1083 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | 1222 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); |
| 1084 | 1223 | ||
| 1224 | if (connector && | ||
| 1225 | (connector->connector_type == DRM_MODE_CONNECTOR_eDP)) { | ||
| 1226 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | ||
| 1227 | struct radeon_connector_atom_dig *radeon_dig_connector = | ||
| 1228 | radeon_connector->con_priv; | ||
| 1229 | atombios_set_edp_panel_power(connector, | ||
| 1230 | ATOM_TRANSMITTER_ACTION_POWER_ON); | ||
| 1231 | radeon_dig_connector->edp_on = true; | ||
| 1232 | } | ||
| 1085 | dp_link_train(encoder, connector); | 1233 | dp_link_train(encoder, connector); |
| 1086 | if (ASIC_IS_DCE4(rdev)) | 1234 | if (ASIC_IS_DCE4(rdev)) |
| 1087 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON); | 1235 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON); |
| 1088 | } | 1236 | } |
| 1237 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) | ||
| 1238 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_LCD_BLON, 0, 0); | ||
| 1089 | break; | 1239 | break; |
| 1090 | case DRM_MODE_DPMS_STANDBY: | 1240 | case DRM_MODE_DPMS_STANDBY: |
| 1091 | case DRM_MODE_DPMS_SUSPEND: | 1241 | case DRM_MODE_DPMS_SUSPEND: |
| 1092 | case DRM_MODE_DPMS_OFF: | 1242 | case DRM_MODE_DPMS_OFF: |
| 1093 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT, 0, 0); | 1243 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT, 0, 0); |
| 1094 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) { | 1244 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) { |
| 1245 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | ||
| 1246 | |||
| 1095 | if (ASIC_IS_DCE4(rdev)) | 1247 | if (ASIC_IS_DCE4(rdev)) |
| 1096 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_OFF); | 1248 | atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_OFF); |
| 1249 | if (connector && | ||
| 1250 | (connector->connector_type == DRM_MODE_CONNECTOR_eDP)) { | ||
| 1251 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | ||
| 1252 | struct radeon_connector_atom_dig *radeon_dig_connector = | ||
| 1253 | radeon_connector->con_priv; | ||
| 1254 | atombios_set_edp_panel_power(connector, | ||
| 1255 | ATOM_TRANSMITTER_ACTION_POWER_OFF); | ||
| 1256 | radeon_dig_connector->edp_on = false; | ||
| 1257 | } | ||
| 1097 | } | 1258 | } |
| 1259 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) | ||
| 1260 | atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_LCD_BLOFF, 0, 0); | ||
| 1098 | break; | 1261 | break; |
| 1099 | } | 1262 | } |
| 1100 | } else { | 1263 | } else { |
| 1101 | switch (mode) { | 1264 | switch (mode) { |
| 1102 | case DRM_MODE_DPMS_ON: | 1265 | case DRM_MODE_DPMS_ON: |
| 1103 | args.ucAction = ATOM_ENABLE; | 1266 | args.ucAction = ATOM_ENABLE; |
| 1267 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
| 1268 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | ||
| 1269 | args.ucAction = ATOM_LCD_BLON; | ||
| 1270 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
| 1271 | } | ||
| 1104 | break; | 1272 | break; |
| 1105 | case DRM_MODE_DPMS_STANDBY: | 1273 | case DRM_MODE_DPMS_STANDBY: |
| 1106 | case DRM_MODE_DPMS_SUSPEND: | 1274 | case DRM_MODE_DPMS_SUSPEND: |
| 1107 | case DRM_MODE_DPMS_OFF: | 1275 | case DRM_MODE_DPMS_OFF: |
| 1108 | args.ucAction = ATOM_DISABLE; | 1276 | args.ucAction = ATOM_DISABLE; |
| 1277 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
| 1278 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | ||
| 1279 | args.ucAction = ATOM_LCD_BLOFF; | ||
| 1280 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
| 1281 | } | ||
| 1109 | break; | 1282 | break; |
| 1110 | } | 1283 | } |
| 1111 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | ||
| 1112 | } | 1284 | } |
| 1285 | |||
| 1286 | if (ext_encoder) { | ||
| 1287 | int action; | ||
| 1288 | |||
| 1289 | switch (mode) { | ||
| 1290 | case DRM_MODE_DPMS_ON: | ||
| 1291 | default: | ||
| 1292 | action = ATOM_ENABLE; | ||
| 1293 | break; | ||
| 1294 | case DRM_MODE_DPMS_STANDBY: | ||
| 1295 | case DRM_MODE_DPMS_SUSPEND: | ||
| 1296 | case DRM_MODE_DPMS_OFF: | ||
| 1297 | action = ATOM_DISABLE; | ||
| 1298 | break; | ||
| 1299 | } | ||
| 1300 | atombios_external_encoder_setup(encoder, ext_encoder, action); | ||
| 1301 | } | ||
| 1302 | |||
| 1113 | radeon_atombios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); | 1303 | radeon_atombios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); |
| 1114 | 1304 | ||
| 1115 | } | 1305 | } |
| @@ -1242,7 +1432,7 @@ atombios_set_encoder_crtc_source(struct drm_encoder *encoder) | |||
| 1242 | break; | 1432 | break; |
| 1243 | default: | 1433 | default: |
| 1244 | DRM_ERROR("Unknown table version: %d, %d\n", frev, crev); | 1434 | DRM_ERROR("Unknown table version: %d, %d\n", frev, crev); |
| 1245 | break; | 1435 | return; |
| 1246 | } | 1436 | } |
| 1247 | 1437 | ||
| 1248 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 1438 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
| @@ -1357,6 +1547,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
| 1357 | struct drm_device *dev = encoder->dev; | 1547 | struct drm_device *dev = encoder->dev; |
| 1358 | struct radeon_device *rdev = dev->dev_private; | 1548 | struct radeon_device *rdev = dev->dev_private; |
| 1359 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1549 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 1550 | struct drm_encoder *ext_encoder = radeon_atom_get_external_encoder(encoder); | ||
| 1360 | 1551 | ||
| 1361 | radeon_encoder->pixel_clock = adjusted_mode->clock; | 1552 | radeon_encoder->pixel_clock = adjusted_mode->clock; |
| 1362 | 1553 | ||
| @@ -1400,11 +1591,9 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
| 1400 | } | 1591 | } |
| 1401 | break; | 1592 | break; |
| 1402 | case ENCODER_OBJECT_ID_INTERNAL_DDI: | 1593 | case ENCODER_OBJECT_ID_INTERNAL_DDI: |
| 1403 | atombios_ddia_setup(encoder, ATOM_ENABLE); | ||
| 1404 | break; | ||
| 1405 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: | 1594 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: |
| 1406 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | 1595 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: |
| 1407 | atombios_external_tmds_setup(encoder, ATOM_ENABLE); | 1596 | atombios_dvo_setup(encoder, ATOM_ENABLE); |
| 1408 | break; | 1597 | break; |
| 1409 | case ENCODER_OBJECT_ID_INTERNAL_DAC1: | 1598 | case ENCODER_OBJECT_ID_INTERNAL_DAC1: |
| 1410 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: | 1599 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: |
| @@ -1419,6 +1608,11 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
| 1419 | } | 1608 | } |
| 1420 | break; | 1609 | break; |
| 1421 | } | 1610 | } |
| 1611 | |||
| 1612 | if (ext_encoder) { | ||
| 1613 | atombios_external_encoder_setup(encoder, ext_encoder, ATOM_ENABLE); | ||
| 1614 | } | ||
| 1615 | |||
| 1422 | atombios_apply_encoder_quirks(encoder, adjusted_mode); | 1616 | atombios_apply_encoder_quirks(encoder, adjusted_mode); |
| 1423 | 1617 | ||
| 1424 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) { | 1618 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) { |
| @@ -1595,11 +1789,9 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder) | |||
| 1595 | } | 1789 | } |
| 1596 | break; | 1790 | break; |
| 1597 | case ENCODER_OBJECT_ID_INTERNAL_DDI: | 1791 | case ENCODER_OBJECT_ID_INTERNAL_DDI: |
| 1598 | atombios_ddia_setup(encoder, ATOM_DISABLE); | ||
| 1599 | break; | ||
| 1600 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: | 1792 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: |
| 1601 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | 1793 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: |
| 1602 | atombios_external_tmds_setup(encoder, ATOM_DISABLE); | 1794 | atombios_dvo_setup(encoder, ATOM_DISABLE); |
| 1603 | break; | 1795 | break; |
| 1604 | case ENCODER_OBJECT_ID_INTERNAL_DAC1: | 1796 | case ENCODER_OBJECT_ID_INTERNAL_DAC1: |
| 1605 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: | 1797 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: |
| @@ -1621,6 +1813,53 @@ disable_done: | |||
| 1621 | radeon_encoder->active_device = 0; | 1813 | radeon_encoder->active_device = 0; |
| 1622 | } | 1814 | } |
| 1623 | 1815 | ||
| 1816 | /* these are handled by the primary encoders */ | ||
| 1817 | static void radeon_atom_ext_prepare(struct drm_encoder *encoder) | ||
| 1818 | { | ||
| 1819 | |||
| 1820 | } | ||
| 1821 | |||
| 1822 | static void radeon_atom_ext_commit(struct drm_encoder *encoder) | ||
| 1823 | { | ||
| 1824 | |||
| 1825 | } | ||
| 1826 | |||
| 1827 | static void | ||
| 1828 | radeon_atom_ext_mode_set(struct drm_encoder *encoder, | ||
| 1829 | struct drm_display_mode *mode, | ||
| 1830 | struct drm_display_mode *adjusted_mode) | ||
| 1831 | { | ||
| 1832 | |||
| 1833 | } | ||
| 1834 | |||
| 1835 | static void radeon_atom_ext_disable(struct drm_encoder *encoder) | ||
| 1836 | { | ||
| 1837 | |||
| 1838 | } | ||
| 1839 | |||
| 1840 | static void | ||
| 1841 | radeon_atom_ext_dpms(struct drm_encoder *encoder, int mode) | ||
| 1842 | { | ||
| 1843 | |||
| 1844 | } | ||
| 1845 | |||
| 1846 | static bool radeon_atom_ext_mode_fixup(struct drm_encoder *encoder, | ||
| 1847 | struct drm_display_mode *mode, | ||
| 1848 | struct drm_display_mode *adjusted_mode) | ||
| 1849 | { | ||
| 1850 | return true; | ||
| 1851 | } | ||
| 1852 | |||
| 1853 | static const struct drm_encoder_helper_funcs radeon_atom_ext_helper_funcs = { | ||
| 1854 | .dpms = radeon_atom_ext_dpms, | ||
| 1855 | .mode_fixup = radeon_atom_ext_mode_fixup, | ||
| 1856 | .prepare = radeon_atom_ext_prepare, | ||
| 1857 | .mode_set = radeon_atom_ext_mode_set, | ||
| 1858 | .commit = radeon_atom_ext_commit, | ||
| 1859 | .disable = radeon_atom_ext_disable, | ||
| 1860 | /* no detect for TMDS/LVDS yet */ | ||
| 1861 | }; | ||
| 1862 | |||
| 1624 | static const struct drm_encoder_helper_funcs radeon_atom_dig_helper_funcs = { | 1863 | static const struct drm_encoder_helper_funcs radeon_atom_dig_helper_funcs = { |
| 1625 | .dpms = radeon_atom_encoder_dpms, | 1864 | .dpms = radeon_atom_encoder_dpms, |
| 1626 | .mode_fixup = radeon_atom_mode_fixup, | 1865 | .mode_fixup = radeon_atom_mode_fixup, |
| @@ -1730,6 +1969,7 @@ radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum, uint32_t | |||
| 1730 | radeon_encoder->devices = supported_device; | 1969 | radeon_encoder->devices = supported_device; |
| 1731 | radeon_encoder->rmx_type = RMX_OFF; | 1970 | radeon_encoder->rmx_type = RMX_OFF; |
| 1732 | radeon_encoder->underscan_type = UNDERSCAN_OFF; | 1971 | radeon_encoder->underscan_type = UNDERSCAN_OFF; |
| 1972 | radeon_encoder->is_ext_encoder = false; | ||
| 1733 | 1973 | ||
| 1734 | switch (radeon_encoder->encoder_id) { | 1974 | switch (radeon_encoder->encoder_id) { |
| 1735 | case ENCODER_OBJECT_ID_INTERNAL_LVDS: | 1975 | case ENCODER_OBJECT_ID_INTERNAL_LVDS: |
| @@ -1771,6 +2011,9 @@ radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum, uint32_t | |||
| 1771 | radeon_encoder->rmx_type = RMX_FULL; | 2011 | radeon_encoder->rmx_type = RMX_FULL; |
| 1772 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_LVDS); | 2012 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_LVDS); |
| 1773 | radeon_encoder->enc_priv = radeon_atombios_get_lvds_info(radeon_encoder); | 2013 | radeon_encoder->enc_priv = radeon_atombios_get_lvds_info(radeon_encoder); |
| 2014 | } else if (radeon_encoder->devices & (ATOM_DEVICE_CRT_SUPPORT)) { | ||
| 2015 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_DAC); | ||
| 2016 | radeon_encoder->enc_priv = radeon_atombios_set_dig_info(radeon_encoder); | ||
| 1774 | } else { | 2017 | } else { |
| 1775 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_TMDS); | 2018 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_TMDS); |
| 1776 | radeon_encoder->enc_priv = radeon_atombios_set_dig_info(radeon_encoder); | 2019 | radeon_encoder->enc_priv = radeon_atombios_set_dig_info(radeon_encoder); |
| @@ -1779,5 +2022,22 @@ radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum, uint32_t | |||
| 1779 | } | 2022 | } |
| 1780 | drm_encoder_helper_add(encoder, &radeon_atom_dig_helper_funcs); | 2023 | drm_encoder_helper_add(encoder, &radeon_atom_dig_helper_funcs); |
| 1781 | break; | 2024 | break; |
| 2025 | case ENCODER_OBJECT_ID_SI170B: | ||
| 2026 | case ENCODER_OBJECT_ID_CH7303: | ||
| 2027 | case ENCODER_OBJECT_ID_EXTERNAL_SDVOA: | ||
| 2028 | case ENCODER_OBJECT_ID_EXTERNAL_SDVOB: | ||
| 2029 | case ENCODER_OBJECT_ID_TITFP513: | ||
| 2030 | case ENCODER_OBJECT_ID_VT1623: | ||
| 2031 | case ENCODER_OBJECT_ID_HDMI_SI1930: | ||
| 2032 | /* these are handled by the primary encoders */ | ||
| 2033 | radeon_encoder->is_ext_encoder = true; | ||
| 2034 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) | ||
| 2035 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_LVDS); | ||
| 2036 | else if (radeon_encoder->devices & (ATOM_DEVICE_CRT_SUPPORT)) | ||
| 2037 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_DAC); | ||
| 2038 | else | ||
| 2039 | drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_TMDS); | ||
| 2040 | drm_encoder_helper_add(encoder, &radeon_atom_ext_helper_funcs); | ||
| 2041 | break; | ||
| 1782 | } | 2042 | } |
| 1783 | } | 2043 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index e65b90317fab..65016117d95f 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
| @@ -79,8 +79,8 @@ int radeon_gart_table_vram_alloc(struct radeon_device *rdev) | |||
| 79 | 79 | ||
| 80 | if (rdev->gart.table.vram.robj == NULL) { | 80 | if (rdev->gart.table.vram.robj == NULL) { |
| 81 | r = radeon_bo_create(rdev, NULL, rdev->gart.table_size, | 81 | r = radeon_bo_create(rdev, NULL, rdev->gart.table_size, |
| 82 | true, RADEON_GEM_DOMAIN_VRAM, | 82 | PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, |
| 83 | &rdev->gart.table.vram.robj); | 83 | &rdev->gart.table.vram.robj); |
| 84 | if (r) { | 84 | if (r) { |
| 85 | return r; | 85 | return r; |
| 86 | } | 86 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index d1e595d91723..df95eb83dac6 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
| @@ -67,7 +67,7 @@ int radeon_gem_object_create(struct radeon_device *rdev, int size, | |||
| 67 | if (alignment < PAGE_SIZE) { | 67 | if (alignment < PAGE_SIZE) { |
| 68 | alignment = PAGE_SIZE; | 68 | alignment = PAGE_SIZE; |
| 69 | } | 69 | } |
| 70 | r = radeon_bo_create(rdev, gobj, size, kernel, initial_domain, &robj); | 70 | r = radeon_bo_create(rdev, gobj, size, alignment, kernel, initial_domain, &robj); |
| 71 | if (r) { | 71 | if (r) { |
| 72 | if (r != -ERESTARTSYS) | 72 | if (r != -ERESTARTSYS) |
| 73 | DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n", | 73 | DRM_ERROR("Failed to allocate GEM object (%d, %d, %u, %d)\n", |
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c index 0cfbba02c4d0..ded2a45bc95c 100644 --- a/drivers/gpu/drm/radeon/radeon_i2c.c +++ b/drivers/gpu/drm/radeon/radeon_i2c.c | |||
| @@ -896,7 +896,8 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, | |||
| 896 | ((rdev->family <= CHIP_RS480) || | 896 | ((rdev->family <= CHIP_RS480) || |
| 897 | ((rdev->family >= CHIP_RV515) && (rdev->family <= CHIP_R580))))) { | 897 | ((rdev->family >= CHIP_RV515) && (rdev->family <= CHIP_R580))))) { |
| 898 | /* set the radeon hw i2c adapter */ | 898 | /* set the radeon hw i2c adapter */ |
| 899 | sprintf(i2c->adapter.name, "Radeon i2c hw bus %s", name); | 899 | snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), |
| 900 | "Radeon i2c hw bus %s", name); | ||
| 900 | i2c->adapter.algo = &radeon_i2c_algo; | 901 | i2c->adapter.algo = &radeon_i2c_algo; |
| 901 | ret = i2c_add_adapter(&i2c->adapter); | 902 | ret = i2c_add_adapter(&i2c->adapter); |
| 902 | if (ret) { | 903 | if (ret) { |
| @@ -905,7 +906,8 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, | |||
| 905 | } | 906 | } |
| 906 | } else { | 907 | } else { |
| 907 | /* set the radeon bit adapter */ | 908 | /* set the radeon bit adapter */ |
| 908 | sprintf(i2c->adapter.name, "Radeon i2c bit bus %s", name); | 909 | snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), |
| 910 | "Radeon i2c bit bus %s", name); | ||
| 909 | i2c->adapter.algo_data = &i2c->algo.bit; | 911 | i2c->adapter.algo_data = &i2c->algo.bit; |
| 910 | i2c->algo.bit.pre_xfer = pre_xfer; | 912 | i2c->algo.bit.pre_xfer = pre_xfer; |
| 911 | i2c->algo.bit.post_xfer = post_xfer; | 913 | i2c->algo.bit.post_xfer = post_xfer; |
| @@ -946,6 +948,8 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev, | |||
| 946 | i2c->rec = *rec; | 948 | i2c->rec = *rec; |
| 947 | i2c->adapter.owner = THIS_MODULE; | 949 | i2c->adapter.owner = THIS_MODULE; |
| 948 | i2c->dev = dev; | 950 | i2c->dev = dev; |
| 951 | snprintf(i2c->adapter.name, sizeof(i2c->adapter.name), | ||
| 952 | "Radeon aux bus %s", name); | ||
| 949 | i2c_set_adapdata(&i2c->adapter, i2c); | 953 | i2c_set_adapdata(&i2c->adapter, i2c); |
| 950 | i2c->adapter.algo_data = &i2c->algo.dp; | 954 | i2c->adapter.algo_data = &i2c->algo.dp; |
| 951 | i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch; | 955 | i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch; |
diff --git a/drivers/gpu/drm/radeon/radeon_irq.c b/drivers/gpu/drm/radeon/radeon_irq.c index 2f349a300195..465746bd51b7 100644 --- a/drivers/gpu/drm/radeon/radeon_irq.c +++ b/drivers/gpu/drm/radeon/radeon_irq.c | |||
| @@ -76,7 +76,7 @@ int radeon_enable_vblank(struct drm_device *dev, int crtc) | |||
| 76 | default: | 76 | default: |
| 77 | DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", | 77 | DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", |
| 78 | crtc); | 78 | crtc); |
| 79 | return EINVAL; | 79 | return -EINVAL; |
| 80 | } | 80 | } |
| 81 | } else { | 81 | } else { |
| 82 | switch (crtc) { | 82 | switch (crtc) { |
| @@ -89,7 +89,7 @@ int radeon_enable_vblank(struct drm_device *dev, int crtc) | |||
| 89 | default: | 89 | default: |
| 90 | DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", | 90 | DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", |
| 91 | crtc); | 91 | crtc); |
| 92 | return EINVAL; | 92 | return -EINVAL; |
| 93 | } | 93 | } |
| 94 | } | 94 | } |
| 95 | 95 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 0b8397000f4c..59f834ba283d 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
| @@ -670,7 +670,7 @@ static void radeon_legacy_tmds_ext_mode_set(struct drm_encoder *encoder, | |||
| 670 | 670 | ||
| 671 | if (rdev->is_atom_bios) { | 671 | if (rdev->is_atom_bios) { |
| 672 | radeon_encoder->pixel_clock = adjusted_mode->clock; | 672 | radeon_encoder->pixel_clock = adjusted_mode->clock; |
| 673 | atombios_external_tmds_setup(encoder, ATOM_ENABLE); | 673 | atombios_dvo_setup(encoder, ATOM_ENABLE); |
| 674 | fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL); | 674 | fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL); |
| 675 | } else { | 675 | } else { |
| 676 | fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL); | 676 | fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL); |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 680f57644e86..e301c6f9e059 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
| @@ -375,6 +375,7 @@ struct radeon_encoder { | |||
| 375 | int hdmi_config_offset; | 375 | int hdmi_config_offset; |
| 376 | int hdmi_audio_workaround; | 376 | int hdmi_audio_workaround; |
| 377 | int hdmi_buffer_status; | 377 | int hdmi_buffer_status; |
| 378 | bool is_ext_encoder; | ||
| 378 | }; | 379 | }; |
| 379 | 380 | ||
| 380 | struct radeon_connector_atom_dig { | 381 | struct radeon_connector_atom_dig { |
| @@ -385,6 +386,7 @@ struct radeon_connector_atom_dig { | |||
| 385 | u8 dp_sink_type; | 386 | u8 dp_sink_type; |
| 386 | int dp_clock; | 387 | int dp_clock; |
| 387 | int dp_lane_count; | 388 | int dp_lane_count; |
| 389 | bool edp_on; | ||
| 388 | }; | 390 | }; |
| 389 | 391 | ||
| 390 | struct radeon_gpio_rec { | 392 | struct radeon_gpio_rec { |
| @@ -523,9 +525,10 @@ struct drm_encoder *radeon_encoder_legacy_primary_dac_add(struct drm_device *dev | |||
| 523 | struct drm_encoder *radeon_encoder_legacy_tv_dac_add(struct drm_device *dev, int bios_index, int with_tv); | 525 | struct drm_encoder *radeon_encoder_legacy_tv_dac_add(struct drm_device *dev, int bios_index, int with_tv); |
| 524 | struct drm_encoder *radeon_encoder_legacy_tmds_int_add(struct drm_device *dev, int bios_index); | 526 | struct drm_encoder *radeon_encoder_legacy_tmds_int_add(struct drm_device *dev, int bios_index); |
| 525 | struct drm_encoder *radeon_encoder_legacy_tmds_ext_add(struct drm_device *dev, int bios_index); | 527 | struct drm_encoder *radeon_encoder_legacy_tmds_ext_add(struct drm_device *dev, int bios_index); |
| 526 | extern void atombios_external_tmds_setup(struct drm_encoder *encoder, int action); | 528 | extern void atombios_dvo_setup(struct drm_encoder *encoder, int action); |
| 527 | extern void atombios_digital_setup(struct drm_encoder *encoder, int action); | 529 | extern void atombios_digital_setup(struct drm_encoder *encoder, int action); |
| 528 | extern int atombios_get_encoder_mode(struct drm_encoder *encoder); | 530 | extern int atombios_get_encoder_mode(struct drm_encoder *encoder); |
| 531 | extern void atombios_set_edp_panel_power(struct drm_connector *connector, int action); | ||
| 529 | extern void radeon_encoder_set_active_device(struct drm_encoder *encoder); | 532 | extern void radeon_encoder_set_active_device(struct drm_encoder *encoder); |
| 530 | 533 | ||
| 531 | extern void radeon_crtc_load_lut(struct drm_crtc *crtc); | 534 | extern void radeon_crtc_load_lut(struct drm_crtc *crtc); |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 8eb183466015..1d067743fee0 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
| @@ -86,11 +86,12 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain) | |||
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj, | 88 | int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj, |
| 89 | unsigned long size, bool kernel, u32 domain, | 89 | unsigned long size, int byte_align, bool kernel, u32 domain, |
| 90 | struct radeon_bo **bo_ptr) | 90 | struct radeon_bo **bo_ptr) |
| 91 | { | 91 | { |
| 92 | struct radeon_bo *bo; | 92 | struct radeon_bo *bo; |
| 93 | enum ttm_bo_type type; | 93 | enum ttm_bo_type type; |
| 94 | int page_align = roundup(byte_align, PAGE_SIZE) >> PAGE_SHIFT; | ||
| 94 | int r; | 95 | int r; |
| 95 | 96 | ||
| 96 | if (unlikely(rdev->mman.bdev.dev_mapping == NULL)) { | 97 | if (unlikely(rdev->mman.bdev.dev_mapping == NULL)) { |
| @@ -115,7 +116,7 @@ retry: | |||
| 115 | /* Kernel allocation are uninterruptible */ | 116 | /* Kernel allocation are uninterruptible */ |
| 116 | mutex_lock(&rdev->vram_mutex); | 117 | mutex_lock(&rdev->vram_mutex); |
| 117 | r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type, | 118 | r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type, |
| 118 | &bo->placement, 0, 0, !kernel, NULL, size, | 119 | &bo->placement, page_align, 0, !kernel, NULL, size, |
| 119 | &radeon_ttm_bo_destroy); | 120 | &radeon_ttm_bo_destroy); |
| 120 | mutex_unlock(&rdev->vram_mutex); | 121 | mutex_unlock(&rdev->vram_mutex); |
| 121 | if (unlikely(r != 0)) { | 122 | if (unlikely(r != 0)) { |
diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index 3481bc7f6f58..d143702b244a 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h | |||
| @@ -137,9 +137,10 @@ static inline int radeon_bo_wait(struct radeon_bo *bo, u32 *mem_type, | |||
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | extern int radeon_bo_create(struct radeon_device *rdev, | 139 | extern int radeon_bo_create(struct radeon_device *rdev, |
| 140 | struct drm_gem_object *gobj, unsigned long size, | 140 | struct drm_gem_object *gobj, unsigned long size, |
| 141 | bool kernel, u32 domain, | 141 | int byte_align, |
| 142 | struct radeon_bo **bo_ptr); | 142 | bool kernel, u32 domain, |
| 143 | struct radeon_bo **bo_ptr); | ||
| 143 | extern int radeon_bo_kmap(struct radeon_bo *bo, void **ptr); | 144 | extern int radeon_bo_kmap(struct radeon_bo *bo, void **ptr); |
| 144 | extern void radeon_bo_kunmap(struct radeon_bo *bo); | 145 | extern void radeon_bo_kunmap(struct radeon_bo *bo); |
| 145 | extern void radeon_bo_unref(struct radeon_bo **bo); | 146 | extern void radeon_bo_unref(struct radeon_bo **bo); |
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 6ea798ce8218..06e79822a2bf 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
| @@ -176,8 +176,8 @@ int radeon_ib_pool_init(struct radeon_device *rdev) | |||
| 176 | INIT_LIST_HEAD(&rdev->ib_pool.bogus_ib); | 176 | INIT_LIST_HEAD(&rdev->ib_pool.bogus_ib); |
| 177 | /* Allocate 1M object buffer */ | 177 | /* Allocate 1M object buffer */ |
| 178 | r = radeon_bo_create(rdev, NULL, RADEON_IB_POOL_SIZE*64*1024, | 178 | r = radeon_bo_create(rdev, NULL, RADEON_IB_POOL_SIZE*64*1024, |
| 179 | true, RADEON_GEM_DOMAIN_GTT, | 179 | PAGE_SIZE, true, RADEON_GEM_DOMAIN_GTT, |
| 180 | &rdev->ib_pool.robj); | 180 | &rdev->ib_pool.robj); |
| 181 | if (r) { | 181 | if (r) { |
| 182 | DRM_ERROR("radeon: failed to ib pool (%d).\n", r); | 182 | DRM_ERROR("radeon: failed to ib pool (%d).\n", r); |
| 183 | return r; | 183 | return r; |
| @@ -332,7 +332,7 @@ int radeon_ring_init(struct radeon_device *rdev, unsigned ring_size) | |||
| 332 | rdev->cp.ring_size = ring_size; | 332 | rdev->cp.ring_size = ring_size; |
| 333 | /* Allocate ring buffer */ | 333 | /* Allocate ring buffer */ |
| 334 | if (rdev->cp.ring_obj == NULL) { | 334 | if (rdev->cp.ring_obj == NULL) { |
| 335 | r = radeon_bo_create(rdev, NULL, rdev->cp.ring_size, true, | 335 | r = radeon_bo_create(rdev, NULL, rdev->cp.ring_size, PAGE_SIZE, true, |
| 336 | RADEON_GEM_DOMAIN_GTT, | 336 | RADEON_GEM_DOMAIN_GTT, |
| 337 | &rdev->cp.ring_obj); | 337 | &rdev->cp.ring_obj); |
| 338 | if (r) { | 338 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c index 313c96bc09da..5b44f652145c 100644 --- a/drivers/gpu/drm/radeon/radeon_test.c +++ b/drivers/gpu/drm/radeon/radeon_test.c | |||
| @@ -52,7 +52,7 @@ void radeon_test_moves(struct radeon_device *rdev) | |||
| 52 | goto out_cleanup; | 52 | goto out_cleanup; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | r = radeon_bo_create(rdev, NULL, size, true, RADEON_GEM_DOMAIN_VRAM, | 55 | r = radeon_bo_create(rdev, NULL, size, PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, |
| 56 | &vram_obj); | 56 | &vram_obj); |
| 57 | if (r) { | 57 | if (r) { |
| 58 | DRM_ERROR("Failed to create VRAM object\n"); | 58 | DRM_ERROR("Failed to create VRAM object\n"); |
| @@ -71,7 +71,7 @@ void radeon_test_moves(struct radeon_device *rdev) | |||
| 71 | void **gtt_start, **gtt_end; | 71 | void **gtt_start, **gtt_end; |
| 72 | void **vram_start, **vram_end; | 72 | void **vram_start, **vram_end; |
| 73 | 73 | ||
| 74 | r = radeon_bo_create(rdev, NULL, size, true, | 74 | r = radeon_bo_create(rdev, NULL, size, PAGE_SIZE, true, |
| 75 | RADEON_GEM_DOMAIN_GTT, gtt_obj + i); | 75 | RADEON_GEM_DOMAIN_GTT, gtt_obj + i); |
| 76 | if (r) { | 76 | if (r) { |
| 77 | DRM_ERROR("Failed to create GTT object %d\n", i); | 77 | DRM_ERROR("Failed to create GTT object %d\n", i); |
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 01c2c736a1da..1272e4b6a1d4 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
| @@ -529,7 +529,7 @@ int radeon_ttm_init(struct radeon_device *rdev) | |||
| 529 | DRM_ERROR("Failed initializing VRAM heap.\n"); | 529 | DRM_ERROR("Failed initializing VRAM heap.\n"); |
| 530 | return r; | 530 | return r; |
| 531 | } | 531 | } |
| 532 | r = radeon_bo_create(rdev, NULL, 256 * 1024, true, | 532 | r = radeon_bo_create(rdev, NULL, 256 * 1024, PAGE_SIZE, true, |
| 533 | RADEON_GEM_DOMAIN_VRAM, | 533 | RADEON_GEM_DOMAIN_VRAM, |
| 534 | &rdev->stollen_vga_memory); | 534 | &rdev->stollen_vga_memory); |
| 535 | if (r) { | 535 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 245374e2b778..4dfead8cee33 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
| @@ -915,8 +915,8 @@ static int rv770_vram_scratch_init(struct radeon_device *rdev) | |||
| 915 | 915 | ||
| 916 | if (rdev->vram_scratch.robj == NULL) { | 916 | if (rdev->vram_scratch.robj == NULL) { |
| 917 | r = radeon_bo_create(rdev, NULL, RADEON_GPU_PAGE_SIZE, | 917 | r = radeon_bo_create(rdev, NULL, RADEON_GPU_PAGE_SIZE, |
| 918 | true, RADEON_GEM_DOMAIN_VRAM, | 918 | PAGE_SIZE, true, RADEON_GEM_DOMAIN_VRAM, |
| 919 | &rdev->vram_scratch.robj); | 919 | &rdev->vram_scratch.robj); |
| 920 | if (r) { | 920 | if (r) { |
| 921 | return r; | 921 | return r; |
| 922 | } | 922 | } |
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 3ca77dc03915..148a322d8f5d 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
| @@ -224,6 +224,9 @@ int ttm_bo_reserve_locked(struct ttm_buffer_object *bo, | |||
| 224 | int ret; | 224 | int ret; |
| 225 | 225 | ||
| 226 | while (unlikely(atomic_cmpxchg(&bo->reserved, 0, 1) != 0)) { | 226 | while (unlikely(atomic_cmpxchg(&bo->reserved, 0, 1) != 0)) { |
| 227 | /** | ||
| 228 | * Deadlock avoidance for multi-bo reserving. | ||
| 229 | */ | ||
| 227 | if (use_sequence && bo->seq_valid && | 230 | if (use_sequence && bo->seq_valid && |
| 228 | (sequence - bo->val_seq < (1 << 31))) { | 231 | (sequence - bo->val_seq < (1 << 31))) { |
| 229 | return -EAGAIN; | 232 | return -EAGAIN; |
| @@ -241,6 +244,14 @@ int ttm_bo_reserve_locked(struct ttm_buffer_object *bo, | |||
| 241 | } | 244 | } |
| 242 | 245 | ||
| 243 | if (use_sequence) { | 246 | if (use_sequence) { |
| 247 | /** | ||
| 248 | * Wake up waiters that may need to recheck for deadlock, | ||
| 249 | * if we decreased the sequence number. | ||
| 250 | */ | ||
| 251 | if (unlikely((bo->val_seq - sequence < (1 << 31)) | ||
| 252 | || !bo->seq_valid)) | ||
| 253 | wake_up_all(&bo->event_queue); | ||
| 254 | |||
| 244 | bo->val_seq = sequence; | 255 | bo->val_seq = sequence; |
| 245 | bo->seq_valid = true; | 256 | bo->seq_valid = true; |
| 246 | } else { | 257 | } else { |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 36e129f0023f..5408b1b7996f 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |||
| @@ -862,7 +862,7 @@ int vmw_dmabuf_alloc_ioctl(struct drm_device *dev, void *data, | |||
| 862 | &vmw_vram_sys_placement, true, | 862 | &vmw_vram_sys_placement, true, |
| 863 | &vmw_user_dmabuf_destroy); | 863 | &vmw_user_dmabuf_destroy); |
| 864 | if (unlikely(ret != 0)) | 864 | if (unlikely(ret != 0)) |
| 865 | return ret; | 865 | goto out_no_dmabuf; |
| 866 | 866 | ||
| 867 | tmp = ttm_bo_reference(&vmw_user_bo->dma.base); | 867 | tmp = ttm_bo_reference(&vmw_user_bo->dma.base); |
| 868 | ret = ttm_base_object_init(vmw_fpriv(file_priv)->tfile, | 868 | ret = ttm_base_object_init(vmw_fpriv(file_priv)->tfile, |
| @@ -870,19 +870,21 @@ int vmw_dmabuf_alloc_ioctl(struct drm_device *dev, void *data, | |||
| 870 | false, | 870 | false, |
| 871 | ttm_buffer_type, | 871 | ttm_buffer_type, |
| 872 | &vmw_user_dmabuf_release, NULL); | 872 | &vmw_user_dmabuf_release, NULL); |
| 873 | if (unlikely(ret != 0)) { | 873 | if (unlikely(ret != 0)) |
| 874 | ttm_bo_unref(&tmp); | 874 | goto out_no_base_object; |
| 875 | } else { | 875 | else { |
| 876 | rep->handle = vmw_user_bo->base.hash.key; | 876 | rep->handle = vmw_user_bo->base.hash.key; |
| 877 | rep->map_handle = vmw_user_bo->dma.base.addr_space_offset; | 877 | rep->map_handle = vmw_user_bo->dma.base.addr_space_offset; |
| 878 | rep->cur_gmr_id = vmw_user_bo->base.hash.key; | 878 | rep->cur_gmr_id = vmw_user_bo->base.hash.key; |
| 879 | rep->cur_gmr_offset = 0; | 879 | rep->cur_gmr_offset = 0; |
| 880 | } | 880 | } |
| 881 | ttm_bo_unref(&tmp); | ||
| 882 | 881 | ||
| 882 | out_no_base_object: | ||
| 883 | ttm_bo_unref(&tmp); | ||
| 884 | out_no_dmabuf: | ||
| 883 | ttm_read_unlock(&vmaster->lock); | 885 | ttm_read_unlock(&vmaster->lock); |
| 884 | 886 | ||
| 885 | return 0; | 887 | return ret; |
| 886 | } | 888 | } |
| 887 | 889 | ||
| 888 | int vmw_dmabuf_unref_ioctl(struct drm_device *dev, void *data, | 890 | int vmw_dmabuf_unref_ioctl(struct drm_device *dev, void *data, |
diff --git a/drivers/input/input.c b/drivers/input/input.c index 90b7ecfb6257..db409d6bd5d2 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
| @@ -752,7 +752,7 @@ static int input_default_setkeycode(struct input_dev *dev, | |||
| 752 | if (index >= dev->keycodemax) | 752 | if (index >= dev->keycodemax) |
| 753 | return -EINVAL; | 753 | return -EINVAL; |
| 754 | 754 | ||
| 755 | if (dev->keycodesize < sizeof(dev->keycode) && | 755 | if (dev->keycodesize < sizeof(ke->keycode) && |
| 756 | (ke->keycode >> (dev->keycodesize * 8))) | 756 | (ke->keycode >> (dev->keycodesize * 8))) |
| 757 | return -EINVAL; | 757 | return -EINVAL; |
| 758 | 758 | ||
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index 57b25b84d1fc..0a619c558bfb 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c | |||
| @@ -1097,7 +1097,7 @@ store_tabletPointerMode(struct device *dev, struct device_attribute *attr, const | |||
| 1097 | } | 1097 | } |
| 1098 | 1098 | ||
| 1099 | static DEVICE_ATTR(pointer_mode, | 1099 | static DEVICE_ATTR(pointer_mode, |
| 1100 | S_IRUGO | S_IWUGO, | 1100 | S_IRUGO | S_IWUSR, |
| 1101 | show_tabletPointerMode, store_tabletPointerMode); | 1101 | show_tabletPointerMode, store_tabletPointerMode); |
| 1102 | 1102 | ||
| 1103 | /*********************************************************************** | 1103 | /*********************************************************************** |
| @@ -1134,7 +1134,7 @@ store_tabletCoordinateMode(struct device *dev, struct device_attribute *attr, co | |||
| 1134 | } | 1134 | } |
| 1135 | 1135 | ||
| 1136 | static DEVICE_ATTR(coordinate_mode, | 1136 | static DEVICE_ATTR(coordinate_mode, |
| 1137 | S_IRUGO | S_IWUGO, | 1137 | S_IRUGO | S_IWUSR, |
| 1138 | show_tabletCoordinateMode, store_tabletCoordinateMode); | 1138 | show_tabletCoordinateMode, store_tabletCoordinateMode); |
| 1139 | 1139 | ||
| 1140 | /*********************************************************************** | 1140 | /*********************************************************************** |
| @@ -1176,7 +1176,7 @@ store_tabletToolMode(struct device *dev, struct device_attribute *attr, const ch | |||
| 1176 | } | 1176 | } |
| 1177 | 1177 | ||
| 1178 | static DEVICE_ATTR(tool_mode, | 1178 | static DEVICE_ATTR(tool_mode, |
| 1179 | S_IRUGO | S_IWUGO, | 1179 | S_IRUGO | S_IWUSR, |
| 1180 | show_tabletToolMode, store_tabletToolMode); | 1180 | show_tabletToolMode, store_tabletToolMode); |
| 1181 | 1181 | ||
| 1182 | /*********************************************************************** | 1182 | /*********************************************************************** |
| @@ -1219,7 +1219,7 @@ store_tabletXtilt(struct device *dev, struct device_attribute *attr, const char | |||
| 1219 | } | 1219 | } |
| 1220 | 1220 | ||
| 1221 | static DEVICE_ATTR(xtilt, | 1221 | static DEVICE_ATTR(xtilt, |
| 1222 | S_IRUGO | S_IWUGO, show_tabletXtilt, store_tabletXtilt); | 1222 | S_IRUGO | S_IWUSR, show_tabletXtilt, store_tabletXtilt); |
| 1223 | 1223 | ||
| 1224 | /*********************************************************************** | 1224 | /*********************************************************************** |
| 1225 | * support routines for the 'ytilt' file. Note that this file | 1225 | * support routines for the 'ytilt' file. Note that this file |
| @@ -1261,7 +1261,7 @@ store_tabletYtilt(struct device *dev, struct device_attribute *attr, const char | |||
| 1261 | } | 1261 | } |
| 1262 | 1262 | ||
| 1263 | static DEVICE_ATTR(ytilt, | 1263 | static DEVICE_ATTR(ytilt, |
| 1264 | S_IRUGO | S_IWUGO, show_tabletYtilt, store_tabletYtilt); | 1264 | S_IRUGO | S_IWUSR, show_tabletYtilt, store_tabletYtilt); |
| 1265 | 1265 | ||
| 1266 | /*********************************************************************** | 1266 | /*********************************************************************** |
| 1267 | * support routines for the 'jitter' file. Note that this file | 1267 | * support routines for the 'jitter' file. Note that this file |
| @@ -1288,7 +1288,7 @@ store_tabletJitterDelay(struct device *dev, struct device_attribute *attr, const | |||
| 1288 | } | 1288 | } |
| 1289 | 1289 | ||
| 1290 | static DEVICE_ATTR(jitter, | 1290 | static DEVICE_ATTR(jitter, |
| 1291 | S_IRUGO | S_IWUGO, | 1291 | S_IRUGO | S_IWUSR, |
| 1292 | show_tabletJitterDelay, store_tabletJitterDelay); | 1292 | show_tabletJitterDelay, store_tabletJitterDelay); |
| 1293 | 1293 | ||
| 1294 | /*********************************************************************** | 1294 | /*********************************************************************** |
| @@ -1317,7 +1317,7 @@ store_tabletProgrammableDelay(struct device *dev, struct device_attribute *attr, | |||
| 1317 | } | 1317 | } |
| 1318 | 1318 | ||
| 1319 | static DEVICE_ATTR(delay, | 1319 | static DEVICE_ATTR(delay, |
| 1320 | S_IRUGO | S_IWUGO, | 1320 | S_IRUGO | S_IWUSR, |
| 1321 | show_tabletProgrammableDelay, store_tabletProgrammableDelay); | 1321 | show_tabletProgrammableDelay, store_tabletProgrammableDelay); |
| 1322 | 1322 | ||
| 1323 | /*********************************************************************** | 1323 | /*********************************************************************** |
| @@ -1406,7 +1406,7 @@ store_tabletStylusUpper(struct device *dev, struct device_attribute *attr, const | |||
| 1406 | } | 1406 | } |
| 1407 | 1407 | ||
| 1408 | static DEVICE_ATTR(stylus_upper, | 1408 | static DEVICE_ATTR(stylus_upper, |
| 1409 | S_IRUGO | S_IWUGO, | 1409 | S_IRUGO | S_IWUSR, |
| 1410 | show_tabletStylusUpper, store_tabletStylusUpper); | 1410 | show_tabletStylusUpper, store_tabletStylusUpper); |
| 1411 | 1411 | ||
| 1412 | /*********************************************************************** | 1412 | /*********************************************************************** |
| @@ -1437,7 +1437,7 @@ store_tabletStylusLower(struct device *dev, struct device_attribute *attr, const | |||
| 1437 | } | 1437 | } |
| 1438 | 1438 | ||
| 1439 | static DEVICE_ATTR(stylus_lower, | 1439 | static DEVICE_ATTR(stylus_lower, |
| 1440 | S_IRUGO | S_IWUGO, | 1440 | S_IRUGO | S_IWUSR, |
| 1441 | show_tabletStylusLower, store_tabletStylusLower); | 1441 | show_tabletStylusLower, store_tabletStylusLower); |
| 1442 | 1442 | ||
| 1443 | /*********************************************************************** | 1443 | /*********************************************************************** |
| @@ -1475,7 +1475,7 @@ store_tabletMouseLeft(struct device *dev, struct device_attribute *attr, const c | |||
| 1475 | } | 1475 | } |
| 1476 | 1476 | ||
| 1477 | static DEVICE_ATTR(mouse_left, | 1477 | static DEVICE_ATTR(mouse_left, |
| 1478 | S_IRUGO | S_IWUGO, | 1478 | S_IRUGO | S_IWUSR, |
| 1479 | show_tabletMouseLeft, store_tabletMouseLeft); | 1479 | show_tabletMouseLeft, store_tabletMouseLeft); |
| 1480 | 1480 | ||
| 1481 | /*********************************************************************** | 1481 | /*********************************************************************** |
| @@ -1505,7 +1505,7 @@ store_tabletMouseMiddle(struct device *dev, struct device_attribute *attr, const | |||
| 1505 | } | 1505 | } |
| 1506 | 1506 | ||
| 1507 | static DEVICE_ATTR(mouse_middle, | 1507 | static DEVICE_ATTR(mouse_middle, |
| 1508 | S_IRUGO | S_IWUGO, | 1508 | S_IRUGO | S_IWUSR, |
| 1509 | show_tabletMouseMiddle, store_tabletMouseMiddle); | 1509 | show_tabletMouseMiddle, store_tabletMouseMiddle); |
| 1510 | 1510 | ||
| 1511 | /*********************************************************************** | 1511 | /*********************************************************************** |
| @@ -1535,7 +1535,7 @@ store_tabletMouseRight(struct device *dev, struct device_attribute *attr, const | |||
| 1535 | } | 1535 | } |
| 1536 | 1536 | ||
| 1537 | static DEVICE_ATTR(mouse_right, | 1537 | static DEVICE_ATTR(mouse_right, |
| 1538 | S_IRUGO | S_IWUGO, | 1538 | S_IRUGO | S_IWUSR, |
| 1539 | show_tabletMouseRight, store_tabletMouseRight); | 1539 | show_tabletMouseRight, store_tabletMouseRight); |
| 1540 | 1540 | ||
| 1541 | /*********************************************************************** | 1541 | /*********************************************************************** |
| @@ -1567,7 +1567,7 @@ store_tabletWheel(struct device *dev, struct device_attribute *attr, const char | |||
| 1567 | } | 1567 | } |
| 1568 | 1568 | ||
| 1569 | static DEVICE_ATTR(wheel, | 1569 | static DEVICE_ATTR(wheel, |
| 1570 | S_IRUGO | S_IWUGO, show_tabletWheel, store_tabletWheel); | 1570 | S_IRUGO | S_IWUSR, show_tabletWheel, store_tabletWheel); |
| 1571 | 1571 | ||
| 1572 | /*********************************************************************** | 1572 | /*********************************************************************** |
| 1573 | * support routines for the 'execute' file. Note that this file | 1573 | * support routines for the 'execute' file. Note that this file |
| @@ -1600,7 +1600,7 @@ store_tabletExecute(struct device *dev, struct device_attribute *attr, const cha | |||
| 1600 | } | 1600 | } |
| 1601 | 1601 | ||
| 1602 | static DEVICE_ATTR(execute, | 1602 | static DEVICE_ATTR(execute, |
| 1603 | S_IRUGO | S_IWUGO, show_tabletExecute, store_tabletExecute); | 1603 | S_IRUGO | S_IWUSR, show_tabletExecute, store_tabletExecute); |
| 1604 | 1604 | ||
| 1605 | /*********************************************************************** | 1605 | /*********************************************************************** |
| 1606 | * support routines for the 'odm_code' file. Note that this file | 1606 | * support routines for the 'odm_code' file. Note that this file |
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 3782f31f06d2..33facd0c45d1 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c | |||
| @@ -125,11 +125,22 @@ struct lp5521_chip { | |||
| 125 | u8 num_leds; | 125 | u8 num_leds; |
| 126 | }; | 126 | }; |
| 127 | 127 | ||
| 128 | #define cdev_to_led(c) container_of(c, struct lp5521_led, cdev) | 128 | static inline struct lp5521_led *cdev_to_led(struct led_classdev *cdev) |
| 129 | #define engine_to_lp5521(eng) container_of((eng), struct lp5521_chip, \ | 129 | { |
| 130 | engines[(eng)->id - 1]) | 130 | return container_of(cdev, struct lp5521_led, cdev); |
| 131 | #define led_to_lp5521(led) container_of((led), struct lp5521_chip, \ | 131 | } |
| 132 | leds[(led)->id]) | 132 | |
| 133 | static inline struct lp5521_chip *engine_to_lp5521(struct lp5521_engine *engine) | ||
| 134 | { | ||
| 135 | return container_of(engine, struct lp5521_chip, | ||
| 136 | engines[engine->id - 1]); | ||
| 137 | } | ||
| 138 | |||
| 139 | static inline struct lp5521_chip *led_to_lp5521(struct lp5521_led *led) | ||
| 140 | { | ||
| 141 | return container_of(led, struct lp5521_chip, | ||
| 142 | leds[led->id]); | ||
| 143 | } | ||
| 133 | 144 | ||
| 134 | static void lp5521_led_brightness_work(struct work_struct *work); | 145 | static void lp5521_led_brightness_work(struct work_struct *work); |
| 135 | 146 | ||
| @@ -185,14 +196,17 @@ static int lp5521_load_program(struct lp5521_engine *eng, const u8 *pattern) | |||
| 185 | 196 | ||
| 186 | /* move current engine to direct mode and remember the state */ | 197 | /* move current engine to direct mode and remember the state */ |
| 187 | ret = lp5521_set_engine_mode(eng, LP5521_CMD_DIRECT); | 198 | ret = lp5521_set_engine_mode(eng, LP5521_CMD_DIRECT); |
| 188 | usleep_range(1000, 10000); | 199 | /* Mode change requires min 500 us delay. 1 - 2 ms with margin */ |
| 200 | usleep_range(1000, 2000); | ||
| 189 | ret |= lp5521_read(client, LP5521_REG_OP_MODE, &mode); | 201 | ret |= lp5521_read(client, LP5521_REG_OP_MODE, &mode); |
| 190 | 202 | ||
| 191 | /* For loading, all the engines to load mode */ | 203 | /* For loading, all the engines to load mode */ |
| 192 | lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT); | 204 | lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT); |
| 193 | usleep_range(1000, 10000); | 205 | /* Mode change requires min 500 us delay. 1 - 2 ms with margin */ |
| 206 | usleep_range(1000, 2000); | ||
| 194 | lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_LOAD); | 207 | lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_LOAD); |
| 195 | usleep_range(1000, 10000); | 208 | /* Mode change requires min 500 us delay. 1 - 2 ms with margin */ |
| 209 | usleep_range(1000, 2000); | ||
| 196 | 210 | ||
| 197 | addr = LP5521_PROG_MEM_BASE + eng->prog_page * LP5521_PROG_MEM_SIZE; | 211 | addr = LP5521_PROG_MEM_BASE + eng->prog_page * LP5521_PROG_MEM_SIZE; |
| 198 | i2c_smbus_write_i2c_block_data(client, | 212 | i2c_smbus_write_i2c_block_data(client, |
| @@ -231,10 +245,6 @@ static int lp5521_configure(struct i2c_client *client, | |||
| 231 | 245 | ||
| 232 | lp5521_init_engine(chip, attr_group); | 246 | lp5521_init_engine(chip, attr_group); |
| 233 | 247 | ||
| 234 | lp5521_write(client, LP5521_REG_RESET, 0xff); | ||
| 235 | |||
| 236 | usleep_range(10000, 20000); | ||
| 237 | |||
| 238 | /* Set all PWMs to direct control mode */ | 248 | /* Set all PWMs to direct control mode */ |
| 239 | ret = lp5521_write(client, LP5521_REG_OP_MODE, 0x3F); | 249 | ret = lp5521_write(client, LP5521_REG_OP_MODE, 0x3F); |
| 240 | 250 | ||
| @@ -251,8 +261,8 @@ static int lp5521_configure(struct i2c_client *client, | |||
| 251 | ret |= lp5521_write(client, LP5521_REG_ENABLE, | 261 | ret |= lp5521_write(client, LP5521_REG_ENABLE, |
| 252 | LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM | | 262 | LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM | |
| 253 | LP5521_EXEC_RUN); | 263 | LP5521_EXEC_RUN); |
| 254 | /* enable takes 500us */ | 264 | /* enable takes 500us. 1 - 2 ms leaves some margin */ |
| 255 | usleep_range(500, 20000); | 265 | usleep_range(1000, 2000); |
| 256 | 266 | ||
| 257 | return ret; | 267 | return ret; |
| 258 | } | 268 | } |
| @@ -305,7 +315,8 @@ static int lp5521_detect(struct i2c_client *client) | |||
| 305 | LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM); | 315 | LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM); |
| 306 | if (ret) | 316 | if (ret) |
| 307 | return ret; | 317 | return ret; |
| 308 | usleep_range(1000, 10000); | 318 | /* enable takes 500us. 1 - 2 ms leaves some margin */ |
| 319 | usleep_range(1000, 2000); | ||
| 309 | ret = lp5521_read(client, LP5521_REG_ENABLE, &buf); | 320 | ret = lp5521_read(client, LP5521_REG_ENABLE, &buf); |
| 310 | if (ret) | 321 | if (ret) |
| 311 | return ret; | 322 | return ret; |
| @@ -693,11 +704,16 @@ static int lp5521_probe(struct i2c_client *client, | |||
| 693 | 704 | ||
| 694 | if (pdata->enable) { | 705 | if (pdata->enable) { |
| 695 | pdata->enable(0); | 706 | pdata->enable(0); |
| 696 | usleep_range(1000, 10000); | 707 | usleep_range(1000, 2000); /* Keep enable down at least 1ms */ |
| 697 | pdata->enable(1); | 708 | pdata->enable(1); |
| 698 | usleep_range(1000, 10000); /* Spec says min 500us */ | 709 | usleep_range(1000, 2000); /* 500us abs min. */ |
| 699 | } | 710 | } |
| 700 | 711 | ||
| 712 | lp5521_write(client, LP5521_REG_RESET, 0xff); | ||
| 713 | usleep_range(10000, 20000); /* | ||
| 714 | * Exact value is not available. 10 - 20ms | ||
| 715 | * appears to be enough for reset. | ||
| 716 | */ | ||
| 701 | ret = lp5521_detect(client); | 717 | ret = lp5521_detect(client); |
| 702 | 718 | ||
| 703 | if (ret) { | 719 | if (ret) { |
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index 1e11fcc08b28..0cc4ead2fd8b 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c | |||
| @@ -134,15 +134,18 @@ struct lp5523_chip { | |||
| 134 | u8 num_leds; | 134 | u8 num_leds; |
| 135 | }; | 135 | }; |
| 136 | 136 | ||
| 137 | #define cdev_to_led(c) container_of(c, struct lp5523_led, cdev) | 137 | static inline struct lp5523_led *cdev_to_led(struct led_classdev *cdev) |
| 138 | { | ||
| 139 | return container_of(cdev, struct lp5523_led, cdev); | ||
| 140 | } | ||
| 138 | 141 | ||
| 139 | static struct lp5523_chip *engine_to_lp5523(struct lp5523_engine *engine) | 142 | static inline struct lp5523_chip *engine_to_lp5523(struct lp5523_engine *engine) |
| 140 | { | 143 | { |
| 141 | return container_of(engine, struct lp5523_chip, | 144 | return container_of(engine, struct lp5523_chip, |
| 142 | engines[engine->id - 1]); | 145 | engines[engine->id - 1]); |
| 143 | } | 146 | } |
| 144 | 147 | ||
| 145 | static struct lp5523_chip *led_to_lp5523(struct lp5523_led *led) | 148 | static inline struct lp5523_chip *led_to_lp5523(struct lp5523_led *led) |
| 146 | { | 149 | { |
| 147 | return container_of(led, struct lp5523_chip, | 150 | return container_of(led, struct lp5523_chip, |
| 148 | leds[led->id]); | 151 | leds[led->id]); |
| @@ -200,13 +203,9 @@ static int lp5523_configure(struct i2c_client *client) | |||
| 200 | { 0x9c, 0x50, 0x9c, 0xd0, 0x9d, 0x80, 0xd8, 0x00, 0}, | 203 | { 0x9c, 0x50, 0x9c, 0xd0, 0x9d, 0x80, 0xd8, 0x00, 0}, |
| 201 | }; | 204 | }; |
| 202 | 205 | ||
| 203 | lp5523_write(client, LP5523_REG_RESET, 0xff); | ||
| 204 | |||
| 205 | usleep_range(10000, 100000); | ||
| 206 | |||
| 207 | ret |= lp5523_write(client, LP5523_REG_ENABLE, LP5523_ENABLE); | 206 | ret |= lp5523_write(client, LP5523_REG_ENABLE, LP5523_ENABLE); |
| 208 | /* Chip startup time after reset is 500 us */ | 207 | /* Chip startup time is 500 us, 1 - 2 ms gives some margin */ |
| 209 | usleep_range(1000, 10000); | 208 | usleep_range(1000, 2000); |
| 210 | 209 | ||
| 211 | ret |= lp5523_write(client, LP5523_REG_CONFIG, | 210 | ret |= lp5523_write(client, LP5523_REG_CONFIG, |
| 212 | LP5523_AUTO_INC | LP5523_PWR_SAVE | | 211 | LP5523_AUTO_INC | LP5523_PWR_SAVE | |
| @@ -243,8 +242,8 @@ static int lp5523_configure(struct i2c_client *client) | |||
| 243 | return -1; | 242 | return -1; |
| 244 | } | 243 | } |
| 245 | 244 | ||
| 246 | /* Wait 3ms and check the engine status */ | 245 | /* Let the programs run for couple of ms and check the engine status */ |
| 247 | usleep_range(3000, 20000); | 246 | usleep_range(3000, 6000); |
| 248 | lp5523_read(client, LP5523_REG_STATUS, &status); | 247 | lp5523_read(client, LP5523_REG_STATUS, &status); |
| 249 | status &= LP5523_ENG_STATUS_MASK; | 248 | status &= LP5523_ENG_STATUS_MASK; |
| 250 | 249 | ||
| @@ -449,10 +448,10 @@ static ssize_t lp5523_selftest(struct device *dev, | |||
| 449 | /* Measure VDD (i.e. VBAT) first (channel 16 corresponds to VDD) */ | 448 | /* Measure VDD (i.e. VBAT) first (channel 16 corresponds to VDD) */ |
| 450 | lp5523_write(chip->client, LP5523_REG_LED_TEST_CTRL, | 449 | lp5523_write(chip->client, LP5523_REG_LED_TEST_CTRL, |
| 451 | LP5523_EN_LEDTEST | 16); | 450 | LP5523_EN_LEDTEST | 16); |
| 452 | usleep_range(3000, 10000); | 451 | usleep_range(3000, 6000); /* ADC conversion time is typically 2.7 ms */ |
| 453 | ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); | 452 | ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); |
| 454 | if (!(status & LP5523_LEDTEST_DONE)) | 453 | if (!(status & LP5523_LEDTEST_DONE)) |
| 455 | usleep_range(3000, 10000); | 454 | usleep_range(3000, 6000); /* Was not ready. Wait little bit */ |
| 456 | 455 | ||
| 457 | ret |= lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &vdd); | 456 | ret |= lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &vdd); |
| 458 | vdd--; /* There may be some fluctuation in measurement */ | 457 | vdd--; /* There may be some fluctuation in measurement */ |
| @@ -468,16 +467,16 @@ static ssize_t lp5523_selftest(struct device *dev, | |||
| 468 | chip->pdata->led_config[i].led_current); | 467 | chip->pdata->led_config[i].led_current); |
| 469 | 468 | ||
| 470 | lp5523_write(chip->client, LP5523_REG_LED_PWM_BASE + i, 0xff); | 469 | lp5523_write(chip->client, LP5523_REG_LED_PWM_BASE + i, 0xff); |
| 471 | /* let current stabilize 2ms before measurements start */ | 470 | /* let current stabilize 2 - 4ms before measurements start */ |
| 472 | usleep_range(2000, 10000); | 471 | usleep_range(2000, 4000); |
| 473 | lp5523_write(chip->client, | 472 | lp5523_write(chip->client, |
| 474 | LP5523_REG_LED_TEST_CTRL, | 473 | LP5523_REG_LED_TEST_CTRL, |
| 475 | LP5523_EN_LEDTEST | i); | 474 | LP5523_EN_LEDTEST | i); |
| 476 | /* ledtest takes 2.7ms */ | 475 | /* ADC conversion time is 2.7 ms typically */ |
| 477 | usleep_range(3000, 10000); | 476 | usleep_range(3000, 6000); |
| 478 | ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); | 477 | ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); |
| 479 | if (!(status & LP5523_LEDTEST_DONE)) | 478 | if (!(status & LP5523_LEDTEST_DONE)) |
| 480 | usleep_range(3000, 10000); | 479 | usleep_range(3000, 6000);/* Was not ready. Wait. */ |
| 481 | ret |= lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &adc); | 480 | ret |= lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &adc); |
| 482 | 481 | ||
| 483 | if (adc >= vdd || adc < LP5523_ADC_SHORTCIRC_LIM) | 482 | if (adc >= vdd || adc < LP5523_ADC_SHORTCIRC_LIM) |
| @@ -930,11 +929,16 @@ static int lp5523_probe(struct i2c_client *client, | |||
| 930 | 929 | ||
| 931 | if (pdata->enable) { | 930 | if (pdata->enable) { |
| 932 | pdata->enable(0); | 931 | pdata->enable(0); |
| 933 | usleep_range(1000, 10000); | 932 | usleep_range(1000, 2000); /* Keep enable down at least 1ms */ |
| 934 | pdata->enable(1); | 933 | pdata->enable(1); |
| 935 | usleep_range(1000, 10000); /* Spec says min 500us */ | 934 | usleep_range(1000, 2000); /* 500us abs min. */ |
| 936 | } | 935 | } |
| 937 | 936 | ||
| 937 | lp5523_write(client, LP5523_REG_RESET, 0xff); | ||
| 938 | usleep_range(10000, 20000); /* | ||
| 939 | * Exact value is not available. 10 - 20ms | ||
| 940 | * appears to be enough for reset. | ||
| 941 | */ | ||
| 938 | ret = lp5523_detect(client); | 942 | ret = lp5523_detect(client); |
| 939 | if (ret) | 943 | if (ret) |
| 940 | goto fail2; | 944 | goto fail2; |
diff --git a/drivers/leds/leds-ss4200.c b/drivers/leds/leds-ss4200.c index a688293abd0b..614ebebaaa28 100644 --- a/drivers/leds/leds-ss4200.c +++ b/drivers/leds/leds-ss4200.c | |||
| @@ -102,6 +102,7 @@ static struct dmi_system_id __initdata nas_led_whitelist[] = { | |||
| 102 | DMI_MATCH(DMI_PRODUCT_VERSION, "1.00.00") | 102 | DMI_MATCH(DMI_PRODUCT_VERSION, "1.00.00") |
| 103 | } | 103 | } |
| 104 | }, | 104 | }, |
| 105 | {} | ||
| 105 | }; | 106 | }; |
| 106 | 107 | ||
| 107 | /* | 108 | /* |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 324a3663fcda..84c46a161927 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -1337,7 +1337,7 @@ super_90_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors) | |||
| 1337 | md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, | 1337 | md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, |
| 1338 | rdev->sb_page); | 1338 | rdev->sb_page); |
| 1339 | md_super_wait(rdev->mddev); | 1339 | md_super_wait(rdev->mddev); |
| 1340 | return num_sectors / 2; /* kB for sysfs */ | 1340 | return num_sectors; |
| 1341 | } | 1341 | } |
| 1342 | 1342 | ||
| 1343 | 1343 | ||
| @@ -1704,7 +1704,7 @@ super_1_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors) | |||
| 1704 | md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, | 1704 | md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, |
| 1705 | rdev->sb_page); | 1705 | rdev->sb_page); |
| 1706 | md_super_wait(rdev->mddev); | 1706 | md_super_wait(rdev->mddev); |
| 1707 | return num_sectors / 2; /* kB for sysfs */ | 1707 | return num_sectors; |
| 1708 | } | 1708 | } |
| 1709 | 1709 | ||
| 1710 | static struct super_type super_types[] = { | 1710 | static struct super_type super_types[] = { |
| @@ -4338,6 +4338,8 @@ static int md_alloc(dev_t dev, char *name) | |||
| 4338 | if (mddev->kobj.sd && | 4338 | if (mddev->kobj.sd && |
| 4339 | sysfs_create_group(&mddev->kobj, &md_bitmap_group)) | 4339 | sysfs_create_group(&mddev->kobj, &md_bitmap_group)) |
| 4340 | printk(KERN_DEBUG "pointless warning\n"); | 4340 | printk(KERN_DEBUG "pointless warning\n"); |
| 4341 | |||
| 4342 | blk_queue_flush(mddev->queue, REQ_FLUSH | REQ_FUA); | ||
| 4341 | abort: | 4343 | abort: |
| 4342 | mutex_unlock(&disks_mutex); | 4344 | mutex_unlock(&disks_mutex); |
| 4343 | if (!error && mddev->kobj.sd) { | 4345 | if (!error && mddev->kobj.sd) { |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 45f8324196ec..845cf95b612c 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
| @@ -1161,6 +1161,7 @@ static int raid1_remove_disk(mddev_t *mddev, int number) | |||
| 1161 | * is not possible. | 1161 | * is not possible. |
| 1162 | */ | 1162 | */ |
| 1163 | if (!test_bit(Faulty, &rdev->flags) && | 1163 | if (!test_bit(Faulty, &rdev->flags) && |
| 1164 | !mddev->recovery_disabled && | ||
| 1164 | mddev->degraded < conf->raid_disks) { | 1165 | mddev->degraded < conf->raid_disks) { |
| 1165 | err = -EBUSY; | 1166 | err = -EBUSY; |
| 1166 | goto abort; | 1167 | goto abort; |
diff --git a/drivers/misc/isl29020.c b/drivers/misc/isl29020.c index ca47e6285075..307aada5fffe 100644 --- a/drivers/misc/isl29020.c +++ b/drivers/misc/isl29020.c | |||
| @@ -183,9 +183,7 @@ static int isl29020_probe(struct i2c_client *client, | |||
| 183 | 183 | ||
| 184 | static int isl29020_remove(struct i2c_client *client) | 184 | static int isl29020_remove(struct i2c_client *client) |
| 185 | { | 185 | { |
| 186 | struct als_data *data = i2c_get_clientdata(client); | ||
| 187 | sysfs_remove_group(&client->dev.kobj, &m_als_gr); | 186 | sysfs_remove_group(&client->dev.kobj, &m_als_gr); |
| 188 | kfree(data); | ||
| 189 | return 0; | 187 | return 0; |
| 190 | } | 188 | } |
| 191 | 189 | ||
| @@ -245,6 +243,6 @@ static void __exit sensor_isl29020_exit(void) | |||
| 245 | module_init(sensor_isl29020_init); | 243 | module_init(sensor_isl29020_init); |
| 246 | module_exit(sensor_isl29020_exit); | 244 | module_exit(sensor_isl29020_exit); |
| 247 | 245 | ||
| 248 | MODULE_AUTHOR("Kalhan Trisal <kalhan.trisal@intel.com"); | 246 | MODULE_AUTHOR("Kalhan Trisal <kalhan.trisal@intel.com>"); |
| 249 | MODULE_DESCRIPTION("Intersil isl29020 ALS Driver"); | 247 | MODULE_DESCRIPTION("Intersil isl29020 ALS Driver"); |
| 250 | MODULE_LICENSE("GPL v2"); | 248 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c index d551f09ccb79..6956f7e7d439 100644 --- a/drivers/misc/sgi-xp/xpc_partition.c +++ b/drivers/misc/sgi-xp/xpc_partition.c | |||
| @@ -439,18 +439,23 @@ xpc_discovery(void) | |||
| 439 | * nodes that can comprise an access protection grouping. The access | 439 | * nodes that can comprise an access protection grouping. The access |
| 440 | * protection is in regards to memory, IOI and IPI. | 440 | * protection is in regards to memory, IOI and IPI. |
| 441 | */ | 441 | */ |
| 442 | max_regions = 64; | ||
| 443 | region_size = xp_region_size; | 442 | region_size = xp_region_size; |
| 444 | 443 | ||
| 445 | switch (region_size) { | 444 | if (is_uv()) |
| 446 | case 128: | 445 | max_regions = 256; |
| 447 | max_regions *= 2; | 446 | else { |
| 448 | case 64: | 447 | max_regions = 64; |
| 449 | max_regions *= 2; | 448 | |
| 450 | case 32: | 449 | switch (region_size) { |
| 451 | max_regions *= 2; | 450 | case 128: |
| 452 | region_size = 16; | 451 | max_regions *= 2; |
| 453 | DBUG_ON(!is_shub2()); | 452 | case 64: |
| 453 | max_regions *= 2; | ||
| 454 | case 32: | ||
| 455 | max_regions *= 2; | ||
| 456 | region_size = 16; | ||
| 457 | DBUG_ON(!is_shub2()); | ||
| 458 | } | ||
| 454 | } | 459 | } |
| 455 | 460 | ||
| 456 | for (region = 0; region < max_regions; region++) { | 461 | for (region = 0; region < max_regions; region++) { |
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index e1da258bbfb7..0a92436f0538 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
| @@ -699,7 +699,8 @@ DEFINE_WINDOW_IO(32) | |||
| 699 | #define DEVICE_PCI(dev) NULL | 699 | #define DEVICE_PCI(dev) NULL |
| 700 | #endif | 700 | #endif |
| 701 | 701 | ||
| 702 | #define VORTEX_PCI(vp) (((vp)->gendev) ? DEVICE_PCI((vp)->gendev) : NULL) | 702 | #define VORTEX_PCI(vp) \ |
| 703 | ((struct pci_dev *) (((vp)->gendev) ? DEVICE_PCI((vp)->gendev) : NULL)) | ||
| 703 | 704 | ||
| 704 | #ifdef CONFIG_EISA | 705 | #ifdef CONFIG_EISA |
| 705 | #define DEVICE_EISA(dev) (((dev)->bus == &eisa_bus_type) ? to_eisa_device((dev)) : NULL) | 706 | #define DEVICE_EISA(dev) (((dev)->bus == &eisa_bus_type) ? to_eisa_device((dev)) : NULL) |
| @@ -707,7 +708,8 @@ DEFINE_WINDOW_IO(32) | |||
| 707 | #define DEVICE_EISA(dev) NULL | 708 | #define DEVICE_EISA(dev) NULL |
| 708 | #endif | 709 | #endif |
| 709 | 710 | ||
| 710 | #define VORTEX_EISA(vp) (((vp)->gendev) ? DEVICE_EISA((vp)->gendev) : NULL) | 711 | #define VORTEX_EISA(vp) \ |
| 712 | ((struct eisa_device *) (((vp)->gendev) ? DEVICE_EISA((vp)->gendev) : NULL)) | ||
| 711 | 713 | ||
| 712 | /* The action to take with a media selection timer tick. | 714 | /* The action to take with a media selection timer tick. |
| 713 | Note that we deviate from the 3Com order by checking 10base2 before AUI. | 715 | Note that we deviate from the 3Com order by checking 10base2 before AUI. |
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index ac422cd332ea..dd16e83933a2 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c | |||
| @@ -490,13 +490,11 @@ static inline unsigned int cp_rx_csum_ok (u32 status) | |||
| 490 | { | 490 | { |
| 491 | unsigned int protocol = (status >> 16) & 0x3; | 491 | unsigned int protocol = (status >> 16) & 0x3; |
| 492 | 492 | ||
| 493 | if (likely((protocol == RxProtoTCP) && (!(status & TCPFail)))) | 493 | if (((protocol == RxProtoTCP) && !(status & TCPFail)) || |
| 494 | ((protocol == RxProtoUDP) && !(status & UDPFail))) | ||
| 494 | return 1; | 495 | return 1; |
| 495 | else if ((protocol == RxProtoUDP) && (!(status & UDPFail))) | 496 | else |
| 496 | return 1; | 497 | return 0; |
| 497 | else if ((protocol == RxProtoIP) && (!(status & IPFail))) | ||
| 498 | return 1; | ||
| 499 | return 0; | ||
| 500 | } | 498 | } |
| 501 | 499 | ||
| 502 | static int cp_rx_poll(struct napi_struct *napi, int budget) | 500 | static int cp_rx_poll(struct napi_struct *napi, int budget) |
diff --git a/drivers/net/atl1c/atl1c_hw.c b/drivers/net/atl1c/atl1c_hw.c index 919080b2c3a5..1bf672009948 100644 --- a/drivers/net/atl1c/atl1c_hw.c +++ b/drivers/net/atl1c/atl1c_hw.c | |||
| @@ -82,7 +82,7 @@ static int atl1c_get_permanent_address(struct atl1c_hw *hw) | |||
| 82 | addr[0] = addr[1] = 0; | 82 | addr[0] = addr[1] = 0; |
| 83 | AT_READ_REG(hw, REG_OTP_CTRL, &otp_ctrl_data); | 83 | AT_READ_REG(hw, REG_OTP_CTRL, &otp_ctrl_data); |
| 84 | if (atl1c_check_eeprom_exist(hw)) { | 84 | if (atl1c_check_eeprom_exist(hw)) { |
| 85 | if (hw->nic_type == athr_l1c || hw->nic_type == athr_l2c_b) { | 85 | if (hw->nic_type == athr_l1c || hw->nic_type == athr_l2c) { |
| 86 | /* Enable OTP CLK */ | 86 | /* Enable OTP CLK */ |
| 87 | if (!(otp_ctrl_data & OTP_CTRL_CLK_EN)) { | 87 | if (!(otp_ctrl_data & OTP_CTRL_CLK_EN)) { |
| 88 | otp_ctrl_data |= OTP_CTRL_CLK_EN; | 88 | otp_ctrl_data |= OTP_CTRL_CLK_EN; |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index c36cd2ffbadc..93354eee2cfd 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
| @@ -2458,6 +2458,12 @@ int be_load_fw(struct be_adapter *adapter, u8 *func) | |||
| 2458 | int status, i = 0, num_imgs = 0; | 2458 | int status, i = 0, num_imgs = 0; |
| 2459 | const u8 *p; | 2459 | const u8 *p; |
| 2460 | 2460 | ||
| 2461 | if (!netif_running(adapter->netdev)) { | ||
| 2462 | dev_err(&adapter->pdev->dev, | ||
| 2463 | "Firmware load not allowed (interface is down)\n"); | ||
| 2464 | return -EPERM; | ||
| 2465 | } | ||
| 2466 | |||
| 2461 | strcpy(fw_file, func); | 2467 | strcpy(fw_file, func); |
| 2462 | 2468 | ||
| 2463 | status = request_firmware(&fw, fw_file, &adapter->pdev->dev); | 2469 | status = request_firmware(&fw, fw_file, &adapter->pdev->dev); |
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c index e9ad16f00b56..9709b8569666 100644 --- a/drivers/net/bnx2x/bnx2x_main.c +++ b/drivers/net/bnx2x/bnx2x_main.c | |||
| @@ -9064,7 +9064,7 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, | |||
| 9064 | default: | 9064 | default: |
| 9065 | pr_err("Unknown board_type (%ld), aborting\n", | 9065 | pr_err("Unknown board_type (%ld), aborting\n", |
| 9066 | ent->driver_data); | 9066 | ent->driver_data); |
| 9067 | return ENODEV; | 9067 | return -ENODEV; |
| 9068 | } | 9068 | } |
| 9069 | 9069 | ||
| 9070 | cid_count += CNIC_CONTEXT_USE; | 9070 | cid_count += CNIC_CONTEXT_USE; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index bdb68a600382..71a169740d05 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -878,8 +878,10 @@ static void __bond_resend_igmp_join_requests(struct net_device *dev) | |||
| 878 | rcu_read_lock(); | 878 | rcu_read_lock(); |
| 879 | in_dev = __in_dev_get_rcu(dev); | 879 | in_dev = __in_dev_get_rcu(dev); |
| 880 | if (in_dev) { | 880 | if (in_dev) { |
| 881 | read_lock(&in_dev->mc_list_lock); | ||
| 881 | for (im = in_dev->mc_list; im; im = im->next) | 882 | for (im = in_dev->mc_list; im; im = im->next) |
| 882 | ip_mc_rejoin_group(im); | 883 | ip_mc_rejoin_group(im); |
| 884 | read_unlock(&in_dev->mc_list_lock); | ||
| 883 | } | 885 | } |
| 884 | 886 | ||
| 885 | rcu_read_unlock(); | 887 | rcu_read_unlock(); |
diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c index 8b4cea57a6c5..20da1996d354 100644 --- a/drivers/net/caif/caif_spi.c +++ b/drivers/net/caif/caif_spi.c | |||
| @@ -635,8 +635,8 @@ int cfspi_spi_probe(struct platform_device *pdev) | |||
| 635 | 635 | ||
| 636 | ndev = alloc_netdev(sizeof(struct cfspi), | 636 | ndev = alloc_netdev(sizeof(struct cfspi), |
| 637 | "cfspi%d", cfspi_setup); | 637 | "cfspi%d", cfspi_setup); |
| 638 | if (!dev) | 638 | if (!ndev) |
| 639 | return -ENODEV; | 639 | return -ENOMEM; |
| 640 | 640 | ||
| 641 | cfspi = netdev_priv(ndev); | 641 | cfspi = netdev_priv(ndev); |
| 642 | netif_stop_queue(ndev); | 642 | netif_stop_queue(ndev); |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 4686c3983fc3..4d62f7bfa036 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | 31 | ||
| 32 | char e1000_driver_name[] = "e1000"; | 32 | char e1000_driver_name[] = "e1000"; |
| 33 | static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; | 33 | static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; |
| 34 | #define DRV_VERSION "7.3.21-k6-NAPI" | 34 | #define DRV_VERSION "7.3.21-k8-NAPI" |
| 35 | const char e1000_driver_version[] = DRV_VERSION; | 35 | const char e1000_driver_version[] = DRV_VERSION; |
| 36 | static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; | 36 | static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; |
| 37 | 37 | ||
| @@ -485,9 +485,6 @@ void e1000_down(struct e1000_adapter *adapter) | |||
| 485 | struct net_device *netdev = adapter->netdev; | 485 | struct net_device *netdev = adapter->netdev; |
| 486 | u32 rctl, tctl; | 486 | u32 rctl, tctl; |
| 487 | 487 | ||
| 488 | /* signal that we're down so the interrupt handler does not | ||
| 489 | * reschedule our watchdog timer */ | ||
| 490 | set_bit(__E1000_DOWN, &adapter->flags); | ||
| 491 | 488 | ||
| 492 | /* disable receives in the hardware */ | 489 | /* disable receives in the hardware */ |
| 493 | rctl = er32(RCTL); | 490 | rctl = er32(RCTL); |
| @@ -508,6 +505,13 @@ void e1000_down(struct e1000_adapter *adapter) | |||
| 508 | 505 | ||
| 509 | e1000_irq_disable(adapter); | 506 | e1000_irq_disable(adapter); |
| 510 | 507 | ||
| 508 | /* | ||
| 509 | * Setting DOWN must be after irq_disable to prevent | ||
| 510 | * a screaming interrupt. Setting DOWN also prevents | ||
| 511 | * timers and tasks from rescheduling. | ||
| 512 | */ | ||
| 513 | set_bit(__E1000_DOWN, &adapter->flags); | ||
| 514 | |||
| 511 | del_timer_sync(&adapter->tx_fifo_stall_timer); | 515 | del_timer_sync(&adapter->tx_fifo_stall_timer); |
| 512 | del_timer_sync(&adapter->watchdog_timer); | 516 | del_timer_sync(&adapter->watchdog_timer); |
| 513 | del_timer_sync(&adapter->phy_info_timer); | 517 | del_timer_sync(&adapter->phy_info_timer); |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 49e4ce1246a7..d1bec6269173 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
| @@ -577,11 +577,10 @@ static int gfar_parse_group(struct device_node *np, | |||
| 577 | irq_of_parse_and_map(np, 1); | 577 | irq_of_parse_and_map(np, 1); |
| 578 | priv->gfargrp[priv->num_grps].interruptError = | 578 | priv->gfargrp[priv->num_grps].interruptError = |
| 579 | irq_of_parse_and_map(np,2); | 579 | irq_of_parse_and_map(np,2); |
| 580 | if (priv->gfargrp[priv->num_grps].interruptTransmit < 0 || | 580 | if (priv->gfargrp[priv->num_grps].interruptTransmit == NO_IRQ || |
| 581 | priv->gfargrp[priv->num_grps].interruptReceive < 0 || | 581 | priv->gfargrp[priv->num_grps].interruptReceive == NO_IRQ || |
| 582 | priv->gfargrp[priv->num_grps].interruptError < 0) { | 582 | priv->gfargrp[priv->num_grps].interruptError == NO_IRQ) |
| 583 | return -EINVAL; | 583 | return -EINVAL; |
| 584 | } | ||
| 585 | } | 584 | } |
| 586 | 585 | ||
| 587 | priv->gfargrp[priv->num_grps].grp_id = priv->num_grps; | 586 | priv->gfargrp[priv->num_grps].grp_id = priv->num_grps; |
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c index dc0198092343..aa93655c3aa7 100644 --- a/drivers/net/ipg.c +++ b/drivers/net/ipg.c | |||
| @@ -88,16 +88,14 @@ static const char *ipg_brand_name[] = { | |||
| 88 | "IC PLUS IP1000 1000/100/10 based NIC", | 88 | "IC PLUS IP1000 1000/100/10 based NIC", |
| 89 | "Sundance Technology ST2021 based NIC", | 89 | "Sundance Technology ST2021 based NIC", |
| 90 | "Tamarack Microelectronics TC9020/9021 based NIC", | 90 | "Tamarack Microelectronics TC9020/9021 based NIC", |
| 91 | "Tamarack Microelectronics TC9020/9021 based NIC", | ||
| 92 | "D-Link NIC IP1000A" | 91 | "D-Link NIC IP1000A" |
| 93 | }; | 92 | }; |
| 94 | 93 | ||
| 95 | static DEFINE_PCI_DEVICE_TABLE(ipg_pci_tbl) = { | 94 | static DEFINE_PCI_DEVICE_TABLE(ipg_pci_tbl) = { |
| 96 | { PCI_VDEVICE(SUNDANCE, 0x1023), 0 }, | 95 | { PCI_VDEVICE(SUNDANCE, 0x1023), 0 }, |
| 97 | { PCI_VDEVICE(SUNDANCE, 0x2021), 1 }, | 96 | { PCI_VDEVICE(SUNDANCE, 0x2021), 1 }, |
| 98 | { PCI_VDEVICE(SUNDANCE, 0x1021), 2 }, | 97 | { PCI_VDEVICE(DLINK, 0x9021), 2 }, |
| 99 | { PCI_VDEVICE(DLINK, 0x9021), 3 }, | 98 | { PCI_VDEVICE(DLINK, 0x4020), 3 }, |
| 100 | { PCI_VDEVICE(DLINK, 0x4020), 4 }, | ||
| 101 | { 0, } | 99 | { 0, } |
| 102 | }; | 100 | }; |
| 103 | 101 | ||
diff --git a/drivers/net/irda/sh_sir.c b/drivers/net/irda/sh_sir.c index 00b38bccd6d0..52a7c86af663 100644 --- a/drivers/net/irda/sh_sir.c +++ b/drivers/net/irda/sh_sir.c | |||
| @@ -258,7 +258,7 @@ static int sh_sir_set_baudrate(struct sh_sir_self *self, u32 baudrate) | |||
| 258 | 258 | ||
| 259 | /* Baud Rate Error Correction x 10000 */ | 259 | /* Baud Rate Error Correction x 10000 */ |
| 260 | u32 rate_err_array[] = { | 260 | u32 rate_err_array[] = { |
| 261 | 0000, 0625, 1250, 1875, | 261 | 0, 625, 1250, 1875, |
| 262 | 2500, 3125, 3750, 4375, | 262 | 2500, 3125, 3750, 4375, |
| 263 | 5000, 5625, 6250, 6875, | 263 | 5000, 5625, 6250, 6875, |
| 264 | 7500, 8125, 8750, 9375, | 264 | 7500, 8125, 8750, 9375, |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index f0bd1a1aba3a..e8b9c53c304b 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
| @@ -30,11 +30,14 @@ | |||
| 30 | #include <linux/ethtool.h> | 30 | #include <linux/ethtool.h> |
| 31 | #include <linux/phy.h> | 31 | #include <linux/phy.h> |
| 32 | #include <linux/marvell_phy.h> | 32 | #include <linux/marvell_phy.h> |
| 33 | #include <linux/of.h> | ||
| 33 | 34 | ||
| 34 | #include <asm/io.h> | 35 | #include <asm/io.h> |
| 35 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
| 36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
| 37 | 38 | ||
| 39 | #define MII_MARVELL_PHY_PAGE 22 | ||
| 40 | |||
| 38 | #define MII_M1011_IEVENT 0x13 | 41 | #define MII_M1011_IEVENT 0x13 |
| 39 | #define MII_M1011_IEVENT_CLEAR 0x0000 | 42 | #define MII_M1011_IEVENT_CLEAR 0x0000 |
| 40 | 43 | ||
| @@ -80,7 +83,6 @@ | |||
| 80 | #define MII_88E1121_PHY_LED_CTRL 16 | 83 | #define MII_88E1121_PHY_LED_CTRL 16 |
| 81 | #define MII_88E1121_PHY_LED_PAGE 3 | 84 | #define MII_88E1121_PHY_LED_PAGE 3 |
| 82 | #define MII_88E1121_PHY_LED_DEF 0x0030 | 85 | #define MII_88E1121_PHY_LED_DEF 0x0030 |
| 83 | #define MII_88E1121_PHY_PAGE 22 | ||
| 84 | 86 | ||
| 85 | #define MII_M1011_PHY_STATUS 0x11 | 87 | #define MII_M1011_PHY_STATUS 0x11 |
| 86 | #define MII_M1011_PHY_STATUS_1000 0x8000 | 88 | #define MII_M1011_PHY_STATUS_1000 0x8000 |
| @@ -186,13 +188,94 @@ static int marvell_config_aneg(struct phy_device *phydev) | |||
| 186 | return 0; | 188 | return 0; |
| 187 | } | 189 | } |
| 188 | 190 | ||
| 191 | #ifdef CONFIG_OF_MDIO | ||
| 192 | /* | ||
| 193 | * Set and/or override some configuration registers based on the | ||
| 194 | * marvell,reg-init property stored in the of_node for the phydev. | ||
| 195 | * | ||
| 196 | * marvell,reg-init = <reg-page reg mask value>,...; | ||
| 197 | * | ||
| 198 | * There may be one or more sets of <reg-page reg mask value>: | ||
| 199 | * | ||
| 200 | * reg-page: which register bank to use. | ||
| 201 | * reg: the register. | ||
| 202 | * mask: if non-zero, ANDed with existing register value. | ||
| 203 | * value: ORed with the masked value and written to the regiser. | ||
| 204 | * | ||
| 205 | */ | ||
| 206 | static int marvell_of_reg_init(struct phy_device *phydev) | ||
| 207 | { | ||
| 208 | const __be32 *paddr; | ||
| 209 | int len, i, saved_page, current_page, page_changed, ret; | ||
| 210 | |||
| 211 | if (!phydev->dev.of_node) | ||
| 212 | return 0; | ||
| 213 | |||
| 214 | paddr = of_get_property(phydev->dev.of_node, "marvell,reg-init", &len); | ||
| 215 | if (!paddr || len < (4 * sizeof(*paddr))) | ||
| 216 | return 0; | ||
| 217 | |||
| 218 | saved_page = phy_read(phydev, MII_MARVELL_PHY_PAGE); | ||
| 219 | if (saved_page < 0) | ||
| 220 | return saved_page; | ||
| 221 | page_changed = 0; | ||
| 222 | current_page = saved_page; | ||
| 223 | |||
| 224 | ret = 0; | ||
| 225 | len /= sizeof(*paddr); | ||
| 226 | for (i = 0; i < len - 3; i += 4) { | ||
| 227 | u16 reg_page = be32_to_cpup(paddr + i); | ||
| 228 | u16 reg = be32_to_cpup(paddr + i + 1); | ||
| 229 | u16 mask = be32_to_cpup(paddr + i + 2); | ||
| 230 | u16 val_bits = be32_to_cpup(paddr + i + 3); | ||
| 231 | int val; | ||
| 232 | |||
| 233 | if (reg_page != current_page) { | ||
| 234 | current_page = reg_page; | ||
| 235 | page_changed = 1; | ||
| 236 | ret = phy_write(phydev, MII_MARVELL_PHY_PAGE, reg_page); | ||
| 237 | if (ret < 0) | ||
| 238 | goto err; | ||
| 239 | } | ||
| 240 | |||
| 241 | val = 0; | ||
| 242 | if (mask) { | ||
| 243 | val = phy_read(phydev, reg); | ||
| 244 | if (val < 0) { | ||
| 245 | ret = val; | ||
| 246 | goto err; | ||
| 247 | } | ||
| 248 | val &= mask; | ||
| 249 | } | ||
| 250 | val |= val_bits; | ||
| 251 | |||
| 252 | ret = phy_write(phydev, reg, val); | ||
| 253 | if (ret < 0) | ||
| 254 | goto err; | ||
| 255 | |||
| 256 | } | ||
| 257 | err: | ||
| 258 | if (page_changed) { | ||
| 259 | i = phy_write(phydev, MII_MARVELL_PHY_PAGE, saved_page); | ||
| 260 | if (ret == 0) | ||
| 261 | ret = i; | ||
| 262 | } | ||
| 263 | return ret; | ||
| 264 | } | ||
| 265 | #else | ||
| 266 | static int marvell_of_reg_init(struct phy_device *phydev) | ||
| 267 | { | ||
| 268 | return 0; | ||
| 269 | } | ||
| 270 | #endif /* CONFIG_OF_MDIO */ | ||
| 271 | |||
| 189 | static int m88e1121_config_aneg(struct phy_device *phydev) | 272 | static int m88e1121_config_aneg(struct phy_device *phydev) |
| 190 | { | 273 | { |
| 191 | int err, oldpage, mscr; | 274 | int err, oldpage, mscr; |
| 192 | 275 | ||
| 193 | oldpage = phy_read(phydev, MII_88E1121_PHY_PAGE); | 276 | oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE); |
| 194 | 277 | ||
| 195 | err = phy_write(phydev, MII_88E1121_PHY_PAGE, | 278 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, |
| 196 | MII_88E1121_PHY_MSCR_PAGE); | 279 | MII_88E1121_PHY_MSCR_PAGE); |
| 197 | if (err < 0) | 280 | if (err < 0) |
| 198 | return err; | 281 | return err; |
| @@ -218,7 +301,7 @@ static int m88e1121_config_aneg(struct phy_device *phydev) | |||
| 218 | return err; | 301 | return err; |
| 219 | } | 302 | } |
| 220 | 303 | ||
| 221 | phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage); | 304 | phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage); |
| 222 | 305 | ||
| 223 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); | 306 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); |
| 224 | if (err < 0) | 307 | if (err < 0) |
| @@ -229,11 +312,11 @@ static int m88e1121_config_aneg(struct phy_device *phydev) | |||
| 229 | if (err < 0) | 312 | if (err < 0) |
| 230 | return err; | 313 | return err; |
| 231 | 314 | ||
| 232 | oldpage = phy_read(phydev, MII_88E1121_PHY_PAGE); | 315 | oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE); |
| 233 | 316 | ||
| 234 | phy_write(phydev, MII_88E1121_PHY_PAGE, MII_88E1121_PHY_LED_PAGE); | 317 | phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_88E1121_PHY_LED_PAGE); |
| 235 | phy_write(phydev, MII_88E1121_PHY_LED_CTRL, MII_88E1121_PHY_LED_DEF); | 318 | phy_write(phydev, MII_88E1121_PHY_LED_CTRL, MII_88E1121_PHY_LED_DEF); |
| 236 | phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage); | 319 | phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage); |
| 237 | 320 | ||
| 238 | err = genphy_config_aneg(phydev); | 321 | err = genphy_config_aneg(phydev); |
| 239 | 322 | ||
| @@ -244,9 +327,9 @@ static int m88e1318_config_aneg(struct phy_device *phydev) | |||
| 244 | { | 327 | { |
| 245 | int err, oldpage, mscr; | 328 | int err, oldpage, mscr; |
| 246 | 329 | ||
| 247 | oldpage = phy_read(phydev, MII_88E1121_PHY_PAGE); | 330 | oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE); |
| 248 | 331 | ||
| 249 | err = phy_write(phydev, MII_88E1121_PHY_PAGE, | 332 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, |
| 250 | MII_88E1121_PHY_MSCR_PAGE); | 333 | MII_88E1121_PHY_MSCR_PAGE); |
| 251 | if (err < 0) | 334 | if (err < 0) |
| 252 | return err; | 335 | return err; |
| @@ -258,7 +341,7 @@ static int m88e1318_config_aneg(struct phy_device *phydev) | |||
| 258 | if (err < 0) | 341 | if (err < 0) |
| 259 | return err; | 342 | return err; |
| 260 | 343 | ||
| 261 | err = phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage); | 344 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage); |
| 262 | if (err < 0) | 345 | if (err < 0) |
| 263 | return err; | 346 | return err; |
| 264 | 347 | ||
| @@ -368,6 +451,9 @@ static int m88e1111_config_init(struct phy_device *phydev) | |||
| 368 | return err; | 451 | return err; |
| 369 | } | 452 | } |
| 370 | 453 | ||
| 454 | err = marvell_of_reg_init(phydev); | ||
| 455 | if (err < 0) | ||
| 456 | return err; | ||
| 371 | 457 | ||
| 372 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); | 458 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); |
| 373 | if (err < 0) | 459 | if (err < 0) |
| @@ -398,7 +484,7 @@ static int m88e1118_config_init(struct phy_device *phydev) | |||
| 398 | int err; | 484 | int err; |
| 399 | 485 | ||
| 400 | /* Change address */ | 486 | /* Change address */ |
| 401 | err = phy_write(phydev, 0x16, 0x0002); | 487 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0x0002); |
| 402 | if (err < 0) | 488 | if (err < 0) |
| 403 | return err; | 489 | return err; |
| 404 | 490 | ||
| @@ -408,7 +494,7 @@ static int m88e1118_config_init(struct phy_device *phydev) | |||
| 408 | return err; | 494 | return err; |
| 409 | 495 | ||
| 410 | /* Change address */ | 496 | /* Change address */ |
| 411 | err = phy_write(phydev, 0x16, 0x0003); | 497 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0x0003); |
| 412 | if (err < 0) | 498 | if (err < 0) |
| 413 | return err; | 499 | return err; |
| 414 | 500 | ||
| @@ -420,8 +506,42 @@ static int m88e1118_config_init(struct phy_device *phydev) | |||
| 420 | if (err < 0) | 506 | if (err < 0) |
| 421 | return err; | 507 | return err; |
| 422 | 508 | ||
| 509 | err = marvell_of_reg_init(phydev); | ||
| 510 | if (err < 0) | ||
| 511 | return err; | ||
| 512 | |||
| 423 | /* Reset address */ | 513 | /* Reset address */ |
| 424 | err = phy_write(phydev, 0x16, 0x0); | 514 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0x0); |
| 515 | if (err < 0) | ||
| 516 | return err; | ||
| 517 | |||
| 518 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); | ||
| 519 | if (err < 0) | ||
| 520 | return err; | ||
| 521 | |||
| 522 | return 0; | ||
| 523 | } | ||
| 524 | |||
| 525 | static int m88e1149_config_init(struct phy_device *phydev) | ||
| 526 | { | ||
| 527 | int err; | ||
| 528 | |||
| 529 | /* Change address */ | ||
| 530 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0x0002); | ||
| 531 | if (err < 0) | ||
| 532 | return err; | ||
| 533 | |||
| 534 | /* Enable 1000 Mbit */ | ||
| 535 | err = phy_write(phydev, 0x15, 0x1048); | ||
| 536 | if (err < 0) | ||
| 537 | return err; | ||
| 538 | |||
| 539 | err = marvell_of_reg_init(phydev); | ||
| 540 | if (err < 0) | ||
| 541 | return err; | ||
| 542 | |||
| 543 | /* Reset address */ | ||
| 544 | err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0x0); | ||
| 425 | if (err < 0) | 545 | if (err < 0) |
| 426 | return err; | 546 | return err; |
| 427 | 547 | ||
| @@ -491,6 +611,10 @@ static int m88e1145_config_init(struct phy_device *phydev) | |||
| 491 | } | 611 | } |
| 492 | } | 612 | } |
| 493 | 613 | ||
| 614 | err = marvell_of_reg_init(phydev); | ||
| 615 | if (err < 0) | ||
| 616 | return err; | ||
| 617 | |||
| 494 | return 0; | 618 | return 0; |
| 495 | } | 619 | } |
| 496 | 620 | ||
| @@ -685,6 +809,19 @@ static struct phy_driver marvell_drivers[] = { | |||
| 685 | .driver = { .owner = THIS_MODULE }, | 809 | .driver = { .owner = THIS_MODULE }, |
| 686 | }, | 810 | }, |
| 687 | { | 811 | { |
| 812 | .phy_id = MARVELL_PHY_ID_88E1149R, | ||
| 813 | .phy_id_mask = MARVELL_PHY_ID_MASK, | ||
| 814 | .name = "Marvell 88E1149R", | ||
| 815 | .features = PHY_GBIT_FEATURES, | ||
| 816 | .flags = PHY_HAS_INTERRUPT, | ||
| 817 | .config_init = &m88e1149_config_init, | ||
| 818 | .config_aneg = &m88e1118_config_aneg, | ||
| 819 | .read_status = &genphy_read_status, | ||
| 820 | .ack_interrupt = &marvell_ack_interrupt, | ||
| 821 | .config_intr = &marvell_config_intr, | ||
| 822 | .driver = { .owner = THIS_MODULE }, | ||
| 823 | }, | ||
| 824 | { | ||
| 688 | .phy_id = MARVELL_PHY_ID_88E1240, | 825 | .phy_id = MARVELL_PHY_ID_88E1240, |
| 689 | .phy_id_mask = MARVELL_PHY_ID_MASK, | 826 | .phy_id_mask = MARVELL_PHY_ID_MASK, |
| 690 | .name = "Marvell 88E1240", | 827 | .name = "Marvell 88E1240", |
| @@ -735,6 +872,7 @@ static struct mdio_device_id __maybe_unused marvell_tbl[] = { | |||
| 735 | { 0x01410e10, 0xfffffff0 }, | 872 | { 0x01410e10, 0xfffffff0 }, |
| 736 | { 0x01410cb0, 0xfffffff0 }, | 873 | { 0x01410cb0, 0xfffffff0 }, |
| 737 | { 0x01410cd0, 0xfffffff0 }, | 874 | { 0x01410cd0, 0xfffffff0 }, |
| 875 | { 0x01410e50, 0xfffffff0 }, | ||
| 738 | { 0x01410e30, 0xfffffff0 }, | 876 | { 0x01410e30, 0xfffffff0 }, |
| 739 | { 0x01410e90, 0xfffffff0 }, | 877 | { 0x01410e90, 0xfffffff0 }, |
| 740 | { } | 878 | { } |
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index c30e0fe55a31..528eaef5308f 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
| @@ -62,15 +62,15 @@ static const u32 default_msg = | |||
| 62 | /* NETIF_MSG_PKTDATA | */ | 62 | /* NETIF_MSG_PKTDATA | */ |
| 63 | NETIF_MSG_HW | NETIF_MSG_WOL | 0; | 63 | NETIF_MSG_HW | NETIF_MSG_WOL | 0; |
| 64 | 64 | ||
| 65 | static int debug = 0x00007fff; /* defaults above */ | 65 | static int debug = -1; /* defaults above */ |
| 66 | module_param(debug, int, 0); | 66 | module_param(debug, int, 0664); |
| 67 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | 67 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); |
| 68 | 68 | ||
| 69 | #define MSIX_IRQ 0 | 69 | #define MSIX_IRQ 0 |
| 70 | #define MSI_IRQ 1 | 70 | #define MSI_IRQ 1 |
| 71 | #define LEG_IRQ 2 | 71 | #define LEG_IRQ 2 |
| 72 | static int qlge_irq_type = MSIX_IRQ; | 72 | static int qlge_irq_type = MSIX_IRQ; |
| 73 | module_param(qlge_irq_type, int, MSIX_IRQ); | 73 | module_param(qlge_irq_type, int, 0664); |
| 74 | MODULE_PARM_DESC(qlge_irq_type, "0 = MSI-X, 1 = MSI, 2 = Legacy."); | 74 | MODULE_PARM_DESC(qlge_irq_type, "0 = MSI-X, 1 = MSI, 2 = Legacy."); |
| 75 | 75 | ||
| 76 | static int qlge_mpi_coredump; | 76 | static int qlge_mpi_coredump; |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 4c4d16905efb..7d33ef4bcb4a 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
| @@ -4440,8 +4440,7 @@ static inline void rtl8169_rx_csum(struct sk_buff *skb, u32 opts1) | |||
| 4440 | u32 status = opts1 & RxProtoMask; | 4440 | u32 status = opts1 & RxProtoMask; |
| 4441 | 4441 | ||
| 4442 | if (((status == RxProtoTCP) && !(opts1 & TCPFail)) || | 4442 | if (((status == RxProtoTCP) && !(opts1 & TCPFail)) || |
| 4443 | ((status == RxProtoUDP) && !(opts1 & UDPFail)) || | 4443 | ((status == RxProtoUDP) && !(opts1 & UDPFail))) |
| 4444 | ((status == RxProtoIP) && !(opts1 & IPFail))) | ||
| 4445 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 4444 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
| 4446 | else | 4445 | else |
| 4447 | skb_checksum_none_assert(skb); | 4446 | skb_checksum_none_assert(skb); |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index 966b9496a9dd..195406db3bd8 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c | |||
| @@ -37,7 +37,7 @@ static bool ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah) | |||
| 37 | int addr, eep_start_loc; | 37 | int addr, eep_start_loc; |
| 38 | eep_data = (u16 *)eep; | 38 | eep_data = (u16 *)eep; |
| 39 | 39 | ||
| 40 | if (ah->hw_version.devid == 0x7015) | 40 | if (AR9287_HTC_DEVID(ah)) |
| 41 | eep_start_loc = AR9287_HTC_EEP_START_LOC; | 41 | eep_start_loc = AR9287_HTC_EEP_START_LOC; |
| 42 | else | 42 | else |
| 43 | eep_start_loc = AR9287_EEP_START_LOC; | 43 | eep_start_loc = AR9287_EEP_START_LOC; |
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index f7ec31b4ddd3..dfb6560dab92 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
| @@ -36,8 +36,13 @@ static struct usb_device_id ath9k_hif_usb_ids[] = { | |||
| 36 | { USB_DEVICE(0x13D3, 0x3327) }, /* Azurewave */ | 36 | { USB_DEVICE(0x13D3, 0x3327) }, /* Azurewave */ |
| 37 | { USB_DEVICE(0x13D3, 0x3328) }, /* Azurewave */ | 37 | { USB_DEVICE(0x13D3, 0x3328) }, /* Azurewave */ |
| 38 | { USB_DEVICE(0x13D3, 0x3346) }, /* IMC Networks */ | 38 | { USB_DEVICE(0x13D3, 0x3346) }, /* IMC Networks */ |
| 39 | { USB_DEVICE(0x13D3, 0x3348) }, /* Azurewave */ | ||
| 40 | { USB_DEVICE(0x13D3, 0x3349) }, /* Azurewave */ | ||
| 41 | { USB_DEVICE(0x13D3, 0x3350) }, /* Azurewave */ | ||
| 39 | { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ | 42 | { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ |
| 40 | { USB_DEVICE(0x083A, 0xA704) }, /* SMC Networks */ | 43 | { USB_DEVICE(0x083A, 0xA704) }, /* SMC Networks */ |
| 44 | { USB_DEVICE(0x040D, 0x3801) }, /* VIA */ | ||
| 45 | { USB_DEVICE(0x1668, 0x1200) }, /* Verizon */ | ||
| 41 | { }, | 46 | { }, |
| 42 | }; | 47 | }; |
| 43 | 48 | ||
| @@ -806,6 +811,8 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev) | |||
| 806 | case 0x7010: | 811 | case 0x7010: |
| 807 | case 0x7015: | 812 | case 0x7015: |
| 808 | case 0x9018: | 813 | case 0x9018: |
| 814 | case 0xA704: | ||
| 815 | case 0x1200: | ||
| 809 | firm_offset = AR7010_FIRMWARE_TEXT; | 816 | firm_offset = AR7010_FIRMWARE_TEXT; |
| 810 | break; | 817 | break; |
| 811 | default: | 818 | default: |
| @@ -928,6 +935,8 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface, | |||
| 928 | case 0x7010: | 935 | case 0x7010: |
| 929 | case 0x7015: | 936 | case 0x7015: |
| 930 | case 0x9018: | 937 | case 0x9018: |
| 938 | case 0xA704: | ||
| 939 | case 0x1200: | ||
| 931 | if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x0202) | 940 | if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x0202) |
| 932 | hif_dev->fw_name = FIRMWARE_AR7010_1_1; | 941 | hif_dev->fw_name = FIRMWARE_AR7010_1_1; |
| 933 | else | 942 | else |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index 3d7b97f1b3ae..7c8a38d04561 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | |||
| @@ -249,6 +249,8 @@ static int ath9k_init_htc_services(struct ath9k_htc_priv *priv, u16 devid) | |||
| 249 | case 0x7010: | 249 | case 0x7010: |
| 250 | case 0x7015: | 250 | case 0x7015: |
| 251 | case 0x9018: | 251 | case 0x9018: |
| 252 | case 0xA704: | ||
| 253 | case 0x1200: | ||
| 252 | priv->htc->credits = 45; | 254 | priv->htc->credits = 45; |
| 253 | break; | 255 | break; |
| 254 | default: | 256 | default: |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index 3d19b5bc937f..29d80ca78393 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | |||
| @@ -121,7 +121,7 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, struct sk_buff *skb) | |||
| 121 | tx_hdr.data_type = ATH9K_HTC_NORMAL; | 121 | tx_hdr.data_type = ATH9K_HTC_NORMAL; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | if (ieee80211_is_data(fc)) { | 124 | if (ieee80211_is_data_qos(fc)) { |
| 125 | qc = ieee80211_get_qos_ctl(hdr); | 125 | qc = ieee80211_get_qos_ctl(hdr); |
| 126 | tx_hdr.tidno = qc[0] & IEEE80211_QOS_CTL_TID_MASK; | 126 | tx_hdr.tidno = qc[0] & IEEE80211_QOS_CTL_TID_MASK; |
| 127 | } | 127 | } |
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 6a0d99eff404..92bc5c5f4876 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
| @@ -817,8 +817,6 @@ void ath9k_deinit_device(struct ath_softc *sc) | |||
| 817 | 817 | ||
| 818 | ath9k_ps_wakeup(sc); | 818 | ath9k_ps_wakeup(sc); |
| 819 | 819 | ||
| 820 | pm_qos_remove_request(&ath9k_pm_qos_req); | ||
| 821 | |||
| 822 | wiphy_rfkill_stop_polling(sc->hw->wiphy); | 820 | wiphy_rfkill_stop_polling(sc->hw->wiphy); |
| 823 | ath_deinit_leds(sc); | 821 | ath_deinit_leds(sc); |
| 824 | 822 | ||
| @@ -832,6 +830,7 @@ void ath9k_deinit_device(struct ath_softc *sc) | |||
| 832 | } | 830 | } |
| 833 | 831 | ||
| 834 | ieee80211_unregister_hw(hw); | 832 | ieee80211_unregister_hw(hw); |
| 833 | pm_qos_remove_request(&ath9k_pm_qos_req); | ||
| 835 | ath_rx_cleanup(sc); | 834 | ath_rx_cleanup(sc); |
| 836 | ath_tx_cleanup(sc); | 835 | ath_tx_cleanup(sc); |
| 837 | ath9k_deinit_softc(sc); | 836 | ath9k_deinit_softc(sc); |
diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h index fa05b711e5cd..dddf579aacf1 100644 --- a/drivers/net/wireless/ath/ath9k/reg.h +++ b/drivers/net/wireless/ath/ath9k/reg.h | |||
| @@ -866,7 +866,13 @@ | |||
| 866 | #define AR_DEVID_7010(_ah) \ | 866 | #define AR_DEVID_7010(_ah) \ |
| 867 | (((_ah)->hw_version.devid == 0x7010) || \ | 867 | (((_ah)->hw_version.devid == 0x7010) || \ |
| 868 | ((_ah)->hw_version.devid == 0x7015) || \ | 868 | ((_ah)->hw_version.devid == 0x7015) || \ |
| 869 | ((_ah)->hw_version.devid == 0x9018)) | 869 | ((_ah)->hw_version.devid == 0x9018) || \ |
| 870 | ((_ah)->hw_version.devid == 0xA704) || \ | ||
| 871 | ((_ah)->hw_version.devid == 0x1200)) | ||
| 872 | |||
| 873 | #define AR9287_HTC_DEVID(_ah) \ | ||
| 874 | (((_ah)->hw_version.devid == 0x7015) || \ | ||
| 875 | ((_ah)->hw_version.devid == 0x1200)) | ||
| 870 | 876 | ||
| 871 | #define AR_RADIO_SREV_MAJOR 0xf0 | 877 | #define AR_RADIO_SREV_MAJOR 0xf0 |
| 872 | #define AR_RAD5133_SREV_MAJOR 0xc0 | 878 | #define AR_RAD5133_SREV_MAJOR 0xc0 |
diff --git a/drivers/net/wireless/ath/carl9170/usb.c b/drivers/net/wireless/ath/carl9170/usb.c index 3317039cd28f..7504ed14c725 100644 --- a/drivers/net/wireless/ath/carl9170/usb.c +++ b/drivers/net/wireless/ath/carl9170/usb.c | |||
| @@ -553,12 +553,12 @@ static int carl9170_usb_flush(struct ar9170 *ar) | |||
| 553 | usb_free_urb(urb); | 553 | usb_free_urb(urb); |
| 554 | } | 554 | } |
| 555 | 555 | ||
| 556 | ret = usb_wait_anchor_empty_timeout(&ar->tx_cmd, HZ); | 556 | ret = usb_wait_anchor_empty_timeout(&ar->tx_cmd, 1000); |
| 557 | if (ret == 0) | 557 | if (ret == 0) |
| 558 | err = -ETIMEDOUT; | 558 | err = -ETIMEDOUT; |
| 559 | 559 | ||
| 560 | /* lets wait a while until the tx - queues are dried out */ | 560 | /* lets wait a while until the tx - queues are dried out */ |
| 561 | ret = usb_wait_anchor_empty_timeout(&ar->tx_anch, HZ); | 561 | ret = usb_wait_anchor_empty_timeout(&ar->tx_anch, 1000); |
| 562 | if (ret == 0) | 562 | if (ret == 0) |
| 563 | err = -ETIMEDOUT; | 563 | err = -ETIMEDOUT; |
| 564 | 564 | ||
diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c index cb12a8e1466b..3f5e387ed564 100644 --- a/drivers/sh/clk/core.c +++ b/drivers/sh/clk/core.c | |||
| @@ -418,8 +418,11 @@ int clk_register(struct clk *clk) | |||
| 418 | list_add(&clk->sibling, &root_clks); | 418 | list_add(&clk->sibling, &root_clks); |
| 419 | 419 | ||
| 420 | list_add(&clk->node, &clock_list); | 420 | list_add(&clk->node, &clock_list); |
| 421 | |||
| 422 | #ifdef CONFIG_SH_CLK_CPG_LEGACY | ||
| 421 | if (clk->ops && clk->ops->init) | 423 | if (clk->ops && clk->ops->init) |
| 422 | clk->ops->init(clk); | 424 | clk->ops->init(clk); |
| 425 | #endif | ||
| 423 | 426 | ||
| 424 | out_unlock: | 427 | out_unlock: |
| 425 | mutex_unlock(&clock_list_sem); | 428 | mutex_unlock(&clock_list_sem); |
| @@ -455,19 +458,13 @@ EXPORT_SYMBOL_GPL(clk_get_rate); | |||
| 455 | 458 | ||
| 456 | int clk_set_rate(struct clk *clk, unsigned long rate) | 459 | int clk_set_rate(struct clk *clk, unsigned long rate) |
| 457 | { | 460 | { |
| 458 | return clk_set_rate_ex(clk, rate, 0); | ||
| 459 | } | ||
| 460 | EXPORT_SYMBOL_GPL(clk_set_rate); | ||
| 461 | |||
| 462 | int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id) | ||
| 463 | { | ||
| 464 | int ret = -EOPNOTSUPP; | 461 | int ret = -EOPNOTSUPP; |
| 465 | unsigned long flags; | 462 | unsigned long flags; |
| 466 | 463 | ||
| 467 | spin_lock_irqsave(&clock_lock, flags); | 464 | spin_lock_irqsave(&clock_lock, flags); |
| 468 | 465 | ||
| 469 | if (likely(clk->ops && clk->ops->set_rate)) { | 466 | if (likely(clk->ops && clk->ops->set_rate)) { |
| 470 | ret = clk->ops->set_rate(clk, rate, algo_id); | 467 | ret = clk->ops->set_rate(clk, rate); |
| 471 | if (ret != 0) | 468 | if (ret != 0) |
| 472 | goto out_unlock; | 469 | goto out_unlock; |
| 473 | } else { | 470 | } else { |
| @@ -485,7 +482,7 @@ out_unlock: | |||
| 485 | 482 | ||
| 486 | return ret; | 483 | return ret; |
| 487 | } | 484 | } |
| 488 | EXPORT_SYMBOL_GPL(clk_set_rate_ex); | 485 | EXPORT_SYMBOL_GPL(clk_set_rate); |
| 489 | 486 | ||
| 490 | int clk_set_parent(struct clk *clk, struct clk *parent) | 487 | int clk_set_parent(struct clk *clk, struct clk *parent) |
| 491 | { | 488 | { |
| @@ -653,8 +650,7 @@ static int clks_sysdev_suspend(struct sys_device *dev, pm_message_t state) | |||
| 653 | clkp->ops->set_parent(clkp, | 650 | clkp->ops->set_parent(clkp, |
| 654 | clkp->parent); | 651 | clkp->parent); |
| 655 | if (likely(clkp->ops->set_rate)) | 652 | if (likely(clkp->ops->set_rate)) |
| 656 | clkp->ops->set_rate(clkp, | 653 | clkp->ops->set_rate(clkp, rate); |
| 657 | rate, NO_CHANGE); | ||
| 658 | else if (likely(clkp->ops->recalc)) | 654 | else if (likely(clkp->ops->recalc)) |
| 659 | clkp->rate = clkp->ops->recalc(clkp); | 655 | clkp->rate = clkp->ops->recalc(clkp); |
| 660 | } | 656 | } |
diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c index 3aea5f0ceb09..6172335ae323 100644 --- a/drivers/sh/clk/cpg.c +++ b/drivers/sh/clk/cpg.c | |||
| @@ -110,8 +110,7 @@ static int sh_clk_div6_set_parent(struct clk *clk, struct clk *parent) | |||
| 110 | return 0; | 110 | return 0; |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | static int sh_clk_div6_set_rate(struct clk *clk, | 113 | static int sh_clk_div6_set_rate(struct clk *clk, unsigned long rate) |
| 114 | unsigned long rate, int algo_id) | ||
| 115 | { | 114 | { |
| 116 | unsigned long value; | 115 | unsigned long value; |
| 117 | int idx; | 116 | int idx; |
| @@ -132,7 +131,7 @@ static int sh_clk_div6_enable(struct clk *clk) | |||
| 132 | unsigned long value; | 131 | unsigned long value; |
| 133 | int ret; | 132 | int ret; |
| 134 | 133 | ||
| 135 | ret = sh_clk_div6_set_rate(clk, clk->rate, 0); | 134 | ret = sh_clk_div6_set_rate(clk, clk->rate); |
| 136 | if (ret == 0) { | 135 | if (ret == 0) { |
| 137 | value = __raw_readl(clk->enable_reg); | 136 | value = __raw_readl(clk->enable_reg); |
| 138 | value &= ~0x100; /* clear stop bit to enable clock */ | 137 | value &= ~0x100; /* clear stop bit to enable clock */ |
| @@ -253,7 +252,7 @@ static int sh_clk_div4_set_parent(struct clk *clk, struct clk *parent) | |||
| 253 | return 0; | 252 | return 0; |
| 254 | } | 253 | } |
| 255 | 254 | ||
| 256 | static int sh_clk_div4_set_rate(struct clk *clk, unsigned long rate, int algo_id) | 255 | static int sh_clk_div4_set_rate(struct clk *clk, unsigned long rate) |
| 257 | { | 256 | { |
| 258 | struct clk_div4_table *d4t = clk->priv; | 257 | struct clk_div4_table *d4t = clk->priv; |
| 259 | unsigned long value; | 258 | unsigned long value; |
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c index eaa5d3efa79d..c556ed9db13d 100644 --- a/drivers/tty/sysrq.c +++ b/drivers/tty/sysrq.c | |||
| @@ -554,7 +554,7 @@ EXPORT_SYMBOL(handle_sysrq); | |||
| 554 | #ifdef CONFIG_INPUT | 554 | #ifdef CONFIG_INPUT |
| 555 | 555 | ||
| 556 | /* Simple translation table for the SysRq keys */ | 556 | /* Simple translation table for the SysRq keys */ |
| 557 | static const unsigned char sysrq_xlate[KEY_MAX + 1] = | 557 | static const unsigned char sysrq_xlate[KEY_CNT] = |
| 558 | "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */ | 558 | "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */ |
| 559 | "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */ | 559 | "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */ |
| 560 | "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */ | 560 | "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */ |
| @@ -563,53 +563,129 @@ static const unsigned char sysrq_xlate[KEY_MAX + 1] = | |||
| 563 | "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */ | 563 | "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */ |
| 564 | "\r\000/"; /* 0x60 - 0x6f */ | 564 | "\r\000/"; /* 0x60 - 0x6f */ |
| 565 | 565 | ||
| 566 | static bool sysrq_down; | 566 | struct sysrq_state { |
| 567 | static int sysrq_alt_use; | 567 | struct input_handle handle; |
| 568 | static int sysrq_alt; | 568 | struct work_struct reinject_work; |
| 569 | static DEFINE_SPINLOCK(sysrq_event_lock); | 569 | unsigned long key_down[BITS_TO_LONGS(KEY_CNT)]; |
| 570 | unsigned int alt; | ||
| 571 | unsigned int alt_use; | ||
| 572 | bool active; | ||
| 573 | bool need_reinject; | ||
| 574 | }; | ||
| 575 | |||
| 576 | static void sysrq_reinject_alt_sysrq(struct work_struct *work) | ||
| 577 | { | ||
| 578 | struct sysrq_state *sysrq = | ||
| 579 | container_of(work, struct sysrq_state, reinject_work); | ||
| 580 | struct input_handle *handle = &sysrq->handle; | ||
| 581 | unsigned int alt_code = sysrq->alt_use; | ||
| 582 | |||
| 583 | if (sysrq->need_reinject) { | ||
| 584 | /* Simulate press and release of Alt + SysRq */ | ||
| 585 | input_inject_event(handle, EV_KEY, alt_code, 1); | ||
| 586 | input_inject_event(handle, EV_KEY, KEY_SYSRQ, 1); | ||
| 587 | input_inject_event(handle, EV_SYN, SYN_REPORT, 1); | ||
| 588 | |||
| 589 | input_inject_event(handle, EV_KEY, KEY_SYSRQ, 0); | ||
| 590 | input_inject_event(handle, EV_KEY, alt_code, 0); | ||
| 591 | input_inject_event(handle, EV_SYN, SYN_REPORT, 1); | ||
| 592 | } | ||
| 593 | } | ||
| 570 | 594 | ||
| 571 | static bool sysrq_filter(struct input_handle *handle, unsigned int type, | 595 | static bool sysrq_filter(struct input_handle *handle, |
| 572 | unsigned int code, int value) | 596 | unsigned int type, unsigned int code, int value) |
| 573 | { | 597 | { |
| 598 | struct sysrq_state *sysrq = handle->private; | ||
| 599 | bool was_active = sysrq->active; | ||
| 574 | bool suppress; | 600 | bool suppress; |
| 575 | 601 | ||
| 576 | /* We are called with interrupts disabled, just take the lock */ | 602 | switch (type) { |
| 577 | spin_lock(&sysrq_event_lock); | ||
| 578 | 603 | ||
| 579 | if (type != EV_KEY) | 604 | case EV_SYN: |
| 580 | goto out; | 605 | suppress = false; |
| 606 | break; | ||
| 581 | 607 | ||
| 582 | switch (code) { | 608 | case EV_KEY: |
| 609 | switch (code) { | ||
| 583 | 610 | ||
| 584 | case KEY_LEFTALT: | 611 | case KEY_LEFTALT: |
| 585 | case KEY_RIGHTALT: | 612 | case KEY_RIGHTALT: |
| 586 | if (value) | 613 | if (!value) { |
| 587 | sysrq_alt = code; | 614 | /* One of ALTs is being released */ |
| 588 | else { | 615 | if (sysrq->active && code == sysrq->alt_use) |
| 589 | if (sysrq_down && code == sysrq_alt_use) | 616 | sysrq->active = false; |
| 590 | sysrq_down = false; | ||
| 591 | 617 | ||
| 592 | sysrq_alt = 0; | 618 | sysrq->alt = KEY_RESERVED; |
| 619 | |||
| 620 | } else if (value != 2) { | ||
| 621 | sysrq->alt = code; | ||
| 622 | sysrq->need_reinject = false; | ||
| 623 | } | ||
| 624 | break; | ||
| 625 | |||
| 626 | case KEY_SYSRQ: | ||
| 627 | if (value == 1 && sysrq->alt != KEY_RESERVED) { | ||
| 628 | sysrq->active = true; | ||
| 629 | sysrq->alt_use = sysrq->alt; | ||
| 630 | /* | ||
| 631 | * If nothing else will be pressed we'll need | ||
| 632 | * to * re-inject Alt-SysRq keysroke. | ||
| 633 | */ | ||
| 634 | sysrq->need_reinject = true; | ||
| 635 | } | ||
| 636 | |||
| 637 | /* | ||
| 638 | * Pretend that sysrq was never pressed at all. This | ||
| 639 | * is needed to properly handle KGDB which will try | ||
| 640 | * to release all keys after exiting debugger. If we | ||
| 641 | * do not clear key bit it KGDB will end up sending | ||
| 642 | * release events for Alt and SysRq, potentially | ||
| 643 | * triggering print screen function. | ||
| 644 | */ | ||
| 645 | if (sysrq->active) | ||
| 646 | clear_bit(KEY_SYSRQ, handle->dev->key); | ||
| 647 | |||
| 648 | break; | ||
| 649 | |||
| 650 | default: | ||
| 651 | if (sysrq->active && value && value != 2) { | ||
| 652 | sysrq->need_reinject = false; | ||
| 653 | __handle_sysrq(sysrq_xlate[code], true); | ||
| 654 | } | ||
| 655 | break; | ||
| 593 | } | 656 | } |
| 594 | break; | ||
| 595 | 657 | ||
| 596 | case KEY_SYSRQ: | 658 | suppress = sysrq->active; |
| 597 | if (value == 1 && sysrq_alt) { | 659 | |
| 598 | sysrq_down = true; | 660 | if (!sysrq->active) { |
| 599 | sysrq_alt_use = sysrq_alt; | 661 | /* |
| 662 | * If we are not suppressing key presses keep track of | ||
| 663 | * keyboard state so we can release keys that have been | ||
| 664 | * pressed before entering SysRq mode. | ||
| 665 | */ | ||
| 666 | if (value) | ||
| 667 | set_bit(code, sysrq->key_down); | ||
| 668 | else | ||
| 669 | clear_bit(code, sysrq->key_down); | ||
| 670 | |||
| 671 | if (was_active) | ||
| 672 | schedule_work(&sysrq->reinject_work); | ||
| 673 | |||
| 674 | } else if (value == 0 && | ||
| 675 | test_and_clear_bit(code, sysrq->key_down)) { | ||
| 676 | /* | ||
| 677 | * Pass on release events for keys that was pressed before | ||
| 678 | * entering SysRq mode. | ||
| 679 | */ | ||
| 680 | suppress = false; | ||
| 600 | } | 681 | } |
| 601 | break; | 682 | break; |
| 602 | 683 | ||
| 603 | default: | 684 | default: |
| 604 | if (sysrq_down && value && value != 2) | 685 | suppress = sysrq->active; |
| 605 | __handle_sysrq(sysrq_xlate[code], true); | ||
| 606 | break; | 686 | break; |
| 607 | } | 687 | } |
| 608 | 688 | ||
| 609 | out: | ||
| 610 | suppress = sysrq_down; | ||
| 611 | spin_unlock(&sysrq_event_lock); | ||
| 612 | |||
| 613 | return suppress; | 689 | return suppress; |
| 614 | } | 690 | } |
| 615 | 691 | ||
| @@ -617,28 +693,28 @@ static int sysrq_connect(struct input_handler *handler, | |||
| 617 | struct input_dev *dev, | 693 | struct input_dev *dev, |
| 618 | const struct input_device_id *id) | 694 | const struct input_device_id *id) |
| 619 | { | 695 | { |
| 620 | struct input_handle *handle; | 696 | struct sysrq_state *sysrq; |
| 621 | int error; | 697 | int error; |
| 622 | 698 | ||
| 623 | sysrq_down = false; | 699 | sysrq = kzalloc(sizeof(struct sysrq_state), GFP_KERNEL); |
| 624 | sysrq_alt = 0; | 700 | if (!sysrq) |
| 625 | |||
| 626 | handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL); | ||
| 627 | if (!handle) | ||
| 628 | return -ENOMEM; | 701 | return -ENOMEM; |
| 629 | 702 | ||
| 630 | handle->dev = dev; | 703 | INIT_WORK(&sysrq->reinject_work, sysrq_reinject_alt_sysrq); |
| 631 | handle->handler = handler; | 704 | |
| 632 | handle->name = "sysrq"; | 705 | sysrq->handle.dev = dev; |
| 706 | sysrq->handle.handler = handler; | ||
| 707 | sysrq->handle.name = "sysrq"; | ||
| 708 | sysrq->handle.private = sysrq; | ||
| 633 | 709 | ||
| 634 | error = input_register_handle(handle); | 710 | error = input_register_handle(&sysrq->handle); |
| 635 | if (error) { | 711 | if (error) { |
| 636 | pr_err("Failed to register input sysrq handler, error %d\n", | 712 | pr_err("Failed to register input sysrq handler, error %d\n", |
| 637 | error); | 713 | error); |
| 638 | goto err_free; | 714 | goto err_free; |
| 639 | } | 715 | } |
| 640 | 716 | ||
| 641 | error = input_open_device(handle); | 717 | error = input_open_device(&sysrq->handle); |
| 642 | if (error) { | 718 | if (error) { |
| 643 | pr_err("Failed to open input device, error %d\n", error); | 719 | pr_err("Failed to open input device, error %d\n", error); |
| 644 | goto err_unregister; | 720 | goto err_unregister; |
| @@ -647,17 +723,20 @@ static int sysrq_connect(struct input_handler *handler, | |||
| 647 | return 0; | 723 | return 0; |
| 648 | 724 | ||
| 649 | err_unregister: | 725 | err_unregister: |
| 650 | input_unregister_handle(handle); | 726 | input_unregister_handle(&sysrq->handle); |
| 651 | err_free: | 727 | err_free: |
| 652 | kfree(handle); | 728 | kfree(sysrq); |
| 653 | return error; | 729 | return error; |
| 654 | } | 730 | } |
| 655 | 731 | ||
| 656 | static void sysrq_disconnect(struct input_handle *handle) | 732 | static void sysrq_disconnect(struct input_handle *handle) |
| 657 | { | 733 | { |
| 734 | struct sysrq_state *sysrq = handle->private; | ||
| 735 | |||
| 658 | input_close_device(handle); | 736 | input_close_device(handle); |
| 737 | cancel_work_sync(&sysrq->reinject_work); | ||
| 659 | input_unregister_handle(handle); | 738 | input_unregister_handle(handle); |
| 660 | kfree(handle); | 739 | kfree(sysrq); |
| 661 | } | 740 | } |
| 662 | 741 | ||
| 663 | /* | 742 | /* |
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index ea071a5b6eee..44447f54942f 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
| @@ -2301,7 +2301,7 @@ out: | |||
| 2301 | return ret; | 2301 | return ret; |
| 2302 | } | 2302 | } |
| 2303 | 2303 | ||
| 2304 | static DEVICE_ATTR(stat_status, S_IWUGO | S_IRUGO, read_status, reboot); | 2304 | static DEVICE_ATTR(stat_status, S_IWUSR | S_IRUGO, read_status, reboot); |
| 2305 | 2305 | ||
| 2306 | static ssize_t read_human_status(struct device *dev, | 2306 | static ssize_t read_human_status(struct device *dev, |
| 2307 | struct device_attribute *attr, char *buf) | 2307 | struct device_attribute *attr, char *buf) |
| @@ -2364,8 +2364,7 @@ out: | |||
| 2364 | return ret; | 2364 | return ret; |
| 2365 | } | 2365 | } |
| 2366 | 2366 | ||
| 2367 | static DEVICE_ATTR(stat_human_status, S_IWUGO | S_IRUGO, | 2367 | static DEVICE_ATTR(stat_human_status, S_IRUGO, read_human_status, NULL); |
| 2368 | read_human_status, NULL); | ||
| 2369 | 2368 | ||
| 2370 | static ssize_t read_delin(struct device *dev, struct device_attribute *attr, | 2369 | static ssize_t read_delin(struct device *dev, struct device_attribute *attr, |
| 2371 | char *buf) | 2370 | char *buf) |
| @@ -2397,7 +2396,7 @@ out: | |||
| 2397 | return ret; | 2396 | return ret; |
| 2398 | } | 2397 | } |
| 2399 | 2398 | ||
| 2400 | static DEVICE_ATTR(stat_delin, S_IWUGO | S_IRUGO, read_delin, NULL); | 2399 | static DEVICE_ATTR(stat_delin, S_IRUGO, read_delin, NULL); |
| 2401 | 2400 | ||
| 2402 | #define UEA_ATTR(name, reset) \ | 2401 | #define UEA_ATTR(name, reset) \ |
| 2403 | \ | 2402 | \ |
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index b5e20e873cba..717ff653fa23 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
| @@ -2017,7 +2017,7 @@ static int __init usba_udc_probe(struct platform_device *pdev) | |||
| 2017 | } | 2017 | } |
| 2018 | } else { | 2018 | } else { |
| 2019 | /* gpio_request fail so use -EINVAL for gpio_is_valid */ | 2019 | /* gpio_request fail so use -EINVAL for gpio_is_valid */ |
| 2020 | ubc->vbus_pin = -EINVAL; | 2020 | udc->vbus_pin = -EINVAL; |
| 2021 | } | 2021 | } |
| 2022 | } | 2022 | } |
| 2023 | 2023 | ||
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c index 86afdc73322f..6e2599661b5b 100644 --- a/drivers/usb/host/ehci-dbg.c +++ b/drivers/usb/host/ehci-dbg.c | |||
| @@ -1067,7 +1067,7 @@ static inline void create_debug_files (struct ehci_hcd *ehci) | |||
| 1067 | &debug_registers_fops)) | 1067 | &debug_registers_fops)) |
| 1068 | goto file_error; | 1068 | goto file_error; |
| 1069 | 1069 | ||
| 1070 | if (!debugfs_create_file("lpm", S_IRUGO|S_IWUGO, ehci->debug_dir, bus, | 1070 | if (!debugfs_create_file("lpm", S_IRUGO|S_IWUSR, ehci->debug_dir, bus, |
| 1071 | &debug_lpm_fops)) | 1071 | &debug_lpm_fops)) |
| 1072 | goto file_error; | 1072 | goto file_error; |
| 1073 | 1073 | ||
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 502a7e6fef42..e9062806d4a2 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
| @@ -1063,10 +1063,11 @@ rescan: | |||
| 1063 | tmp && tmp != qh; | 1063 | tmp && tmp != qh; |
| 1064 | tmp = tmp->qh_next.qh) | 1064 | tmp = tmp->qh_next.qh) |
| 1065 | continue; | 1065 | continue; |
| 1066 | /* periodic qh self-unlinks on empty */ | 1066 | /* periodic qh self-unlinks on empty, and a COMPLETING qh |
| 1067 | if (!tmp) | 1067 | * may already be unlinked. |
| 1068 | goto nogood; | 1068 | */ |
| 1069 | unlink_async (ehci, qh); | 1069 | if (tmp) |
| 1070 | unlink_async(ehci, qh); | ||
| 1070 | /* FALL THROUGH */ | 1071 | /* FALL THROUGH */ |
| 1071 | case QH_STATE_UNLINK: /* wait for hw to finish? */ | 1072 | case QH_STATE_UNLINK: /* wait for hw to finish? */ |
| 1072 | case QH_STATE_UNLINK_WAIT: | 1073 | case QH_STATE_UNLINK_WAIT: |
| @@ -1083,7 +1084,6 @@ idle_timeout: | |||
| 1083 | } | 1084 | } |
| 1084 | /* else FALL THROUGH */ | 1085 | /* else FALL THROUGH */ |
| 1085 | default: | 1086 | default: |
| 1086 | nogood: | ||
| 1087 | /* caller was supposed to have unlinked any requests; | 1087 | /* caller was supposed to have unlinked any requests; |
| 1088 | * that's not our job. just leak this memory. | 1088 | * that's not our job. just leak this memory. |
| 1089 | */ | 1089 | */ |
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c index d36e4e75e08d..12f70c302b0b 100644 --- a/drivers/usb/host/ehci-mem.c +++ b/drivers/usb/host/ehci-mem.c | |||
| @@ -141,6 +141,10 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci) | |||
| 141 | qh_put (ehci->async); | 141 | qh_put (ehci->async); |
| 142 | ehci->async = NULL; | 142 | ehci->async = NULL; |
| 143 | 143 | ||
| 144 | if (ehci->dummy) | ||
| 145 | qh_put(ehci->dummy); | ||
| 146 | ehci->dummy = NULL; | ||
| 147 | |||
| 144 | /* DMA consistent memory and pools */ | 148 | /* DMA consistent memory and pools */ |
| 145 | if (ehci->qtd_pool) | 149 | if (ehci->qtd_pool) |
| 146 | dma_pool_destroy (ehci->qtd_pool); | 150 | dma_pool_destroy (ehci->qtd_pool); |
| @@ -227,8 +231,26 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags) | |||
| 227 | if (ehci->periodic == NULL) { | 231 | if (ehci->periodic == NULL) { |
| 228 | goto fail; | 232 | goto fail; |
| 229 | } | 233 | } |
| 230 | for (i = 0; i < ehci->periodic_size; i++) | 234 | |
| 231 | ehci->periodic [i] = EHCI_LIST_END(ehci); | 235 | if (ehci->use_dummy_qh) { |
| 236 | struct ehci_qh_hw *hw; | ||
| 237 | ehci->dummy = ehci_qh_alloc(ehci, flags); | ||
| 238 | if (!ehci->dummy) | ||
| 239 | goto fail; | ||
| 240 | |||
| 241 | hw = ehci->dummy->hw; | ||
| 242 | hw->hw_next = EHCI_LIST_END(ehci); | ||
| 243 | hw->hw_qtd_next = EHCI_LIST_END(ehci); | ||
| 244 | hw->hw_alt_next = EHCI_LIST_END(ehci); | ||
| 245 | hw->hw_token &= ~QTD_STS_ACTIVE; | ||
| 246 | ehci->dummy->hw = hw; | ||
| 247 | |||
| 248 | for (i = 0; i < ehci->periodic_size; i++) | ||
| 249 | ehci->periodic[i] = ehci->dummy->qh_dma; | ||
| 250 | } else { | ||
| 251 | for (i = 0; i < ehci->periodic_size; i++) | ||
| 252 | ehci->periodic[i] = EHCI_LIST_END(ehci); | ||
| 253 | } | ||
| 232 | 254 | ||
| 233 | /* software shadow of hardware table */ | 255 | /* software shadow of hardware table */ |
| 234 | ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags); | 256 | ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags); |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index a1e8d273103f..01bb72b71832 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
| @@ -103,6 +103,19 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
| 103 | if (retval) | 103 | if (retval) |
| 104 | return retval; | 104 | return retval; |
| 105 | 105 | ||
| 106 | if ((pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x7808) || | ||
| 107 | (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x4396)) { | ||
| 108 | /* EHCI controller on AMD SB700/SB800/Hudson-2/3 platforms may | ||
| 109 | * read/write memory space which does not belong to it when | ||
| 110 | * there is NULL pointer with T-bit set to 1 in the frame list | ||
| 111 | * table. To avoid the issue, the frame list link pointer | ||
| 112 | * should always contain a valid pointer to a inactive qh. | ||
| 113 | */ | ||
| 114 | ehci->use_dummy_qh = 1; | ||
| 115 | ehci_info(ehci, "applying AMD SB700/SB800/Hudson-2/3 EHCI " | ||
| 116 | "dummy qh workaround\n"); | ||
| 117 | } | ||
| 118 | |||
| 106 | /* data structure init */ | 119 | /* data structure init */ |
| 107 | retval = ehci_init(hcd); | 120 | retval = ehci_init(hcd); |
| 108 | if (retval) | 121 | if (retval) |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index a92526d6e5ae..d9f78eb26572 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
| @@ -98,7 +98,14 @@ static void periodic_unlink (struct ehci_hcd *ehci, unsigned frame, void *ptr) | |||
| 98 | */ | 98 | */ |
| 99 | *prev_p = *periodic_next_shadow(ehci, &here, | 99 | *prev_p = *periodic_next_shadow(ehci, &here, |
| 100 | Q_NEXT_TYPE(ehci, *hw_p)); | 100 | Q_NEXT_TYPE(ehci, *hw_p)); |
| 101 | *hw_p = *shadow_next_periodic(ehci, &here, Q_NEXT_TYPE(ehci, *hw_p)); | 101 | |
| 102 | if (!ehci->use_dummy_qh || | ||
| 103 | *shadow_next_periodic(ehci, &here, Q_NEXT_TYPE(ehci, *hw_p)) | ||
| 104 | != EHCI_LIST_END(ehci)) | ||
| 105 | *hw_p = *shadow_next_periodic(ehci, &here, | ||
| 106 | Q_NEXT_TYPE(ehci, *hw_p)); | ||
| 107 | else | ||
| 108 | *hw_p = ehci->dummy->qh_dma; | ||
| 102 | } | 109 | } |
| 103 | 110 | ||
| 104 | /* how many of the uframe's 125 usecs are allocated? */ | 111 | /* how many of the uframe's 125 usecs are allocated? */ |
| @@ -2335,7 +2342,11 @@ restart: | |||
| 2335 | * pointer for much longer, if at all. | 2342 | * pointer for much longer, if at all. |
| 2336 | */ | 2343 | */ |
| 2337 | *q_p = q.itd->itd_next; | 2344 | *q_p = q.itd->itd_next; |
| 2338 | *hw_p = q.itd->hw_next; | 2345 | if (!ehci->use_dummy_qh || |
| 2346 | q.itd->hw_next != EHCI_LIST_END(ehci)) | ||
| 2347 | *hw_p = q.itd->hw_next; | ||
| 2348 | else | ||
| 2349 | *hw_p = ehci->dummy->qh_dma; | ||
| 2339 | type = Q_NEXT_TYPE(ehci, q.itd->hw_next); | 2350 | type = Q_NEXT_TYPE(ehci, q.itd->hw_next); |
| 2340 | wmb(); | 2351 | wmb(); |
| 2341 | modified = itd_complete (ehci, q.itd); | 2352 | modified = itd_complete (ehci, q.itd); |
| @@ -2368,7 +2379,11 @@ restart: | |||
| 2368 | * URB completion. | 2379 | * URB completion. |
| 2369 | */ | 2380 | */ |
| 2370 | *q_p = q.sitd->sitd_next; | 2381 | *q_p = q.sitd->sitd_next; |
| 2371 | *hw_p = q.sitd->hw_next; | 2382 | if (!ehci->use_dummy_qh || |
| 2383 | q.sitd->hw_next != EHCI_LIST_END(ehci)) | ||
| 2384 | *hw_p = q.sitd->hw_next; | ||
| 2385 | else | ||
| 2386 | *hw_p = ehci->dummy->qh_dma; | ||
| 2372 | type = Q_NEXT_TYPE(ehci, q.sitd->hw_next); | 2387 | type = Q_NEXT_TYPE(ehci, q.sitd->hw_next); |
| 2373 | wmb(); | 2388 | wmb(); |
| 2374 | modified = sitd_complete (ehci, q.sitd); | 2389 | modified = sitd_complete (ehci, q.sitd); |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index bde823f704e9..ba8eab366b82 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
| @@ -73,6 +73,7 @@ struct ehci_hcd { /* one per controller */ | |||
| 73 | 73 | ||
| 74 | /* async schedule support */ | 74 | /* async schedule support */ |
| 75 | struct ehci_qh *async; | 75 | struct ehci_qh *async; |
| 76 | struct ehci_qh *dummy; /* For AMD quirk use */ | ||
| 76 | struct ehci_qh *reclaim; | 77 | struct ehci_qh *reclaim; |
| 77 | unsigned scanning : 1; | 78 | unsigned scanning : 1; |
| 78 | 79 | ||
| @@ -131,6 +132,7 @@ struct ehci_hcd { /* one per controller */ | |||
| 131 | unsigned need_io_watchdog:1; | 132 | unsigned need_io_watchdog:1; |
| 132 | unsigned broken_periodic:1; | 133 | unsigned broken_periodic:1; |
| 133 | unsigned fs_i_thresh:1; /* Intel iso scheduling */ | 134 | unsigned fs_i_thresh:1; /* Intel iso scheduling */ |
| 135 | unsigned use_dummy_qh:1; /* AMD Frame List table quirk*/ | ||
| 134 | 136 | ||
| 135 | /* required for usb32 quirk */ | 137 | /* required for usb32 quirk */ |
| 136 | #define OHCI_CTRL_HCFS (3 << 6) | 138 | #define OHCI_CTRL_HCFS (3 << 6) |
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 6c4fb4efb4bb..43a39eb56cc6 100644 --- a/drivers/usb/host/isp1362-hcd.c +++ b/drivers/usb/host/isp1362-hcd.c | |||
| @@ -2683,7 +2683,7 @@ static int __devexit isp1362_remove(struct platform_device *pdev) | |||
| 2683 | return 0; | 2683 | return 0; |
| 2684 | } | 2684 | } |
| 2685 | 2685 | ||
| 2686 | static int __init isp1362_probe(struct platform_device *pdev) | 2686 | static int __devinit isp1362_probe(struct platform_device *pdev) |
| 2687 | { | 2687 | { |
| 2688 | struct usb_hcd *hcd; | 2688 | struct usb_hcd *hcd; |
| 2689 | struct isp1362_hcd *isp1362_hcd; | 2689 | struct isp1362_hcd *isp1362_hcd; |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 202770676da3..d178761c3981 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
| @@ -1045,7 +1045,7 @@ static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci, | |||
| 1045 | if (udev->speed == USB_SPEED_SUPER) | 1045 | if (udev->speed == USB_SPEED_SUPER) |
| 1046 | return ep->ss_ep_comp.wBytesPerInterval; | 1046 | return ep->ss_ep_comp.wBytesPerInterval; |
| 1047 | 1047 | ||
| 1048 | max_packet = ep->desc.wMaxPacketSize & 0x3ff; | 1048 | max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize); |
| 1049 | max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11; | 1049 | max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11; |
| 1050 | /* A 0 in max burst means 1 transfer per ESIT */ | 1050 | /* A 0 in max burst means 1 transfer per ESIT */ |
| 1051 | return max_packet * (max_burst + 1); | 1051 | return max_packet * (max_burst + 1); |
| @@ -1135,7 +1135,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, | |||
| 1135 | /* Fall through */ | 1135 | /* Fall through */ |
| 1136 | case USB_SPEED_FULL: | 1136 | case USB_SPEED_FULL: |
| 1137 | case USB_SPEED_LOW: | 1137 | case USB_SPEED_LOW: |
| 1138 | max_packet = ep->desc.wMaxPacketSize & 0x3ff; | 1138 | max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize); |
| 1139 | ep_ctx->ep_info2 |= MAX_PACKET(max_packet); | 1139 | ep_ctx->ep_info2 |= MAX_PACKET(max_packet); |
| 1140 | break; | 1140 | break; |
| 1141 | default: | 1141 | default: |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 9f3115e729b1..df558f6f84e3 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -2104,7 +2104,6 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) | |||
| 2104 | 2104 | ||
| 2105 | if (!(status & STS_EINT)) { | 2105 | if (!(status & STS_EINT)) { |
| 2106 | spin_unlock(&xhci->lock); | 2106 | spin_unlock(&xhci->lock); |
| 2107 | xhci_warn(xhci, "Spurious interrupt.\n"); | ||
| 2108 | return IRQ_NONE; | 2107 | return IRQ_NONE; |
| 2109 | } | 2108 | } |
| 2110 | xhci_dbg(xhci, "op reg status = %08x\n", status); | 2109 | xhci_dbg(xhci, "op reg status = %08x\n", status); |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 5d7d4e951ea4..06fca0835b52 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
| @@ -577,6 +577,65 @@ static void xhci_restore_registers(struct xhci_hcd *xhci) | |||
| 577 | xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); | 577 | xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); |
| 578 | } | 578 | } |
| 579 | 579 | ||
| 580 | static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci) | ||
| 581 | { | ||
| 582 | u64 val_64; | ||
| 583 | |||
| 584 | /* step 2: initialize command ring buffer */ | ||
| 585 | val_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | ||
| 586 | val_64 = (val_64 & (u64) CMD_RING_RSVD_BITS) | | ||
| 587 | (xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg, | ||
| 588 | xhci->cmd_ring->dequeue) & | ||
| 589 | (u64) ~CMD_RING_RSVD_BITS) | | ||
| 590 | xhci->cmd_ring->cycle_state; | ||
| 591 | xhci_dbg(xhci, "// Setting command ring address to 0x%llx\n", | ||
| 592 | (long unsigned long) val_64); | ||
| 593 | xhci_write_64(xhci, val_64, &xhci->op_regs->cmd_ring); | ||
| 594 | } | ||
| 595 | |||
| 596 | /* | ||
| 597 | * The whole command ring must be cleared to zero when we suspend the host. | ||
| 598 | * | ||
| 599 | * The host doesn't save the command ring pointer in the suspend well, so we | ||
| 600 | * need to re-program it on resume. Unfortunately, the pointer must be 64-byte | ||
| 601 | * aligned, because of the reserved bits in the command ring dequeue pointer | ||
| 602 | * register. Therefore, we can't just set the dequeue pointer back in the | ||
| 603 | * middle of the ring (TRBs are 16-byte aligned). | ||
| 604 | */ | ||
| 605 | static void xhci_clear_command_ring(struct xhci_hcd *xhci) | ||
| 606 | { | ||
| 607 | struct xhci_ring *ring; | ||
| 608 | struct xhci_segment *seg; | ||
| 609 | |||
| 610 | ring = xhci->cmd_ring; | ||
| 611 | seg = ring->deq_seg; | ||
| 612 | do { | ||
| 613 | memset(seg->trbs, 0, SEGMENT_SIZE); | ||
| 614 | seg = seg->next; | ||
| 615 | } while (seg != ring->deq_seg); | ||
| 616 | |||
| 617 | /* Reset the software enqueue and dequeue pointers */ | ||
| 618 | ring->deq_seg = ring->first_seg; | ||
| 619 | ring->dequeue = ring->first_seg->trbs; | ||
| 620 | ring->enq_seg = ring->deq_seg; | ||
| 621 | ring->enqueue = ring->dequeue; | ||
| 622 | |||
| 623 | /* | ||
| 624 | * Ring is now zeroed, so the HW should look for change of ownership | ||
| 625 | * when the cycle bit is set to 1. | ||
| 626 | */ | ||
| 627 | ring->cycle_state = 1; | ||
| 628 | |||
| 629 | /* | ||
| 630 | * Reset the hardware dequeue pointer. | ||
| 631 | * Yes, this will need to be re-written after resume, but we're paranoid | ||
| 632 | * and want to make sure the hardware doesn't access bogus memory | ||
| 633 | * because, say, the BIOS or an SMI started the host without changing | ||
| 634 | * the command ring pointers. | ||
| 635 | */ | ||
| 636 | xhci_set_cmd_ring_deq(xhci); | ||
| 637 | } | ||
| 638 | |||
| 580 | /* | 639 | /* |
| 581 | * Stop HC (not bus-specific) | 640 | * Stop HC (not bus-specific) |
| 582 | * | 641 | * |
| @@ -604,6 +663,7 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
| 604 | spin_unlock_irq(&xhci->lock); | 663 | spin_unlock_irq(&xhci->lock); |
| 605 | return -ETIMEDOUT; | 664 | return -ETIMEDOUT; |
| 606 | } | 665 | } |
| 666 | xhci_clear_command_ring(xhci); | ||
| 607 | 667 | ||
| 608 | /* step 3: save registers */ | 668 | /* step 3: save registers */ |
| 609 | xhci_save_registers(xhci); | 669 | xhci_save_registers(xhci); |
| @@ -635,7 +695,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
| 635 | u32 command, temp = 0; | 695 | u32 command, temp = 0; |
| 636 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 696 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
| 637 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); | 697 | struct pci_dev *pdev = to_pci_dev(hcd->self.controller); |
| 638 | u64 val_64; | ||
| 639 | int old_state, retval; | 698 | int old_state, retval; |
| 640 | 699 | ||
| 641 | old_state = hcd->state; | 700 | old_state = hcd->state; |
| @@ -648,15 +707,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
| 648 | /* step 1: restore register */ | 707 | /* step 1: restore register */ |
| 649 | xhci_restore_registers(xhci); | 708 | xhci_restore_registers(xhci); |
| 650 | /* step 2: initialize command ring buffer */ | 709 | /* step 2: initialize command ring buffer */ |
| 651 | val_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); | 710 | xhci_set_cmd_ring_deq(xhci); |
| 652 | val_64 = (val_64 & (u64) CMD_RING_RSVD_BITS) | | ||
| 653 | (xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg, | ||
| 654 | xhci->cmd_ring->dequeue) & | ||
| 655 | (u64) ~CMD_RING_RSVD_BITS) | | ||
| 656 | xhci->cmd_ring->cycle_state; | ||
| 657 | xhci_dbg(xhci, "// Setting command ring address to 0x%llx\n", | ||
| 658 | (long unsigned long) val_64); | ||
| 659 | xhci_write_64(xhci, val_64, &xhci->op_regs->cmd_ring); | ||
| 660 | /* step 3: restore state and start state*/ | 711 | /* step 3: restore state and start state*/ |
| 661 | /* step 3: set CRS flag */ | 712 | /* step 3: set CRS flag */ |
| 662 | command = xhci_readl(xhci, &xhci->op_regs->command); | 713 | command = xhci_readl(xhci, &xhci->op_regs->command); |
| @@ -714,6 +765,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
| 714 | return retval; | 765 | return retval; |
| 715 | } | 766 | } |
| 716 | 767 | ||
| 768 | spin_unlock_irq(&xhci->lock); | ||
| 717 | /* Re-setup MSI-X */ | 769 | /* Re-setup MSI-X */ |
| 718 | if (hcd->irq) | 770 | if (hcd->irq) |
| 719 | free_irq(hcd->irq, hcd); | 771 | free_irq(hcd->irq, hcd); |
| @@ -736,6 +788,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
| 736 | hcd->irq = pdev->irq; | 788 | hcd->irq = pdev->irq; |
| 737 | } | 789 | } |
| 738 | 790 | ||
| 791 | spin_lock_irq(&xhci->lock); | ||
| 739 | /* step 4: set Run/Stop bit */ | 792 | /* step 4: set Run/Stop bit */ |
| 740 | command = xhci_readl(xhci, &xhci->op_regs->command); | 793 | command = xhci_readl(xhci, &xhci->op_regs->command); |
| 741 | command |= CMD_RUN; | 794 | command |= CMD_RUN; |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 93d3bf4d213c..85e65647d445 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
| @@ -621,6 +621,11 @@ struct xhci_ep_ctx { | |||
| 621 | #define MAX_PACKET_MASK (0xffff << 16) | 621 | #define MAX_PACKET_MASK (0xffff << 16) |
| 622 | #define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff) | 622 | #define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff) |
| 623 | 623 | ||
| 624 | /* Get max packet size from ep desc. Bit 10..0 specify the max packet size. | ||
| 625 | * USB2.0 spec 9.6.6. | ||
| 626 | */ | ||
| 627 | #define GET_MAX_PACKET(p) ((p) & 0x7ff) | ||
| 628 | |||
| 624 | /* tx_info bitmasks */ | 629 | /* tx_info bitmasks */ |
| 625 | #define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff) | 630 | #define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff) |
| 626 | #define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16) | 631 | #define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16) |
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c index 2f43c57743c9..9251773ecef4 100644 --- a/drivers/usb/misc/cypress_cy7c63.c +++ b/drivers/usb/misc/cypress_cy7c63.c | |||
| @@ -196,11 +196,9 @@ static ssize_t get_port1_handler(struct device *dev, | |||
| 196 | return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); | 196 | return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | static DEVICE_ATTR(port0, S_IWUGO | S_IRUGO, | 199 | static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR, get_port0_handler, set_port0_handler); |
| 200 | get_port0_handler, set_port0_handler); | ||
| 201 | 200 | ||
| 202 | static DEVICE_ATTR(port1, S_IWUGO | S_IRUGO, | 201 | static DEVICE_ATTR(port1, S_IRUGO | S_IWUSR, get_port1_handler, set_port1_handler); |
| 203 | get_port1_handler, set_port1_handler); | ||
| 204 | 202 | ||
| 205 | 203 | ||
| 206 | static int cypress_probe(struct usb_interface *interface, | 204 | static int cypress_probe(struct usb_interface *interface, |
diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c index d77aba46ae85..f63776a48e2a 100644 --- a/drivers/usb/misc/trancevibrator.c +++ b/drivers/usb/misc/trancevibrator.c | |||
| @@ -86,7 +86,7 @@ static ssize_t set_speed(struct device *dev, struct device_attribute *attr, | |||
| 86 | return count; | 86 | return count; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | static DEVICE_ATTR(speed, S_IWUGO | S_IRUGO, show_speed, set_speed); | 89 | static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR, show_speed, set_speed); |
| 90 | 90 | ||
| 91 | static int tv_probe(struct usb_interface *interface, | 91 | static int tv_probe(struct usb_interface *interface, |
| 92 | const struct usb_device_id *id) | 92 | const struct usb_device_id *id) |
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index 63da2c3c838f..c96f51de1696 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c | |||
| @@ -94,7 +94,7 @@ static ssize_t set_##value(struct device *dev, struct device_attribute *attr, co | |||
| 94 | change_color(led); \ | 94 | change_color(led); \ |
| 95 | return count; \ | 95 | return count; \ |
| 96 | } \ | 96 | } \ |
| 97 | static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); | 97 | static DEVICE_ATTR(value, S_IRUGO | S_IWUSR, show_##value, set_##value); |
| 98 | show_set(blue); | 98 | show_set(blue); |
| 99 | show_set(red); | 99 | show_set(red); |
| 100 | show_set(green); | 100 | show_set(green); |
diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c index de8ef945b536..417b8f207e8b 100644 --- a/drivers/usb/misc/usbsevseg.c +++ b/drivers/usb/misc/usbsevseg.c | |||
| @@ -192,7 +192,7 @@ static ssize_t set_attr_##name(struct device *dev, \ | |||
| 192 | \ | 192 | \ |
| 193 | return count; \ | 193 | return count; \ |
| 194 | } \ | 194 | } \ |
| 195 | static DEVICE_ATTR(name, S_IWUGO | S_IRUGO, show_attr_##name, set_attr_##name); | 195 | static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_attr_##name, set_attr_##name); |
| 196 | 196 | ||
| 197 | static ssize_t show_attr_text(struct device *dev, | 197 | static ssize_t show_attr_text(struct device *dev, |
| 198 | struct device_attribute *attr, char *buf) | 198 | struct device_attribute *attr, char *buf) |
| @@ -223,7 +223,7 @@ static ssize_t set_attr_text(struct device *dev, | |||
| 223 | return count; | 223 | return count; |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | static DEVICE_ATTR(text, S_IWUGO | S_IRUGO, show_attr_text, set_attr_text); | 226 | static DEVICE_ATTR(text, S_IRUGO | S_IWUSR, show_attr_text, set_attr_text); |
| 227 | 227 | ||
| 228 | static ssize_t show_attr_decimals(struct device *dev, | 228 | static ssize_t show_attr_decimals(struct device *dev, |
| 229 | struct device_attribute *attr, char *buf) | 229 | struct device_attribute *attr, char *buf) |
| @@ -272,8 +272,7 @@ static ssize_t set_attr_decimals(struct device *dev, | |||
| 272 | return count; | 272 | return count; |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | static DEVICE_ATTR(decimals, S_IWUGO | S_IRUGO, | 275 | static DEVICE_ATTR(decimals, S_IRUGO | S_IWUSR, show_attr_decimals, set_attr_decimals); |
| 276 | show_attr_decimals, set_attr_decimals); | ||
| 277 | 276 | ||
| 278 | static ssize_t show_attr_textmode(struct device *dev, | 277 | static ssize_t show_attr_textmode(struct device *dev, |
| 279 | struct device_attribute *attr, char *buf) | 278 | struct device_attribute *attr, char *buf) |
| @@ -319,8 +318,7 @@ static ssize_t set_attr_textmode(struct device *dev, | |||
| 319 | return -EINVAL; | 318 | return -EINVAL; |
| 320 | } | 319 | } |
| 321 | 320 | ||
| 322 | static DEVICE_ATTR(textmode, S_IWUGO | S_IRUGO, | 321 | static DEVICE_ATTR(textmode, S_IRUGO | S_IWUSR, show_attr_textmode, set_attr_textmode); |
| 323 | show_attr_textmode, set_attr_textmode); | ||
| 324 | 322 | ||
| 325 | 323 | ||
| 326 | MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered); | 324 | MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered); |
diff --git a/drivers/usb/otg/langwell_otg.c b/drivers/usb/otg/langwell_otg.c index bdc3ea66be69..9fea48264fa2 100644 --- a/drivers/usb/otg/langwell_otg.c +++ b/drivers/usb/otg/langwell_otg.c | |||
| @@ -1896,7 +1896,7 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr, | |||
| 1896 | } | 1896 | } |
| 1897 | return count; | 1897 | return count; |
| 1898 | } | 1898 | } |
| 1899 | static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUGO, get_a_bus_req, set_a_bus_req); | 1899 | static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUSR, get_a_bus_req, set_a_bus_req); |
| 1900 | 1900 | ||
| 1901 | static ssize_t | 1901 | static ssize_t |
| 1902 | get_a_bus_drop(struct device *dev, struct device_attribute *attr, char *buf) | 1902 | get_a_bus_drop(struct device *dev, struct device_attribute *attr, char *buf) |
| @@ -1942,8 +1942,7 @@ set_a_bus_drop(struct device *dev, struct device_attribute *attr, | |||
| 1942 | } | 1942 | } |
| 1943 | return count; | 1943 | return count; |
| 1944 | } | 1944 | } |
| 1945 | static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUGO, | 1945 | static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUSR, get_a_bus_drop, set_a_bus_drop); |
| 1946 | get_a_bus_drop, set_a_bus_drop); | ||
| 1947 | 1946 | ||
| 1948 | static ssize_t | 1947 | static ssize_t |
| 1949 | get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf) | 1948 | get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf) |
| @@ -1988,7 +1987,7 @@ set_b_bus_req(struct device *dev, struct device_attribute *attr, | |||
| 1988 | } | 1987 | } |
| 1989 | return count; | 1988 | return count; |
| 1990 | } | 1989 | } |
| 1991 | static DEVICE_ATTR(b_bus_req, S_IRUGO | S_IWUGO, get_b_bus_req, set_b_bus_req); | 1990 | static DEVICE_ATTR(b_bus_req, S_IRUGO | S_IWUSR, get_b_bus_req, set_b_bus_req); |
| 1992 | 1991 | ||
| 1993 | static ssize_t | 1992 | static ssize_t |
| 1994 | set_a_clr_err(struct device *dev, struct device_attribute *attr, | 1993 | set_a_clr_err(struct device *dev, struct device_attribute *attr, |
| @@ -2012,7 +2011,7 @@ set_a_clr_err(struct device *dev, struct device_attribute *attr, | |||
| 2012 | } | 2011 | } |
| 2013 | return count; | 2012 | return count; |
| 2014 | } | 2013 | } |
| 2015 | static DEVICE_ATTR(a_clr_err, S_IWUGO, NULL, set_a_clr_err); | 2014 | static DEVICE_ATTR(a_clr_err, S_IWUSR, NULL, set_a_clr_err); |
| 2016 | 2015 | ||
| 2017 | static struct attribute *inputs_attrs[] = { | 2016 | static struct attribute *inputs_attrs[] = { |
| 2018 | &dev_attr_a_bus_req.attr, | 2017 | &dev_attr_a_bus_req.attr, |
diff --git a/drivers/usb/storage/sierra_ms.c b/drivers/usb/storage/sierra_ms.c index 57fc2f532cab..ceba512f84d0 100644 --- a/drivers/usb/storage/sierra_ms.c +++ b/drivers/usb/storage/sierra_ms.c | |||
| @@ -121,7 +121,7 @@ static ssize_t show_truinst(struct device *dev, struct device_attribute *attr, | |||
| 121 | } | 121 | } |
| 122 | return result; | 122 | return result; |
| 123 | } | 123 | } |
| 124 | static DEVICE_ATTR(truinst, S_IWUGO | S_IRUGO, show_truinst, NULL); | 124 | static DEVICE_ATTR(truinst, S_IRUGO, show_truinst, NULL); |
| 125 | 125 | ||
| 126 | int sierra_ms_init(struct us_data *us) | 126 | int sierra_ms_init(struct us_data *us) |
| 127 | { | 127 | { |
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index e207810bba3c..08703299ef61 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
| @@ -197,12 +197,12 @@ static int backlight_suspend(struct device *dev, pm_message_t state) | |||
| 197 | { | 197 | { |
| 198 | struct backlight_device *bd = to_backlight_device(dev); | 198 | struct backlight_device *bd = to_backlight_device(dev); |
| 199 | 199 | ||
| 200 | if (bd->ops->options & BL_CORE_SUSPENDRESUME) { | 200 | mutex_lock(&bd->ops_lock); |
| 201 | mutex_lock(&bd->ops_lock); | 201 | if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { |
| 202 | bd->props.state |= BL_CORE_SUSPENDED; | 202 | bd->props.state |= BL_CORE_SUSPENDED; |
| 203 | backlight_update_status(bd); | 203 | backlight_update_status(bd); |
| 204 | mutex_unlock(&bd->ops_lock); | ||
| 205 | } | 204 | } |
| 205 | mutex_unlock(&bd->ops_lock); | ||
| 206 | 206 | ||
| 207 | return 0; | 207 | return 0; |
| 208 | } | 208 | } |
| @@ -211,12 +211,12 @@ static int backlight_resume(struct device *dev) | |||
| 211 | { | 211 | { |
| 212 | struct backlight_device *bd = to_backlight_device(dev); | 212 | struct backlight_device *bd = to_backlight_device(dev); |
| 213 | 213 | ||
| 214 | if (bd->ops->options & BL_CORE_SUSPENDRESUME) { | 214 | mutex_lock(&bd->ops_lock); |
| 215 | mutex_lock(&bd->ops_lock); | 215 | if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { |
| 216 | bd->props.state &= ~BL_CORE_SUSPENDED; | 216 | bd->props.state &= ~BL_CORE_SUSPENDED; |
| 217 | backlight_update_status(bd); | 217 | backlight_update_status(bd); |
| 218 | mutex_unlock(&bd->ops_lock); | ||
| 219 | } | 218 | } |
| 219 | mutex_unlock(&bd->ops_lock); | ||
| 220 | 220 | ||
| 221 | return 0; | 221 | return 0; |
| 222 | } | 222 | } |
diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c index f53b9f1d6aba..affdf3e32cf3 100644 --- a/drivers/video/fbcmap.c +++ b/drivers/video/fbcmap.c | |||
| @@ -88,34 +88,48 @@ static const struct fb_cmap default_16_colors = { | |||
| 88 | * | 88 | * |
| 89 | */ | 89 | */ |
| 90 | 90 | ||
| 91 | int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp) | 91 | int fb_alloc_cmap_gfp(struct fb_cmap *cmap, int len, int transp, gfp_t flags) |
| 92 | { | 92 | { |
| 93 | int size = len*sizeof(u16); | 93 | int size = len * sizeof(u16); |
| 94 | 94 | int ret = -ENOMEM; | |
| 95 | if (cmap->len != len) { | 95 | |
| 96 | fb_dealloc_cmap(cmap); | 96 | if (cmap->len != len) { |
| 97 | if (!len) | 97 | fb_dealloc_cmap(cmap); |
| 98 | return 0; | 98 | if (!len) |
| 99 | if (!(cmap->red = kmalloc(size, GFP_ATOMIC))) | 99 | return 0; |
| 100 | goto fail; | 100 | |
| 101 | if (!(cmap->green = kmalloc(size, GFP_ATOMIC))) | 101 | cmap->red = kmalloc(size, flags); |
| 102 | goto fail; | 102 | if (!cmap->red) |
| 103 | if (!(cmap->blue = kmalloc(size, GFP_ATOMIC))) | 103 | goto fail; |
| 104 | goto fail; | 104 | cmap->green = kmalloc(size, flags); |
| 105 | if (transp) { | 105 | if (!cmap->green) |
| 106 | if (!(cmap->transp = kmalloc(size, GFP_ATOMIC))) | 106 | goto fail; |
| 107 | cmap->blue = kmalloc(size, flags); | ||
| 108 | if (!cmap->blue) | ||
| 109 | goto fail; | ||
| 110 | if (transp) { | ||
| 111 | cmap->transp = kmalloc(size, flags); | ||
| 112 | if (!cmap->transp) | ||
| 113 | goto fail; | ||
| 114 | } else { | ||
| 115 | cmap->transp = NULL; | ||
| 116 | } | ||
| 117 | } | ||
| 118 | cmap->start = 0; | ||
| 119 | cmap->len = len; | ||
| 120 | ret = fb_copy_cmap(fb_default_cmap(len), cmap); | ||
| 121 | if (ret) | ||
| 107 | goto fail; | 122 | goto fail; |
| 108 | } else | 123 | return 0; |
| 109 | cmap->transp = NULL; | ||
| 110 | } | ||
| 111 | cmap->start = 0; | ||
| 112 | cmap->len = len; | ||
| 113 | fb_copy_cmap(fb_default_cmap(len), cmap); | ||
| 114 | return 0; | ||
| 115 | 124 | ||
| 116 | fail: | 125 | fail: |
| 117 | fb_dealloc_cmap(cmap); | 126 | fb_dealloc_cmap(cmap); |
| 118 | return -ENOMEM; | 127 | return ret; |
| 128 | } | ||
| 129 | |||
| 130 | int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp) | ||
| 131 | { | ||
| 132 | return fb_alloc_cmap_gfp(cmap, len, transp, GFP_ATOMIC); | ||
| 119 | } | 133 | } |
| 120 | 134 | ||
| 121 | /** | 135 | /** |
| @@ -250,8 +264,12 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) | |||
| 250 | int rc, size = cmap->len * sizeof(u16); | 264 | int rc, size = cmap->len * sizeof(u16); |
| 251 | struct fb_cmap umap; | 265 | struct fb_cmap umap; |
| 252 | 266 | ||
| 267 | if (size < 0 || size < cmap->len) | ||
| 268 | return -E2BIG; | ||
| 269 | |||
| 253 | memset(&umap, 0, sizeof(struct fb_cmap)); | 270 | memset(&umap, 0, sizeof(struct fb_cmap)); |
| 254 | rc = fb_alloc_cmap(&umap, cmap->len, cmap->transp != NULL); | 271 | rc = fb_alloc_cmap_gfp(&umap, cmap->len, cmap->transp != NULL, |
| 272 | GFP_KERNEL); | ||
| 255 | if (rc) | 273 | if (rc) |
| 256 | return rc; | 274 | return rc; |
| 257 | if (copy_from_user(umap.red, cmap->red, size) || | 275 | if (copy_from_user(umap.red, cmap->red, size) || |
diff --git a/drivers/video/geode/lxfb_ops.c b/drivers/video/geode/lxfb_ops.c index bc35a95e59d4..85ec7f64c42a 100644 --- a/drivers/video/geode/lxfb_ops.c +++ b/drivers/video/geode/lxfb_ops.c | |||
| @@ -276,10 +276,10 @@ static void lx_graphics_enable(struct fb_info *info) | |||
| 276 | write_fp(par, FP_PT1, 0); | 276 | write_fp(par, FP_PT1, 0); |
| 277 | temp = FP_PT2_SCRC; | 277 | temp = FP_PT2_SCRC; |
| 278 | 278 | ||
| 279 | if (info->var.sync & FB_SYNC_HOR_HIGH_ACT) | 279 | if (!(info->var.sync & FB_SYNC_HOR_HIGH_ACT)) |
| 280 | temp |= FP_PT2_HSP; | 280 | temp |= FP_PT2_HSP; |
| 281 | 281 | ||
| 282 | if (info->var.sync & FB_SYNC_VERT_HIGH_ACT) | 282 | if (!(info->var.sync & FB_SYNC_VERT_HIGH_ACT)) |
| 283 | temp |= FP_PT2_VSP; | 283 | temp |= FP_PT2_VSP; |
| 284 | 284 | ||
| 285 | write_fp(par, FP_PT2, temp); | 285 | write_fp(par, FP_PT2, temp); |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 9b1364723c65..b02d97a879d6 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
| @@ -860,7 +860,7 @@ static void sh_mobile_fb_reconfig(struct fb_info *info) | |||
| 860 | /* Couldn't reconfigure, hopefully, can continue as before */ | 860 | /* Couldn't reconfigure, hopefully, can continue as before */ |
| 861 | return; | 861 | return; |
| 862 | 862 | ||
| 863 | info->fix.line_length = mode2.xres * (ch->cfg.bpp / 8); | 863 | info->fix.line_length = mode1.xres * (ch->cfg.bpp / 8); |
| 864 | 864 | ||
| 865 | /* | 865 | /* |
| 866 | * fb_set_var() calls the notifier change internally, only if | 866 | * fb_set_var() calls the notifier change internally, only if |
| @@ -868,7 +868,7 @@ static void sh_mobile_fb_reconfig(struct fb_info *info) | |||
| 868 | * user event, we have to call the chain ourselves. | 868 | * user event, we have to call the chain ourselves. |
| 869 | */ | 869 | */ |
| 870 | event.info = info; | 870 | event.info = info; |
| 871 | event.data = &mode2; | 871 | event.data = &mode1; |
| 872 | fb_notifier_call_chain(evnt, &event); | 872 | fb_notifier_call_chain(evnt, &event); |
| 873 | } | 873 | } |
| 874 | 874 | ||
diff --git a/drivers/video/sis/init.c b/drivers/video/sis/init.c index c311ad3c3687..31137adc8fba 100644 --- a/drivers/video/sis/init.c +++ b/drivers/video/sis/init.c | |||
| @@ -62,11 +62,11 @@ | |||
| 62 | 62 | ||
| 63 | #include "init.h" | 63 | #include "init.h" |
| 64 | 64 | ||
| 65 | #ifdef SIS300 | 65 | #ifdef CONFIG_FB_SIS_300 |
| 66 | #include "300vtbl.h" | 66 | #include "300vtbl.h" |
| 67 | #endif | 67 | #endif |
| 68 | 68 | ||
| 69 | #ifdef SIS315H | 69 | #ifdef CONFIG_FB_SIS_315 |
| 70 | #include "310vtbl.h" | 70 | #include "310vtbl.h" |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| @@ -78,7 +78,7 @@ | |||
| 78 | /* POINTER INITIALIZATION */ | 78 | /* POINTER INITIALIZATION */ |
| 79 | /*********************************************/ | 79 | /*********************************************/ |
| 80 | 80 | ||
| 81 | #if defined(SIS300) || defined(SIS315H) | 81 | #if defined(CONFIG_FB_SIS_300) || defined(CONFIG_FB_SIS_315) |
| 82 | static void | 82 | static void |
| 83 | InitCommonPointer(struct SiS_Private *SiS_Pr) | 83 | InitCommonPointer(struct SiS_Private *SiS_Pr) |
| 84 | { | 84 | { |
| @@ -160,7 +160,7 @@ InitCommonPointer(struct SiS_Private *SiS_Pr) | |||
| 160 | } | 160 | } |
| 161 | #endif | 161 | #endif |
| 162 | 162 | ||
| 163 | #ifdef SIS300 | 163 | #ifdef CONFIG_FB_SIS_300 |
| 164 | static void | 164 | static void |
| 165 | InitTo300Pointer(struct SiS_Private *SiS_Pr) | 165 | InitTo300Pointer(struct SiS_Private *SiS_Pr) |
| 166 | { | 166 | { |
| @@ -237,7 +237,7 @@ InitTo300Pointer(struct SiS_Private *SiS_Pr) | |||
| 237 | } | 237 | } |
| 238 | #endif | 238 | #endif |
| 239 | 239 | ||
| 240 | #ifdef SIS315H | 240 | #ifdef CONFIG_FB_SIS_315 |
| 241 | static void | 241 | static void |
| 242 | InitTo310Pointer(struct SiS_Private *SiS_Pr) | 242 | InitTo310Pointer(struct SiS_Private *SiS_Pr) |
| 243 | { | 243 | { |
| @@ -321,13 +321,13 @@ bool | |||
| 321 | SiSInitPtr(struct SiS_Private *SiS_Pr) | 321 | SiSInitPtr(struct SiS_Private *SiS_Pr) |
| 322 | { | 322 | { |
| 323 | if(SiS_Pr->ChipType < SIS_315H) { | 323 | if(SiS_Pr->ChipType < SIS_315H) { |
| 324 | #ifdef SIS300 | 324 | #ifdef CONFIG_FB_SIS_300 |
| 325 | InitTo300Pointer(SiS_Pr); | 325 | InitTo300Pointer(SiS_Pr); |
| 326 | #else | 326 | #else |
| 327 | return false; | 327 | return false; |
| 328 | #endif | 328 | #endif |
| 329 | } else { | 329 | } else { |
| 330 | #ifdef SIS315H | 330 | #ifdef CONFIG_FB_SIS_315 |
| 331 | InitTo310Pointer(SiS_Pr); | 331 | InitTo310Pointer(SiS_Pr); |
| 332 | #else | 332 | #else |
| 333 | return false; | 333 | return false; |
| @@ -340,9 +340,7 @@ SiSInitPtr(struct SiS_Private *SiS_Pr) | |||
| 340 | /* HELPER: Get ModeID */ | 340 | /* HELPER: Get ModeID */ |
| 341 | /*********************************************/ | 341 | /*********************************************/ |
| 342 | 342 | ||
| 343 | #ifndef SIS_XORG_XF86 | ||
| 344 | static | 343 | static |
| 345 | #endif | ||
| 346 | unsigned short | 344 | unsigned short |
| 347 | SiS_GetModeID(int VGAEngine, unsigned int VBFlags, int HDisplay, int VDisplay, | 345 | SiS_GetModeID(int VGAEngine, unsigned int VBFlags, int HDisplay, int VDisplay, |
| 348 | int Depth, bool FSTN, int LCDwidth, int LCDheight) | 346 | int Depth, bool FSTN, int LCDwidth, int LCDheight) |
| @@ -884,51 +882,51 @@ SiS_GetModeID_VGA2(int VGAEngine, unsigned int VBFlags, int HDisplay, int VDispl | |||
| 884 | void | 882 | void |
| 885 | SiS_SetReg(SISIOADDRESS port, unsigned short index, unsigned short data) | 883 | SiS_SetReg(SISIOADDRESS port, unsigned short index, unsigned short data) |
| 886 | { | 884 | { |
| 887 | OutPortByte(port, index); | 885 | outb((u8)index, port); |
| 888 | OutPortByte(port + 1, data); | 886 | outb((u8)data, port + 1); |
| 889 | } | 887 | } |
| 890 | 888 | ||
| 891 | void | 889 | void |
| 892 | SiS_SetRegByte(SISIOADDRESS port, unsigned short data) | 890 | SiS_SetRegByte(SISIOADDRESS port, unsigned short data) |
| 893 | { | 891 | { |
| 894 | OutPortByte(port, data); | 892 | outb((u8)data, port); |
| 895 | } | 893 | } |
| 896 | 894 | ||
| 897 | void | 895 | void |
| 898 | SiS_SetRegShort(SISIOADDRESS port, unsigned short data) | 896 | SiS_SetRegShort(SISIOADDRESS port, unsigned short data) |
| 899 | { | 897 | { |
| 900 | OutPortWord(port, data); | 898 | outw((u16)data, port); |
| 901 | } | 899 | } |
| 902 | 900 | ||
| 903 | void | 901 | void |
| 904 | SiS_SetRegLong(SISIOADDRESS port, unsigned int data) | 902 | SiS_SetRegLong(SISIOADDRESS port, unsigned int data) |
| 905 | { | 903 | { |
| 906 | OutPortLong(port, data); | 904 | outl((u32)data, port); |
| 907 | } | 905 | } |
| 908 | 906 | ||
| 909 | unsigned char | 907 | unsigned char |
| 910 | SiS_GetReg(SISIOADDRESS port, unsigned short index) | 908 | SiS_GetReg(SISIOADDRESS port, unsigned short index) |
| 911 | { | 909 | { |
| 912 | OutPortByte(port, index); | 910 | outb((u8)index, port); |
| 913 | return(InPortByte(port + 1)); | 911 | return inb(port + 1); |
| 914 | } | 912 | } |
| 915 | 913 | ||
| 916 | unsigned char | 914 | unsigned char |
| 917 | SiS_GetRegByte(SISIOADDRESS port) | 915 | SiS_GetRegByte(SISIOADDRESS port) |
| 918 | { | 916 | { |
| 919 | return(InPortByte(port)); | 917 | return inb(port); |
| 920 | } | 918 | } |
| 921 | 919 | ||
| 922 | unsigned short | 920 | unsigned short |
| 923 | SiS_GetRegShort(SISIOADDRESS port) | 921 | SiS_GetRegShort(SISIOADDRESS port) |
| 924 | { | 922 | { |
| 925 | return(InPortWord(port)); | 923 | return inw(port); |
| 926 | } | 924 | } |
| 927 | 925 | ||
| 928 | unsigned int | 926 | unsigned int |
| 929 | SiS_GetRegLong(SISIOADDRESS port) | 927 | SiS_GetRegLong(SISIOADDRESS port) |
| 930 | { | 928 | { |
| 931 | return(InPortLong(port)); | 929 | return inl(port); |
| 932 | } | 930 | } |
| 933 | 931 | ||
| 934 | void | 932 | void |
| @@ -1089,7 +1087,7 @@ static void | |||
| 1089 | SiSInitPCIetc(struct SiS_Private *SiS_Pr) | 1087 | SiSInitPCIetc(struct SiS_Private *SiS_Pr) |
| 1090 | { | 1088 | { |
| 1091 | switch(SiS_Pr->ChipType) { | 1089 | switch(SiS_Pr->ChipType) { |
| 1092 | #ifdef SIS300 | 1090 | #ifdef CONFIG_FB_SIS_300 |
| 1093 | case SIS_300: | 1091 | case SIS_300: |
| 1094 | case SIS_540: | 1092 | case SIS_540: |
| 1095 | case SIS_630: | 1093 | case SIS_630: |
| @@ -1108,7 +1106,7 @@ SiSInitPCIetc(struct SiS_Private *SiS_Pr) | |||
| 1108 | SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x5A); | 1106 | SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x5A); |
| 1109 | break; | 1107 | break; |
| 1110 | #endif | 1108 | #endif |
| 1111 | #ifdef SIS315H | 1109 | #ifdef CONFIG_FB_SIS_315 |
| 1112 | case SIS_315H: | 1110 | case SIS_315H: |
| 1113 | case SIS_315: | 1111 | case SIS_315: |
| 1114 | case SIS_315PRO: | 1112 | case SIS_315PRO: |
| @@ -1152,9 +1150,7 @@ SiSInitPCIetc(struct SiS_Private *SiS_Pr) | |||
| 1152 | /* HELPER: SetLVDSetc */ | 1150 | /* HELPER: SetLVDSetc */ |
| 1153 | /*********************************************/ | 1151 | /*********************************************/ |
| 1154 | 1152 | ||
| 1155 | #ifdef SIS_LINUX_KERNEL | ||
| 1156 | static | 1153 | static |
| 1157 | #endif | ||
| 1158 | void | 1154 | void |
| 1159 | SiSSetLVDSetc(struct SiS_Private *SiS_Pr) | 1155 | SiSSetLVDSetc(struct SiS_Private *SiS_Pr) |
| 1160 | { | 1156 | { |
| @@ -1174,7 +1170,7 @@ SiSSetLVDSetc(struct SiS_Private *SiS_Pr) | |||
| 1174 | if((temp == 1) || (temp == 2)) return; | 1170 | if((temp == 1) || (temp == 2)) return; |
| 1175 | 1171 | ||
| 1176 | switch(SiS_Pr->ChipType) { | 1172 | switch(SiS_Pr->ChipType) { |
| 1177 | #ifdef SIS300 | 1173 | #ifdef CONFIG_FB_SIS_300 |
| 1178 | case SIS_540: | 1174 | case SIS_540: |
| 1179 | case SIS_630: | 1175 | case SIS_630: |
| 1180 | case SIS_730: | 1176 | case SIS_730: |
| @@ -1188,7 +1184,7 @@ SiSSetLVDSetc(struct SiS_Private *SiS_Pr) | |||
| 1188 | } | 1184 | } |
| 1189 | break; | 1185 | break; |
| 1190 | #endif | 1186 | #endif |
| 1191 | #ifdef SIS315H | 1187 | #ifdef CONFIG_FB_SIS_315 |
| 1192 | case SIS_550: | 1188 | case SIS_550: |
| 1193 | case SIS_650: | 1189 | case SIS_650: |
| 1194 | case SIS_740: | 1190 | case SIS_740: |
| @@ -1420,9 +1416,7 @@ SiS_ResetSegmentRegisters(struct SiS_Private *SiS_Pr) | |||
| 1420 | /* HELPER: GetVBType */ | 1416 | /* HELPER: GetVBType */ |
| 1421 | /*********************************************/ | 1417 | /*********************************************/ |
| 1422 | 1418 | ||
| 1423 | #ifdef SIS_LINUX_KERNEL | ||
| 1424 | static | 1419 | static |
| 1425 | #endif | ||
| 1426 | void | 1420 | void |
| 1427 | SiS_GetVBType(struct SiS_Private *SiS_Pr) | 1421 | SiS_GetVBType(struct SiS_Private *SiS_Pr) |
| 1428 | { | 1422 | { |
| @@ -1487,7 +1481,6 @@ SiS_GetVBType(struct SiS_Private *SiS_Pr) | |||
| 1487 | /* HELPER: Check RAM size */ | 1481 | /* HELPER: Check RAM size */ |
| 1488 | /*********************************************/ | 1482 | /*********************************************/ |
| 1489 | 1483 | ||
| 1490 | #ifdef SIS_LINUX_KERNEL | ||
| 1491 | static bool | 1484 | static bool |
| 1492 | SiS_CheckMemorySize(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | 1485 | SiS_CheckMemorySize(struct SiS_Private *SiS_Pr, unsigned short ModeNo, |
| 1493 | unsigned short ModeIdIndex) | 1486 | unsigned short ModeIdIndex) |
| @@ -1501,13 +1494,12 @@ SiS_CheckMemorySize(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 1501 | if(AdapterMemSize < memorysize) return false; | 1494 | if(AdapterMemSize < memorysize) return false; |
| 1502 | return true; | 1495 | return true; |
| 1503 | } | 1496 | } |
| 1504 | #endif | ||
| 1505 | 1497 | ||
| 1506 | /*********************************************/ | 1498 | /*********************************************/ |
| 1507 | /* HELPER: Get DRAM type */ | 1499 | /* HELPER: Get DRAM type */ |
| 1508 | /*********************************************/ | 1500 | /*********************************************/ |
| 1509 | 1501 | ||
| 1510 | #ifdef SIS315H | 1502 | #ifdef CONFIG_FB_SIS_315 |
| 1511 | static unsigned char | 1503 | static unsigned char |
| 1512 | SiS_Get310DRAMType(struct SiS_Private *SiS_Pr) | 1504 | SiS_Get310DRAMType(struct SiS_Private *SiS_Pr) |
| 1513 | { | 1505 | { |
| @@ -1574,7 +1566,6 @@ SiS_GetMCLK(struct SiS_Private *SiS_Pr) | |||
| 1574 | /* HELPER: ClearBuffer */ | 1566 | /* HELPER: ClearBuffer */ |
| 1575 | /*********************************************/ | 1567 | /*********************************************/ |
| 1576 | 1568 | ||
| 1577 | #ifdef SIS_LINUX_KERNEL | ||
| 1578 | static void | 1569 | static void |
| 1579 | SiS_ClearBuffer(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | 1570 | SiS_ClearBuffer(struct SiS_Private *SiS_Pr, unsigned short ModeNo) |
| 1580 | { | 1571 | { |
| @@ -1587,7 +1578,7 @@ SiS_ClearBuffer(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | |||
| 1587 | 1578 | ||
| 1588 | if(SiS_Pr->SiS_ModeType >= ModeEGA) { | 1579 | if(SiS_Pr->SiS_ModeType >= ModeEGA) { |
| 1589 | if(ModeNo > 0x13) { | 1580 | if(ModeNo > 0x13) { |
| 1590 | SiS_SetMemory(memaddr, memsize, 0); | 1581 | memset_io(memaddr, 0, memsize); |
| 1591 | } else { | 1582 | } else { |
| 1592 | pBuffer = (unsigned short SISIOMEMTYPE *)memaddr; | 1583 | pBuffer = (unsigned short SISIOMEMTYPE *)memaddr; |
| 1593 | for(i = 0; i < 0x4000; i++) writew(0x0000, &pBuffer[i]); | 1584 | for(i = 0; i < 0x4000; i++) writew(0x0000, &pBuffer[i]); |
| @@ -1596,10 +1587,9 @@ SiS_ClearBuffer(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | |||
| 1596 | pBuffer = (unsigned short SISIOMEMTYPE *)memaddr; | 1587 | pBuffer = (unsigned short SISIOMEMTYPE *)memaddr; |
| 1597 | for(i = 0; i < 0x4000; i++) writew(0x0720, &pBuffer[i]); | 1588 | for(i = 0; i < 0x4000; i++) writew(0x0720, &pBuffer[i]); |
| 1598 | } else { | 1589 | } else { |
| 1599 | SiS_SetMemory(memaddr, 0x8000, 0); | 1590 | memset_io(memaddr, 0, 0x8000); |
| 1600 | } | 1591 | } |
| 1601 | } | 1592 | } |
| 1602 | #endif | ||
| 1603 | 1593 | ||
| 1604 | /*********************************************/ | 1594 | /*********************************************/ |
| 1605 | /* HELPER: SearchModeID */ | 1595 | /* HELPER: SearchModeID */ |
| @@ -2132,7 +2122,7 @@ SiS_SetCRT1CRTC(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 2132 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x14,0x4F); | 2122 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x14,0x4F); |
| 2133 | } | 2123 | } |
| 2134 | 2124 | ||
| 2135 | #ifdef SIS315H | 2125 | #ifdef CONFIG_FB_SIS_315 |
| 2136 | if(SiS_Pr->ChipType == XGI_20) { | 2126 | if(SiS_Pr->ChipType == XGI_20) { |
| 2137 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x04,crt1data[4] - 1); | 2127 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x04,crt1data[4] - 1); |
| 2138 | if(!(temp = crt1data[5] & 0x1f)) { | 2128 | if(!(temp = crt1data[5] & 0x1f)) { |
| @@ -2215,7 +2205,7 @@ SiS_SetCRT1VCLK(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 2215 | SiS_SetReg(SiS_Pr->SiS_P3c4,0x2c,clkb); | 2205 | SiS_SetReg(SiS_Pr->SiS_P3c4,0x2c,clkb); |
| 2216 | 2206 | ||
| 2217 | if(SiS_Pr->ChipType >= SIS_315H) { | 2207 | if(SiS_Pr->ChipType >= SIS_315H) { |
| 2218 | #ifdef SIS315H | 2208 | #ifdef CONFIG_FB_SIS_315 |
| 2219 | SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x01); | 2209 | SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x01); |
| 2220 | if(SiS_Pr->ChipType == XGI_20) { | 2210 | if(SiS_Pr->ChipType == XGI_20) { |
| 2221 | unsigned short mf = SiS_GetModeFlag(SiS_Pr, ModeNo, ModeIdIndex); | 2211 | unsigned short mf = SiS_GetModeFlag(SiS_Pr, ModeNo, ModeIdIndex); |
| @@ -2236,7 +2226,7 @@ SiS_SetCRT1VCLK(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 2236 | /* FIFO */ | 2226 | /* FIFO */ |
| 2237 | /*********************************************/ | 2227 | /*********************************************/ |
| 2238 | 2228 | ||
| 2239 | #ifdef SIS300 | 2229 | #ifdef CONFIG_FB_SIS_300 |
| 2240 | void | 2230 | void |
| 2241 | SiS_GetFIFOThresholdIndex300(struct SiS_Private *SiS_Pr, unsigned short *idx1, | 2231 | SiS_GetFIFOThresholdIndex300(struct SiS_Private *SiS_Pr, unsigned short *idx1, |
| 2242 | unsigned short *idx2) | 2232 | unsigned short *idx2) |
| @@ -2506,11 +2496,7 @@ SiS_SetCRT1FIFO_630(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 2506 | SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x09,0x80,data); | 2496 | SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x09,0x80,data); |
| 2507 | 2497 | ||
| 2508 | /* Write foreground and background queue */ | 2498 | /* Write foreground and background queue */ |
| 2509 | #ifdef SIS_LINUX_KERNEL | ||
| 2510 | templ = sisfb_read_nbridge_pci_dword(SiS_Pr, 0x50); | 2499 | templ = sisfb_read_nbridge_pci_dword(SiS_Pr, 0x50); |
| 2511 | #else | ||
| 2512 | templ = pciReadLong(0x00000000, 0x50); | ||
| 2513 | #endif | ||
| 2514 | 2500 | ||
| 2515 | if(SiS_Pr->ChipType == SIS_730) { | 2501 | if(SiS_Pr->ChipType == SIS_730) { |
| 2516 | 2502 | ||
| @@ -2530,13 +2516,8 @@ SiS_SetCRT1FIFO_630(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 2530 | 2516 | ||
| 2531 | } | 2517 | } |
| 2532 | 2518 | ||
| 2533 | #ifdef SIS_LINUX_KERNEL | ||
| 2534 | sisfb_write_nbridge_pci_dword(SiS_Pr, 0x50, templ); | 2519 | sisfb_write_nbridge_pci_dword(SiS_Pr, 0x50, templ); |
| 2535 | templ = sisfb_read_nbridge_pci_dword(SiS_Pr, 0xA0); | 2520 | templ = sisfb_read_nbridge_pci_dword(SiS_Pr, 0xA0); |
| 2536 | #else | ||
| 2537 | pciWriteLong(0x00000000, 0x50, templ); | ||
| 2538 | templ = pciReadLong(0x00000000, 0xA0); | ||
| 2539 | #endif | ||
| 2540 | 2521 | ||
| 2541 | /* GUI grant timer (PCI config 0xA3) */ | 2522 | /* GUI grant timer (PCI config 0xA3) */ |
| 2542 | if(SiS_Pr->ChipType == SIS_730) { | 2523 | if(SiS_Pr->ChipType == SIS_730) { |
| @@ -2552,15 +2533,11 @@ SiS_SetCRT1FIFO_630(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 2552 | 2533 | ||
| 2553 | } | 2534 | } |
| 2554 | 2535 | ||
| 2555 | #ifdef SIS_LINUX_KERNEL | ||
| 2556 | sisfb_write_nbridge_pci_dword(SiS_Pr, 0xA0, templ); | 2536 | sisfb_write_nbridge_pci_dword(SiS_Pr, 0xA0, templ); |
| 2557 | #else | ||
| 2558 | pciWriteLong(0x00000000, 0xA0, templ); | ||
| 2559 | #endif | ||
| 2560 | } | 2537 | } |
| 2561 | #endif /* SIS300 */ | 2538 | #endif /* CONFIG_FB_SIS_300 */ |
| 2562 | 2539 | ||
| 2563 | #ifdef SIS315H | 2540 | #ifdef CONFIG_FB_SIS_315 |
| 2564 | static void | 2541 | static void |
| 2565 | SiS_SetCRT1FIFO_310(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex) | 2542 | SiS_SetCRT1FIFO_310(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex) |
| 2566 | { | 2543 | { |
| @@ -2612,7 +2589,7 @@ SiS_SetVCLKState(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 2612 | } | 2589 | } |
| 2613 | 2590 | ||
| 2614 | if(SiS_Pr->ChipType < SIS_315H) { | 2591 | if(SiS_Pr->ChipType < SIS_315H) { |
| 2615 | #ifdef SIS300 | 2592 | #ifdef CONFIG_FB_SIS_300 |
| 2616 | if(VCLK > 150) data |= 0x80; | 2593 | if(VCLK > 150) data |= 0x80; |
| 2617 | SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0x7B,data); | 2594 | SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0x7B,data); |
| 2618 | 2595 | ||
| @@ -2621,7 +2598,7 @@ SiS_SetVCLKState(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 2621 | SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xF7,data); | 2598 | SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xF7,data); |
| 2622 | #endif | 2599 | #endif |
| 2623 | } else if(SiS_Pr->ChipType < XGI_20) { | 2600 | } else if(SiS_Pr->ChipType < XGI_20) { |
| 2624 | #ifdef SIS315H | 2601 | #ifdef CONFIG_FB_SIS_315 |
| 2625 | if(VCLK >= 166) data |= 0x0c; | 2602 | if(VCLK >= 166) data |= 0x0c; |
| 2626 | SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xf3,data); | 2603 | SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xf3,data); |
| 2627 | 2604 | ||
| @@ -2630,7 +2607,7 @@ SiS_SetVCLKState(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 2630 | } | 2607 | } |
| 2631 | #endif | 2608 | #endif |
| 2632 | } else { | 2609 | } else { |
| 2633 | #ifdef SIS315H | 2610 | #ifdef CONFIG_FB_SIS_315 |
| 2634 | if(VCLK >= 200) data |= 0x0c; | 2611 | if(VCLK >= 200) data |= 0x0c; |
| 2635 | if(SiS_Pr->ChipType == XGI_20) data &= ~0x04; | 2612 | if(SiS_Pr->ChipType == XGI_20) data &= ~0x04; |
| 2636 | SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xf3,data); | 2613 | SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xf3,data); |
| @@ -2675,7 +2652,7 @@ SiS_SetCRT1ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 2675 | unsigned short ModeIdIndex, unsigned short RRTI) | 2652 | unsigned short ModeIdIndex, unsigned short RRTI) |
| 2676 | { | 2653 | { |
| 2677 | unsigned short data, infoflag = 0, modeflag, resindex; | 2654 | unsigned short data, infoflag = 0, modeflag, resindex; |
| 2678 | #ifdef SIS315H | 2655 | #ifdef CONFIG_FB_SIS_315 |
| 2679 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; | 2656 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; |
| 2680 | unsigned short data2, data3; | 2657 | unsigned short data2, data3; |
| 2681 | #endif | 2658 | #endif |
| @@ -2736,7 +2713,7 @@ SiS_SetCRT1ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 2736 | SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xB7,data); | 2713 | SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xB7,data); |
| 2737 | } | 2714 | } |
| 2738 | 2715 | ||
| 2739 | #ifdef SIS315H | 2716 | #ifdef CONFIG_FB_SIS_315 |
| 2740 | if(SiS_Pr->ChipType >= SIS_315H) { | 2717 | if(SiS_Pr->ChipType >= SIS_315H) { |
| 2741 | SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xfb); | 2718 | SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xfb); |
| 2742 | } | 2719 | } |
| @@ -2826,7 +2803,7 @@ SiS_SetCRT1ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 2826 | 2803 | ||
| 2827 | SiS_SetVCLKState(SiS_Pr, ModeNo, RRTI, ModeIdIndex); | 2804 | SiS_SetVCLKState(SiS_Pr, ModeNo, RRTI, ModeIdIndex); |
| 2828 | 2805 | ||
| 2829 | #ifdef SIS315H | 2806 | #ifdef CONFIG_FB_SIS_315 |
| 2830 | if(((SiS_Pr->ChipType >= SIS_315H) && (SiS_Pr->ChipType < SIS_661)) || | 2807 | if(((SiS_Pr->ChipType >= SIS_315H) && (SiS_Pr->ChipType < SIS_661)) || |
| 2831 | (SiS_Pr->ChipType == XGI_40)) { | 2808 | (SiS_Pr->ChipType == XGI_40)) { |
| 2832 | if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & 0x40) { | 2809 | if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & 0x40) { |
| @@ -2845,7 +2822,7 @@ SiS_SetCRT1ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 2845 | #endif | 2822 | #endif |
| 2846 | } | 2823 | } |
| 2847 | 2824 | ||
| 2848 | #ifdef SIS315H | 2825 | #ifdef CONFIG_FB_SIS_315 |
| 2849 | static void | 2826 | static void |
| 2850 | SiS_SetupDualChip(struct SiS_Private *SiS_Pr) | 2827 | SiS_SetupDualChip(struct SiS_Private *SiS_Pr) |
| 2851 | { | 2828 | { |
| @@ -2999,11 +2976,6 @@ SiS_SetCRT1Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned sho | |||
| 2999 | SiS_Pr->SiS_SelectCRT2Rate = 0; | 2976 | SiS_Pr->SiS_SelectCRT2Rate = 0; |
| 3000 | SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2); | 2977 | SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2); |
| 3001 | 2978 | ||
| 3002 | #ifdef SIS_XORG_XF86 | ||
| 3003 | xf86DrvMsgVerb(0, X_PROBED, 4, "(init: VBType=0x%04x, VBInfo=0x%04x)\n", | ||
| 3004 | SiS_Pr->SiS_VBType, SiS_Pr->SiS_VBInfo); | ||
| 3005 | #endif | ||
| 3006 | |||
| 3007 | if(SiS_Pr->SiS_VBInfo & SetSimuScanMode) { | 2979 | if(SiS_Pr->SiS_VBInfo & SetSimuScanMode) { |
| 3008 | if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { | 2980 | if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { |
| 3009 | SiS_Pr->SiS_SetFlag |= ProgrammingCRT2; | 2981 | SiS_Pr->SiS_SetFlag |= ProgrammingCRT2; |
| @@ -3028,7 +3000,7 @@ SiS_SetCRT1Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned sho | |||
| 3028 | } | 3000 | } |
| 3029 | 3001 | ||
| 3030 | switch(SiS_Pr->ChipType) { | 3002 | switch(SiS_Pr->ChipType) { |
| 3031 | #ifdef SIS300 | 3003 | #ifdef CONFIG_FB_SIS_300 |
| 3032 | case SIS_300: | 3004 | case SIS_300: |
| 3033 | SiS_SetCRT1FIFO_300(SiS_Pr, ModeNo, RefreshRateTableIndex); | 3005 | SiS_SetCRT1FIFO_300(SiS_Pr, ModeNo, RefreshRateTableIndex); |
| 3034 | break; | 3006 | break; |
| @@ -3039,7 +3011,7 @@ SiS_SetCRT1Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned sho | |||
| 3039 | break; | 3011 | break; |
| 3040 | #endif | 3012 | #endif |
| 3041 | default: | 3013 | default: |
| 3042 | #ifdef SIS315H | 3014 | #ifdef CONFIG_FB_SIS_315 |
| 3043 | if(SiS_Pr->ChipType == XGI_20) { | 3015 | if(SiS_Pr->ChipType == XGI_20) { |
| 3044 | unsigned char sr2b = 0, sr2c = 0; | 3016 | unsigned char sr2b = 0, sr2c = 0; |
| 3045 | switch(ModeNo) { | 3017 | switch(ModeNo) { |
| @@ -3062,7 +3034,7 @@ SiS_SetCRT1Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned sho | |||
| 3062 | 3034 | ||
| 3063 | SiS_SetCRT1ModeRegs(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); | 3035 | SiS_SetCRT1ModeRegs(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); |
| 3064 | 3036 | ||
| 3065 | #ifdef SIS315H | 3037 | #ifdef CONFIG_FB_SIS_315 |
| 3066 | if(SiS_Pr->ChipType == XGI_40) { | 3038 | if(SiS_Pr->ChipType == XGI_40) { |
| 3067 | SiS_SetupDualChip(SiS_Pr); | 3039 | SiS_SetupDualChip(SiS_Pr); |
| 3068 | } | 3040 | } |
| @@ -3070,11 +3042,9 @@ SiS_SetCRT1Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned sho | |||
| 3070 | 3042 | ||
| 3071 | SiS_LoadDAC(SiS_Pr, ModeNo, ModeIdIndex); | 3043 | SiS_LoadDAC(SiS_Pr, ModeNo, ModeIdIndex); |
| 3072 | 3044 | ||
| 3073 | #ifdef SIS_LINUX_KERNEL | ||
| 3074 | if(SiS_Pr->SiS_flag_clearbuffer) { | 3045 | if(SiS_Pr->SiS_flag_clearbuffer) { |
| 3075 | SiS_ClearBuffer(SiS_Pr, ModeNo); | 3046 | SiS_ClearBuffer(SiS_Pr, ModeNo); |
| 3076 | } | 3047 | } |
| 3077 | #endif | ||
| 3078 | 3048 | ||
| 3079 | if(!(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchCRT2 | SetCRT2ToLCDA))) { | 3049 | if(!(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchCRT2 | SetCRT2ToLCDA))) { |
| 3080 | SiS_WaitRetrace1(SiS_Pr); | 3050 | SiS_WaitRetrace1(SiS_Pr); |
| @@ -3104,7 +3074,7 @@ SiS_InitVB(struct SiS_Private *SiS_Pr) | |||
| 3104 | static void | 3074 | static void |
| 3105 | SiS_ResetVB(struct SiS_Private *SiS_Pr) | 3075 | SiS_ResetVB(struct SiS_Private *SiS_Pr) |
| 3106 | { | 3076 | { |
| 3107 | #ifdef SIS315H | 3077 | #ifdef CONFIG_FB_SIS_315 |
| 3108 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; | 3078 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; |
| 3109 | unsigned short temp; | 3079 | unsigned short temp; |
| 3110 | 3080 | ||
| @@ -3139,7 +3109,7 @@ SiS_StrangeStuff(struct SiS_Private *SiS_Pr) | |||
| 3139 | * which locks CRT2 in some way to CRT1 timing. Disable | 3109 | * which locks CRT2 in some way to CRT1 timing. Disable |
| 3140 | * this here. | 3110 | * this here. |
| 3141 | */ | 3111 | */ |
| 3142 | #ifdef SIS315H | 3112 | #ifdef CONFIG_FB_SIS_315 |
| 3143 | if((IS_SIS651) || (IS_SISM650) || | 3113 | if((IS_SIS651) || (IS_SISM650) || |
| 3144 | SiS_Pr->ChipType == SIS_340 || | 3114 | SiS_Pr->ChipType == SIS_340 || |
| 3145 | SiS_Pr->ChipType == XGI_40) { | 3115 | SiS_Pr->ChipType == XGI_40) { |
| @@ -3160,7 +3130,7 @@ SiS_StrangeStuff(struct SiS_Private *SiS_Pr) | |||
| 3160 | static void | 3130 | static void |
| 3161 | SiS_Handle760(struct SiS_Private *SiS_Pr) | 3131 | SiS_Handle760(struct SiS_Private *SiS_Pr) |
| 3162 | { | 3132 | { |
| 3163 | #ifdef SIS315H | 3133 | #ifdef CONFIG_FB_SIS_315 |
| 3164 | unsigned int somebase; | 3134 | unsigned int somebase; |
| 3165 | unsigned char temp1, temp2, temp3; | 3135 | unsigned char temp1, temp2, temp3; |
| 3166 | 3136 | ||
| @@ -3170,11 +3140,7 @@ SiS_Handle760(struct SiS_Private *SiS_Pr) | |||
| 3170 | (!(SiS_Pr->SiS_SysFlags & SF_760UMA)) ) | 3140 | (!(SiS_Pr->SiS_SysFlags & SF_760UMA)) ) |
| 3171 | return; | 3141 | return; |
| 3172 | 3142 | ||
| 3173 | #ifdef SIS_LINUX_KERNEL | ||
| 3174 | somebase = sisfb_read_mio_pci_word(SiS_Pr, 0x74); | 3143 | somebase = sisfb_read_mio_pci_word(SiS_Pr, 0x74); |
| 3175 | #else | ||
| 3176 | somebase = pciReadWord(0x00001000, 0x74); | ||
| 3177 | #endif | ||
| 3178 | somebase &= 0xffff; | 3144 | somebase &= 0xffff; |
| 3179 | 3145 | ||
| 3180 | if(somebase == 0) return; | 3146 | if(somebase == 0) return; |
| @@ -3190,105 +3156,34 @@ SiS_Handle760(struct SiS_Private *SiS_Pr) | |||
| 3190 | temp2 = 0x0b; | 3156 | temp2 = 0x0b; |
| 3191 | } | 3157 | } |
| 3192 | 3158 | ||
| 3193 | #ifdef SIS_LINUX_KERNEL | ||
| 3194 | sisfb_write_nbridge_pci_byte(SiS_Pr, 0x7e, temp1); | 3159 | sisfb_write_nbridge_pci_byte(SiS_Pr, 0x7e, temp1); |
| 3195 | sisfb_write_nbridge_pci_byte(SiS_Pr, 0x8d, temp2); | 3160 | sisfb_write_nbridge_pci_byte(SiS_Pr, 0x8d, temp2); |
| 3196 | #else | ||
| 3197 | pciWriteByte(0x00000000, 0x7e, temp1); | ||
| 3198 | pciWriteByte(0x00000000, 0x8d, temp2); | ||
| 3199 | #endif | ||
| 3200 | 3161 | ||
| 3201 | SiS_SetRegByte((somebase + 0x85), temp3); | 3162 | SiS_SetRegByte((somebase + 0x85), temp3); |
| 3202 | #endif | 3163 | #endif |
| 3203 | } | 3164 | } |
| 3204 | 3165 | ||
| 3205 | /*********************************************/ | 3166 | /*********************************************/ |
| 3206 | /* X.org/XFree86: SET SCREEN PITCH */ | ||
| 3207 | /*********************************************/ | ||
| 3208 | |||
| 3209 | #ifdef SIS_XORG_XF86 | ||
| 3210 | static void | ||
| 3211 | SiS_SetPitchCRT1(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn) | ||
| 3212 | { | ||
| 3213 | SISPtr pSiS = SISPTR(pScrn); | ||
| 3214 | unsigned short HDisplay = pSiS->scrnPitch >> 3; | ||
| 3215 | |||
| 3216 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x13,(HDisplay & 0xFF)); | ||
| 3217 | SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0xF0,(HDisplay >> 8)); | ||
| 3218 | } | ||
| 3219 | |||
| 3220 | static void | ||
| 3221 | SiS_SetPitchCRT2(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn) | ||
| 3222 | { | ||
| 3223 | SISPtr pSiS = SISPTR(pScrn); | ||
| 3224 | unsigned short HDisplay = pSiS->scrnPitch2 >> 3; | ||
| 3225 | |||
| 3226 | /* Unlock CRT2 */ | ||
| 3227 | if(pSiS->VGAEngine == SIS_315_VGA) | ||
| 3228 | SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2F, 0x01); | ||
| 3229 | else | ||
| 3230 | SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x24, 0x01); | ||
| 3231 | |||
| 3232 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x07,(HDisplay & 0xFF)); | ||
| 3233 | SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0xF0,(HDisplay >> 8)); | ||
| 3234 | } | ||
| 3235 | |||
| 3236 | static void | ||
| 3237 | SiS_SetPitch(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn) | ||
| 3238 | { | ||
| 3239 | SISPtr pSiS = SISPTR(pScrn); | ||
| 3240 | bool isslavemode = false; | ||
| 3241 | |||
| 3242 | if( (pSiS->VBFlags2 & VB2_VIDEOBRIDGE) && | ||
| 3243 | ( ((pSiS->VGAEngine == SIS_300_VGA) && | ||
| 3244 | (SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0xa0) == 0x20) || | ||
| 3245 | ((pSiS->VGAEngine == SIS_315_VGA) && | ||
| 3246 | (SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x50) == 0x10) ) ) { | ||
| 3247 | isslavemode = true; | ||
| 3248 | } | ||
| 3249 | |||
| 3250 | /* We need to set pitch for CRT1 if bridge is in slave mode, too */ | ||
| 3251 | if((pSiS->VBFlags & DISPTYPE_DISP1) || (isslavemode)) { | ||
| 3252 | SiS_SetPitchCRT1(SiS_Pr, pScrn); | ||
| 3253 | } | ||
| 3254 | /* We must not set the pitch for CRT2 if bridge is in slave mode */ | ||
| 3255 | if((pSiS->VBFlags & DISPTYPE_DISP2) && (!isslavemode)) { | ||
| 3256 | SiS_SetPitchCRT2(SiS_Pr, pScrn); | ||
| 3257 | } | ||
| 3258 | } | ||
| 3259 | #endif | ||
| 3260 | |||
| 3261 | /*********************************************/ | ||
| 3262 | /* SiSSetMode() */ | 3167 | /* SiSSetMode() */ |
| 3263 | /*********************************************/ | 3168 | /*********************************************/ |
| 3264 | 3169 | ||
| 3265 | #ifdef SIS_XORG_XF86 | ||
| 3266 | /* We need pScrn for setting the pitch correctly */ | ||
| 3267 | bool | ||
| 3268 | SiSSetMode(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, unsigned short ModeNo, bool dosetpitch) | ||
| 3269 | #else | ||
| 3270 | bool | 3170 | bool |
| 3271 | SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | 3171 | SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo) |
| 3272 | #endif | ||
| 3273 | { | 3172 | { |
| 3274 | SISIOADDRESS BaseAddr = SiS_Pr->IOAddress; | 3173 | SISIOADDRESS BaseAddr = SiS_Pr->IOAddress; |
| 3275 | unsigned short RealModeNo, ModeIdIndex; | 3174 | unsigned short RealModeNo, ModeIdIndex; |
| 3276 | unsigned char backupreg = 0; | 3175 | unsigned char backupreg = 0; |
| 3277 | #ifdef SIS_LINUX_KERNEL | ||
| 3278 | unsigned short KeepLockReg; | 3176 | unsigned short KeepLockReg; |
| 3279 | 3177 | ||
| 3280 | SiS_Pr->UseCustomMode = false; | 3178 | SiS_Pr->UseCustomMode = false; |
| 3281 | SiS_Pr->CRT1UsesCustomMode = false; | 3179 | SiS_Pr->CRT1UsesCustomMode = false; |
| 3282 | #endif | ||
| 3283 | 3180 | ||
| 3284 | SiS_Pr->SiS_flag_clearbuffer = 0; | 3181 | SiS_Pr->SiS_flag_clearbuffer = 0; |
| 3285 | 3182 | ||
| 3286 | if(SiS_Pr->UseCustomMode) { | 3183 | if(SiS_Pr->UseCustomMode) { |
| 3287 | ModeNo = 0xfe; | 3184 | ModeNo = 0xfe; |
| 3288 | } else { | 3185 | } else { |
| 3289 | #ifdef SIS_LINUX_KERNEL | ||
| 3290 | if(!(ModeNo & 0x80)) SiS_Pr->SiS_flag_clearbuffer = 1; | 3186 | if(!(ModeNo & 0x80)) SiS_Pr->SiS_flag_clearbuffer = 1; |
| 3291 | #endif | ||
| 3292 | ModeNo &= 0x7f; | 3187 | ModeNo &= 0x7f; |
| 3293 | } | 3188 | } |
| 3294 | 3189 | ||
| @@ -3301,13 +3196,8 @@ SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | |||
| 3301 | SiS_GetSysFlags(SiS_Pr); | 3196 | SiS_GetSysFlags(SiS_Pr); |
| 3302 | 3197 | ||
| 3303 | SiS_Pr->SiS_VGAINFO = 0x11; | 3198 | SiS_Pr->SiS_VGAINFO = 0x11; |
| 3304 | #if defined(SIS_XORG_XF86) && (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__) || defined(__amd64__) || defined(__x86_64__)) | ||
| 3305 | if(pScrn) SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); | ||
| 3306 | #endif | ||
| 3307 | 3199 | ||
| 3308 | #ifdef SIS_LINUX_KERNEL | ||
| 3309 | KeepLockReg = SiS_GetReg(SiS_Pr->SiS_P3c4,0x05); | 3200 | KeepLockReg = SiS_GetReg(SiS_Pr->SiS_P3c4,0x05); |
| 3310 | #endif | ||
| 3311 | SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86); | 3201 | SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86); |
| 3312 | 3202 | ||
| 3313 | SiSInitPCIetc(SiS_Pr); | 3203 | SiSInitPCIetc(SiS_Pr); |
| @@ -3344,12 +3234,10 @@ SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | |||
| 3344 | SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex); | 3234 | SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex); |
| 3345 | SiS_SetLowModeTest(SiS_Pr, ModeNo); | 3235 | SiS_SetLowModeTest(SiS_Pr, ModeNo); |
| 3346 | 3236 | ||
| 3347 | #ifdef SIS_LINUX_KERNEL | ||
| 3348 | /* Check memory size (kernel framebuffer driver only) */ | 3237 | /* Check memory size (kernel framebuffer driver only) */ |
| 3349 | if(!SiS_CheckMemorySize(SiS_Pr, ModeNo, ModeIdIndex)) { | 3238 | if(!SiS_CheckMemorySize(SiS_Pr, ModeNo, ModeIdIndex)) { |
| 3350 | return false; | 3239 | return false; |
| 3351 | } | 3240 | } |
| 3352 | #endif | ||
| 3353 | 3241 | ||
| 3354 | SiS_OpenCRTC(SiS_Pr); | 3242 | SiS_OpenCRTC(SiS_Pr); |
| 3355 | 3243 | ||
| @@ -3384,7 +3272,7 @@ SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | |||
| 3384 | SiS_DisplayOn(SiS_Pr); | 3272 | SiS_DisplayOn(SiS_Pr); |
| 3385 | SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xFF); | 3273 | SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xFF); |
| 3386 | 3274 | ||
| 3387 | #ifdef SIS315H | 3275 | #ifdef CONFIG_FB_SIS_315 |
| 3388 | if(SiS_Pr->ChipType >= SIS_315H) { | 3276 | if(SiS_Pr->ChipType >= SIS_315H) { |
| 3389 | if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { | 3277 | if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { |
| 3390 | if(!(SiS_IsDualEdge(SiS_Pr))) { | 3278 | if(!(SiS_IsDualEdge(SiS_Pr))) { |
| @@ -3396,7 +3284,7 @@ SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | |||
| 3396 | 3284 | ||
| 3397 | if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { | 3285 | if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { |
| 3398 | if(SiS_Pr->ChipType >= SIS_315H) { | 3286 | if(SiS_Pr->ChipType >= SIS_315H) { |
| 3399 | #ifdef SIS315H | 3287 | #ifdef CONFIG_FB_SIS_315 |
| 3400 | if(!SiS_Pr->SiS_ROMNew) { | 3288 | if(!SiS_Pr->SiS_ROMNew) { |
| 3401 | if(SiS_IsVAMode(SiS_Pr)) { | 3289 | if(SiS_IsVAMode(SiS_Pr)) { |
| 3402 | SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); | 3290 | SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); |
| @@ -3424,424 +3312,16 @@ SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | |||
| 3424 | } | 3312 | } |
| 3425 | } | 3313 | } |
| 3426 | 3314 | ||
| 3427 | #ifdef SIS_XORG_XF86 | ||
| 3428 | if(pScrn) { | ||
| 3429 | /* SetPitch: Adapt to virtual size & position */ | ||
| 3430 | if((ModeNo > 0x13) && (dosetpitch)) { | ||
| 3431 | SiS_SetPitch(SiS_Pr, pScrn); | ||
| 3432 | } | ||
| 3433 | |||
| 3434 | /* Backup/Set ModeNo in BIOS scratch area */ | ||
| 3435 | SiS_GetSetModeID(pScrn, ModeNo); | ||
| 3436 | } | ||
| 3437 | #endif | ||
| 3438 | |||
| 3439 | SiS_CloseCRTC(SiS_Pr); | 3315 | SiS_CloseCRTC(SiS_Pr); |
| 3440 | 3316 | ||
| 3441 | SiS_Handle760(SiS_Pr); | 3317 | SiS_Handle760(SiS_Pr); |
| 3442 | 3318 | ||
| 3443 | #ifdef SIS_LINUX_KERNEL | ||
| 3444 | /* We never lock registers in XF86 */ | 3319 | /* We never lock registers in XF86 */ |
| 3445 | if(KeepLockReg != 0xA1) SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x00); | 3320 | if(KeepLockReg != 0xA1) SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x00); |
| 3446 | #endif | ||
| 3447 | 3321 | ||
| 3448 | return true; | 3322 | return true; |
| 3449 | } | 3323 | } |
| 3450 | 3324 | ||
| 3451 | /*********************************************/ | ||
| 3452 | /* X.org/XFree86: SiSBIOSSetMode() */ | ||
| 3453 | /* for non-Dual-Head mode */ | ||
| 3454 | /*********************************************/ | ||
| 3455 | |||
| 3456 | #ifdef SIS_XORG_XF86 | ||
| 3457 | bool | ||
| 3458 | SiSBIOSSetMode(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, | ||
| 3459 | DisplayModePtr mode, bool IsCustom) | ||
| 3460 | { | ||
| 3461 | SISPtr pSiS = SISPTR(pScrn); | ||
| 3462 | unsigned short ModeNo = 0; | ||
| 3463 | |||
| 3464 | SiS_Pr->UseCustomMode = false; | ||
| 3465 | |||
| 3466 | if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) { | ||
| 3467 | |||
| 3468 | xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting custom mode %dx%d\n", | ||
| 3469 | SiS_Pr->CHDisplay, | ||
| 3470 | (mode->Flags & V_INTERLACE ? SiS_Pr->CVDisplay * 2 : | ||
| 3471 | (mode->Flags & V_DBLSCAN ? SiS_Pr->CVDisplay / 2 : | ||
| 3472 | SiS_Pr->CVDisplay))); | ||
| 3473 | |||
| 3474 | } else { | ||
| 3475 | |||
| 3476 | /* Don't need vbflags here; checks done earlier */ | ||
| 3477 | ModeNo = SiS_GetModeNumber(pScrn, mode, pSiS->VBFlags); | ||
| 3478 | if(!ModeNo) return false; | ||
| 3479 | |||
| 3480 | xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting standard mode 0x%x\n", ModeNo); | ||
| 3481 | |||
| 3482 | } | ||
| 3483 | |||
| 3484 | return(SiSSetMode(SiS_Pr, pScrn, ModeNo, true)); | ||
| 3485 | } | ||
| 3486 | |||
| 3487 | /*********************************************/ | ||
| 3488 | /* X.org/XFree86: SiSBIOSSetModeCRT2() */ | ||
| 3489 | /* for Dual-Head modes */ | ||
| 3490 | /*********************************************/ | ||
| 3491 | |||
| 3492 | bool | ||
| 3493 | SiSBIOSSetModeCRT2(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, | ||
| 3494 | DisplayModePtr mode, bool IsCustom) | ||
| 3495 | { | ||
| 3496 | SISIOADDRESS BaseAddr = SiS_Pr->IOAddress; | ||
| 3497 | SISPtr pSiS = SISPTR(pScrn); | ||
| 3498 | #ifdef SISDUALHEAD | ||
| 3499 | SISEntPtr pSiSEnt = pSiS->entityPrivate; | ||
| 3500 | #endif | ||
| 3501 | unsigned short ModeIdIndex; | ||
| 3502 | unsigned short ModeNo = 0; | ||
| 3503 | unsigned char backupreg = 0; | ||
| 3504 | |||
| 3505 | SiS_Pr->UseCustomMode = false; | ||
| 3506 | |||
| 3507 | /* Remember: Custom modes for CRT2 are ONLY supported | ||
| 3508 | * -) on the 30x/B/C, and | ||
| 3509 | * -) if CRT2 is LCD or VGA, or CRT1 is LCDA | ||
| 3510 | */ | ||
| 3511 | |||
| 3512 | if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) { | ||
| 3513 | |||
| 3514 | ModeNo = 0xfe; | ||
| 3515 | |||
| 3516 | } else { | ||
| 3517 | |||
| 3518 | ModeNo = SiS_GetModeNumber(pScrn, mode, pSiS->VBFlags); | ||
| 3519 | if(!ModeNo) return false; | ||
| 3520 | |||
| 3521 | } | ||
| 3522 | |||
| 3523 | SiSRegInit(SiS_Pr, BaseAddr); | ||
| 3524 | SiSInitPtr(SiS_Pr); | ||
| 3525 | SiS_GetSysFlags(SiS_Pr); | ||
| 3526 | #if defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__) || defined(__amd64__) || defined(__x86_64__) | ||
| 3527 | SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); | ||
| 3528 | #else | ||
| 3529 | SiS_Pr->SiS_VGAINFO = 0x11; | ||
| 3530 | #endif | ||
| 3531 | |||
| 3532 | SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86); | ||
| 3533 | |||
| 3534 | SiSInitPCIetc(SiS_Pr); | ||
| 3535 | SiSSetLVDSetc(SiS_Pr); | ||
| 3536 | SiSDetermineROMUsage(SiS_Pr); | ||
| 3537 | |||
| 3538 | /* Save mode info so we can set it from within SetMode for CRT1 */ | ||
| 3539 | #ifdef SISDUALHEAD | ||
| 3540 | if(pSiS->DualHeadMode) { | ||
| 3541 | pSiSEnt->CRT2ModeNo = ModeNo; | ||
| 3542 | pSiSEnt->CRT2DMode = mode; | ||
| 3543 | pSiSEnt->CRT2IsCustom = IsCustom; | ||
| 3544 | pSiSEnt->CRT2CR30 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); | ||
| 3545 | pSiSEnt->CRT2CR31 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x31); | ||
| 3546 | pSiSEnt->CRT2CR35 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); | ||
| 3547 | pSiSEnt->CRT2CR38 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); | ||
| 3548 | #if 0 | ||
| 3549 | /* We can't set CRT2 mode before CRT1 mode is set - says who...? */ | ||
| 3550 | if(pSiSEnt->CRT1ModeNo == -1) { | ||
| 3551 | xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, | ||
| 3552 | "Setting CRT2 mode delayed until after setting CRT1 mode\n"); | ||
| 3553 | return true; | ||
| 3554 | } | ||
| 3555 | #endif | ||
| 3556 | pSiSEnt->CRT2ModeSet = true; | ||
| 3557 | } | ||
| 3558 | #endif | ||
| 3559 | |||
| 3560 | if(SiS_Pr->UseCustomMode) { | ||
| 3561 | |||
| 3562 | unsigned short temptemp = SiS_Pr->CVDisplay; | ||
| 3563 | |||
| 3564 | if(SiS_Pr->CModeFlag & DoubleScanMode) temptemp >>= 1; | ||
| 3565 | else if(SiS_Pr->CInfoFlag & InterlaceMode) temptemp <<= 1; | ||
| 3566 | |||
| 3567 | xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, | ||
| 3568 | "Setting custom mode %dx%d on CRT2\n", | ||
| 3569 | SiS_Pr->CHDisplay, temptemp); | ||
| 3570 | |||
| 3571 | } else { | ||
| 3572 | |||
| 3573 | xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, | ||
| 3574 | "Setting standard mode 0x%x on CRT2\n", ModeNo); | ||
| 3575 | |||
| 3576 | } | ||
| 3577 | |||
| 3578 | SiS_UnLockCRT2(SiS_Pr); | ||
| 3579 | |||
| 3580 | if(!SiS_Pr->UseCustomMode) { | ||
| 3581 | if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) return false; | ||
| 3582 | } else { | ||
| 3583 | ModeIdIndex = 0; | ||
| 3584 | } | ||
| 3585 | |||
| 3586 | SiS_GetVBType(SiS_Pr); | ||
| 3587 | |||
| 3588 | SiS_InitVB(SiS_Pr); | ||
| 3589 | if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { | ||
| 3590 | if(SiS_Pr->ChipType >= SIS_315H) { | ||
| 3591 | SiS_ResetVB(SiS_Pr); | ||
| 3592 | SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10); | ||
| 3593 | SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x00,0x0c); | ||
| 3594 | backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); | ||
| 3595 | } else { | ||
| 3596 | backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); | ||
| 3597 | } | ||
| 3598 | } | ||
| 3599 | |||
| 3600 | /* Get VB information (connectors, connected devices) */ | ||
| 3601 | if(!SiS_Pr->UseCustomMode) { | ||
| 3602 | SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, 1); | ||
| 3603 | } else { | ||
| 3604 | /* If this is a custom mode, we don't check the modeflag for CRT2Mode */ | ||
| 3605 | SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, 0); | ||
| 3606 | } | ||
| 3607 | SiS_SetYPbPr(SiS_Pr); | ||
| 3608 | SiS_SetTVMode(SiS_Pr, ModeNo, ModeIdIndex); | ||
| 3609 | SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex); | ||
| 3610 | SiS_SetLowModeTest(SiS_Pr, ModeNo); | ||
| 3611 | |||
| 3612 | SiS_ResetSegmentRegisters(SiS_Pr); | ||
| 3613 | |||
| 3614 | /* Set mode on CRT2 */ | ||
| 3615 | if( (SiS_Pr->SiS_VBType & VB_SISVB) || | ||
| 3616 | (SiS_Pr->SiS_IF_DEF_LVDS == 1) || | ||
| 3617 | (SiS_Pr->SiS_IF_DEF_CH70xx != 0) || | ||
| 3618 | (SiS_Pr->SiS_IF_DEF_TRUMPION != 0) ) { | ||
| 3619 | SiS_SetCRT2Group(SiS_Pr, ModeNo); | ||
| 3620 | } | ||
| 3621 | |||
| 3622 | SiS_StrangeStuff(SiS_Pr); | ||
| 3623 | |||
| 3624 | SiS_DisplayOn(SiS_Pr); | ||
| 3625 | SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xFF); | ||
| 3626 | |||
| 3627 | if(SiS_Pr->ChipType >= SIS_315H) { | ||
| 3628 | if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { | ||
| 3629 | if(!(SiS_IsDualEdge(SiS_Pr))) { | ||
| 3630 | SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb); | ||
| 3631 | } | ||
| 3632 | } | ||
| 3633 | } | ||
| 3634 | |||
| 3635 | if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { | ||
| 3636 | if(SiS_Pr->ChipType >= SIS_315H) { | ||
| 3637 | if(!SiS_Pr->SiS_ROMNew) { | ||
| 3638 | if(SiS_IsVAMode(SiS_Pr)) { | ||
| 3639 | SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); | ||
| 3640 | } else { | ||
| 3641 | SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x35,0xFE); | ||
| 3642 | } | ||
| 3643 | } | ||
| 3644 | |||
| 3645 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,backupreg); | ||
| 3646 | |||
| 3647 | if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x30) & SetCRT2ToLCD) { | ||
| 3648 | SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc); | ||
| 3649 | } | ||
| 3650 | } else if((SiS_Pr->ChipType == SIS_630) || | ||
| 3651 | (SiS_Pr->ChipType == SIS_730)) { | ||
| 3652 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,backupreg); | ||
| 3653 | } | ||
| 3654 | } | ||
| 3655 | |||
| 3656 | /* SetPitch: Adapt to virtual size & position */ | ||
| 3657 | SiS_SetPitchCRT2(SiS_Pr, pScrn); | ||
| 3658 | |||
| 3659 | SiS_Handle760(SiS_Pr); | ||
| 3660 | |||
| 3661 | return true; | ||
| 3662 | } | ||
| 3663 | |||
| 3664 | /*********************************************/ | ||
| 3665 | /* X.org/XFree86: SiSBIOSSetModeCRT1() */ | ||
| 3666 | /* for Dual-Head modes */ | ||
| 3667 | /*********************************************/ | ||
| 3668 | |||
| 3669 | bool | ||
| 3670 | SiSBIOSSetModeCRT1(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, | ||
| 3671 | DisplayModePtr mode, bool IsCustom) | ||
| 3672 | { | ||
| 3673 | SISIOADDRESS BaseAddr = SiS_Pr->IOAddress; | ||
| 3674 | SISPtr pSiS = SISPTR(pScrn); | ||
| 3675 | unsigned short ModeIdIndex, ModeNo = 0; | ||
| 3676 | unsigned char backupreg = 0; | ||
| 3677 | #ifdef SISDUALHEAD | ||
| 3678 | SISEntPtr pSiSEnt = pSiS->entityPrivate; | ||
| 3679 | unsigned char backupcr30, backupcr31, backupcr38, backupcr35, backupp40d=0; | ||
| 3680 | bool backupcustom; | ||
| 3681 | #endif | ||
| 3682 | |||
| 3683 | SiS_Pr->UseCustomMode = false; | ||
| 3684 | |||
| 3685 | if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) { | ||
| 3686 | |||
| 3687 | unsigned short temptemp = SiS_Pr->CVDisplay; | ||
| 3688 | |||
| 3689 | if(SiS_Pr->CModeFlag & DoubleScanMode) temptemp >>= 1; | ||
| 3690 | else if(SiS_Pr->CInfoFlag & InterlaceMode) temptemp <<= 1; | ||
| 3691 | |||
| 3692 | xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, | ||
| 3693 | "Setting custom mode %dx%d on CRT1\n", | ||
| 3694 | SiS_Pr->CHDisplay, temptemp); | ||
| 3695 | ModeNo = 0xfe; | ||
| 3696 | |||
| 3697 | } else { | ||
| 3698 | |||
| 3699 | ModeNo = SiS_GetModeNumber(pScrn, mode, 0); /* don't give VBFlags */ | ||
| 3700 | if(!ModeNo) return false; | ||
| 3701 | |||
| 3702 | xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, | ||
| 3703 | "Setting standard mode 0x%x on CRT1\n", ModeNo); | ||
| 3704 | } | ||
| 3705 | |||
| 3706 | SiSInitPtr(SiS_Pr); | ||
| 3707 | SiSRegInit(SiS_Pr, BaseAddr); | ||
| 3708 | SiS_GetSysFlags(SiS_Pr); | ||
| 3709 | #if defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__) || defined(__amd64__) || defined(__x86_64__) | ||
| 3710 | SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); | ||
| 3711 | #else | ||
| 3712 | SiS_Pr->SiS_VGAINFO = 0x11; | ||
| 3713 | #endif | ||
| 3714 | |||
| 3715 | SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86); | ||
| 3716 | |||
| 3717 | SiSInitPCIetc(SiS_Pr); | ||
| 3718 | SiSSetLVDSetc(SiS_Pr); | ||
| 3719 | SiSDetermineROMUsage(SiS_Pr); | ||
| 3720 | |||
| 3721 | SiS_UnLockCRT2(SiS_Pr); | ||
| 3722 | |||
| 3723 | if(!SiS_Pr->UseCustomMode) { | ||
| 3724 | if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) return false; | ||
| 3725 | } else { | ||
| 3726 | ModeIdIndex = 0; | ||
| 3727 | } | ||
| 3728 | |||
| 3729 | /* Determine VBType */ | ||
| 3730 | SiS_GetVBType(SiS_Pr); | ||
| 3731 | |||
| 3732 | SiS_InitVB(SiS_Pr); | ||
| 3733 | if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { | ||
| 3734 | if(SiS_Pr->ChipType >= SIS_315H) { | ||
| 3735 | backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); | ||
| 3736 | } else { | ||
| 3737 | backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); | ||
| 3738 | } | ||
| 3739 | } | ||
| 3740 | |||
| 3741 | /* Get VB information (connectors, connected devices) */ | ||
| 3742 | /* (We don't care if the current mode is a CRT2 mode) */ | ||
| 3743 | SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, 0); | ||
| 3744 | SiS_SetYPbPr(SiS_Pr); | ||
| 3745 | SiS_SetTVMode(SiS_Pr, ModeNo, ModeIdIndex); | ||
| 3746 | SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex); | ||
| 3747 | SiS_SetLowModeTest(SiS_Pr, ModeNo); | ||
| 3748 | |||
| 3749 | SiS_OpenCRTC(SiS_Pr); | ||
| 3750 | |||
| 3751 | /* Set mode on CRT1 */ | ||
| 3752 | SiS_SetCRT1Group(SiS_Pr, ModeNo, ModeIdIndex); | ||
| 3753 | if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { | ||
| 3754 | SiS_SetCRT2Group(SiS_Pr, ModeNo); | ||
| 3755 | } | ||
| 3756 | |||
| 3757 | /* SetPitch: Adapt to virtual size & position */ | ||
| 3758 | SiS_SetPitchCRT1(SiS_Pr, pScrn); | ||
| 3759 | |||
| 3760 | SiS_HandleCRT1(SiS_Pr); | ||
| 3761 | |||
| 3762 | SiS_StrangeStuff(SiS_Pr); | ||
| 3763 | |||
| 3764 | SiS_CloseCRTC(SiS_Pr); | ||
| 3765 | |||
| 3766 | #ifdef SISDUALHEAD | ||
| 3767 | if(pSiS->DualHeadMode) { | ||
| 3768 | pSiSEnt->CRT1ModeNo = ModeNo; | ||
| 3769 | pSiSEnt->CRT1DMode = mode; | ||
| 3770 | } | ||
| 3771 | #endif | ||
| 3772 | |||
| 3773 | if(SiS_Pr->UseCustomMode) { | ||
| 3774 | SiS_Pr->CRT1UsesCustomMode = true; | ||
| 3775 | SiS_Pr->CSRClock_CRT1 = SiS_Pr->CSRClock; | ||
| 3776 | SiS_Pr->CModeFlag_CRT1 = SiS_Pr->CModeFlag; | ||
| 3777 | } else { | ||
| 3778 | SiS_Pr->CRT1UsesCustomMode = false; | ||
| 3779 | } | ||
| 3780 | |||
| 3781 | /* Reset CRT2 if changing mode on CRT1 */ | ||
| 3782 | #ifdef SISDUALHEAD | ||
| 3783 | if(pSiS->DualHeadMode) { | ||
| 3784 | if(pSiSEnt->CRT2ModeNo != -1) { | ||
| 3785 | xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, | ||
| 3786 | "(Re-)Setting mode for CRT2\n"); | ||
| 3787 | backupcustom = SiS_Pr->UseCustomMode; | ||
| 3788 | backupcr30 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); | ||
| 3789 | backupcr31 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x31); | ||
| 3790 | backupcr35 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); | ||
| 3791 | backupcr38 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); | ||
| 3792 | if(SiS_Pr->SiS_VBType & VB_SISVB) { | ||
| 3793 | /* Backup LUT-enable */ | ||
| 3794 | if(pSiSEnt->CRT2ModeSet) { | ||
| 3795 | backupp40d = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x0d) & 0x08; | ||
| 3796 | } | ||
| 3797 | } | ||
| 3798 | if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { | ||
| 3799 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x30,pSiSEnt->CRT2CR30); | ||
| 3800 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x31,pSiSEnt->CRT2CR31); | ||
| 3801 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,pSiSEnt->CRT2CR35); | ||
| 3802 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,pSiSEnt->CRT2CR38); | ||
| 3803 | } | ||
| 3804 | |||
| 3805 | SiSBIOSSetModeCRT2(SiS_Pr, pSiSEnt->pScrn_1, | ||
| 3806 | pSiSEnt->CRT2DMode, pSiSEnt->CRT2IsCustom); | ||
| 3807 | |||
| 3808 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x30,backupcr30); | ||
| 3809 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x31,backupcr31); | ||
| 3810 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,backupcr35); | ||
| 3811 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,backupcr38); | ||
| 3812 | if(SiS_Pr->SiS_VBType & VB_SISVB) { | ||
| 3813 | SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0d, ~0x08, backupp40d); | ||
| 3814 | } | ||
| 3815 | SiS_Pr->UseCustomMode = backupcustom; | ||
| 3816 | } | ||
| 3817 | } | ||
| 3818 | #endif | ||
| 3819 | |||
| 3820 | /* Warning: From here, the custom mode entries in SiS_Pr are | ||
| 3821 | * possibly overwritten | ||
| 3822 | */ | ||
| 3823 | |||
| 3824 | SiS_DisplayOn(SiS_Pr); | ||
| 3825 | SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xFF); | ||
| 3826 | |||
| 3827 | if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { | ||
| 3828 | if(SiS_Pr->ChipType >= SIS_315H) { | ||
| 3829 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,backupreg); | ||
| 3830 | } else if((SiS_Pr->ChipType == SIS_630) || | ||
| 3831 | (SiS_Pr->ChipType == SIS_730)) { | ||
| 3832 | SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,backupreg); | ||
| 3833 | } | ||
| 3834 | } | ||
| 3835 | |||
| 3836 | SiS_Handle760(SiS_Pr); | ||
| 3837 | |||
| 3838 | /* Backup/Set ModeNo in BIOS scratch area */ | ||
| 3839 | SiS_GetSetModeID(pScrn,ModeNo); | ||
| 3840 | |||
| 3841 | return true; | ||
| 3842 | } | ||
| 3843 | #endif /* Linux_XF86 */ | ||
| 3844 | |||
| 3845 | #ifndef GETBITSTR | 3325 | #ifndef GETBITSTR |
| 3846 | #define BITMASK(h,l) (((unsigned)(1U << ((h)-(l)+1))-1)<<(l)) | 3326 | #define BITMASK(h,l) (((unsigned)(1U << ((h)-(l)+1))-1)<<(l)) |
| 3847 | #define GENMASK(mask) BITMASK(1?mask,0?mask) | 3327 | #define GENMASK(mask) BITMASK(1?mask,0?mask) |
| @@ -3927,7 +3407,7 @@ SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 3927 | SiS_Pr->CVBlankStart = SiS_Pr->SiS_VGAVDE; | 3407 | SiS_Pr->CVBlankStart = SiS_Pr->SiS_VGAVDE; |
| 3928 | 3408 | ||
| 3929 | if(SiS_Pr->ChipType < SIS_315H) { | 3409 | if(SiS_Pr->ChipType < SIS_315H) { |
| 3930 | #ifdef SIS300 | 3410 | #ifdef CONFIG_FB_SIS_300 |
| 3931 | tempbx = SiS_Pr->SiS_VGAHT; | 3411 | tempbx = SiS_Pr->SiS_VGAHT; |
| 3932 | if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { | 3412 | if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { |
| 3933 | tempbx = SiS_Pr->PanelHT; | 3413 | tempbx = SiS_Pr->PanelHT; |
| @@ -3936,7 +3416,7 @@ SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 3936 | remaining = tempbx % 8; | 3416 | remaining = tempbx % 8; |
| 3937 | #endif | 3417 | #endif |
| 3938 | } else { | 3418 | } else { |
| 3939 | #ifdef SIS315H | 3419 | #ifdef CONFIG_FB_SIS_315 |
| 3940 | /* OK for LCDA, LVDS */ | 3420 | /* OK for LCDA, LVDS */ |
| 3941 | tempbx = SiS_Pr->PanelHT - SiS_Pr->PanelXRes; | 3421 | tempbx = SiS_Pr->PanelHT - SiS_Pr->PanelXRes; |
| 3942 | tempax = SiS_Pr->SiS_VGAHDE; /* not /2 ! */ | 3422 | tempax = SiS_Pr->SiS_VGAHDE; /* not /2 ! */ |
| @@ -3950,7 +3430,7 @@ SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 3950 | SiS_Pr->CHTotal = SiS_Pr->CHBlankEnd = tempbx; | 3430 | SiS_Pr->CHTotal = SiS_Pr->CHBlankEnd = tempbx; |
| 3951 | 3431 | ||
| 3952 | if(SiS_Pr->ChipType < SIS_315H) { | 3432 | if(SiS_Pr->ChipType < SIS_315H) { |
| 3953 | #ifdef SIS300 | 3433 | #ifdef CONFIG_FB_SIS_300 |
| 3954 | if(SiS_Pr->SiS_VGAHDE == SiS_Pr->PanelXRes) { | 3434 | if(SiS_Pr->SiS_VGAHDE == SiS_Pr->PanelXRes) { |
| 3955 | SiS_Pr->CHSyncStart = SiS_Pr->SiS_VGAHDE + ((SiS_Pr->PanelHRS + 1) & ~1); | 3435 | SiS_Pr->CHSyncStart = SiS_Pr->SiS_VGAHDE + ((SiS_Pr->PanelHRS + 1) & ~1); |
| 3956 | SiS_Pr->CHSyncEnd = SiS_Pr->CHSyncStart + SiS_Pr->PanelHRE; | 3436 | SiS_Pr->CHSyncEnd = SiS_Pr->CHSyncStart + SiS_Pr->PanelHRE; |
| @@ -3982,7 +3462,7 @@ SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 3982 | } | 3462 | } |
| 3983 | #endif | 3463 | #endif |
| 3984 | } else { | 3464 | } else { |
| 3985 | #ifdef SIS315H | 3465 | #ifdef CONFIG_FB_SIS_315 |
| 3986 | tempax = VGAHDE; | 3466 | tempax = VGAHDE; |
| 3987 | if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { | 3467 | if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { |
| 3988 | tempbx = SiS_Pr->PanelXRes; | 3468 | tempbx = SiS_Pr->PanelXRes; |
| @@ -4001,7 +3481,7 @@ SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 4001 | if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { | 3481 | if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { |
| 4002 | tempax = SiS_Pr->PanelYRes; | 3482 | tempax = SiS_Pr->PanelYRes; |
| 4003 | } else if(SiS_Pr->ChipType < SIS_315H) { | 3483 | } else if(SiS_Pr->ChipType < SIS_315H) { |
| 4004 | #ifdef SIS300 | 3484 | #ifdef CONFIG_FB_SIS_300 |
| 4005 | /* Stupid hack for 640x400/320x200 */ | 3485 | /* Stupid hack for 640x400/320x200 */ |
| 4006 | if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { | 3486 | if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { |
| 4007 | if((tempax + tempbx) == 438) tempbx += 16; | 3487 | if((tempax + tempbx) == 438) tempbx += 16; |
| @@ -4054,36 +3534,12 @@ SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 4054 | if(modeflag & DoubleScanMode) tempax |= 0x80; | 3534 | if(modeflag & DoubleScanMode) tempax |= 0x80; |
| 4055 | SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,tempax); | 3535 | SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,tempax); |
| 4056 | 3536 | ||
| 4057 | #ifdef SIS_XORG_XF86 | ||
| 4058 | #ifdef TWDEBUG | ||
| 4059 | xf86DrvMsg(0, X_INFO, "%d %d %d %d %d %d %d %d (%d %d %d %d)\n", | ||
| 4060 | SiS_Pr->CHDisplay, SiS_Pr->CHSyncStart, SiS_Pr->CHSyncEnd, SiS_Pr->CHTotal, | ||
| 4061 | SiS_Pr->CVDisplay, SiS_Pr->CVSyncStart, SiS_Pr->CVSyncEnd, SiS_Pr->CVTotal, | ||
| 4062 | SiS_Pr->CHBlankStart, SiS_Pr->CHBlankEnd, SiS_Pr->CVBlankStart, SiS_Pr->CVBlankEnd); | ||
| 4063 | xf86DrvMsg(0, X_INFO, " {{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", | ||
| 4064 | SiS_Pr->CCRT1CRTC[0], SiS_Pr->CCRT1CRTC[1], | ||
| 4065 | SiS_Pr->CCRT1CRTC[2], SiS_Pr->CCRT1CRTC[3], | ||
| 4066 | SiS_Pr->CCRT1CRTC[4], SiS_Pr->CCRT1CRTC[5], | ||
| 4067 | SiS_Pr->CCRT1CRTC[6], SiS_Pr->CCRT1CRTC[7]); | ||
| 4068 | xf86DrvMsg(0, X_INFO, " 0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", | ||
| 4069 | SiS_Pr->CCRT1CRTC[8], SiS_Pr->CCRT1CRTC[9], | ||
| 4070 | SiS_Pr->CCRT1CRTC[10], SiS_Pr->CCRT1CRTC[11], | ||
| 4071 | SiS_Pr->CCRT1CRTC[12], SiS_Pr->CCRT1CRTC[13], | ||
| 4072 | SiS_Pr->CCRT1CRTC[14], SiS_Pr->CCRT1CRTC[15]); | ||
| 4073 | xf86DrvMsg(0, X_INFO, " 0x%02x}},\n", SiS_Pr->CCRT1CRTC[16]); | ||
| 4074 | #endif | ||
| 4075 | #endif | ||
| 4076 | } | 3537 | } |
| 4077 | 3538 | ||
| 4078 | void | 3539 | void |
| 4079 | SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, | 3540 | SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, |
| 4080 | int xres, int yres, | 3541 | int xres, int yres, |
| 4081 | #ifdef SIS_XORG_XF86 | ||
| 4082 | DisplayModePtr current | ||
| 4083 | #endif | ||
| 4084 | #ifdef SIS_LINUX_KERNEL | ||
| 4085 | struct fb_var_screeninfo *var, bool writeres | 3542 | struct fb_var_screeninfo *var, bool writeres |
| 4086 | #endif | ||
| 4087 | ) | 3543 | ) |
| 4088 | { | 3544 | { |
| 4089 | unsigned short HRE, HBE, HRS, HBS, HDE, HT; | 3545 | unsigned short HRE, HBE, HRS, HBS, HDE, HT; |
| @@ -4127,25 +3583,10 @@ SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, | |||
| 4127 | 3583 | ||
| 4128 | D = B - F - C; | 3584 | D = B - F - C; |
| 4129 | 3585 | ||
| 4130 | #ifdef SIS_XORG_XF86 | ||
| 4131 | current->HDisplay = (E * 8); | ||
| 4132 | current->HSyncStart = (E * 8) + (F * 8); | ||
| 4133 | current->HSyncEnd = (E * 8) + (F * 8) + (C * 8); | ||
| 4134 | current->HTotal = (E * 8) + (F * 8) + (C * 8) + (D * 8); | ||
| 4135 | #ifdef TWDEBUG | ||
| 4136 | xf86DrvMsg(0, X_INFO, | ||
| 4137 | "H: A %d B %d C %d D %d E %d F %d HT %d HDE %d HRS %d HBS %d HBE %d HRE %d\n", | ||
| 4138 | A, B, C, D, E, F, HT, HDE, HRS, HBS, HBE, HRE); | ||
| 4139 | #else | ||
| 4140 | (void)VBS; (void)HBS; (void)A; | ||
| 4141 | #endif | ||
| 4142 | #endif | ||
| 4143 | #ifdef SIS_LINUX_KERNEL | ||
| 4144 | if(writeres) var->xres = xres = E * 8; | 3586 | if(writeres) var->xres = xres = E * 8; |
| 4145 | var->left_margin = D * 8; | 3587 | var->left_margin = D * 8; |
| 4146 | var->right_margin = F * 8; | 3588 | var->right_margin = F * 8; |
| 4147 | var->hsync_len = C * 8; | 3589 | var->hsync_len = C * 8; |
| 4148 | #endif | ||
| 4149 | 3590 | ||
| 4150 | /* Vertical */ | 3591 | /* Vertical */ |
| 4151 | sr_data = crdata[13]; | 3592 | sr_data = crdata[13]; |
| @@ -4192,30 +3633,10 @@ SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, | |||
| 4192 | 3633 | ||
| 4193 | D = B - F - C; | 3634 | D = B - F - C; |
| 4194 | 3635 | ||
| 4195 | #ifdef SIS_XORG_XF86 | ||
| 4196 | current->VDisplay = VDE + 1; | ||
| 4197 | current->VSyncStart = VRS + 1; | ||
| 4198 | current->VSyncEnd = ((VRS & ~0x1f) | VRE) + 1; | ||
| 4199 | if(VRE <= (VRS & 0x1f)) current->VSyncEnd += 32; | ||
| 4200 | current->VTotal = E + D + C + F; | ||
| 4201 | #if 0 | ||
| 4202 | current->VDisplay = E; | ||
| 4203 | current->VSyncStart = E + D; | ||
| 4204 | current->VSyncEnd = E + D + C; | ||
| 4205 | current->VTotal = E + D + C + F; | ||
| 4206 | #endif | ||
| 4207 | #ifdef TWDEBUG | ||
| 4208 | xf86DrvMsg(0, X_INFO, | ||
| 4209 | "V: A %d B %d C %d D %d E %d F %d VT %d VDE %d VRS %d VBS %d VBE %d VRE %d\n", | ||
| 4210 | A, B, C, D, E, F, VT, VDE, VRS, VBS, VBE, VRE); | ||
| 4211 | #endif | ||
| 4212 | #endif | ||
| 4213 | #ifdef SIS_LINUX_KERNEL | ||
| 4214 | if(writeres) var->yres = yres = E; | 3636 | if(writeres) var->yres = yres = E; |
| 4215 | var->upper_margin = D; | 3637 | var->upper_margin = D; |
| 4216 | var->lower_margin = F; | 3638 | var->lower_margin = F; |
| 4217 | var->vsync_len = C; | 3639 | var->vsync_len = C; |
| 4218 | #endif | ||
| 4219 | 3640 | ||
| 4220 | if((xres == 320) && ((yres == 200) || (yres == 240))) { | 3641 | if((xres == 320) && ((yres == 200) || (yres == 240))) { |
| 4221 | /* Terrible hack, but correct CRTC data for | 3642 | /* Terrible hack, but correct CRTC data for |
| @@ -4224,17 +3645,9 @@ SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, | |||
| 4224 | * a negative D. The CRT controller does not | 3645 | * a negative D. The CRT controller does not |
| 4225 | * seem to like correcting HRE to 50) | 3646 | * seem to like correcting HRE to 50) |
| 4226 | */ | 3647 | */ |
| 4227 | #ifdef SIS_XORG_XF86 | ||
| 4228 | current->HDisplay = 320; | ||
| 4229 | current->HSyncStart = 328; | ||
| 4230 | current->HSyncEnd = 376; | ||
| 4231 | current->HTotal = 400; | ||
| 4232 | #endif | ||
| 4233 | #ifdef SIS_LINUX_KERNEL | ||
| 4234 | var->left_margin = (400 - 376); | 3648 | var->left_margin = (400 - 376); |
| 4235 | var->right_margin = (328 - 320); | 3649 | var->right_margin = (328 - 320); |
| 4236 | var->hsync_len = (376 - 328); | 3650 | var->hsync_len = (376 - 328); |
| 4237 | #endif | ||
| 4238 | 3651 | ||
| 4239 | } | 3652 | } |
| 4240 | 3653 | ||
diff --git a/drivers/video/sis/init.h b/drivers/video/sis/init.h index b96005c39c67..ee8ed3c203da 100644 --- a/drivers/video/sis/init.h +++ b/drivers/video/sis/init.h | |||
| @@ -53,21 +53,8 @@ | |||
| 53 | #ifndef _INIT_H_ | 53 | #ifndef _INIT_H_ |
| 54 | #define _INIT_H_ | 54 | #define _INIT_H_ |
| 55 | 55 | ||
| 56 | #include "osdef.h" | ||
| 57 | #include "initdef.h" | 56 | #include "initdef.h" |
| 58 | 57 | ||
| 59 | #ifdef SIS_XORG_XF86 | ||
| 60 | #include "sis.h" | ||
| 61 | #define SIS_NEED_inSISREG | ||
| 62 | #define SIS_NEED_inSISREGW | ||
| 63 | #define SIS_NEED_inSISREGL | ||
| 64 | #define SIS_NEED_outSISREG | ||
| 65 | #define SIS_NEED_outSISREGW | ||
| 66 | #define SIS_NEED_outSISREGL | ||
| 67 | #include "sis_regs.h" | ||
| 68 | #endif | ||
| 69 | |||
| 70 | #ifdef SIS_LINUX_KERNEL | ||
| 71 | #include "vgatypes.h" | 58 | #include "vgatypes.h" |
| 72 | #include "vstruct.h" | 59 | #include "vstruct.h" |
| 73 | #ifdef SIS_CP | 60 | #ifdef SIS_CP |
| @@ -78,7 +65,6 @@ | |||
| 78 | #include <linux/fb.h> | 65 | #include <linux/fb.h> |
| 79 | #include "sis.h" | 66 | #include "sis.h" |
| 80 | #include <video/sisfb.h> | 67 | #include <video/sisfb.h> |
| 81 | #endif | ||
| 82 | 68 | ||
| 83 | /* Mode numbers */ | 69 | /* Mode numbers */ |
| 84 | static const unsigned short ModeIndex_320x200[] = {0x59, 0x41, 0x00, 0x4f}; | 70 | static const unsigned short ModeIndex_320x200[] = {0x59, 0x41, 0x00, 0x4f}; |
| @@ -286,7 +272,7 @@ static const struct SiS_ModeResInfo_S SiS_ModeResInfo[] = | |||
| 286 | { 1280, 854, 8,16} /* 0x22 */ | 272 | { 1280, 854, 8,16} /* 0x22 */ |
| 287 | }; | 273 | }; |
| 288 | 274 | ||
| 289 | #if defined(SIS300) || defined(SIS315H) | 275 | #if defined(CONFIG_FB_SIS_300) || defined(CONFIG_FB_SIS_315) |
| 290 | static const struct SiS_StandTable_S SiS_StandTable[]= | 276 | static const struct SiS_StandTable_S SiS_StandTable[]= |
| 291 | { | 277 | { |
| 292 | /* 0x00: MD_0_200 */ | 278 | /* 0x00: MD_0_200 */ |
| @@ -1521,10 +1507,6 @@ static const struct SiS_LVDSCRT1Data SiS_LVDSCRT1640x480_1_H[] = | |||
| 1521 | }; | 1507 | }; |
| 1522 | 1508 | ||
| 1523 | bool SiSInitPtr(struct SiS_Private *SiS_Pr); | 1509 | bool SiSInitPtr(struct SiS_Private *SiS_Pr); |
| 1524 | #ifdef SIS_XORG_XF86 | ||
| 1525 | unsigned short SiS_GetModeID(int VGAEngine, unsigned int VBFlags, int HDisplay, int VDisplay, | ||
| 1526 | int Depth, bool FSTN, int LCDwith, int LCDheight); | ||
| 1527 | #endif | ||
| 1528 | unsigned short SiS_GetModeID_LCD(int VGAEngine, unsigned int VBFlags, int HDisplay, | 1510 | unsigned short SiS_GetModeID_LCD(int VGAEngine, unsigned int VBFlags, int HDisplay, |
| 1529 | int VDisplay, int Depth, bool FSTN, | 1511 | int VDisplay, int Depth, bool FSTN, |
| 1530 | unsigned short CustomT, int LCDwith, int LCDheight, | 1512 | unsigned short CustomT, int LCDwith, int LCDheight, |
| @@ -1550,17 +1532,11 @@ void SiS_SetRegOR(SISIOADDRESS Port,unsigned short Index, unsigned short DataOR | |||
| 1550 | void SiS_DisplayOn(struct SiS_Private *SiS_Pr); | 1532 | void SiS_DisplayOn(struct SiS_Private *SiS_Pr); |
| 1551 | void SiS_DisplayOff(struct SiS_Private *SiS_Pr); | 1533 | void SiS_DisplayOff(struct SiS_Private *SiS_Pr); |
| 1552 | void SiSRegInit(struct SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr); | 1534 | void SiSRegInit(struct SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr); |
| 1553 | #ifndef SIS_LINUX_KERNEL | ||
| 1554 | void SiSSetLVDSetc(struct SiS_Private *SiS_Pr); | ||
| 1555 | #endif | ||
| 1556 | void SiS_SetEnableDstn(struct SiS_Private *SiS_Pr, int enable); | 1535 | void SiS_SetEnableDstn(struct SiS_Private *SiS_Pr, int enable); |
| 1557 | void SiS_SetEnableFstn(struct SiS_Private *SiS_Pr, int enable); | 1536 | void SiS_SetEnableFstn(struct SiS_Private *SiS_Pr, int enable); |
| 1558 | unsigned short SiS_GetModeFlag(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | 1537 | unsigned short SiS_GetModeFlag(struct SiS_Private *SiS_Pr, unsigned short ModeNo, |
| 1559 | unsigned short ModeIdIndex); | 1538 | unsigned short ModeIdIndex); |
| 1560 | bool SiSDetermineROMLayout661(struct SiS_Private *SiS_Pr); | 1539 | bool SiSDetermineROMLayout661(struct SiS_Private *SiS_Pr); |
| 1561 | #ifndef SIS_LINUX_KERNEL | ||
| 1562 | void SiS_GetVBType(struct SiS_Private *SiS_Pr); | ||
| 1563 | #endif | ||
| 1564 | 1540 | ||
| 1565 | bool SiS_SearchModeID(struct SiS_Private *SiS_Pr, unsigned short *ModeNo, | 1541 | bool SiS_SearchModeID(struct SiS_Private *SiS_Pr, unsigned short *ModeNo, |
| 1566 | unsigned short *ModeIdIndex); | 1542 | unsigned short *ModeIdIndex); |
| @@ -1572,37 +1548,19 @@ unsigned short SiS_GetColorDepth(struct SiS_Private *SiS_Pr, unsigned short Mode | |||
| 1572 | unsigned short ModeIdIndex); | 1548 | unsigned short ModeIdIndex); |
| 1573 | unsigned short SiS_GetOffset(struct SiS_Private *SiS_Pr,unsigned short ModeNo, | 1549 | unsigned short SiS_GetOffset(struct SiS_Private *SiS_Pr,unsigned short ModeNo, |
| 1574 | unsigned short ModeIdIndex, unsigned short RRTI); | 1550 | unsigned short ModeIdIndex, unsigned short RRTI); |
| 1575 | #ifdef SIS300 | 1551 | #ifdef CONFIG_FB_SIS_300 |
| 1576 | void SiS_GetFIFOThresholdIndex300(struct SiS_Private *SiS_Pr, unsigned short *idx1, | 1552 | void SiS_GetFIFOThresholdIndex300(struct SiS_Private *SiS_Pr, unsigned short *idx1, |
| 1577 | unsigned short *idx2); | 1553 | unsigned short *idx2); |
| 1578 | unsigned short SiS_GetFIFOThresholdB300(unsigned short idx1, unsigned short idx2); | 1554 | unsigned short SiS_GetFIFOThresholdB300(unsigned short idx1, unsigned short idx2); |
| 1579 | unsigned short SiS_GetLatencyFactor630(struct SiS_Private *SiS_Pr, unsigned short index); | 1555 | unsigned short SiS_GetLatencyFactor630(struct SiS_Private *SiS_Pr, unsigned short index); |
| 1580 | #endif | 1556 | #endif |
| 1581 | void SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex); | 1557 | void SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex); |
| 1582 | #ifdef SIS_XORG_XF86 | ||
| 1583 | bool SiSSetMode(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, unsigned short ModeNo, | ||
| 1584 | bool dosetpitch); | ||
| 1585 | bool SiSBIOSSetMode(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, | ||
| 1586 | DisplayModePtr mode, bool IsCustom); | ||
| 1587 | bool SiSBIOSSetModeCRT2(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, | ||
| 1588 | DisplayModePtr mode, bool IsCustom); | ||
| 1589 | bool SiSBIOSSetModeCRT1(struct SiS_Private *SiS_Pr, ScrnInfoPtr pScrn, | ||
| 1590 | DisplayModePtr mode, bool IsCustom); | ||
| 1591 | #endif | ||
| 1592 | #ifdef SIS_LINUX_KERNEL | ||
| 1593 | bool SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); | 1558 | bool SiSSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); |
| 1594 | #endif | ||
| 1595 | void SiS_CalcCRRegisters(struct SiS_Private *SiS_Pr, int depth); | 1559 | void SiS_CalcCRRegisters(struct SiS_Private *SiS_Pr, int depth); |
| 1596 | void SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | 1560 | void SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short ModeNo, |
| 1597 | unsigned short ModeIdIndex); | 1561 | unsigned short ModeIdIndex); |
| 1598 | #ifdef SIS_XORG_XF86 | ||
| 1599 | void SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, int xres, | ||
| 1600 | int yres, DisplayModePtr current); | ||
| 1601 | #endif | ||
| 1602 | #ifdef SIS_LINUX_KERNEL | ||
| 1603 | void SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, int xres, | 1562 | void SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata, int xres, |
| 1604 | int yres, struct fb_var_screeninfo *var, bool writeres); | 1563 | int yres, struct fb_var_screeninfo *var, bool writeres); |
| 1605 | #endif | ||
| 1606 | 1564 | ||
| 1607 | /* From init301.c: */ | 1565 | /* From init301.c: */ |
| 1608 | extern void SiS_GetVBInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | 1566 | extern void SiS_GetVBInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, |
| @@ -1626,29 +1584,16 @@ extern unsigned short SiS_GetVCLK2Ptr(struct SiS_Private *SiS_Pr, unsigned short | |||
| 1626 | extern bool SiS_IsVAMode(struct SiS_Private *); | 1584 | extern bool SiS_IsVAMode(struct SiS_Private *); |
| 1627 | extern bool SiS_IsDualEdge(struct SiS_Private *); | 1585 | extern bool SiS_IsDualEdge(struct SiS_Private *); |
| 1628 | 1586 | ||
| 1629 | #ifdef SIS_XORG_XF86 | 1587 | #ifdef CONFIG_FB_SIS_300 |
| 1630 | /* From other modules: */ | ||
| 1631 | extern unsigned short SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, | ||
| 1632 | unsigned int VBFlags); | ||
| 1633 | extern unsigned char SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, unsigned short offset, | ||
| 1634 | unsigned char value); | ||
| 1635 | extern unsigned char SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id); | ||
| 1636 | extern unsigned short SiS_GetModeNumber(ScrnInfoPtr pScrn, DisplayModePtr mode, | ||
| 1637 | unsigned int VBFlags); | ||
| 1638 | #endif | ||
| 1639 | |||
| 1640 | #ifdef SIS_LINUX_KERNEL | ||
| 1641 | #ifdef SIS300 | ||
| 1642 | extern unsigned int sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg); | 1588 | extern unsigned int sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg); |
| 1643 | extern void sisfb_write_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg, | 1589 | extern void sisfb_write_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg, |
| 1644 | unsigned int val); | 1590 | unsigned int val); |
| 1645 | #endif | 1591 | #endif |
| 1646 | #ifdef SIS315H | 1592 | #ifdef CONFIG_FB_SIS_315 |
| 1647 | extern void sisfb_write_nbridge_pci_byte(struct SiS_Private *SiS_Pr, int reg, | 1593 | extern void sisfb_write_nbridge_pci_byte(struct SiS_Private *SiS_Pr, int reg, |
| 1648 | unsigned char val); | 1594 | unsigned char val); |
| 1649 | extern unsigned int sisfb_read_mio_pci_word(struct SiS_Private *SiS_Pr, int reg); | 1595 | extern unsigned int sisfb_read_mio_pci_word(struct SiS_Private *SiS_Pr, int reg); |
| 1650 | #endif | 1596 | #endif |
| 1651 | #endif | ||
| 1652 | 1597 | ||
| 1653 | #endif | 1598 | #endif |
| 1654 | 1599 | ||
diff --git a/drivers/video/sis/init301.c b/drivers/video/sis/init301.c index da33d801c22e..9fa66fd4052a 100644 --- a/drivers/video/sis/init301.c +++ b/drivers/video/sis/init301.c | |||
| @@ -75,11 +75,11 @@ | |||
| 75 | 75 | ||
| 76 | #include "init301.h" | 76 | #include "init301.h" |
| 77 | 77 | ||
| 78 | #ifdef SIS300 | 78 | #ifdef CONFIG_FB_SIS_300 |
| 79 | #include "oem300.h" | 79 | #include "oem300.h" |
| 80 | #endif | 80 | #endif |
| 81 | 81 | ||
| 82 | #ifdef SIS315H | 82 | #ifdef CONFIG_FB_SIS_315 |
| 83 | #include "oem310.h" | 83 | #include "oem310.h" |
| 84 | #endif | 84 | #endif |
| 85 | 85 | ||
| @@ -87,9 +87,7 @@ | |||
| 87 | #define SiS_I2CDELAYSHORT 150 | 87 | #define SiS_I2CDELAYSHORT 150 |
| 88 | 88 | ||
| 89 | static unsigned short SiS_GetBIOSLCDResInfo(struct SiS_Private *SiS_Pr); | 89 | static unsigned short SiS_GetBIOSLCDResInfo(struct SiS_Private *SiS_Pr); |
| 90 | #ifdef SIS_LINUX_KERNEL | ||
| 91 | static void SiS_SetCH70xx(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val); | 90 | static void SiS_SetCH70xx(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val); |
| 92 | #endif | ||
| 93 | 91 | ||
| 94 | /*********************************************/ | 92 | /*********************************************/ |
| 95 | /* HELPER: Lock/Unlock CRT2 */ | 93 | /* HELPER: Lock/Unlock CRT2 */ |
| @@ -106,9 +104,7 @@ SiS_UnLockCRT2(struct SiS_Private *SiS_Pr) | |||
| 106 | SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x24,0x01); | 104 | SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x24,0x01); |
| 107 | } | 105 | } |
| 108 | 106 | ||
| 109 | #ifdef SIS_LINUX_KERNEL | ||
| 110 | static | 107 | static |
| 111 | #endif | ||
| 112 | void | 108 | void |
| 113 | SiS_LockCRT2(struct SiS_Private *SiS_Pr) | 109 | SiS_LockCRT2(struct SiS_Private *SiS_Pr) |
| 114 | { | 110 | { |
| @@ -138,7 +134,7 @@ SiS_SetRegSR11ANDOR(struct SiS_Private *SiS_Pr, unsigned short DataAND, unsigned | |||
| 138 | /* HELPER: Get Pointer to LCD structure */ | 134 | /* HELPER: Get Pointer to LCD structure */ |
| 139 | /*********************************************/ | 135 | /*********************************************/ |
| 140 | 136 | ||
| 141 | #ifdef SIS315H | 137 | #ifdef CONFIG_FB_SIS_315 |
| 142 | static unsigned char * | 138 | static unsigned char * |
| 143 | GetLCDStructPtr661(struct SiS_Private *SiS_Pr) | 139 | GetLCDStructPtr661(struct SiS_Private *SiS_Pr) |
| 144 | { | 140 | { |
| @@ -404,7 +400,7 @@ SiS_SaveCRT2Info(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | |||
| 404 | /* HELPER: GET SOME DATA FROM BIOS ROM */ | 400 | /* HELPER: GET SOME DATA FROM BIOS ROM */ |
| 405 | /*********************************************/ | 401 | /*********************************************/ |
| 406 | 402 | ||
| 407 | #ifdef SIS300 | 403 | #ifdef CONFIG_FB_SIS_300 |
| 408 | static bool | 404 | static bool |
| 409 | SiS_CR36BIOSWord23b(struct SiS_Private *SiS_Pr) | 405 | SiS_CR36BIOSWord23b(struct SiS_Private *SiS_Pr) |
| 410 | { | 406 | { |
| @@ -449,7 +445,7 @@ SiS_DDC2Delay(struct SiS_Private *SiS_Pr, unsigned int delaytime) | |||
| 449 | SiS_GetReg(SiS_Pr->SiS_P3c4, 0x05); | 445 | SiS_GetReg(SiS_Pr->SiS_P3c4, 0x05); |
| 450 | } | 446 | } |
| 451 | 447 | ||
| 452 | #if defined(SIS300) || defined(SIS315H) | 448 | #if defined(CONFIG_FB_SIS_300) || defined(CONFIG_FB_SIS_315) |
| 453 | static void | 449 | static void |
| 454 | SiS_GenericDelay(struct SiS_Private *SiS_Pr, unsigned short delay) | 450 | SiS_GenericDelay(struct SiS_Private *SiS_Pr, unsigned short delay) |
| 455 | { | 451 | { |
| @@ -457,7 +453,7 @@ SiS_GenericDelay(struct SiS_Private *SiS_Pr, unsigned short delay) | |||
| 457 | } | 453 | } |
| 458 | #endif | 454 | #endif |
| 459 | 455 | ||
| 460 | #ifdef SIS315H | 456 | #ifdef CONFIG_FB_SIS_315 |
| 461 | static void | 457 | static void |
| 462 | SiS_LongDelay(struct SiS_Private *SiS_Pr, unsigned short delay) | 458 | SiS_LongDelay(struct SiS_Private *SiS_Pr, unsigned short delay) |
| 463 | { | 459 | { |
| @@ -467,7 +463,7 @@ SiS_LongDelay(struct SiS_Private *SiS_Pr, unsigned short delay) | |||
| 467 | } | 463 | } |
| 468 | #endif | 464 | #endif |
| 469 | 465 | ||
| 470 | #if defined(SIS300) || defined(SIS315H) | 466 | #if defined(CONFIG_FB_SIS_300) || defined(CONFIG_FB_SIS_315) |
| 471 | static void | 467 | static void |
| 472 | SiS_ShortDelay(struct SiS_Private *SiS_Pr, unsigned short delay) | 468 | SiS_ShortDelay(struct SiS_Private *SiS_Pr, unsigned short delay) |
| 473 | { | 469 | { |
| @@ -480,14 +476,14 @@ SiS_ShortDelay(struct SiS_Private *SiS_Pr, unsigned short delay) | |||
| 480 | static void | 476 | static void |
| 481 | SiS_PanelDelay(struct SiS_Private *SiS_Pr, unsigned short DelayTime) | 477 | SiS_PanelDelay(struct SiS_Private *SiS_Pr, unsigned short DelayTime) |
| 482 | { | 478 | { |
| 483 | #if defined(SIS300) || defined(SIS315H) | 479 | #if defined(CONFIG_FB_SIS_300) || defined(CONFIG_FB_SIS_315) |
| 484 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; | 480 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; |
| 485 | unsigned short PanelID, DelayIndex, Delay=0; | 481 | unsigned short PanelID, DelayIndex, Delay=0; |
| 486 | #endif | 482 | #endif |
| 487 | 483 | ||
| 488 | if(SiS_Pr->ChipType < SIS_315H) { | 484 | if(SiS_Pr->ChipType < SIS_315H) { |
| 489 | 485 | ||
| 490 | #ifdef SIS300 | 486 | #ifdef CONFIG_FB_SIS_300 |
| 491 | 487 | ||
| 492 | PanelID = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36); | 488 | PanelID = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36); |
| 493 | if(SiS_Pr->SiS_VBType & VB_SISVB) { | 489 | if(SiS_Pr->SiS_VBType & VB_SISVB) { |
| @@ -513,11 +509,11 @@ SiS_PanelDelay(struct SiS_Private *SiS_Pr, unsigned short DelayTime) | |||
| 513 | } | 509 | } |
| 514 | SiS_ShortDelay(SiS_Pr, Delay); | 510 | SiS_ShortDelay(SiS_Pr, Delay); |
| 515 | 511 | ||
| 516 | #endif /* SIS300 */ | 512 | #endif /* CONFIG_FB_SIS_300 */ |
| 517 | 513 | ||
| 518 | } else { | 514 | } else { |
| 519 | 515 | ||
| 520 | #ifdef SIS315H | 516 | #ifdef CONFIG_FB_SIS_315 |
| 521 | 517 | ||
| 522 | if((SiS_Pr->ChipType >= SIS_661) || | 518 | if((SiS_Pr->ChipType >= SIS_661) || |
| 523 | (SiS_Pr->ChipType <= SIS_315PRO) || | 519 | (SiS_Pr->ChipType <= SIS_315PRO) || |
| @@ -579,12 +575,12 @@ SiS_PanelDelay(struct SiS_Private *SiS_Pr, unsigned short DelayTime) | |||
| 579 | 575 | ||
| 580 | } | 576 | } |
| 581 | 577 | ||
| 582 | #endif /* SIS315H */ | 578 | #endif /* CONFIG_FB_SIS_315 */ |
| 583 | 579 | ||
| 584 | } | 580 | } |
| 585 | } | 581 | } |
| 586 | 582 | ||
| 587 | #ifdef SIS315H | 583 | #ifdef CONFIG_FB_SIS_315 |
| 588 | static void | 584 | static void |
| 589 | SiS_PanelDelayLoop(struct SiS_Private *SiS_Pr, unsigned short DelayTime, unsigned short DelayLoop) | 585 | SiS_PanelDelayLoop(struct SiS_Private *SiS_Pr, unsigned short DelayTime, unsigned short DelayLoop) |
| 590 | { | 586 | { |
| @@ -613,7 +609,7 @@ SiS_WaitRetrace1(struct SiS_Private *SiS_Pr) | |||
| 613 | while((!(SiS_GetRegByte(SiS_Pr->SiS_P3da) & 0x08)) && --watchdog); | 609 | while((!(SiS_GetRegByte(SiS_Pr->SiS_P3da) & 0x08)) && --watchdog); |
| 614 | } | 610 | } |
| 615 | 611 | ||
| 616 | #if defined(SIS300) || defined(SIS315H) | 612 | #if defined(CONFIG_FB_SIS_300) || defined(CONFIG_FB_SIS_315) |
| 617 | static void | 613 | static void |
| 618 | SiS_WaitRetrace2(struct SiS_Private *SiS_Pr, unsigned short reg) | 614 | SiS_WaitRetrace2(struct SiS_Private *SiS_Pr, unsigned short reg) |
| 619 | { | 615 | { |
| @@ -630,7 +626,7 @@ static void | |||
| 630 | SiS_WaitVBRetrace(struct SiS_Private *SiS_Pr) | 626 | SiS_WaitVBRetrace(struct SiS_Private *SiS_Pr) |
| 631 | { | 627 | { |
| 632 | if(SiS_Pr->ChipType < SIS_315H) { | 628 | if(SiS_Pr->ChipType < SIS_315H) { |
| 633 | #ifdef SIS300 | 629 | #ifdef CONFIG_FB_SIS_300 |
| 634 | if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { | 630 | if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { |
| 635 | if(!(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x20)) return; | 631 | if(!(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x20)) return; |
| 636 | } | 632 | } |
| @@ -641,7 +637,7 @@ SiS_WaitVBRetrace(struct SiS_Private *SiS_Pr) | |||
| 641 | } | 637 | } |
| 642 | #endif | 638 | #endif |
| 643 | } else { | 639 | } else { |
| 644 | #ifdef SIS315H | 640 | #ifdef CONFIG_FB_SIS_315 |
| 645 | if(!(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x40)) { | 641 | if(!(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x40)) { |
| 646 | SiS_WaitRetrace1(SiS_Pr); | 642 | SiS_WaitRetrace1(SiS_Pr); |
| 647 | } else { | 643 | } else { |
| @@ -686,7 +682,7 @@ SiS_VBLongWait(struct SiS_Private *SiS_Pr) | |||
| 686 | /* HELPER: MISC */ | 682 | /* HELPER: MISC */ |
| 687 | /*********************************************/ | 683 | /*********************************************/ |
| 688 | 684 | ||
| 689 | #ifdef SIS300 | 685 | #ifdef CONFIG_FB_SIS_300 |
| 690 | static bool | 686 | static bool |
| 691 | SiS_Is301B(struct SiS_Private *SiS_Pr) | 687 | SiS_Is301B(struct SiS_Private *SiS_Pr) |
| 692 | { | 688 | { |
| @@ -708,7 +704,7 @@ SiS_CRT2IsLCD(struct SiS_Private *SiS_Pr) | |||
| 708 | bool | 704 | bool |
| 709 | SiS_IsDualEdge(struct SiS_Private *SiS_Pr) | 705 | SiS_IsDualEdge(struct SiS_Private *SiS_Pr) |
| 710 | { | 706 | { |
| 711 | #ifdef SIS315H | 707 | #ifdef CONFIG_FB_SIS_315 |
| 712 | if(SiS_Pr->ChipType >= SIS_315H) { | 708 | if(SiS_Pr->ChipType >= SIS_315H) { |
| 713 | if((SiS_Pr->ChipType != SIS_650) || (SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0xf0)) { | 709 | if((SiS_Pr->ChipType != SIS_650) || (SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0xf0)) { |
| 714 | if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x38) & EnableDualEdge) return true; | 710 | if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x38) & EnableDualEdge) return true; |
| @@ -721,7 +717,7 @@ SiS_IsDualEdge(struct SiS_Private *SiS_Pr) | |||
| 721 | bool | 717 | bool |
| 722 | SiS_IsVAMode(struct SiS_Private *SiS_Pr) | 718 | SiS_IsVAMode(struct SiS_Private *SiS_Pr) |
| 723 | { | 719 | { |
| 724 | #ifdef SIS315H | 720 | #ifdef CONFIG_FB_SIS_315 |
| 725 | unsigned short flag; | 721 | unsigned short flag; |
| 726 | 722 | ||
| 727 | if(SiS_Pr->ChipType >= SIS_315H) { | 723 | if(SiS_Pr->ChipType >= SIS_315H) { |
| @@ -732,7 +728,7 @@ SiS_IsVAMode(struct SiS_Private *SiS_Pr) | |||
| 732 | return false; | 728 | return false; |
| 733 | } | 729 | } |
| 734 | 730 | ||
| 735 | #ifdef SIS315H | 731 | #ifdef CONFIG_FB_SIS_315 |
| 736 | static bool | 732 | static bool |
| 737 | SiS_IsVAorLCD(struct SiS_Private *SiS_Pr) | 733 | SiS_IsVAorLCD(struct SiS_Private *SiS_Pr) |
| 738 | { | 734 | { |
| @@ -745,7 +741,7 @@ SiS_IsVAorLCD(struct SiS_Private *SiS_Pr) | |||
| 745 | static bool | 741 | static bool |
| 746 | SiS_IsDualLink(struct SiS_Private *SiS_Pr) | 742 | SiS_IsDualLink(struct SiS_Private *SiS_Pr) |
| 747 | { | 743 | { |
| 748 | #ifdef SIS315H | 744 | #ifdef CONFIG_FB_SIS_315 |
| 749 | if(SiS_Pr->ChipType >= SIS_315H) { | 745 | if(SiS_Pr->ChipType >= SIS_315H) { |
| 750 | if((SiS_CRT2IsLCD(SiS_Pr)) || | 746 | if((SiS_CRT2IsLCD(SiS_Pr)) || |
| 751 | (SiS_IsVAMode(SiS_Pr))) { | 747 | (SiS_IsVAMode(SiS_Pr))) { |
| @@ -756,7 +752,7 @@ SiS_IsDualLink(struct SiS_Private *SiS_Pr) | |||
| 756 | return false; | 752 | return false; |
| 757 | } | 753 | } |
| 758 | 754 | ||
| 759 | #ifdef SIS315H | 755 | #ifdef CONFIG_FB_SIS_315 |
| 760 | static bool | 756 | static bool |
| 761 | SiS_TVEnabled(struct SiS_Private *SiS_Pr) | 757 | SiS_TVEnabled(struct SiS_Private *SiS_Pr) |
| 762 | { | 758 | { |
| @@ -768,7 +764,7 @@ SiS_TVEnabled(struct SiS_Private *SiS_Pr) | |||
| 768 | } | 764 | } |
| 769 | #endif | 765 | #endif |
| 770 | 766 | ||
| 771 | #ifdef SIS315H | 767 | #ifdef CONFIG_FB_SIS_315 |
| 772 | static bool | 768 | static bool |
| 773 | SiS_LCDAEnabled(struct SiS_Private *SiS_Pr) | 769 | SiS_LCDAEnabled(struct SiS_Private *SiS_Pr) |
| 774 | { | 770 | { |
| @@ -777,7 +773,7 @@ SiS_LCDAEnabled(struct SiS_Private *SiS_Pr) | |||
| 777 | } | 773 | } |
| 778 | #endif | 774 | #endif |
| 779 | 775 | ||
| 780 | #ifdef SIS315H | 776 | #ifdef CONFIG_FB_SIS_315 |
| 781 | static bool | 777 | static bool |
| 782 | SiS_WeHaveBacklightCtrl(struct SiS_Private *SiS_Pr) | 778 | SiS_WeHaveBacklightCtrl(struct SiS_Private *SiS_Pr) |
| 783 | { | 779 | { |
| @@ -788,7 +784,7 @@ SiS_WeHaveBacklightCtrl(struct SiS_Private *SiS_Pr) | |||
| 788 | } | 784 | } |
| 789 | #endif | 785 | #endif |
| 790 | 786 | ||
| 791 | #ifdef SIS315H | 787 | #ifdef CONFIG_FB_SIS_315 |
| 792 | static bool | 788 | static bool |
| 793 | SiS_IsNotM650orLater(struct SiS_Private *SiS_Pr) | 789 | SiS_IsNotM650orLater(struct SiS_Private *SiS_Pr) |
| 794 | { | 790 | { |
| @@ -804,7 +800,7 @@ SiS_IsNotM650orLater(struct SiS_Private *SiS_Pr) | |||
| 804 | } | 800 | } |
| 805 | #endif | 801 | #endif |
| 806 | 802 | ||
| 807 | #ifdef SIS315H | 803 | #ifdef CONFIG_FB_SIS_315 |
| 808 | static bool | 804 | static bool |
| 809 | SiS_IsYPbPr(struct SiS_Private *SiS_Pr) | 805 | SiS_IsYPbPr(struct SiS_Private *SiS_Pr) |
| 810 | { | 806 | { |
| @@ -816,7 +812,7 @@ SiS_IsYPbPr(struct SiS_Private *SiS_Pr) | |||
| 816 | } | 812 | } |
| 817 | #endif | 813 | #endif |
| 818 | 814 | ||
| 819 | #ifdef SIS315H | 815 | #ifdef CONFIG_FB_SIS_315 |
| 820 | static bool | 816 | static bool |
| 821 | SiS_IsChScart(struct SiS_Private *SiS_Pr) | 817 | SiS_IsChScart(struct SiS_Private *SiS_Pr) |
| 822 | { | 818 | { |
| @@ -828,7 +824,7 @@ SiS_IsChScart(struct SiS_Private *SiS_Pr) | |||
| 828 | } | 824 | } |
| 829 | #endif | 825 | #endif |
| 830 | 826 | ||
| 831 | #ifdef SIS315H | 827 | #ifdef CONFIG_FB_SIS_315 |
| 832 | static bool | 828 | static bool |
| 833 | SiS_IsTVOrYPbPrOrScart(struct SiS_Private *SiS_Pr) | 829 | SiS_IsTVOrYPbPrOrScart(struct SiS_Private *SiS_Pr) |
| 834 | { | 830 | { |
| @@ -848,7 +844,7 @@ SiS_IsTVOrYPbPrOrScart(struct SiS_Private *SiS_Pr) | |||
| 848 | } | 844 | } |
| 849 | #endif | 845 | #endif |
| 850 | 846 | ||
| 851 | #ifdef SIS315H | 847 | #ifdef CONFIG_FB_SIS_315 |
| 852 | static bool | 848 | static bool |
| 853 | SiS_IsLCDOrLCDA(struct SiS_Private *SiS_Pr) | 849 | SiS_IsLCDOrLCDA(struct SiS_Private *SiS_Pr) |
| 854 | { | 850 | { |
| @@ -914,7 +910,7 @@ SiS_BridgeInSlavemode(struct SiS_Private *SiS_Pr) | |||
| 914 | /*********************************************/ | 910 | /*********************************************/ |
| 915 | 911 | ||
| 916 | /* Setup general purpose IO for Chrontel communication */ | 912 | /* Setup general purpose IO for Chrontel communication */ |
| 917 | #ifdef SIS300 | 913 | #ifdef CONFIG_FB_SIS_300 |
| 918 | void | 914 | void |
| 919 | SiS_SetChrontelGPIO(struct SiS_Private *SiS_Pr, unsigned short myvbinfo) | 915 | SiS_SetChrontelGPIO(struct SiS_Private *SiS_Pr, unsigned short myvbinfo) |
| 920 | { | 916 | { |
| @@ -923,11 +919,7 @@ SiS_SetChrontelGPIO(struct SiS_Private *SiS_Pr, unsigned short myvbinfo) | |||
| 923 | 919 | ||
| 924 | if(!(SiS_Pr->SiS_ChSW)) return; | 920 | if(!(SiS_Pr->SiS_ChSW)) return; |
| 925 | 921 | ||
| 926 | #ifdef SIS_LINUX_KERNEL | ||
| 927 | acpibase = sisfb_read_lpc_pci_dword(SiS_Pr, 0x74); | 922 | acpibase = sisfb_read_lpc_pci_dword(SiS_Pr, 0x74); |
| 928 | #else | ||
| 929 | acpibase = pciReadLong(0x00000800, 0x74); | ||
| 930 | #endif | ||
| 931 | acpibase &= 0xFFFF; | 923 | acpibase &= 0xFFFF; |
| 932 | if(!acpibase) return; | 924 | if(!acpibase) return; |
| 933 | temp = SiS_GetRegShort((acpibase + 0x3c)); /* ACPI register 0x3c: GP Event 1 I/O mode select */ | 925 | temp = SiS_GetRegShort((acpibase + 0x3c)); /* ACPI register 0x3c: GP Event 1 I/O mode select */ |
| @@ -969,7 +961,7 @@ SiS_GetVBInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 969 | tempax &= (DriverMode | LoadDACFlag | SetNotSimuMode | SetPALTV); | 961 | tempax &= (DriverMode | LoadDACFlag | SetNotSimuMode | SetPALTV); |
| 970 | tempbx |= tempax; | 962 | tempbx |= tempax; |
| 971 | 963 | ||
| 972 | #ifdef SIS315H | 964 | #ifdef CONFIG_FB_SIS_315 |
| 973 | if(SiS_Pr->ChipType >= SIS_315H) { | 965 | if(SiS_Pr->ChipType >= SIS_315H) { |
| 974 | if(SiS_Pr->SiS_VBType & VB_SISLCDA) { | 966 | if(SiS_Pr->SiS_VBType & VB_SISLCDA) { |
| 975 | if(ModeNo == 0x03) { | 967 | if(ModeNo == 0x03) { |
| @@ -1019,7 +1011,7 @@ SiS_GetVBInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 1019 | } | 1011 | } |
| 1020 | } | 1012 | } |
| 1021 | 1013 | ||
| 1022 | #endif /* SIS315H */ | 1014 | #endif /* CONFIG_FB_SIS_315 */ |
| 1023 | 1015 | ||
| 1024 | if(!(SiS_Pr->SiS_VBType & VB_SISVGA2)) { | 1016 | if(!(SiS_Pr->SiS_VBType & VB_SISVGA2)) { |
| 1025 | tempbx &= ~(SetCRT2ToRAMDAC); | 1017 | tempbx &= ~(SetCRT2ToRAMDAC); |
| @@ -1154,24 +1146,16 @@ SiS_GetVBInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, | |||
| 1154 | 1146 | ||
| 1155 | SiS_Pr->SiS_VBInfo = tempbx; | 1147 | SiS_Pr->SiS_VBInfo = tempbx; |
| 1156 | 1148 | ||
| 1157 | #ifdef SIS300 | 1149 | #ifdef CONFIG_FB_SIS_300 |
| 1158 | if(SiS_Pr->ChipType == SIS_630) { | 1150 | if(SiS_Pr->ChipType == SIS_630) { |
| 1159 | SiS_SetChrontelGPIO(SiS_Pr, SiS_Pr->SiS_VBInfo); | 1151 | SiS_SetChrontelGPIO(SiS_Pr, SiS_Pr->SiS_VBInfo); |
| 1160 | } | 1152 | } |
| 1161 | #endif | 1153 | #endif |
| 1162 | 1154 | ||
| 1163 | #ifdef SIS_LINUX_KERNEL | ||
| 1164 | #if 0 | 1155 | #if 0 |
| 1165 | printk(KERN_DEBUG "sisfb: (init301: VBInfo= 0x%04x, SetFlag=0x%04x)\n", | 1156 | printk(KERN_DEBUG "sisfb: (init301: VBInfo= 0x%04x, SetFlag=0x%04x)\n", |
| 1166 | SiS_Pr->SiS_VBInfo, SiS_Pr->SiS_SetFlag); | 1157 | SiS_Pr->SiS_VBInfo, SiS_Pr->SiS_SetFlag); |
| 1167 | #endif | 1158 | #endif |
| 1168 | #endif | ||
| 1169 | #ifdef SIS_XORG_XF86 | ||
| 1170 | #ifdef TWDEBUG | ||
| 1171 | xf86DrvMsg(0, X_PROBED, "(init301: VBInfo=0x%04x, SetFlag=0x%04x)\n", | ||
| 1172 | SiS_Pr->SiS_VBInfo, SiS_Pr->SiS_SetFlag); | ||
| 1173 | #endif | ||
| 1174 | #endif | ||
| 1175 | } | 1159 | } |
| 1176 | 1160 | ||
| 1177 | /*********************************************/ | 1161 | /*********************************************/ |
| @@ -1415,12 +1399,6 @@ SiS_SetTVMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 1415 | } | 1399 | } |
| 1416 | 1400 | ||
| 1417 | SiS_Pr->SiS_VBInfo &= ~SetPALTV; | 1401 | SiS_Pr->SiS_VBInfo &= ~SetPALTV; |
| 1418 | |||
| 1419 | #ifdef SIS_XORG_XF86 | ||
| 1420 | #ifdef TWDEBUG | ||
| 1421 | xf86DrvMsg(0, X_INFO, "(init301: TVMode %x, VBInfo %x)\n", SiS_Pr->SiS_TVMode, SiS_Pr->SiS_VBInfo); | ||
| 1422 | #endif | ||
| 1423 | #endif | ||
| 1424 | } | 1402 | } |
| 1425 | 1403 | ||
| 1426 | /*********************************************/ | 1404 | /*********************************************/ |
| @@ -1443,22 +1421,10 @@ SiS_GetBIOSLCDResInfo(struct SiS_Private *SiS_Pr) | |||
| 1443 | static void | 1421 | static void |
| 1444 | SiS_GetLCDInfoBIOS(struct SiS_Private *SiS_Pr) | 1422 | SiS_GetLCDInfoBIOS(struct SiS_Private *SiS_Pr) |
| 1445 | { | 1423 | { |
| 1446 | #ifdef SIS315H | 1424 | #ifdef CONFIG_FB_SIS_315 |
| 1447 | unsigned char *ROMAddr; | 1425 | unsigned char *ROMAddr; |
| 1448 | unsigned short temp; | 1426 | unsigned short temp; |
| 1449 | 1427 | ||
| 1450 | #ifdef SIS_XORG_XF86 | ||
| 1451 | #ifdef TWDEBUG | ||
| 1452 | xf86DrvMsg(0, X_INFO, "Paneldata driver: [%d %d] [H %d %d] [V %d %d] [C %d 0x%02x 0x%02x]\n", | ||
| 1453 | SiS_Pr->PanelHT, SiS_Pr->PanelVT, | ||
| 1454 | SiS_Pr->PanelHRS, SiS_Pr->PanelHRE, | ||
| 1455 | SiS_Pr->PanelVRS, SiS_Pr->PanelVRE, | ||
| 1456 | SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].CLOCK, | ||
| 1457 | SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].Part4_A, | ||
| 1458 | SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].Part4_B); | ||
| 1459 | #endif | ||
| 1460 | #endif | ||
| 1461 | |||
| 1462 | if((ROMAddr = GetLCDStructPtr661(SiS_Pr))) { | 1428 | if((ROMAddr = GetLCDStructPtr661(SiS_Pr))) { |
| 1463 | if((temp = SISGETROMW(6)) != SiS_Pr->PanelHT) { | 1429 | if((temp = SISGETROMW(6)) != SiS_Pr->PanelHT) { |
| 1464 | SiS_Pr->SiS_NeedRomModeData = true; | 1430 | SiS_Pr->SiS_NeedRomModeData = true; |
| @@ -1480,18 +1446,6 @@ SiS_GetLCDInfoBIOS(struct SiS_Private *SiS_Pr) | |||
| 1480 | SiS_Pr->SiS_VCLKData[VCLK_CUSTOM_315].SR2C = | 1446 | SiS_Pr->SiS_VCLKData[VCLK_CUSTOM_315].SR2C = |
| 1481 | SiS_Pr->SiS_VBVCLKData[VCLK_CUSTOM_315].Part4_B = ROMAddr[20]; | 1447 | SiS_Pr->SiS_VBVCLKData[VCLK_CUSTOM_315].Part4_B = ROMAddr[20]; |
| 1482 | 1448 | ||
| 1483 | #ifdef SIS_XORG_XF86 | ||
| 1484 | #ifdef TWDEBUG | ||
| 1485 | xf86DrvMsg(0, X_INFO, "Paneldata BIOS: [%d %d] [H %d %d] [V %d %d] [C %d 0x%02x 0x%02x]\n", | ||
| 1486 | SiS_Pr->PanelHT, SiS_Pr->PanelVT, | ||
| 1487 | SiS_Pr->PanelHRS, SiS_Pr->PanelHRE, | ||
| 1488 | SiS_Pr->PanelVRS, SiS_Pr->PanelVRE, | ||
| 1489 | SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].CLOCK, | ||
| 1490 | SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].Part4_A, | ||
| 1491 | SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].Part4_B); | ||
| 1492 | #endif | ||
| 1493 | #endif | ||
| 1494 | |||
| 1495 | } | 1449 | } |
| 1496 | #endif | 1450 | #endif |
| 1497 | } | 1451 | } |
| @@ -1517,13 +1471,13 @@ SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned sh | |||
| 1517 | { | 1471 | { |
| 1518 | unsigned short temp,modeflag,resinfo=0,modexres=0,modeyres=0; | 1472 | unsigned short temp,modeflag,resinfo=0,modexres=0,modeyres=0; |
| 1519 | bool panelcanscale = false; | 1473 | bool panelcanscale = false; |
| 1520 | #ifdef SIS300 | 1474 | #ifdef CONFIG_FB_SIS_300 |
| 1521 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; | 1475 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; |
| 1522 | static const unsigned char SiS300SeriesLCDRes[] = | 1476 | static const unsigned char SiS300SeriesLCDRes[] = |
| 1523 | { 0, 1, 2, 3, 7, 4, 5, 8, | 1477 | { 0, 1, 2, 3, 7, 4, 5, 8, |
| 1524 | 0, 0, 10, 0, 0, 0, 0, 15 }; | 1478 | 0, 0, 10, 0, 0, 0, 0, 15 }; |
| 1525 | #endif | 1479 | #endif |
| 1526 | #ifdef SIS315H | 1480 | #ifdef CONFIG_FB_SIS_315 |
| 1527 | unsigned char *myptr = NULL; | 1481 | unsigned char *myptr = NULL; |
| 1528 | #endif | 1482 | #endif |
| 1529 | 1483 | ||
| @@ -1562,7 +1516,7 @@ SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned sh | |||
| 1562 | SiS_Pr->SiS_LCDTypeInfo = (temp & 0x0F) - 1; | 1516 | SiS_Pr->SiS_LCDTypeInfo = (temp & 0x0F) - 1; |
| 1563 | } | 1517 | } |
| 1564 | temp &= 0x0f; | 1518 | temp &= 0x0f; |
| 1565 | #ifdef SIS300 | 1519 | #ifdef CONFIG_FB_SIS_300 |
| 1566 | if(SiS_Pr->ChipType < SIS_315H) { | 1520 | if(SiS_Pr->ChipType < SIS_315H) { |
| 1567 | /* Very old BIOSes only know 7 sizes (NetVista 2179, 1.01g) */ | 1521 | /* Very old BIOSes only know 7 sizes (NetVista 2179, 1.01g) */ |
| 1568 | if(SiS_Pr->SiS_VBType & VB_SIS301) { | 1522 | if(SiS_Pr->SiS_VBType & VB_SIS301) { |
| @@ -1574,7 +1528,7 @@ SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned sh | |||
| 1574 | #endif | 1528 | #endif |
| 1575 | 1529 | ||
| 1576 | /* Translate to our internal types */ | 1530 | /* Translate to our internal types */ |
| 1577 | #ifdef SIS315H | 1531 | #ifdef CONFIG_FB_SIS_315 |
| 1578 | if(SiS_Pr->ChipType == SIS_550) { | 1532 | if(SiS_Pr->ChipType == SIS_550) { |
| 1579 | if (temp == Panel310_1152x768) temp = Panel_320x240_2; /* Verified working */ | 1533 | if (temp == Panel310_1152x768) temp = Panel_320x240_2; /* Verified working */ |
| 1580 | else if(temp == Panel310_320x240_2) temp = Panel_320x240_2; | 1534 | else if(temp == Panel310_320x240_2) temp = Panel_320x240_2; |
| @@ -1597,7 +1551,7 @@ SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned sh | |||
| 1597 | 1551 | ||
| 1598 | SiS_Pr->SiS_LCDResInfo = temp; | 1552 | SiS_Pr->SiS_LCDResInfo = temp; |
| 1599 | 1553 | ||
| 1600 | #ifdef SIS300 | 1554 | #ifdef CONFIG_FB_SIS_300 |
| 1601 | if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { | 1555 | if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { |
| 1602 | if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) { | 1556 | if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) { |
| 1603 | SiS_Pr->SiS_LCDResInfo = Panel_Barco1366; | 1557 | SiS_Pr->SiS_LCDResInfo = Panel_Barco1366; |
| @@ -1639,7 +1593,7 @@ SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned sh | |||
| 1639 | else if(SiS_Pr->UsePanelScaler == 1) SiS_Pr->SiS_LCDInfo |= DontExpandLCD; | 1593 | else if(SiS_Pr->UsePanelScaler == 1) SiS_Pr->SiS_LCDInfo |= DontExpandLCD; |
| 1640 | 1594 | ||
| 1641 | /* Dual link, Pass 1:1 BIOS default, etc. */ | 1595 | /* Dual link, Pass 1:1 BIOS default, etc. */ |
| 1642 | #ifdef SIS315H | 1596 | #ifdef CONFIG_FB_SIS_315 |
| 1643 | if(SiS_Pr->ChipType >= SIS_661) { | 1597 | if(SiS_Pr->ChipType >= SIS_661) { |
| 1644 | if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { | 1598 | if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { |
| 1645 | if(temp & 0x08) SiS_Pr->SiS_LCDInfo |= LCDPass11; | 1599 | if(temp & 0x08) SiS_Pr->SiS_LCDInfo |= LCDPass11; |
| @@ -2076,7 +2030,7 @@ SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned sh | |||
| 2076 | } | 2030 | } |
| 2077 | } | 2031 | } |
| 2078 | 2032 | ||
| 2079 | #ifdef SIS300 | 2033 | #ifdef CONFIG_FB_SIS_300 |
| 2080 | if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { | 2034 | if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { |
| 2081 | if(SiS_Pr->SiS_CustomT == CUT_PANEL848 || SiS_Pr->SiS_CustomT == CUT_PANEL856) { | 2035 | if(SiS_Pr->SiS_CustomT == CUT_PANEL848 || SiS_Pr->SiS_CustomT == CUT_PANEL856) { |
| 2082 | SiS_Pr->SiS_LCDInfo = 0x80 | 0x40 | 0x20; /* neg h/v sync, RGB24(D0 = 0) */ | 2036 | SiS_Pr->SiS_LCDInfo = 0x80 | 0x40 | 0x20; /* neg h/v sync, RGB24(D0 = 0) */ |
| @@ -2186,17 +2140,10 @@ SiS_GetLCDResInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned sh | |||
| 2186 | SiS_Pr->SiS_SetFlag |= LCDVESATiming; | 2140 | SiS_Pr->SiS_SetFlag |= LCDVESATiming; |
| 2187 | } | 2141 | } |
| 2188 | 2142 | ||
| 2189 | #ifdef SIS_LINUX_KERNEL | ||
| 2190 | #if 0 | 2143 | #if 0 |
| 2191 | printk(KERN_DEBUG "sisfb: (LCDInfo=0x%04x LCDResInfo=0x%02x LCDTypeInfo=0x%02x)\n", | 2144 | printk(KERN_DEBUG "sisfb: (LCDInfo=0x%04x LCDResInfo=0x%02x LCDTypeInfo=0x%02x)\n", |
| 2192 | SiS_Pr->SiS_LCDInfo, SiS_Pr->SiS_LCDResInfo, SiS_Pr->SiS_LCDTypeInfo); | 2145 | SiS_Pr->SiS_LCDInfo, SiS_Pr->SiS_LCDResInfo, SiS_Pr->SiS_LCDTypeInfo); |
| 2193 | #endif | 2146 | #endif |
| 2194 | #endif | ||
| 2195 | #ifdef SIS_XORG_XF86 | ||
| 2196 | xf86DrvMsgVerb(0, X_PROBED, 4, | ||
| 2197 | "(init301: LCDInfo=0x%04x LCDResInfo=0x%02x LCDTypeInfo=0x%02x SetFlag=0x%04x)\n", | ||
| 2198 | SiS_Pr->SiS_LCDInfo, SiS_Pr->SiS_LCDResInfo, SiS_Pr->SiS_LCDTypeInfo, SiS_Pr->SiS_SetFlag); | ||
| 2199 | #endif | ||
| 2200 | } | 2147 | } |
| 2201 | 2148 | ||
| 2202 | /*********************************************/ | 2149 | /*********************************************/ |
| @@ -2359,7 +2306,7 @@ SiS_GetVCLK2Ptr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned shor | |||
| 2359 | VCLKIndex = SiS_Pr->PanelVCLKIdx315; | 2306 | VCLKIndex = SiS_Pr->PanelVCLKIdx315; |
| 2360 | } | 2307 | } |
| 2361 | 2308 | ||
| 2362 | #ifdef SIS300 | 2309 | #ifdef CONFIG_FB_SIS_300 |
| 2363 | /* Special Timing: Barco iQ Pro R series */ | 2310 | /* Special Timing: Barco iQ Pro R series */ |
| 2364 | if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) VCLKIndex = 0x44; | 2311 | if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) VCLKIndex = 0x44; |
| 2365 | 2312 | ||
| @@ -2410,12 +2357,6 @@ SiS_GetVCLK2Ptr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned shor | |||
| 2410 | 2357 | ||
| 2411 | } | 2358 | } |
| 2412 | 2359 | ||
| 2413 | #ifdef SIS_XORG_XF86 | ||
| 2414 | #ifdef TWDEBUG | ||
| 2415 | xf86DrvMsg(0, X_INFO, "VCLKIndex %d (0x%x)\n", VCLKIndex, VCLKIndex); | ||
| 2416 | #endif | ||
| 2417 | #endif | ||
| 2418 | |||
| 2419 | return VCLKIndex; | 2360 | return VCLKIndex; |
| 2420 | } | 2361 | } |
| 2421 | 2362 | ||
| @@ -2428,10 +2369,10 @@ SiS_SetCRT2ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned | |||
| 2428 | { | 2369 | { |
| 2429 | unsigned short i, j, modeflag, tempah=0; | 2370 | unsigned short i, j, modeflag, tempah=0; |
| 2430 | short tempcl; | 2371 | short tempcl; |
| 2431 | #if defined(SIS300) || defined(SIS315H) | 2372 | #if defined(CONFIG_FB_SIS_300) || defined(CONFIG_FB_SIS_315) |
| 2432 | unsigned short tempbl; | 2373 | unsigned short tempbl; |
| 2433 | #endif | 2374 | #endif |
| 2434 | #ifdef SIS315H | 2375 | #ifdef CONFIG_FB_SIS_315 |
| 2435 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; | 2376 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; |
| 2436 | unsigned short tempah2, tempbl2; | 2377 | unsigned short tempah2, tempbl2; |
| 2437 | #endif | 2378 | #endif |
| @@ -2454,7 +2395,7 @@ SiS_SetCRT2ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned | |||
| 2454 | 2395 | ||
| 2455 | if(SiS_Pr->ChipType < SIS_315H) { | 2396 | if(SiS_Pr->ChipType < SIS_315H) { |
| 2456 | 2397 | ||
| 2457 | #ifdef SIS300 /* ---- 300 series ---- */ | 2398 | #ifdef CONFIG_FB_SIS_300 /* ---- 300 series ---- */ |
| 2458 | 2399 | ||
| 2459 | /* For 301BDH: (with LCD via LVDS) */ | 2400 | /* For 301BDH: (with LCD via LVDS) */ |
| 2460 | if(SiS_Pr->SiS_VBType & VB_NoLCD) { | 2401 | if(SiS_Pr->SiS_VBType & VB_NoLCD) { |
| @@ -2477,11 +2418,11 @@ SiS_SetCRT2ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned | |||
| 2477 | 2418 | ||
| 2478 | if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempah ^= 0xA0; | 2419 | if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempah ^= 0xA0; |
| 2479 | 2420 | ||
| 2480 | #endif /* SIS300 */ | 2421 | #endif /* CONFIG_FB_SIS_300 */ |
| 2481 | 2422 | ||
| 2482 | } else { | 2423 | } else { |
| 2483 | 2424 | ||
| 2484 | #ifdef SIS315H /* ------- 315/330 series ------ */ | 2425 | #ifdef CONFIG_FB_SIS_315 /* ------- 315/330 series ------ */ |
| 2485 | 2426 | ||
| 2486 | if(ModeNo > 0x13) { | 2427 | if(ModeNo > 0x13) { |
| 2487 | tempcl -= ModeVGA; | 2428 | tempcl -= ModeVGA; |
| @@ -2494,7 +2435,7 @@ SiS_SetCRT2ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned | |||
| 2494 | 2435 | ||
| 2495 | if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempah ^= 0x50; | 2436 | if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempah ^= 0x50; |
| 2496 | 2437 | ||
| 2497 | #endif /* SIS315H */ | 2438 | #endif /* CONFIG_FB_SIS_315 */ |
| 2498 | 2439 | ||
| 2499 | } | 2440 | } |
| 2500 | 2441 | ||
| @@ -2503,7 +2444,7 @@ SiS_SetCRT2ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned | |||
| 2503 | if(SiS_Pr->ChipType < SIS_315H) { | 2444 | if(SiS_Pr->ChipType < SIS_315H) { |
| 2504 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,tempah); | 2445 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,tempah); |
| 2505 | } else { | 2446 | } else { |
| 2506 | #ifdef SIS315H | 2447 | #ifdef CONFIG_FB_SIS_315 |
| 2507 | if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { | 2448 | if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { |
| 2508 | SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x00,0xa0,tempah); | 2449 | SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x00,0xa0,tempah); |
| 2509 | } else if(SiS_Pr->SiS_VBType & VB_SISVB) { | 2450 | } else if(SiS_Pr->SiS_VBType & VB_SISVB) { |
| @@ -2584,7 +2525,7 @@ SiS_SetCRT2ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned | |||
| 2584 | 2525 | ||
| 2585 | if(SiS_Pr->ChipType >= SIS_315H) { | 2526 | if(SiS_Pr->ChipType >= SIS_315H) { |
| 2586 | 2527 | ||
| 2587 | #ifdef SIS315H | 2528 | #ifdef CONFIG_FB_SIS_315 |
| 2588 | /* LVDS can only be slave in 8bpp modes */ | 2529 | /* LVDS can only be slave in 8bpp modes */ |
| 2589 | tempah = 0x80; | 2530 | tempah = 0x80; |
| 2590 | if((modeflag & CRT2Mode) && (SiS_Pr->SiS_ModeType > ModeVGA)) { | 2531 | if((modeflag & CRT2Mode) && (SiS_Pr->SiS_ModeType > ModeVGA)) { |
| @@ -2604,7 +2545,7 @@ SiS_SetCRT2ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned | |||
| 2604 | 2545 | ||
| 2605 | } else { | 2546 | } else { |
| 2606 | 2547 | ||
| 2607 | #ifdef SIS300 | 2548 | #ifdef CONFIG_FB_SIS_300 |
| 2608 | tempah = 0; | 2549 | tempah = 0; |
| 2609 | if( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) && (SiS_Pr->SiS_ModeType > ModeVGA) ) { | 2550 | if( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) && (SiS_Pr->SiS_ModeType > ModeVGA) ) { |
| 2610 | tempah |= 0x02; | 2551 | tempah |= 0x02; |
| @@ -2626,7 +2567,7 @@ SiS_SetCRT2ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned | |||
| 2626 | 2567 | ||
| 2627 | if(SiS_Pr->ChipType >= SIS_315H) { | 2568 | if(SiS_Pr->ChipType >= SIS_315H) { |
| 2628 | 2569 | ||
| 2629 | #ifdef SIS315H | 2570 | #ifdef CONFIG_FB_SIS_315 |
| 2630 | /* unsigned char bridgerev = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01); */ | 2571 | /* unsigned char bridgerev = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01); */ |
| 2631 | 2572 | ||
| 2632 | /* The following is nearly unpreditable and varies from machine | 2573 | /* The following is nearly unpreditable and varies from machine |
| @@ -2718,11 +2659,11 @@ SiS_SetCRT2ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned | |||
| 2718 | SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x23,tempbl,tempah); | 2659 | SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x23,tempbl,tempah); |
| 2719 | } | 2660 | } |
| 2720 | 2661 | ||
| 2721 | #endif /* SIS315H */ | 2662 | #endif /* CONFIG_FB_SIS_315 */ |
| 2722 | 2663 | ||
| 2723 | } else if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { | 2664 | } else if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { |
| 2724 | 2665 | ||
| 2725 | #ifdef SIS300 | 2666 | #ifdef CONFIG_FB_SIS_300 |
| 2726 | SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x21,0x3f); | 2667 | SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x21,0x3f); |
| 2727 | 2668 | ||
| 2728 | if((SiS_Pr->SiS_VBInfo & DisableCRT2Display) || | 2669 | if((SiS_Pr->SiS_VBInfo & DisableCRT2Display) || |
| @@ -2745,7 +2686,7 @@ SiS_SetCRT2ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned | |||
| 2745 | 2686 | ||
| 2746 | } else { /* LVDS */ | 2687 | } else { /* LVDS */ |
| 2747 | 2688 | ||
| 2748 | #ifdef SIS315H | 2689 | #ifdef CONFIG_FB_SIS_315 |
| 2749 | if(SiS_Pr->ChipType >= SIS_315H) { | 2690 | if(SiS_Pr->ChipType >= SIS_315H) { |
| 2750 | 2691 | ||
| 2751 | if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { | 2692 | if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { |
| @@ -2931,7 +2872,7 @@ SiS_GetCRT2Ptr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 2931 | } | 2872 | } |
| 2932 | } | 2873 | } |
| 2933 | 2874 | ||
| 2934 | #ifdef SIS315H | 2875 | #ifdef CONFIG_FB_SIS_315 |
| 2935 | if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { | 2876 | if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { |
| 2936 | if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) { | 2877 | if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) { |
| 2937 | if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) { | 2878 | if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) { |
| @@ -3036,7 +2977,7 @@ SiS_GetCRT2Ptr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 3036 | case Panel_1280x1024: tempbx = 24; break; | 2977 | case Panel_1280x1024: tempbx = 24; break; |
| 3037 | case Panel_1400x1050: tempbx = 26; break; | 2978 | case Panel_1400x1050: tempbx = 26; break; |
| 3038 | case Panel_1600x1200: tempbx = 28; break; | 2979 | case Panel_1600x1200: tempbx = 28; break; |
| 3039 | #ifdef SIS300 | 2980 | #ifdef CONFIG_FB_SIS_300 |
| 3040 | case Panel_Barco1366: tempbx = 80; break; | 2981 | case Panel_Barco1366: tempbx = 80; break; |
| 3041 | #endif | 2982 | #endif |
| 3042 | } | 2983 | } |
| @@ -3053,7 +2994,7 @@ SiS_GetCRT2Ptr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 3053 | 2994 | ||
| 3054 | if(SiS_Pr->SiS_LCDInfo & LCDPass11) tempbx = 30; | 2995 | if(SiS_Pr->SiS_LCDInfo & LCDPass11) tempbx = 30; |
| 3055 | 2996 | ||
| 3056 | #ifdef SIS300 | 2997 | #ifdef CONFIG_FB_SIS_300 |
| 3057 | if(SiS_Pr->SiS_CustomT == CUT_BARCO1024) { | 2998 | if(SiS_Pr->SiS_CustomT == CUT_BARCO1024) { |
| 3058 | tempbx = 82; | 2999 | tempbx = 82; |
| 3059 | if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; | 3000 | if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; |
| @@ -3189,7 +3130,7 @@ SiS_GetCRT2DataLVDS(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned | |||
| 3189 | 3130 | ||
| 3190 | if((SiS_Pr->SiS_VBType & VB_SISVB) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { | 3131 | if((SiS_Pr->SiS_VBType & VB_SISVB) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { |
| 3191 | 3132 | ||
| 3192 | #ifdef SIS315H | 3133 | #ifdef CONFIG_FB_SIS_315 |
| 3193 | SiS_CalcPanelLinkTiming(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); | 3134 | SiS_CalcPanelLinkTiming(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); |
| 3194 | SiS_CalcLCDACRT1Timing(SiS_Pr, ModeNo, ModeIdIndex); | 3135 | SiS_CalcLCDACRT1Timing(SiS_Pr, ModeNo, ModeIdIndex); |
| 3195 | #endif | 3136 | #endif |
| @@ -3214,7 +3155,7 @@ SiS_GetCRT2DataLVDS(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned | |||
| 3214 | case 16: LVDSData = SiS_Pr->SiS_LVDS800x600Data_1; break; | 3155 | case 16: LVDSData = SiS_Pr->SiS_LVDS800x600Data_1; break; |
| 3215 | case 18: LVDSData = SiS_Pr->SiS_LVDS1024x600Data_1; break; | 3156 | case 18: LVDSData = SiS_Pr->SiS_LVDS1024x600Data_1; break; |
| 3216 | case 20: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break; | 3157 | case 20: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break; |
| 3217 | #ifdef SIS300 | 3158 | #ifdef CONFIG_FB_SIS_300 |
| 3218 | case 80: LVDSData = SiS_Pr->SiS_LVDSBARCO1366Data_1; break; | 3159 | case 80: LVDSData = SiS_Pr->SiS_LVDSBARCO1366Data_1; break; |
| 3219 | case 81: LVDSData = SiS_Pr->SiS_LVDSBARCO1366Data_2; break; | 3160 | case 81: LVDSData = SiS_Pr->SiS_LVDSBARCO1366Data_2; break; |
| 3220 | case 82: LVDSData = SiS_Pr->SiS_LVDSBARCO1024Data_1; break; | 3161 | case 82: LVDSData = SiS_Pr->SiS_LVDSBARCO1024Data_1; break; |
| @@ -3248,7 +3189,7 @@ SiS_GetCRT2DataLVDS(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned | |||
| 3248 | (SiS_Pr->SiS_SetFlag & SetDOSMode) ) { | 3189 | (SiS_Pr->SiS_SetFlag & SetDOSMode) ) { |
| 3249 | SiS_Pr->SiS_HDE = SiS_Pr->PanelXRes; | 3190 | SiS_Pr->SiS_HDE = SiS_Pr->PanelXRes; |
| 3250 | SiS_Pr->SiS_VDE = SiS_Pr->PanelYRes; | 3191 | SiS_Pr->SiS_VDE = SiS_Pr->PanelYRes; |
| 3251 | #ifdef SIS300 | 3192 | #ifdef CONFIG_FB_SIS_300 |
| 3252 | if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) { | 3193 | if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) { |
| 3253 | if(ResIndex < 0x08) { | 3194 | if(ResIndex < 0x08) { |
| 3254 | SiS_Pr->SiS_HDE = 1280; | 3195 | SiS_Pr->SiS_HDE = 1280; |
| @@ -3270,7 +3211,7 @@ SiS_GetCRT2Data301(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 3270 | unsigned short resinfo, CRT2Index, ResIndex; | 3211 | unsigned short resinfo, CRT2Index, ResIndex; |
| 3271 | const struct SiS_LCDData *LCDPtr = NULL; | 3212 | const struct SiS_LCDData *LCDPtr = NULL; |
| 3272 | const struct SiS_TVData *TVPtr = NULL; | 3213 | const struct SiS_TVData *TVPtr = NULL; |
| 3273 | #ifdef SIS315H | 3214 | #ifdef CONFIG_FB_SIS_315 |
| 3274 | short resinfo661; | 3215 | short resinfo661; |
| 3275 | #endif | 3216 | #endif |
| 3276 | 3217 | ||
| @@ -3283,7 +3224,7 @@ SiS_GetCRT2Data301(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 3283 | } else { | 3224 | } else { |
| 3284 | modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; | 3225 | modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
| 3285 | resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; | 3226 | resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; |
| 3286 | #ifdef SIS315H | 3227 | #ifdef CONFIG_FB_SIS_315 |
| 3287 | resinfo661 = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].ROMMODEIDX661; | 3228 | resinfo661 = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].ROMMODEIDX661; |
| 3288 | if( (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && | 3229 | if( (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && |
| 3289 | (SiS_Pr->SiS_SetFlag & LCDVESATiming) && | 3230 | (SiS_Pr->SiS_SetFlag & LCDVESATiming) && |
| @@ -3460,7 +3401,7 @@ SiS_GetCRT2Data301(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 3460 | 3401 | ||
| 3461 | } else if( (!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) && (romptr) && (ROMAddr) ) { | 3402 | } else if( (!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) && (romptr) && (ROMAddr) ) { |
| 3462 | 3403 | ||
| 3463 | #ifdef SIS315H | 3404 | #ifdef CONFIG_FB_SIS_315 |
| 3464 | SiS_Pr->SiS_RVBHCMAX = ROMAddr[romptr]; | 3405 | SiS_Pr->SiS_RVBHCMAX = ROMAddr[romptr]; |
| 3465 | SiS_Pr->SiS_RVBHCFACT = ROMAddr[romptr+1]; | 3406 | SiS_Pr->SiS_RVBHCFACT = ROMAddr[romptr+1]; |
| 3466 | SiS_Pr->SiS_VGAHT = ROMAddr[romptr+2] | ((ROMAddr[romptr+3] & 0x0f) << 8); | 3407 | SiS_Pr->SiS_VGAHT = ROMAddr[romptr+2] | ((ROMAddr[romptr+3] & 0x0f) << 8); |
| @@ -3520,19 +3461,13 @@ SiS_GetCRT2Data301(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 3520 | case Panel_1680x1050 : | 3461 | case Panel_1680x1050 : |
| 3521 | case Panel_1680x1050 + 32: LCDPtr = SiS_Pr->SiS_LCD1680x1050Data; break; | 3462 | case Panel_1680x1050 + 32: LCDPtr = SiS_Pr->SiS_LCD1680x1050Data; break; |
| 3522 | case 100 : LCDPtr = SiS_Pr->SiS_NoScaleData; break; | 3463 | case 100 : LCDPtr = SiS_Pr->SiS_NoScaleData; break; |
| 3523 | #ifdef SIS315H | 3464 | #ifdef CONFIG_FB_SIS_315 |
| 3524 | case 200 : LCDPtr = SiS310_ExtCompaq1280x1024Data; break; | 3465 | case 200 : LCDPtr = SiS310_ExtCompaq1280x1024Data; break; |
| 3525 | case 201 : LCDPtr = SiS_Pr->SiS_St2LCD1280x1024Data; break; | 3466 | case 201 : LCDPtr = SiS_Pr->SiS_St2LCD1280x1024Data; break; |
| 3526 | #endif | 3467 | #endif |
| 3527 | default : LCDPtr = SiS_Pr->SiS_ExtLCD1024x768Data; break; | 3468 | default : LCDPtr = SiS_Pr->SiS_ExtLCD1024x768Data; break; |
| 3528 | } | 3469 | } |
| 3529 | 3470 | ||
| 3530 | #ifdef SIS_XORG_XF86 | ||
| 3531 | #ifdef TWDEBUG | ||
| 3532 | xf86DrvMsg(0, X_INFO, "GetCRT2Data: Index %d ResIndex %d\n", CRT2Index, ResIndex); | ||
| 3533 | #endif | ||
| 3534 | #endif | ||
| 3535 | |||
| 3536 | SiS_Pr->SiS_RVBHCMAX = (LCDPtr+ResIndex)->RVBHCMAX; | 3471 | SiS_Pr->SiS_RVBHCMAX = (LCDPtr+ResIndex)->RVBHCMAX; |
| 3537 | SiS_Pr->SiS_RVBHCFACT = (LCDPtr+ResIndex)->RVBHCFACT; | 3472 | SiS_Pr->SiS_RVBHCFACT = (LCDPtr+ResIndex)->RVBHCFACT; |
| 3538 | SiS_Pr->SiS_VGAHT = (LCDPtr+ResIndex)->VGAHT; | 3473 | SiS_Pr->SiS_VGAHT = (LCDPtr+ResIndex)->VGAHT; |
| @@ -3624,7 +3559,7 @@ SiS_GetLVDSDesPtr(struct SiS_Private *SiS_Pr) | |||
| 3624 | { | 3559 | { |
| 3625 | const struct SiS_LVDSDes *PanelDesPtr = NULL; | 3560 | const struct SiS_LVDSDes *PanelDesPtr = NULL; |
| 3626 | 3561 | ||
| 3627 | #ifdef SIS300 | 3562 | #ifdef CONFIG_FB_SIS_300 |
| 3628 | if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { | 3563 | if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { |
| 3629 | 3564 | ||
| 3630 | if(SiS_Pr->ChipType < SIS_315H) { | 3565 | if(SiS_Pr->ChipType < SIS_315H) { |
| @@ -3696,7 +3631,7 @@ SiS_GetLVDSDesData(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 3696 | 3631 | ||
| 3697 | if((SiS_Pr->SiS_VBType & VB_SIS30xBLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { | 3632 | if((SiS_Pr->SiS_VBType & VB_SIS30xBLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { |
| 3698 | 3633 | ||
| 3699 | #ifdef SIS315H | 3634 | #ifdef CONFIG_FB_SIS_315 |
| 3700 | if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { | 3635 | if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { |
| 3701 | /* non-pass 1:1 only, see above */ | 3636 | /* non-pass 1:1 only, see above */ |
| 3702 | if(SiS_Pr->SiS_VGAHDE != SiS_Pr->PanelXRes) { | 3637 | if(SiS_Pr->SiS_VGAHDE != SiS_Pr->PanelXRes) { |
| @@ -3771,7 +3706,7 @@ SiS_GetLVDSDesData(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 3771 | } else { | 3706 | } else { |
| 3772 | 3707 | ||
| 3773 | if(SiS_Pr->ChipType < SIS_315H) { | 3708 | if(SiS_Pr->ChipType < SIS_315H) { |
| 3774 | #ifdef SIS300 | 3709 | #ifdef CONFIG_FB_SIS_300 |
| 3775 | switch(SiS_Pr->SiS_LCDResInfo) { | 3710 | switch(SiS_Pr->SiS_LCDResInfo) { |
| 3776 | case Panel_800x600: | 3711 | case Panel_800x600: |
| 3777 | if(SiS_Pr->SiS_VGAVDE == SiS_Pr->PanelYRes) { | 3712 | if(SiS_Pr->SiS_VGAVDE == SiS_Pr->PanelYRes) { |
| @@ -3816,7 +3751,7 @@ SiS_GetLVDSDesData(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 3816 | } | 3751 | } |
| 3817 | #endif | 3752 | #endif |
| 3818 | } else { | 3753 | } else { |
| 3819 | #ifdef SIS315H | 3754 | #ifdef CONFIG_FB_SIS_315 |
| 3820 | switch(SiS_Pr->SiS_LCDResInfo) { | 3755 | switch(SiS_Pr->SiS_LCDResInfo) { |
| 3821 | case Panel_1024x768: | 3756 | case Panel_1024x768: |
| 3822 | case Panel_1280x1024: | 3757 | case Panel_1280x1024: |
| @@ -3844,7 +3779,7 @@ SiS_GetLVDSDesData(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 3844 | if(SiS_Pr->ChipType < SIS_315H) { | 3779 | if(SiS_Pr->ChipType < SIS_315H) { |
| 3845 | if(!(modeflag & HalfDCLK)) SiS_Pr->SiS_LCDHDES = 320; | 3780 | if(!(modeflag & HalfDCLK)) SiS_Pr->SiS_LCDHDES = 320; |
| 3846 | } else { | 3781 | } else { |
| 3847 | #ifdef SIS315H | 3782 | #ifdef CONFIG_FB_SIS_315 |
| 3848 | if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) SiS_Pr->SiS_LCDHDES = 480; | 3783 | if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) SiS_Pr->SiS_LCDHDES = 480; |
| 3849 | if(SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) SiS_Pr->SiS_LCDHDES = 804; | 3784 | if(SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) SiS_Pr->SiS_LCDHDES = 804; |
| 3850 | if(SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) SiS_Pr->SiS_LCDHDES = 704; | 3785 | if(SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) SiS_Pr->SiS_LCDHDES = 704; |
| @@ -3866,7 +3801,7 @@ SiS_GetLVDSDesData(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 3866 | /* DISABLE VIDEO BRIDGE */ | 3801 | /* DISABLE VIDEO BRIDGE */ |
| 3867 | /*********************************************/ | 3802 | /*********************************************/ |
| 3868 | 3803 | ||
| 3869 | #ifdef SIS315H | 3804 | #ifdef CONFIG_FB_SIS_315 |
| 3870 | static int | 3805 | static int |
| 3871 | SiS_HandlePWD(struct SiS_Private *SiS_Pr) | 3806 | SiS_HandlePWD(struct SiS_Private *SiS_Pr) |
| 3872 | { | 3807 | { |
| @@ -3891,11 +3826,6 @@ SiS_HandlePWD(struct SiS_Private *SiS_Pr) | |||
| 3891 | ret = 1; | 3826 | ret = 1; |
| 3892 | } | 3827 | } |
| 3893 | SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x27,0x7f,temp); | 3828 | SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x27,0x7f,temp); |
| 3894 | #ifdef SIS_XORG_XF86 | ||
| 3895 | #ifdef TWDEBUG | ||
| 3896 | xf86DrvMsg(0, 0, "Setting PWD %x\n", temp); | ||
| 3897 | #endif | ||
| 3898 | #endif | ||
| 3899 | } | 3829 | } |
| 3900 | #endif | 3830 | #endif |
| 3901 | return ret; | 3831 | return ret; |
| @@ -3909,7 +3839,7 @@ SiS_HandlePWD(struct SiS_Private *SiS_Pr) | |||
| 3909 | void | 3839 | void |
| 3910 | SiS_DisableBridge(struct SiS_Private *SiS_Pr) | 3840 | SiS_DisableBridge(struct SiS_Private *SiS_Pr) |
| 3911 | { | 3841 | { |
| 3912 | #ifdef SIS315H | 3842 | #ifdef CONFIG_FB_SIS_315 |
| 3913 | unsigned short tempah, pushax=0, modenum; | 3843 | unsigned short tempah, pushax=0, modenum; |
| 3914 | #endif | 3844 | #endif |
| 3915 | unsigned short temp=0; | 3845 | unsigned short temp=0; |
| @@ -3920,7 +3850,7 @@ SiS_DisableBridge(struct SiS_Private *SiS_Pr) | |||
| 3920 | 3850 | ||
| 3921 | if(SiS_Pr->ChipType < SIS_315H) { | 3851 | if(SiS_Pr->ChipType < SIS_315H) { |
| 3922 | 3852 | ||
| 3923 | #ifdef SIS300 /* 300 series */ | 3853 | #ifdef CONFIG_FB_SIS_300 /* 300 series */ |
| 3924 | 3854 | ||
| 3925 | if(!(SiS_CR36BIOSWord23b(SiS_Pr))) { | 3855 | if(!(SiS_CR36BIOSWord23b(SiS_Pr))) { |
| 3926 | if(SiS_Pr->SiS_VBType & VB_SISLVDS) { | 3856 | if(SiS_Pr->SiS_VBType & VB_SISLVDS) { |
| @@ -3953,11 +3883,11 @@ SiS_DisableBridge(struct SiS_Private *SiS_Pr) | |||
| 3953 | } | 3883 | } |
| 3954 | } | 3884 | } |
| 3955 | 3885 | ||
| 3956 | #endif /* SIS300 */ | 3886 | #endif /* CONFIG_FB_SIS_300 */ |
| 3957 | 3887 | ||
| 3958 | } else { | 3888 | } else { |
| 3959 | 3889 | ||
| 3960 | #ifdef SIS315H /* 315 series */ | 3890 | #ifdef CONFIG_FB_SIS_315 /* 315 series */ |
| 3961 | 3891 | ||
| 3962 | int didpwd = 0; | 3892 | int didpwd = 0; |
| 3963 | bool custom1 = (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) || | 3893 | bool custom1 = (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) || |
| @@ -4081,14 +4011,14 @@ SiS_DisableBridge(struct SiS_Private *SiS_Pr) | |||
| 4081 | 4011 | ||
| 4082 | } | 4012 | } |
| 4083 | 4013 | ||
| 4084 | #endif /* SIS315H */ | 4014 | #endif /* CONFIG_FB_SIS_315 */ |
| 4085 | 4015 | ||
| 4086 | } | 4016 | } |
| 4087 | 4017 | ||
| 4088 | } else { /* ============ For 301 ================ */ | 4018 | } else { /* ============ For 301 ================ */ |
| 4089 | 4019 | ||
| 4090 | if(SiS_Pr->ChipType < SIS_315H) { | 4020 | if(SiS_Pr->ChipType < SIS_315H) { |
| 4091 | #ifdef SIS300 | 4021 | #ifdef CONFIG_FB_SIS_300 |
| 4092 | if(!(SiS_CR36BIOSWord23b(SiS_Pr))) { | 4022 | if(!(SiS_CR36BIOSWord23b(SiS_Pr))) { |
| 4093 | SiS_SetRegSR11ANDOR(SiS_Pr,0xF7,0x08); | 4023 | SiS_SetRegSR11ANDOR(SiS_Pr,0xF7,0x08); |
| 4094 | SiS_PanelDelay(SiS_Pr, 3); | 4024 | SiS_PanelDelay(SiS_Pr, 3); |
| @@ -4111,7 +4041,7 @@ SiS_DisableBridge(struct SiS_Private *SiS_Pr) | |||
| 4111 | SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); | 4041 | SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); |
| 4112 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,temp); | 4042 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,temp); |
| 4113 | } else { | 4043 | } else { |
| 4114 | #ifdef SIS300 | 4044 | #ifdef CONFIG_FB_SIS_300 |
| 4115 | SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF); /* disable CRT2 */ | 4045 | SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF); /* disable CRT2 */ |
| 4116 | if( (!(SiS_CRT2IsLCD(SiS_Pr))) || | 4046 | if( (!(SiS_CRT2IsLCD(SiS_Pr))) || |
| 4117 | (!(SiS_CR36BIOSWord23d(SiS_Pr))) ) { | 4047 | (!(SiS_CR36BIOSWord23d(SiS_Pr))) ) { |
| @@ -4127,7 +4057,7 @@ SiS_DisableBridge(struct SiS_Private *SiS_Pr) | |||
| 4127 | 4057 | ||
| 4128 | if(SiS_Pr->ChipType < SIS_315H) { | 4058 | if(SiS_Pr->ChipType < SIS_315H) { |
| 4129 | 4059 | ||
| 4130 | #ifdef SIS300 /* 300 series */ | 4060 | #ifdef CONFIG_FB_SIS_300 /* 300 series */ |
| 4131 | 4061 | ||
| 4132 | if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) { | 4062 | if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) { |
| 4133 | SiS_SetCH700x(SiS_Pr,0x0E,0x09); | 4063 | SiS_SetCH700x(SiS_Pr,0x0E,0x09); |
| @@ -4171,11 +4101,11 @@ SiS_DisableBridge(struct SiS_Private *SiS_Pr) | |||
| 4171 | SiS_SetRegSR11ANDOR(SiS_Pr,0xFB,0x04); | 4101 | SiS_SetRegSR11ANDOR(SiS_Pr,0xFB,0x04); |
| 4172 | } | 4102 | } |
| 4173 | 4103 | ||
| 4174 | #endif /* SIS300 */ | 4104 | #endif /* CONFIG_FB_SIS_300 */ |
| 4175 | 4105 | ||
| 4176 | } else { | 4106 | } else { |
| 4177 | 4107 | ||
| 4178 | #ifdef SIS315H /* 315 series */ | 4108 | #ifdef CONFIG_FB_SIS_315 /* 315 series */ |
| 4179 | 4109 | ||
| 4180 | if(!(SiS_IsNotM650orLater(SiS_Pr))) { | 4110 | if(!(SiS_IsNotM650orLater(SiS_Pr))) { |
| 4181 | /*if(SiS_Pr->ChipType < SIS_340) { */ /* XGI needs this */ | 4111 | /*if(SiS_Pr->ChipType < SIS_340) { */ /* XGI needs this */ |
| @@ -4288,7 +4218,7 @@ SiS_DisableBridge(struct SiS_Private *SiS_Pr) | |||
| 4288 | } | 4218 | } |
| 4289 | } | 4219 | } |
| 4290 | 4220 | ||
| 4291 | #endif /* SIS315H */ | 4221 | #endif /* CONFIG_FB_SIS_315 */ |
| 4292 | 4222 | ||
| 4293 | } /* 315 series */ | 4223 | } /* 315 series */ |
| 4294 | 4224 | ||
| @@ -4304,14 +4234,12 @@ SiS_DisableBridge(struct SiS_Private *SiS_Pr) | |||
| 4304 | * from outside the context of a mode switch! | 4234 | * from outside the context of a mode switch! |
| 4305 | * MUST call getVBType before calling this | 4235 | * MUST call getVBType before calling this |
| 4306 | */ | 4236 | */ |
| 4307 | #ifdef SIS_LINUX_KERNEL | ||
| 4308 | static | 4237 | static |
| 4309 | #endif | ||
| 4310 | void | 4238 | void |
| 4311 | SiS_EnableBridge(struct SiS_Private *SiS_Pr) | 4239 | SiS_EnableBridge(struct SiS_Private *SiS_Pr) |
| 4312 | { | 4240 | { |
| 4313 | unsigned short temp=0, tempah; | 4241 | unsigned short temp=0, tempah; |
| 4314 | #ifdef SIS315H | 4242 | #ifdef CONFIG_FB_SIS_315 |
| 4315 | unsigned short temp1, pushax=0; | 4243 | unsigned short temp1, pushax=0; |
| 4316 | bool delaylong = false; | 4244 | bool delaylong = false; |
| 4317 | #endif | 4245 | #endif |
| @@ -4322,7 +4250,7 @@ SiS_EnableBridge(struct SiS_Private *SiS_Pr) | |||
| 4322 | 4250 | ||
| 4323 | if(SiS_Pr->ChipType < SIS_315H) { | 4251 | if(SiS_Pr->ChipType < SIS_315H) { |
| 4324 | 4252 | ||
| 4325 | #ifdef SIS300 /* 300 series */ | 4253 | #ifdef CONFIG_FB_SIS_300 /* 300 series */ |
| 4326 | 4254 | ||
| 4327 | if(SiS_CRT2IsLCD(SiS_Pr)) { | 4255 | if(SiS_CRT2IsLCD(SiS_Pr)) { |
| 4328 | if(SiS_Pr->SiS_VBType & VB_SISLVDS) { | 4256 | if(SiS_Pr->SiS_VBType & VB_SISLVDS) { |
| @@ -4385,11 +4313,11 @@ SiS_EnableBridge(struct SiS_Private *SiS_Pr) | |||
| 4385 | } | 4313 | } |
| 4386 | 4314 | ||
| 4387 | 4315 | ||
| 4388 | #endif /* SIS300 */ | 4316 | #endif /* CONFIG_FB_SIS_300 */ |
| 4389 | 4317 | ||
| 4390 | } else { | 4318 | } else { |
| 4391 | 4319 | ||
| 4392 | #ifdef SIS315H /* 315 series */ | 4320 | #ifdef CONFIG_FB_SIS_315 /* 315 series */ |
| 4393 | 4321 | ||
| 4394 | #ifdef SET_EMI | 4322 | #ifdef SET_EMI |
| 4395 | unsigned char r30=0, r31=0, r32=0, r33=0, cr36=0; | 4323 | unsigned char r30=0, r31=0, r32=0, r33=0, cr36=0; |
| @@ -4688,7 +4616,7 @@ SiS_EnableBridge(struct SiS_Private *SiS_Pr) | |||
| 4688 | SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f); | 4616 | SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f); |
| 4689 | } | 4617 | } |
| 4690 | 4618 | ||
| 4691 | #endif /* SIS315H */ | 4619 | #endif /* CONFIG_FB_SIS_315 */ |
| 4692 | 4620 | ||
| 4693 | } | 4621 | } |
| 4694 | 4622 | ||
| @@ -4739,7 +4667,7 @@ SiS_EnableBridge(struct SiS_Private *SiS_Pr) | |||
| 4739 | 4667 | ||
| 4740 | if(SiS_Pr->ChipType < SIS_315H) { | 4668 | if(SiS_Pr->ChipType < SIS_315H) { |
| 4741 | 4669 | ||
| 4742 | #ifdef SIS300 /* 300 series */ | 4670 | #ifdef CONFIG_FB_SIS_300 /* 300 series */ |
| 4743 | 4671 | ||
| 4744 | if(SiS_CRT2IsLCD(SiS_Pr)) { | 4672 | if(SiS_CRT2IsLCD(SiS_Pr)) { |
| 4745 | if(SiS_Pr->ChipType == SIS_730) { | 4673 | if(SiS_Pr->ChipType == SIS_730) { |
| @@ -4783,11 +4711,11 @@ SiS_EnableBridge(struct SiS_Private *SiS_Pr) | |||
| 4783 | } | 4711 | } |
| 4784 | } | 4712 | } |
| 4785 | 4713 | ||
| 4786 | #endif /* SIS300 */ | 4714 | #endif /* CONFIG_FB_SIS_300 */ |
| 4787 | 4715 | ||
| 4788 | } else { | 4716 | } else { |
| 4789 | 4717 | ||
| 4790 | #ifdef SIS315H /* 315 series */ | 4718 | #ifdef CONFIG_FB_SIS_315 /* 315 series */ |
| 4791 | 4719 | ||
| 4792 | if(!(SiS_IsNotM650orLater(SiS_Pr))) { | 4720 | if(!(SiS_IsNotM650orLater(SiS_Pr))) { |
| 4793 | /*if(SiS_Pr->ChipType < SIS_340) {*/ /* XGI needs this */ | 4721 | /*if(SiS_Pr->ChipType < SIS_340) {*/ /* XGI needs this */ |
| @@ -4881,7 +4809,7 @@ SiS_EnableBridge(struct SiS_Private *SiS_Pr) | |||
| 4881 | } | 4809 | } |
| 4882 | } | 4810 | } |
| 4883 | 4811 | ||
| 4884 | #endif /* SIS315H */ | 4812 | #endif /* CONFIG_FB_SIS_315 */ |
| 4885 | 4813 | ||
| 4886 | } /* 310 series */ | 4814 | } /* 310 series */ |
| 4887 | 4815 | ||
| @@ -4971,7 +4899,7 @@ SiS_SetCRT2Sync(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned shor | |||
| 4971 | 4899 | ||
| 4972 | if(SiS_Pr->ChipType < SIS_315H) { | 4900 | if(SiS_Pr->ChipType < SIS_315H) { |
| 4973 | 4901 | ||
| 4974 | #ifdef SIS300 /* ---- 300 series --- */ | 4902 | #ifdef CONFIG_FB_SIS_300 /* ---- 300 series --- */ |
| 4975 | 4903 | ||
| 4976 | if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { /* 630 - 301B(-DH) */ | 4904 | if(SiS_Pr->SiS_VBType & VB_SIS30xBLV) { /* 630 - 301B(-DH) */ |
| 4977 | 4905 | ||
| @@ -5000,11 +4928,11 @@ SiS_SetCRT2Sync(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned shor | |||
| 5000 | 4928 | ||
| 5001 | } | 4929 | } |
| 5002 | 4930 | ||
| 5003 | #endif /* SIS300 */ | 4931 | #endif /* CONFIG_FB_SIS_300 */ |
| 5004 | 4932 | ||
| 5005 | } else { | 4933 | } else { |
| 5006 | 4934 | ||
| 5007 | #ifdef SIS315H /* ------- 315 series ------ */ | 4935 | #ifdef CONFIG_FB_SIS_315 /* ------- 315 series ------ */ |
| 5008 | 4936 | ||
| 5009 | if(SiS_Pr->SiS_VBType & VB_SISLVDS) { /* 315 - LVDS */ | 4937 | if(SiS_Pr->SiS_VBType & VB_SISLVDS) { /* 315 - LVDS */ |
| 5010 | 4938 | ||
| @@ -5076,13 +5004,13 @@ SiS_SetCRT2Sync(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned shor | |||
| 5076 | } | 5004 | } |
| 5077 | 5005 | ||
| 5078 | } | 5006 | } |
| 5079 | #endif /* SIS315H */ | 5007 | #endif /* CONFIG_FB_SIS_315 */ |
| 5080 | } | 5008 | } |
| 5081 | } | 5009 | } |
| 5082 | } | 5010 | } |
| 5083 | 5011 | ||
| 5084 | /* Set CRT2 FIFO on 300/540/630/730 */ | 5012 | /* Set CRT2 FIFO on 300/540/630/730 */ |
| 5085 | #ifdef SIS300 | 5013 | #ifdef CONFIG_FB_SIS_300 |
| 5086 | static void | 5014 | static void |
| 5087 | SiS_SetCRT2FIFO_300(struct SiS_Private *SiS_Pr,unsigned short ModeNo) | 5015 | SiS_SetCRT2FIFO_300(struct SiS_Private *SiS_Pr,unsigned short ModeNo) |
| 5088 | { | 5016 | { |
| @@ -5154,13 +5082,8 @@ SiS_SetCRT2FIFO_300(struct SiS_Private *SiS_Pr,unsigned short ModeNo) | |||
| 5154 | 5082 | ||
| 5155 | } else { | 5083 | } else { |
| 5156 | 5084 | ||
| 5157 | #ifdef SIS_LINUX_KERNEL | ||
| 5158 | pci50 = sisfb_read_nbridge_pci_dword(SiS_Pr, 0x50); | 5085 | pci50 = sisfb_read_nbridge_pci_dword(SiS_Pr, 0x50); |
| 5159 | pciA0 = sisfb_read_nbridge_pci_dword(SiS_Pr, 0xa0); | 5086 | pciA0 = sisfb_read_nbridge_pci_dword(SiS_Pr, 0xa0); |
| 5160 | #else | ||
| 5161 | pci50 = pciReadLong(0x00000000, 0x50); | ||
| 5162 | pciA0 = pciReadLong(0x00000000, 0xA0); | ||
| 5163 | #endif | ||
| 5164 | 5087 | ||
| 5165 | if(SiS_Pr->ChipType == SIS_730) { | 5088 | if(SiS_Pr->ChipType == SIS_730) { |
| 5166 | 5089 | ||
| @@ -5262,7 +5185,7 @@ SiS_SetCRT2FIFO_300(struct SiS_Private *SiS_Pr,unsigned short ModeNo) | |||
| 5262 | #endif | 5185 | #endif |
| 5263 | 5186 | ||
| 5264 | /* Set CRT2 FIFO on 315/330 series */ | 5187 | /* Set CRT2 FIFO on 315/330 series */ |
| 5265 | #ifdef SIS315H | 5188 | #ifdef CONFIG_FB_SIS_315 |
| 5266 | static void | 5189 | static void |
| 5267 | SiS_SetCRT2FIFO_310(struct SiS_Private *SiS_Pr) | 5190 | SiS_SetCRT2FIFO_310(struct SiS_Private *SiS_Pr) |
| 5268 | { | 5191 | { |
| @@ -5420,27 +5343,6 @@ SiS_SetGroup1_301(struct SiS_Private *SiS_Pr, unsigned short ModeNo,unsigned sho | |||
| 5420 | 5343 | ||
| 5421 | temp = SiS_GetRegByte((SiS_Pr->SiS_P3ca+0x02)); | 5344 | temp = SiS_GetRegByte((SiS_Pr->SiS_P3ca+0x02)); |
| 5422 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1b,temp); /* ? */ | 5345 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1b,temp); /* ? */ |
| 5423 | |||
| 5424 | #ifdef SIS_XORG_XF86 | ||
| 5425 | #ifdef TWDEBUG | ||
| 5426 | xf86DrvMsg(0, X_INFO, "%d %d %d %d %d %d %d %d (%d %d %d %d)\n", | ||
| 5427 | SiS_Pr->CHDisplay, SiS_Pr->CHSyncStart, SiS_Pr->CHSyncEnd, SiS_Pr->CHTotal, | ||
| 5428 | SiS_Pr->CVDisplay, SiS_Pr->CVSyncStart, SiS_Pr->CVSyncEnd, SiS_Pr->CVTotal, | ||
| 5429 | SiS_Pr->CHBlankStart, SiS_Pr->CHBlankEnd, SiS_Pr->CVBlankStart, SiS_Pr->CVBlankEnd); | ||
| 5430 | |||
| 5431 | xf86DrvMsg(0, X_INFO, " {{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", | ||
| 5432 | SiS_Pr->CCRT1CRTC[0], SiS_Pr->CCRT1CRTC[1], | ||
| 5433 | SiS_Pr->CCRT1CRTC[2], SiS_Pr->CCRT1CRTC[3], | ||
| 5434 | SiS_Pr->CCRT1CRTC[4], SiS_Pr->CCRT1CRTC[5], | ||
| 5435 | SiS_Pr->CCRT1CRTC[6], SiS_Pr->CCRT1CRTC[7]); | ||
| 5436 | xf86DrvMsg(0, X_INFO, " 0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", | ||
| 5437 | SiS_Pr->CCRT1CRTC[8], SiS_Pr->CCRT1CRTC[9], | ||
| 5438 | SiS_Pr->CCRT1CRTC[10], SiS_Pr->CCRT1CRTC[11], | ||
| 5439 | SiS_Pr->CCRT1CRTC[12], SiS_Pr->CCRT1CRTC[13], | ||
| 5440 | SiS_Pr->CCRT1CRTC[14], SiS_Pr->CCRT1CRTC[15]); | ||
| 5441 | xf86DrvMsg(0, X_INFO, " 0x%02x}},\n", SiS_Pr->CCRT1CRTC[16]); | ||
| 5442 | #endif | ||
| 5443 | #endif | ||
| 5444 | } | 5346 | } |
| 5445 | 5347 | ||
| 5446 | /* Setup panel link | 5348 | /* Setup panel link |
| @@ -5455,17 +5357,17 @@ SiS_SetGroup1_LVDS(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 5455 | unsigned short push2, tempax, tempbx, tempcx, temp; | 5357 | unsigned short push2, tempax, tempbx, tempcx, temp; |
| 5456 | unsigned int tempeax = 0, tempebx, tempecx, tempvcfact = 0; | 5358 | unsigned int tempeax = 0, tempebx, tempecx, tempvcfact = 0; |
| 5457 | bool islvds = false, issis = false, chkdclkfirst = false; | 5359 | bool islvds = false, issis = false, chkdclkfirst = false; |
| 5458 | #ifdef SIS300 | 5360 | #ifdef CONFIG_FB_SIS_300 |
| 5459 | unsigned short crt2crtc = 0; | 5361 | unsigned short crt2crtc = 0; |
| 5460 | #endif | 5362 | #endif |
| 5461 | #ifdef SIS315H | 5363 | #ifdef CONFIG_FB_SIS_315 |
| 5462 | unsigned short pushcx; | 5364 | unsigned short pushcx; |
| 5463 | #endif | 5365 | #endif |
| 5464 | 5366 | ||
| 5465 | if(ModeNo <= 0x13) { | 5367 | if(ModeNo <= 0x13) { |
| 5466 | modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; | 5368 | modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; |
| 5467 | resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; | 5369 | resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; |
| 5468 | #ifdef SIS300 | 5370 | #ifdef CONFIG_FB_SIS_300 |
| 5469 | crt2crtc = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; | 5371 | crt2crtc = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; |
| 5470 | #endif | 5372 | #endif |
| 5471 | } else if(SiS_Pr->UseCustomMode) { | 5373 | } else if(SiS_Pr->UseCustomMode) { |
| @@ -5473,7 +5375,7 @@ SiS_SetGroup1_LVDS(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 5473 | } else { | 5375 | } else { |
| 5474 | modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; | 5376 | modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; |
| 5475 | resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; | 5377 | resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; |
| 5476 | #ifdef SIS300 | 5378 | #ifdef CONFIG_FB_SIS_300 |
| 5477 | crt2crtc = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; | 5379 | crt2crtc = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; |
| 5478 | #endif | 5380 | #endif |
| 5479 | } | 5381 | } |
| @@ -5494,7 +5396,7 @@ SiS_SetGroup1_LVDS(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 5494 | } | 5396 | } |
| 5495 | } | 5397 | } |
| 5496 | 5398 | ||
| 5497 | #ifdef SIS315H | 5399 | #ifdef CONFIG_FB_SIS_315 |
| 5498 | if((SiS_Pr->ChipType >= SIS_315H) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { | 5400 | if((SiS_Pr->ChipType >= SIS_315H) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { |
| 5499 | if(IS_SIS330) { | 5401 | if(IS_SIS330) { |
| 5500 | SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x10); | 5402 | SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x10); |
| @@ -5744,7 +5646,7 @@ SiS_SetGroup1_LVDS(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 5744 | 5646 | ||
| 5745 | if(SiS_Pr->ChipType < SIS_315H) { | 5647 | if(SiS_Pr->ChipType < SIS_315H) { |
| 5746 | 5648 | ||
| 5747 | #ifdef SIS300 /* 300 series */ | 5649 | #ifdef CONFIG_FB_SIS_300 /* 300 series */ |
| 5748 | tempeax = SiS_Pr->SiS_VGAVDE << 6; | 5650 | tempeax = SiS_Pr->SiS_VGAVDE << 6; |
| 5749 | temp = (tempeax % (unsigned int)SiS_Pr->SiS_VDE); | 5651 | temp = (tempeax % (unsigned int)SiS_Pr->SiS_VDE); |
| 5750 | tempeax = tempeax / (unsigned int)SiS_Pr->SiS_VDE; | 5652 | tempeax = tempeax / (unsigned int)SiS_Pr->SiS_VDE; |
| @@ -5755,11 +5657,11 @@ SiS_SetGroup1_LVDS(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 5755 | temp = (unsigned short)(tempeax & 0x00FF); | 5657 | temp = (unsigned short)(tempeax & 0x00FF); |
| 5756 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1E,temp); /* BPLVCFACT */ | 5658 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1E,temp); /* BPLVCFACT */ |
| 5757 | tempvcfact = temp; | 5659 | tempvcfact = temp; |
| 5758 | #endif /* SIS300 */ | 5660 | #endif /* CONFIG_FB_SIS_300 */ |
| 5759 | 5661 | ||
| 5760 | } else { | 5662 | } else { |
| 5761 | 5663 | ||
| 5762 | #ifdef SIS315H /* 315 series */ | 5664 | #ifdef CONFIG_FB_SIS_315 /* 315 series */ |
| 5763 | tempeax = SiS_Pr->SiS_VGAVDE << 18; | 5665 | tempeax = SiS_Pr->SiS_VGAVDE << 18; |
| 5764 | tempebx = SiS_Pr->SiS_VDE; | 5666 | tempebx = SiS_Pr->SiS_VDE; |
| 5765 | temp = (tempeax % tempebx); | 5667 | temp = (tempeax % tempebx); |
| @@ -5845,7 +5747,7 @@ SiS_SetGroup1_LVDS(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 5845 | temp = (unsigned short)(tempecx & 0x00FF); | 5747 | temp = (unsigned short)(tempecx & 0x00FF); |
| 5846 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x23,temp); | 5748 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x23,temp); |
| 5847 | 5749 | ||
| 5848 | #ifdef SIS315H | 5750 | #ifdef CONFIG_FB_SIS_315 |
| 5849 | if(SiS_Pr->ChipType >= SIS_315H) { | 5751 | if(SiS_Pr->ChipType >= SIS_315H) { |
| 5850 | if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { | 5752 | if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { |
| 5851 | if((islvds) || (SiS_Pr->SiS_VBInfo & VB_SISLVDS)) { | 5753 | if((islvds) || (SiS_Pr->SiS_VBInfo & VB_SISLVDS)) { |
| @@ -5863,7 +5765,7 @@ SiS_SetGroup1_LVDS(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 5863 | } | 5765 | } |
| 5864 | #endif | 5766 | #endif |
| 5865 | 5767 | ||
| 5866 | #ifdef SIS300 | 5768 | #ifdef CONFIG_FB_SIS_300 |
| 5867 | if(SiS_Pr->SiS_IF_DEF_TRUMPION) { | 5769 | if(SiS_Pr->SiS_IF_DEF_TRUMPION) { |
| 5868 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; | 5770 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; |
| 5869 | unsigned char *trumpdata; | 5771 | unsigned char *trumpdata; |
| @@ -5899,7 +5801,7 @@ SiS_SetGroup1_LVDS(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 5899 | } | 5801 | } |
| 5900 | #endif | 5802 | #endif |
| 5901 | 5803 | ||
| 5902 | #ifdef SIS315H | 5804 | #ifdef CONFIG_FB_SIS_315 |
| 5903 | if(SiS_Pr->SiS_IF_DEF_FSTN || SiS_Pr->SiS_IF_DEF_DSTN) { | 5805 | if(SiS_Pr->SiS_IF_DEF_FSTN || SiS_Pr->SiS_IF_DEF_DSTN) { |
| 5904 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x25,0x00); | 5806 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x25,0x00); |
| 5905 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x26,0x00); | 5807 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x26,0x00); |
| @@ -5999,7 +5901,7 @@ SiS_SetGroup1_LVDS(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned s | |||
| 5999 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x45,0x0a); | 5901 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x45,0x0a); |
| 6000 | } | 5902 | } |
| 6001 | } | 5903 | } |
| 6002 | #endif /* SIS315H */ | 5904 | #endif /* CONFIG_FB_SIS_315 */ |
| 6003 | } | 5905 | } |
| 6004 | 5906 | ||
| 6005 | /* Set Part 1 */ | 5907 | /* Set Part 1 */ |
| @@ -6007,12 +5909,12 @@ static void | |||
| 6007 | SiS_SetGroup1(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex, | 5909 | SiS_SetGroup1(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex, |
| 6008 | unsigned short RefreshRateTableIndex) | 5910 | unsigned short RefreshRateTableIndex) |
| 6009 | { | 5911 | { |
| 6010 | #if defined(SIS300) || defined(SIS315H) | 5912 | #if defined(CONFIG_FB_SIS_300) || defined(CONFIG_FB_SIS_315) |
| 6011 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; | 5913 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; |
| 6012 | #endif | 5914 | #endif |
| 6013 | unsigned short temp=0, tempax=0, tempbx=0, tempcx=0, bridgeadd=0; | 5915 | unsigned short temp=0, tempax=0, tempbx=0, tempcx=0, bridgeadd=0; |
| 6014 | unsigned short pushbx=0, CRT1Index=0, modeflag, resinfo=0; | 5916 | unsigned short pushbx=0, CRT1Index=0, modeflag, resinfo=0; |
| 6015 | #ifdef SIS315H | 5917 | #ifdef CONFIG_FB_SIS_315 |
| 6016 | unsigned short tempbl=0; | 5918 | unsigned short tempbl=0; |
| 6017 | #endif | 5919 | #endif |
| 6018 | 5920 | ||
| @@ -6038,11 +5940,11 @@ SiS_SetGroup1(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 6038 | (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ) { | 5940 | (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ) { |
| 6039 | 5941 | ||
| 6040 | if(SiS_Pr->ChipType < SIS_315H ) { | 5942 | if(SiS_Pr->ChipType < SIS_315H ) { |
| 6041 | #ifdef SIS300 | 5943 | #ifdef CONFIG_FB_SIS_300 |
| 6042 | SiS_SetCRT2FIFO_300(SiS_Pr, ModeNo); | 5944 | SiS_SetCRT2FIFO_300(SiS_Pr, ModeNo); |
| 6043 | #endif | 5945 | #endif |
| 6044 | } else { | 5946 | } else { |
| 6045 | #ifdef SIS315H | 5947 | #ifdef CONFIG_FB_SIS_315 |
| 6046 | SiS_SetCRT2FIFO_310(SiS_Pr); | 5948 | SiS_SetCRT2FIFO_310(SiS_Pr); |
| 6047 | #endif | 5949 | #endif |
| 6048 | } | 5950 | } |
| @@ -6051,7 +5953,7 @@ SiS_SetGroup1(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 6051 | 5953 | ||
| 6052 | if(SiS_Pr->ChipType < SIS_315H ) { | 5954 | if(SiS_Pr->ChipType < SIS_315H ) { |
| 6053 | 5955 | ||
| 6054 | #ifdef SIS300 /* ------------- 300 series --------------*/ | 5956 | #ifdef CONFIG_FB_SIS_300 /* ------------- 300 series --------------*/ |
| 6055 | 5957 | ||
| 6056 | temp = (SiS_Pr->SiS_VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */ | 5958 | temp = (SiS_Pr->SiS_VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */ |
| 6057 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x08,temp); /* CRT2 Horizontal Total */ | 5959 | SiS_SetReg(SiS_Pr->SiS_Part1Port,0x08,temp); /* CRT2 Horizontal Total */ |
| @@ -6070,11 +5972,11 @@ SiS_SetGroup1(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 6070 | 5972 | ||
| 6071 | bridgeadd = 12; | 5973 | bridgeadd = 12; |
| 6072 | 5974 | ||
| 6073 | #endif /* SIS300 */ | 5975 | #endif /* CONFIG_FB_SIS_300 */ |
| 6074 | 5976 | ||
| 6075 | } else { | 5977 | } else { |
| 6076 | 5978 | ||
| 6077 | #ifdef SIS315H /* ------------------- 315/330 series --------------- */ | 5979 | #ifdef CONFIG_FB_SIS_315 /* ------------------- 315/330 series --------------- */ |
| 6078 | 5980 | ||
| 6079 | tempcx = SiS_Pr->SiS_VGAHT; /* BTVGA2HT 0x08,0x09 */ | 5981 | tempcx = SiS_Pr->SiS_VGAHT; /* BTVGA2HT 0x08,0x09 */ |
| 6080 | if(modeflag & HalfDCLK) { | 5982 | if(modeflag & HalfDCLK) { |
| @@ -6125,7 +6027,7 @@ SiS_SetGroup1(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 6125 | } | 6027 | } |
| 6126 | } | 6028 | } |
| 6127 | 6029 | ||
| 6128 | #endif /* SIS315H */ | 6030 | #endif /* CONFIG_FB_SIS_315 */ |
| 6129 | 6031 | ||
| 6130 | } /* 315/330 series */ | 6032 | } /* 315/330 series */ |
| 6131 | 6033 | ||
| @@ -6256,7 +6158,7 @@ SiS_SetGroup1(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 6256 | 6158 | ||
| 6257 | if(SiS_Pr->ChipType < SIS_315H) { | 6159 | if(SiS_Pr->ChipType < SIS_315H) { |
| 6258 | 6160 | ||
| 6259 | #ifdef SIS300 /* ---------- 300 series -------------- */ | 6161 | #ifdef CONFIG_FB_SIS_300 /* ---------- 300 series -------------- */ |
| 6260 | 6162 | ||
| 6261 | if(SiS_Pr->SiS_VBType & VB_SISVB) { | 6163 | if(SiS_Pr->SiS_VBType & VB_SISVB) { |
| 6262 | temp = 0x20; | 6164 | temp = 0x20; |
| @@ -6310,11 +6212,11 @@ SiS_SetGroup1(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 6310 | 6212 | ||
| 6311 | SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x3C,temp); /* Panel Link Delay Compensation; (Software Command Reset; Power Saving) */ | 6213 | SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x3C,temp); /* Panel Link Delay Compensation; (Software Command Reset; Power Saving) */ |
| 6312 | 6214 | ||
| 6313 | #endif /* SIS300 */ | 6215 | #endif /* CONFIG_FB_SIS_300 */ |
| 6314 | 6216 | ||
| 6315 | } else { | 6217 | } else { |
| 6316 | 6218 | ||
| 6317 | #ifdef SIS315H /* --------------- 315/330 series ---------------*/ | 6219 | #ifdef CONFIG_FB_SIS_315 /* --------------- 315/330 series ---------------*/ |
| 6318 | 6220 | ||
| 6319 | if(SiS_Pr->ChipType < SIS_661) { | 6221 | if(SiS_Pr->ChipType < SIS_661) { |
| 6320 | 6222 | ||
| @@ -6349,7 +6251,7 @@ SiS_SetGroup1(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 6349 | if(modeflag & HalfDCLK) tempax |= 0x40; | 6251 | if(modeflag & HalfDCLK) tempax |= 0x40; |
| 6350 | SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2C,0x3f,tempax); | 6252 | SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2C,0x3f,tempax); |
| 6351 | 6253 | ||
| 6352 | #endif /* SIS315H */ | 6254 | #endif /* CONFIG_FB_SIS_315 */ |
| 6353 | 6255 | ||
| 6354 | } | 6256 | } |
| 6355 | 6257 | ||
| @@ -6381,7 +6283,7 @@ SiS_SetGroup1(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 6381 | /* SET PART 2 REGISTER GROUP */ | 6283 | /* SET PART 2 REGISTER GROUP */ |
| 6382 | /*********************************************/ | 6284 | /*********************************************/ |
| 6383 | 6285 | ||
| 6384 | #ifdef SIS315H | 6286 | #ifdef CONFIG_FB_SIS_315 |
| 6385 | static unsigned char * | 6287 | static unsigned char * |
| 6386 | SiS_GetGroup2CLVXPtr(struct SiS_Private *SiS_Pr, int tabletype) | 6288 | SiS_GetGroup2CLVXPtr(struct SiS_Private *SiS_Pr, int tabletype) |
| 6387 | { | 6289 | { |
| @@ -6478,7 +6380,7 @@ SiS_GetCRT2Part2Ptr(struct SiS_Private *SiS_Pr,unsigned short ModeNo,unsigned sh | |||
| 6478 | } | 6380 | } |
| 6479 | #endif | 6381 | #endif |
| 6480 | 6382 | ||
| 6481 | #ifdef SIS300 | 6383 | #ifdef CONFIG_FB_SIS_300 |
| 6482 | static void | 6384 | static void |
| 6483 | SiS_Group2LCDSpecial(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short crt2crtc) | 6385 | SiS_Group2LCDSpecial(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short crt2crtc) |
| 6484 | { | 6386 | { |
| @@ -6690,7 +6592,7 @@ SiS_SetGroup2(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 6690 | unsigned int longtemp, PhaseIndex; | 6592 | unsigned int longtemp, PhaseIndex; |
| 6691 | bool newtvphase; | 6593 | bool newtvphase; |
| 6692 | const unsigned char *TimingPoint; | 6594 | const unsigned char *TimingPoint; |
| 6693 | #ifdef SIS315H | 6595 | #ifdef CONFIG_FB_SIS_315 |
| 6694 | unsigned short resindex, CRT2Index; | 6596 | unsigned short resindex, CRT2Index; |
| 6695 | const struct SiS_Part2PortTbl *CRT2Part2Ptr = NULL; | 6597 | const struct SiS_Part2PortTbl *CRT2Part2Ptr = NULL; |
| 6696 | 6598 | ||
| @@ -7069,7 +6971,7 @@ SiS_SetGroup2(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 7069 | SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x17,0xFB); | 6971 | SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x17,0xFB); |
| 7070 | SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x18,0xDF); | 6972 | SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x18,0xDF); |
| 7071 | 6973 | ||
| 7072 | #ifdef SIS315H | 6974 | #ifdef CONFIG_FB_SIS_315 |
| 7073 | if(SiS_GetCRT2Part2Ptr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, | 6975 | if(SiS_GetCRT2Part2Ptr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, |
| 7074 | &CRT2Index, &resindex)) { | 6976 | &CRT2Index, &resindex)) { |
| 7075 | switch(CRT2Index) { | 6977 | switch(CRT2Index) { |
| @@ -7130,12 +7032,6 @@ SiS_SetGroup2(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 7130 | 7032 | ||
| 7131 | /* Non-expanding: lcdvdes = tempcx = VT-1; lcdvdee = tempbx = VDE-1 */ | 7033 | /* Non-expanding: lcdvdes = tempcx = VT-1; lcdvdee = tempbx = VDE-1 */ |
| 7132 | 7034 | ||
| 7133 | #ifdef SIS_XORG_XF86 | ||
| 7134 | #ifdef TWDEBUG | ||
| 7135 | xf86DrvMsg(0, X_INFO, "lcdvdes 0x%x lcdvdee 0x%x\n", tempcx, tempbx); | ||
| 7136 | #endif | ||
| 7137 | #endif | ||
| 7138 | |||
| 7139 | SiS_SetReg(SiS_Pr->SiS_Part2Port,0x05,tempcx); /* lcdvdes */ | 7035 | SiS_SetReg(SiS_Pr->SiS_Part2Port,0x05,tempcx); /* lcdvdes */ |
| 7140 | SiS_SetReg(SiS_Pr->SiS_Part2Port,0x06,tempbx); /* lcdvdee */ | 7036 | SiS_SetReg(SiS_Pr->SiS_Part2Port,0x06,tempbx); /* lcdvdee */ |
| 7141 | 7037 | ||
| @@ -7184,12 +7080,6 @@ SiS_SetGroup2(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 7184 | tempbx = SiS_Pr->CVSyncStart; | 7080 | tempbx = SiS_Pr->CVSyncStart; |
| 7185 | } | 7081 | } |
| 7186 | 7082 | ||
| 7187 | #ifdef SIS_XORG_XF86 | ||
| 7188 | #ifdef TWDEBUG | ||
| 7189 | xf86DrvMsg(0, X_INFO, "lcdvrs 0x%x\n", tempbx); | ||
| 7190 | #endif | ||
| 7191 | #endif | ||
| 7192 | |||
| 7193 | SiS_SetReg(SiS_Pr->SiS_Part2Port,0x04,tempbx); /* lcdvrs */ | 7083 | SiS_SetReg(SiS_Pr->SiS_Part2Port,0x04,tempbx); /* lcdvrs */ |
| 7194 | 7084 | ||
| 7195 | temp = (tempbx >> 4) & 0xF0; | 7085 | temp = (tempbx >> 4) & 0xF0; |
| @@ -7201,15 +7091,9 @@ SiS_SetGroup2(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 7201 | temp |= (SiS_Pr->CVSyncEnd & 0x0f); | 7091 | temp |= (SiS_Pr->CVSyncEnd & 0x0f); |
| 7202 | } | 7092 | } |
| 7203 | 7093 | ||
| 7204 | #ifdef SIS_XORG_XF86 | ||
| 7205 | #ifdef TWDEBUG | ||
| 7206 | xf86DrvMsg(0, X_INFO, "lcdvre[3:0] 0x%x\n", (temp & 0x0f)); | ||
| 7207 | #endif | ||
| 7208 | #endif | ||
| 7209 | |||
| 7210 | SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,temp); | 7094 | SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,temp); |
| 7211 | 7095 | ||
| 7212 | #ifdef SIS300 | 7096 | #ifdef CONFIG_FB_SIS_300 |
| 7213 | SiS_Group2LCDSpecial(SiS_Pr, ModeNo, crt2crtc); | 7097 | SiS_Group2LCDSpecial(SiS_Pr, ModeNo, crt2crtc); |
| 7214 | #endif | 7098 | #endif |
| 7215 | 7099 | ||
| @@ -7245,12 +7129,6 @@ SiS_SetGroup2(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 7245 | tempax >>= 1; | 7129 | tempax >>= 1; |
| 7246 | } | 7130 | } |
| 7247 | 7131 | ||
| 7248 | #ifdef SIS_XORG_XF86 | ||
| 7249 | #ifdef TWDEBUG | ||
| 7250 | xf86DrvMsg(0, X_INFO, "lcdhdee 0x%x\n", tempbx); | ||
| 7251 | #endif | ||
| 7252 | #endif | ||
| 7253 | |||
| 7254 | tempbx += bridgeoffset; | 7132 | tempbx += bridgeoffset; |
| 7255 | 7133 | ||
| 7256 | SiS_SetReg(SiS_Pr->SiS_Part2Port,0x23,tempbx); /* lcdhdee */ | 7134 | SiS_SetReg(SiS_Pr->SiS_Part2Port,0x23,tempbx); /* lcdhdee */ |
| @@ -7276,12 +7154,6 @@ SiS_SetGroup2(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 7276 | tempbx += bridgeoffset; | 7154 | tempbx += bridgeoffset; |
| 7277 | } | 7155 | } |
| 7278 | 7156 | ||
| 7279 | #ifdef SIS_XORG_XF86 | ||
| 7280 | #ifdef TWDEBUG | ||
| 7281 | xf86DrvMsg(0, X_INFO, "lcdhrs 0x%x\n", tempbx); | ||
| 7282 | #endif | ||
| 7283 | #endif | ||
| 7284 | |||
| 7285 | SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1C,tempbx); /* lcdhrs */ | 7157 | SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1C,tempbx); /* lcdhrs */ |
| 7286 | SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0x0F,((tempbx >> 4) & 0xf0)); | 7158 | SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0x0F,((tempbx >> 4) & 0xf0)); |
| 7287 | 7159 | ||
| @@ -7300,20 +7172,14 @@ SiS_SetGroup2(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 7300 | tempbx += bridgeoffset; | 7172 | tempbx += bridgeoffset; |
| 7301 | } | 7173 | } |
| 7302 | 7174 | ||
| 7303 | #ifdef SIS_XORG_XF86 | ||
| 7304 | #ifdef TWDEBUG | ||
| 7305 | xf86DrvMsg(0, X_INFO, "lcdhre 0x%x\n", tempbx); | ||
| 7306 | #endif | ||
| 7307 | #endif | ||
| 7308 | |||
| 7309 | SiS_SetReg(SiS_Pr->SiS_Part2Port,0x21,tempbx); /* lcdhre */ | 7175 | SiS_SetReg(SiS_Pr->SiS_Part2Port,0x21,tempbx); /* lcdhre */ |
| 7310 | 7176 | ||
| 7311 | SiS_SetGroup2_Tail(SiS_Pr, ModeNo); | 7177 | SiS_SetGroup2_Tail(SiS_Pr, ModeNo); |
| 7312 | 7178 | ||
| 7313 | #ifdef SIS300 | 7179 | #ifdef CONFIG_FB_SIS_300 |
| 7314 | SiS_Set300Part2Regs(SiS_Pr, ModeIdIndex, RefreshRateTableIndex, ModeNo); | 7180 | SiS_Set300Part2Regs(SiS_Pr, ModeIdIndex, RefreshRateTableIndex, ModeNo); |
| 7315 | #endif | 7181 | #endif |
| 7316 | #ifdef SIS315H | 7182 | #ifdef CONFIG_FB_SIS_315 |
| 7317 | } /* CRT2-LCD from table */ | 7183 | } /* CRT2-LCD from table */ |
| 7318 | #endif | 7184 | #endif |
| 7319 | } | 7185 | } |
| @@ -7382,7 +7248,7 @@ SiS_SetGroup3(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 7382 | /* SET PART 4 REGISTER GROUP */ | 7248 | /* SET PART 4 REGISTER GROUP */ |
| 7383 | /*********************************************/ | 7249 | /*********************************************/ |
| 7384 | 7250 | ||
| 7385 | #ifdef SIS315H | 7251 | #ifdef CONFIG_FB_SIS_315 |
| 7386 | #if 0 | 7252 | #if 0 |
| 7387 | static void | 7253 | static void |
| 7388 | SiS_ShiftXPos(struct SiS_Private *SiS_Pr, int shift) | 7254 | SiS_ShiftXPos(struct SiS_Private *SiS_Pr, int shift) |
| @@ -8011,7 +7877,7 @@ SiS_SetCHTVReg(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 8011 | 7877 | ||
| 8012 | if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) { | 7878 | if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) { |
| 8013 | 7879 | ||
| 8014 | #ifdef SIS300 | 7880 | #ifdef CONFIG_FB_SIS_300 |
| 8015 | 7881 | ||
| 8016 | /* Chrontel 7005 - I assume that it does not come with a 315 series chip */ | 7882 | /* Chrontel 7005 - I assume that it does not come with a 315 series chip */ |
| 8017 | 7883 | ||
| @@ -8124,7 +7990,7 @@ SiS_SetCHTVReg(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 8124 | 7990 | ||
| 8125 | /* Chrontel 7019 - assumed that it does not come with a 300 series chip */ | 7991 | /* Chrontel 7019 - assumed that it does not come with a 300 series chip */ |
| 8126 | 7992 | ||
| 8127 | #ifdef SIS315H | 7993 | #ifdef CONFIG_FB_SIS_315 |
| 8128 | 7994 | ||
| 8129 | unsigned short temp; | 7995 | unsigned short temp; |
| 8130 | 7996 | ||
| @@ -8175,7 +8041,7 @@ SiS_SetCHTVReg(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short | |||
| 8175 | 8041 | ||
| 8176 | } | 8042 | } |
| 8177 | 8043 | ||
| 8178 | #ifdef SIS315H /* ----------- 315 series only ---------- */ | 8044 | #ifdef CONFIG_FB_SIS_315 /* ----------- 315 series only ---------- */ |
| 8179 | 8045 | ||
| 8180 | void | 8046 | void |
| 8181 | SiS_Chrontel701xBLOn(struct SiS_Private *SiS_Pr) | 8047 | SiS_Chrontel701xBLOn(struct SiS_Private *SiS_Pr) |
| @@ -8657,7 +8523,7 @@ SiS_ChrontelDoSomething1(struct SiS_Private *SiS_Pr) | |||
| 8657 | bool | 8523 | bool |
| 8658 | SiS_SetCRT2Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | 8524 | SiS_SetCRT2Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo) |
| 8659 | { | 8525 | { |
| 8660 | #ifdef SIS300 | 8526 | #ifdef CONFIG_FB_SIS_300 |
| 8661 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; | 8527 | unsigned char *ROMAddr = SiS_Pr->VirtualRomBase; |
| 8662 | #endif | 8528 | #endif |
| 8663 | unsigned short ModeIdIndex, RefreshRateTableIndex; | 8529 | unsigned short ModeIdIndex, RefreshRateTableIndex; |
| @@ -8703,16 +8569,6 @@ SiS_SetCRT2Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | |||
| 8703 | SiS_GetLVDSDesData(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); | 8569 | SiS_GetLVDSDesData(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); |
| 8704 | } | 8570 | } |
| 8705 | 8571 | ||
| 8706 | #ifdef SIS_XORG_XF86 | ||
| 8707 | #ifdef TWDEBUG | ||
| 8708 | xf86DrvMsg(0, X_INFO, "(init301: LCDHDES 0x%03x LCDVDES 0x%03x)\n", SiS_Pr->SiS_LCDHDES, SiS_Pr->SiS_LCDVDES); | ||
| 8709 | xf86DrvMsg(0, X_INFO, "(init301: HDE 0x%03x VDE 0x%03x)\n", SiS_Pr->SiS_HDE, SiS_Pr->SiS_VDE); | ||
| 8710 | xf86DrvMsg(0, X_INFO, "(init301: VGAHDE 0x%03x VGAVDE 0x%03x)\n", SiS_Pr->SiS_VGAHDE, SiS_Pr->SiS_VGAVDE); | ||
| 8711 | xf86DrvMsg(0, X_INFO, "(init301: HT 0x%03x VT 0x%03x)\n", SiS_Pr->SiS_HT, SiS_Pr->SiS_VT); | ||
| 8712 | xf86DrvMsg(0, X_INFO, "(init301: VGAHT 0x%03x VGAVT 0x%03x)\n", SiS_Pr->SiS_VGAHT, SiS_Pr->SiS_VGAVT); | ||
| 8713 | #endif | ||
| 8714 | #endif | ||
| 8715 | |||
| 8716 | if(SiS_Pr->SiS_SetFlag & LowModeTests) { | 8572 | if(SiS_Pr->SiS_SetFlag & LowModeTests) { |
| 8717 | SiS_SetGroup1(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); | 8573 | SiS_SetGroup1(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); |
| 8718 | } | 8574 | } |
| @@ -8722,12 +8578,12 @@ SiS_SetCRT2Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | |||
| 8722 | if(SiS_Pr->SiS_SetFlag & LowModeTests) { | 8578 | if(SiS_Pr->SiS_SetFlag & LowModeTests) { |
| 8723 | 8579 | ||
| 8724 | SiS_SetGroup2(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); | 8580 | SiS_SetGroup2(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); |
| 8725 | #ifdef SIS315H | 8581 | #ifdef CONFIG_FB_SIS_315 |
| 8726 | SiS_SetGroup2_C_ELV(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); | 8582 | SiS_SetGroup2_C_ELV(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); |
| 8727 | #endif | 8583 | #endif |
| 8728 | SiS_SetGroup3(SiS_Pr, ModeNo, ModeIdIndex); | 8584 | SiS_SetGroup3(SiS_Pr, ModeNo, ModeIdIndex); |
| 8729 | SiS_SetGroup4(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); | 8585 | SiS_SetGroup4(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); |
| 8730 | #ifdef SIS315H | 8586 | #ifdef CONFIG_FB_SIS_315 |
| 8731 | SiS_SetGroup4_C_ELV(SiS_Pr, ModeNo, ModeIdIndex); | 8587 | SiS_SetGroup4_C_ELV(SiS_Pr, ModeNo, ModeIdIndex); |
| 8732 | #endif | 8588 | #endif |
| 8733 | SiS_SetGroup5(SiS_Pr, ModeNo, ModeIdIndex); | 8589 | SiS_SetGroup5(SiS_Pr, ModeNo, ModeIdIndex); |
| @@ -8758,7 +8614,7 @@ SiS_SetCRT2Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | |||
| 8758 | if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { | 8614 | if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { |
| 8759 | if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { | 8615 | if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { |
| 8760 | if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) { | 8616 | if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) { |
| 8761 | #ifdef SIS315H | 8617 | #ifdef CONFIG_FB_SIS_315 |
| 8762 | SiS_SetCH701xForLCD(SiS_Pr); | 8618 | SiS_SetCH701xForLCD(SiS_Pr); |
| 8763 | #endif | 8619 | #endif |
| 8764 | } | 8620 | } |
| @@ -8771,7 +8627,7 @@ SiS_SetCRT2Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | |||
| 8771 | 8627 | ||
| 8772 | } | 8628 | } |
| 8773 | 8629 | ||
| 8774 | #ifdef SIS300 | 8630 | #ifdef CONFIG_FB_SIS_300 |
| 8775 | if(SiS_Pr->ChipType < SIS_315H) { | 8631 | if(SiS_Pr->ChipType < SIS_315H) { |
| 8776 | if(SiS_Pr->SiS_SetFlag & LowModeTests) { | 8632 | if(SiS_Pr->SiS_SetFlag & LowModeTests) { |
| 8777 | if(SiS_Pr->SiS_UseOEM) { | 8633 | if(SiS_Pr->SiS_UseOEM) { |
| @@ -8794,7 +8650,7 @@ SiS_SetCRT2Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo) | |||
| 8794 | } | 8650 | } |
| 8795 | #endif | 8651 | #endif |
| 8796 | 8652 | ||
| 8797 | #ifdef SIS315H | 8653 | #ifdef CONFIG_FB_SIS_315 |
| 8798 | if(SiS_Pr->ChipType >= SIS_315H) { | 8654 | if(SiS_Pr->ChipType >= SIS_315H) { |
| 8799 | if(SiS_Pr->SiS_SetFlag & LowModeTests) { | 8655 | if(SiS_Pr->SiS_SetFlag & LowModeTests) { |
| 8800 | if(SiS_Pr->ChipType < SIS_661) { | 8656 | if(SiS_Pr->ChipType < SIS_661) { |
| @@ -8873,7 +8729,7 @@ SiS_SetupDDCN(struct SiS_Private *SiS_Pr) | |||
| 8873 | } | 8729 | } |
| 8874 | } | 8730 | } |
| 8875 | 8731 | ||
| 8876 | #ifdef SIS300 | 8732 | #ifdef CONFIG_FB_SIS_300 |
| 8877 | static unsigned char * | 8733 | static unsigned char * |
| 8878 | SiS_SetTrumpBlockLoop(struct SiS_Private *SiS_Pr, unsigned char *dataptr) | 8734 | SiS_SetTrumpBlockLoop(struct SiS_Private *SiS_Pr, unsigned char *dataptr) |
| 8879 | { | 8735 | { |
| @@ -8923,11 +8779,6 @@ SiS_SetTrumpionBlock(struct SiS_Private *SiS_Pr, unsigned char *dataptr) | |||
| 8923 | dataptr = SiS_SetTrumpBlockLoop(SiS_Pr, dataptr); | 8779 | dataptr = SiS_SetTrumpBlockLoop(SiS_Pr, dataptr); |
| 8924 | if(!dataptr) return false; | 8780 | if(!dataptr) return false; |
| 8925 | } | 8781 | } |
| 8926 | #ifdef SIS_XORG_XF86 | ||
| 8927 | #ifdef TWDEBUG | ||
| 8928 | xf86DrvMsg(0, X_INFO, "Trumpion block success\n"); | ||
| 8929 | #endif | ||
| 8930 | #endif | ||
| 8931 | return true; | 8782 | return true; |
| 8932 | } | 8783 | } |
| 8933 | #endif | 8784 | #endif |
| @@ -9002,9 +8853,7 @@ SiS_SetCH701x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val) | |||
| 9002 | SiS_SetChReg(SiS_Pr, reg, val, 0); | 8853 | SiS_SetChReg(SiS_Pr, reg, val, 0); |
| 9003 | } | 8854 | } |
| 9004 | 8855 | ||
| 9005 | #ifdef SIS_LINUX_KERNEL | ||
| 9006 | static | 8856 | static |
| 9007 | #endif | ||
| 9008 | void | 8857 | void |
| 9009 | SiS_SetCH70xx(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val) | 8858 | SiS_SetCH70xx(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val) |
| 9010 | { | 8859 | { |
| @@ -9091,9 +8940,7 @@ SiS_GetCH701x(struct SiS_Private *SiS_Pr, unsigned short tempbx) | |||
| 9091 | 8940 | ||
| 9092 | /* Read from Chrontel 70xx */ | 8941 | /* Read from Chrontel 70xx */ |
| 9093 | /* Parameter is [Register no (S7-S0)] */ | 8942 | /* Parameter is [Register no (S7-S0)] */ |
| 9094 | #ifdef SIS_LINUX_KERNEL | ||
| 9095 | static | 8943 | static |
| 9096 | #endif | ||
| 9097 | unsigned short | 8944 | unsigned short |
| 9098 | SiS_GetCH70xx(struct SiS_Private *SiS_Pr, unsigned short tempbx) | 8945 | SiS_GetCH70xx(struct SiS_Private *SiS_Pr, unsigned short tempbx) |
| 9099 | { | 8946 | { |
| @@ -9114,9 +8961,7 @@ SiS_SetCH70xxANDOR(struct SiS_Private *SiS_Pr, unsigned short reg, | |||
| 9114 | } | 8961 | } |
| 9115 | 8962 | ||
| 9116 | /* Our own DDC functions */ | 8963 | /* Our own DDC functions */ |
| 9117 | #ifndef SIS_XORG_XF86 | ||
| 9118 | static | 8964 | static |
| 9119 | #endif | ||
| 9120 | unsigned short | 8965 | unsigned short |
| 9121 | SiS_InitDDCRegs(struct SiS_Private *SiS_Pr, unsigned int VBFlags, int VGAEngine, | 8966 | SiS_InitDDCRegs(struct SiS_Private *SiS_Pr, unsigned int VBFlags, int VGAEngine, |
| 9122 | unsigned short adaptnum, unsigned short DDCdatatype, bool checkcr32, | 8967 | unsigned short adaptnum, unsigned short DDCdatatype, bool checkcr32, |
| @@ -9224,12 +9069,6 @@ SiS_InitDDCRegs(struct SiS_Private *SiS_Pr, unsigned int VBFlags, int VGAEngine, | |||
| 9224 | 9069 | ||
| 9225 | SiS_SetupDDCN(SiS_Pr); | 9070 | SiS_SetupDDCN(SiS_Pr); |
| 9226 | 9071 | ||
| 9227 | #ifdef SIS_XORG_XF86 | ||
| 9228 | #ifdef TWDEBUG | ||
| 9229 | xf86DrvMsg(0, X_INFO, "DDC Port %x Index %x Shift %d\n", | ||
| 9230 | SiS_Pr->SiS_DDC_Port, SiS_Pr->SiS_DDC_Index, temp); | ||
| 9231 | #endif | ||
| 9232 | #endif | ||
| 9233 | return 0; | 9072 | return 0; |
| 9234 | } | 9073 | } |
| 9235 | 9074 | ||
| @@ -9292,11 +9131,6 @@ SiS_DoProbeDDC(struct SiS_Private *SiS_Pr) | |||
| 9292 | SiS_SetSwitchDDC2(SiS_Pr); | 9131 | SiS_SetSwitchDDC2(SiS_Pr); |
| 9293 | if(SiS_PrepareDDC(SiS_Pr)) { | 9132 | if(SiS_PrepareDDC(SiS_Pr)) { |
| 9294 | SiS_SetStop(SiS_Pr); | 9133 | SiS_SetStop(SiS_Pr); |
| 9295 | #ifdef SIS_XORG_XF86 | ||
| 9296 | #ifdef TWDEBUG | ||
| 9297 | xf86DrvMsg(0, X_INFO, "Probe: Prepare failed\n"); | ||
| 9298 | #endif | ||
| 9299 | #endif | ||
| 9300 | return 0xFFFF; | 9134 | return 0xFFFF; |
| 9301 | } | 9135 | } |
| 9302 | mask = 0xf0; | 9136 | mask = 0xf0; |
| @@ -9310,11 +9144,6 @@ SiS_DoProbeDDC(struct SiS_Private *SiS_Pr) | |||
| 9310 | } else { | 9144 | } else { |
| 9311 | failed = true; | 9145 | failed = true; |
| 9312 | ret = 0xFFFF; | 9146 | ret = 0xFFFF; |
| 9313 | #ifdef SIS_XORG_XF86 | ||
| 9314 | #ifdef TWDEBUG | ||
| 9315 | xf86DrvMsg(0, X_INFO, "Probe: Read 1 failed\n"); | ||
| 9316 | #endif | ||
| 9317 | #endif | ||
| 9318 | } | 9147 | } |
| 9319 | } | 9148 | } |
| 9320 | if(!failed) { | 9149 | if(!failed) { |
| @@ -9324,11 +9153,6 @@ SiS_DoProbeDDC(struct SiS_Private *SiS_Pr) | |||
| 9324 | if(temp == value) ret = 0; | 9153 | if(temp == value) ret = 0; |
| 9325 | else { | 9154 | else { |
| 9326 | ret = 0xFFFF; | 9155 | ret = 0xFFFF; |
| 9327 | #ifdef SIS_XORG_XF86 | ||
| 9328 | #ifdef TWDEBUG | ||
| 9329 | xf86DrvMsg(0, X_INFO, "Probe: Read 2 failed\n"); | ||
| 9330 | #endif | ||
| 9331 | #endif | ||
| 9332 | if(SiS_Pr->SiS_DDC_DeviceAddr == 0xa0) { | 9156 | if(SiS_Pr->SiS_DDC_DeviceAddr == 0xa0) { |
| 9333 | if(temp == 0x30) ret = 0; | 9157 | if(temp == 0x30) ret = 0; |
| 9334 | } | 9158 | } |
| @@ -9338,9 +9162,7 @@ SiS_DoProbeDDC(struct SiS_Private *SiS_Pr) | |||
| 9338 | return ret; | 9162 | return ret; |
| 9339 | } | 9163 | } |
| 9340 | 9164 | ||
| 9341 | #ifndef SIS_XORG_XF86 | ||
| 9342 | static | 9165 | static |
| 9343 | #endif | ||
| 9344 | unsigned short | 9166 | unsigned short |
| 9345 | SiS_ProbeDDC(struct SiS_Private *SiS_Pr) | 9167 | SiS_ProbeDDC(struct SiS_Private *SiS_Pr) |
| 9346 | { | 9168 | { |
| @@ -9357,9 +9179,7 @@ SiS_ProbeDDC(struct SiS_Private *SiS_Pr) | |||
| 9357 | return flag; | 9179 | return flag; |
| 9358 | } | 9180 | } |
| 9359 | 9181 | ||
| 9360 | #ifndef SIS_XORG_XF86 | ||
| 9361 | static | 9182 | static |
| 9362 | #endif | ||
| 9363 | unsigned short | 9183 | unsigned short |
| 9364 | SiS_ReadDDC(struct SiS_Private *SiS_Pr, unsigned short DDCdatatype, unsigned char *buffer) | 9184 | SiS_ReadDDC(struct SiS_Private *SiS_Pr, unsigned short DDCdatatype, unsigned char *buffer) |
| 9365 | { | 9185 | { |
| @@ -9606,11 +9426,6 @@ SiS_SetSCLKHigh(struct SiS_Private *SiS_Pr) | |||
| 9606 | temp = SiS_GetReg(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index); | 9426 | temp = SiS_GetReg(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index); |
| 9607 | } while((!(temp & SiS_Pr->SiS_DDC_Clk)) && --watchdog); | 9427 | } while((!(temp & SiS_Pr->SiS_DDC_Clk)) && --watchdog); |
| 9608 | if (!watchdog) { | 9428 | if (!watchdog) { |
| 9609 | #ifdef SIS_XORG_XF86 | ||
| 9610 | #ifdef TWDEBUG | ||
| 9611 | xf86DrvMsg(0, X_INFO, "SetClkHigh failed\n"); | ||
| 9612 | #endif | ||
| 9613 | #endif | ||
| 9614 | return 0xFFFF; | 9429 | return 0xFFFF; |
| 9615 | } | 9430 | } |
| 9616 | SiS_DDC2Delay(SiS_Pr,SiS_I2CDELAYSHORT); | 9431 | SiS_DDC2Delay(SiS_Pr,SiS_I2CDELAYSHORT); |
| @@ -9641,7 +9456,7 @@ SiS_CheckACK(struct SiS_Private *SiS_Pr) | |||
| 9641 | 9456 | ||
| 9642 | /* =============== SiS 315/330 O.E.M. ================= */ | 9457 | /* =============== SiS 315/330 O.E.M. ================= */ |
| 9643 | 9458 | ||
| 9644 | #ifdef SIS315H | 9459 | #ifdef CONFIG_FB_SIS_315 |
| 9645 | 9460 | ||
| 9646 | static unsigned short | 9461 | static unsigned short |
| 9647 | GetRAMDACromptr(struct SiS_Private *SiS_Pr) | 9462 | GetRAMDACromptr(struct SiS_Private *SiS_Pr) |
| @@ -10829,7 +10644,7 @@ SiS_FinalizeLCD(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned shor | |||
| 10829 | 10644 | ||
| 10830 | /* ================= SiS 300 O.E.M. ================== */ | 10645 | /* ================= SiS 300 O.E.M. ================== */ |
| 10831 | 10646 | ||
| 10832 | #ifdef SIS300 | 10647 | #ifdef CONFIG_FB_SIS_300 |
| 10833 | 10648 | ||
| 10834 | static void | 10649 | static void |
| 10835 | SetOEMLCDData2(struct SiS_Private *SiS_Pr, unsigned short ModeNo,unsigned short ModeIdIndex, | 10650 | SetOEMLCDData2(struct SiS_Private *SiS_Pr, unsigned short ModeNo,unsigned short ModeIdIndex, |
diff --git a/drivers/video/sis/init301.h b/drivers/video/sis/init301.h index 51d99222375d..e1fd31d0fddf 100644 --- a/drivers/video/sis/init301.h +++ b/drivers/video/sis/init301.h | |||
| @@ -53,15 +53,8 @@ | |||
| 53 | #ifndef _INIT301_H_ | 53 | #ifndef _INIT301_H_ |
| 54 | #define _INIT301_H_ | 54 | #define _INIT301_H_ |
| 55 | 55 | ||
| 56 | #include "osdef.h" | ||
| 57 | #include "initdef.h" | 56 | #include "initdef.h" |
| 58 | 57 | ||
| 59 | #ifdef SIS_XORG_XF86 | ||
| 60 | #include "sis.h" | ||
| 61 | #include "sis_regs.h" | ||
| 62 | #endif | ||
| 63 | |||
| 64 | #ifdef SIS_LINUX_KERNEL | ||
| 65 | #include "vgatypes.h" | 58 | #include "vgatypes.h" |
| 66 | #include "vstruct.h" | 59 | #include "vstruct.h" |
| 67 | #ifdef SIS_CP | 60 | #ifdef SIS_CP |
| @@ -72,7 +65,6 @@ | |||
| 72 | #include <linux/fb.h> | 65 | #include <linux/fb.h> |
| 73 | #include "sis.h" | 66 | #include "sis.h" |
| 74 | #include <video/sisfb.h> | 67 | #include <video/sisfb.h> |
| 75 | #endif | ||
| 76 | 68 | ||
| 77 | static const unsigned char SiS_YPbPrTable[3][64] = { | 69 | static const unsigned char SiS_YPbPrTable[3][64] = { |
| 78 | { | 70 | { |
| @@ -237,7 +229,7 @@ static const unsigned char SiS_Part2CLVX_6[] = { /* 1080i */ | |||
| 237 | 0xFF,0xFF, | 229 | 0xFF,0xFF, |
| 238 | }; | 230 | }; |
| 239 | 231 | ||
| 240 | #ifdef SIS315H | 232 | #ifdef CONFIG_FB_SIS_315 |
| 241 | /* 661 et al LCD data structure (2.03.00) */ | 233 | /* 661 et al LCD data structure (2.03.00) */ |
| 242 | static const unsigned char SiS_LCDStruct661[] = { | 234 | static const unsigned char SiS_LCDStruct661[] = { |
| 243 | /* 1024x768 */ | 235 | /* 1024x768 */ |
| @@ -279,7 +271,7 @@ static const unsigned char SiS_LCDStruct661[] = { | |||
| 279 | }; | 271 | }; |
| 280 | #endif | 272 | #endif |
| 281 | 273 | ||
| 282 | #ifdef SIS300 | 274 | #ifdef CONFIG_FB_SIS_300 |
| 283 | static unsigned char SiS300_TrumpionData[14][80] = { | 275 | static unsigned char SiS300_TrumpionData[14][80] = { |
| 284 | { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02, | 276 | { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02, |
| 285 | 0x20,0x03,0x0B,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x10,0x00,0x00,0x04,0x23, | 277 | 0x20,0x03,0x0B,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x10,0x00,0x00,0x04,0x23, |
| @@ -356,9 +348,6 @@ static unsigned char SiS300_TrumpionData[14][80] = { | |||
| 356 | #endif | 348 | #endif |
| 357 | 349 | ||
| 358 | void SiS_UnLockCRT2(struct SiS_Private *SiS_Pr); | 350 | void SiS_UnLockCRT2(struct SiS_Private *SiS_Pr); |
| 359 | #ifndef SIS_LINUX_KERNEL | ||
| 360 | void SiS_LockCRT2(struct SiS_Private *SiS_Pr); | ||
| 361 | #endif | ||
| 362 | void SiS_EnableCRT2(struct SiS_Private *SiS_Pr); | 351 | void SiS_EnableCRT2(struct SiS_Private *SiS_Pr); |
| 363 | unsigned short SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex); | 352 | unsigned short SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex); |
| 364 | void SiS_WaitRetrace1(struct SiS_Private *SiS_Pr); | 353 | void SiS_WaitRetrace1(struct SiS_Private *SiS_Pr); |
| @@ -375,9 +364,6 @@ unsigned short SiS_GetVCLK2Ptr(struct SiS_Private *SiS_Pr, unsigned short ModeNo | |||
| 375 | unsigned short RefreshRateTableIndex); | 364 | unsigned short RefreshRateTableIndex); |
| 376 | unsigned short SiS_GetResInfo(struct SiS_Private *SiS_Pr,unsigned short ModeNo,unsigned short ModeIdIndex); | 365 | unsigned short SiS_GetResInfo(struct SiS_Private *SiS_Pr,unsigned short ModeNo,unsigned short ModeIdIndex); |
| 377 | void SiS_DisableBridge(struct SiS_Private *SiS_Pr); | 366 | void SiS_DisableBridge(struct SiS_Private *SiS_Pr); |
| 378 | #ifndef SIS_LINUX_KERNEL | ||
| 379 | void SiS_EnableBridge(struct SiS_Private *SiS_Pr); | ||
| 380 | #endif | ||
| 381 | bool SiS_SetCRT2Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo); | 367 | bool SiS_SetCRT2Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo); |
| 382 | void SiS_SiS30xBLOn(struct SiS_Private *SiS_Pr); | 368 | void SiS_SiS30xBLOn(struct SiS_Private *SiS_Pr); |
| 383 | void SiS_SiS30xBLOff(struct SiS_Private *SiS_Pr); | 369 | void SiS_SiS30xBLOff(struct SiS_Private *SiS_Pr); |
| @@ -386,13 +372,9 @@ void SiS_SetCH700x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned cha | |||
| 386 | unsigned short SiS_GetCH700x(struct SiS_Private *SiS_Pr, unsigned short tempax); | 372 | unsigned short SiS_GetCH700x(struct SiS_Private *SiS_Pr, unsigned short tempax); |
| 387 | void SiS_SetCH701x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val); | 373 | void SiS_SetCH701x(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val); |
| 388 | unsigned short SiS_GetCH701x(struct SiS_Private *SiS_Pr, unsigned short tempax); | 374 | unsigned short SiS_GetCH701x(struct SiS_Private *SiS_Pr, unsigned short tempax); |
| 389 | #ifndef SIS_LINUX_KERNEL | ||
| 390 | void SiS_SetCH70xx(struct SiS_Private *SiS_Pr, unsigned short reg, unsigned char val); | ||
| 391 | unsigned short SiS_GetCH70xx(struct SiS_Private *SiS_Pr, unsigned short tempax); | ||
| 392 | #endif | ||
| 393 | void SiS_SetCH70xxANDOR(struct SiS_Private *SiS_Pr, unsigned short reg, | 375 | void SiS_SetCH70xxANDOR(struct SiS_Private *SiS_Pr, unsigned short reg, |
| 394 | unsigned char orval,unsigned short andval); | 376 | unsigned char orval,unsigned short andval); |
| 395 | #ifdef SIS315H | 377 | #ifdef CONFIG_FB_SIS_315 |
| 396 | static void SiS_Chrontel701xOn(struct SiS_Private *SiS_Pr); | 378 | static void SiS_Chrontel701xOn(struct SiS_Private *SiS_Pr); |
| 397 | static void SiS_Chrontel701xOff(struct SiS_Private *SiS_Pr); | 379 | static void SiS_Chrontel701xOff(struct SiS_Private *SiS_Pr); |
| 398 | static void SiS_ChrontelInitTVVSync(struct SiS_Private *SiS_Pr); | 380 | static void SiS_ChrontelInitTVVSync(struct SiS_Private *SiS_Pr); |
| @@ -401,7 +383,7 @@ void SiS_Chrontel701xBLOn(struct SiS_Private *SiS_Pr); | |||
| 401 | void SiS_Chrontel701xBLOff(struct SiS_Private *SiS_Pr); | 383 | void SiS_Chrontel701xBLOff(struct SiS_Private *SiS_Pr); |
| 402 | #endif /* 315 */ | 384 | #endif /* 315 */ |
| 403 | 385 | ||
| 404 | #ifdef SIS300 | 386 | #ifdef CONFIG_FB_SIS_300 |
| 405 | static bool SiS_SetTrumpionBlock(struct SiS_Private *SiS_Pr, unsigned char *dataptr); | 387 | static bool SiS_SetTrumpionBlock(struct SiS_Private *SiS_Pr, unsigned char *dataptr); |
| 406 | void SiS_SetChrontelGPIO(struct SiS_Private *SiS_Pr, unsigned short myvbinfo); | 388 | void SiS_SetChrontelGPIO(struct SiS_Private *SiS_Pr, unsigned short myvbinfo); |
| 407 | #endif | 389 | #endif |
| @@ -412,21 +394,12 @@ unsigned short SiS_HandleDDC(struct SiS_Private *SiS_Pr, unsigned int VBFlags, i | |||
| 412 | unsigned short adaptnum, unsigned short DDCdatatype, | 394 | unsigned short adaptnum, unsigned short DDCdatatype, |
| 413 | unsigned char *buffer, unsigned int VBFlags2); | 395 | unsigned char *buffer, unsigned int VBFlags2); |
| 414 | 396 | ||
| 415 | #ifdef SIS_XORG_XF86 | ||
| 416 | unsigned short SiS_InitDDCRegs(struct SiS_Private *SiS_Pr, unsigned int VBFlags, | ||
| 417 | int VGAEngine, unsigned short adaptnum, unsigned short DDCdatatype, | ||
| 418 | bool checkcr32, unsigned int VBFlags2); | ||
| 419 | unsigned short SiS_ProbeDDC(struct SiS_Private *SiS_Pr); | ||
| 420 | unsigned short SiS_ReadDDC(struct SiS_Private *SiS_Pr, unsigned short DDCdatatype, | ||
| 421 | unsigned char *buffer); | ||
| 422 | #else | ||
| 423 | static unsigned short SiS_InitDDCRegs(struct SiS_Private *SiS_Pr, unsigned int VBFlags, | 397 | static unsigned short SiS_InitDDCRegs(struct SiS_Private *SiS_Pr, unsigned int VBFlags, |
| 424 | int VGAEngine, unsigned short adaptnum, unsigned short DDCdatatype, | 398 | int VGAEngine, unsigned short adaptnum, unsigned short DDCdatatype, |
| 425 | bool checkcr32, unsigned int VBFlags2); | 399 | bool checkcr32, unsigned int VBFlags2); |
| 426 | static unsigned short SiS_ProbeDDC(struct SiS_Private *SiS_Pr); | 400 | static unsigned short SiS_ProbeDDC(struct SiS_Private *SiS_Pr); |
| 427 | static unsigned short SiS_ReadDDC(struct SiS_Private *SiS_Pr, unsigned short DDCdatatype, | 401 | static unsigned short SiS_ReadDDC(struct SiS_Private *SiS_Pr, unsigned short DDCdatatype, |
| 428 | unsigned char *buffer); | 402 | unsigned char *buffer); |
| 429 | #endif | ||
| 430 | static void SiS_SetSwitchDDC2(struct SiS_Private *SiS_Pr); | 403 | static void SiS_SetSwitchDDC2(struct SiS_Private *SiS_Pr); |
| 431 | static unsigned short SiS_SetStart(struct SiS_Private *SiS_Pr); | 404 | static unsigned short SiS_SetStart(struct SiS_Private *SiS_Pr); |
| 432 | static unsigned short SiS_SetStop(struct SiS_Private *SiS_Pr); | 405 | static unsigned short SiS_SetStop(struct SiS_Private *SiS_Pr); |
| @@ -441,13 +414,13 @@ static unsigned short SiS_PrepareDDC(struct SiS_Private *SiS_Pr); | |||
| 441 | static void SiS_SendACK(struct SiS_Private *SiS_Pr, unsigned short yesno); | 414 | static void SiS_SendACK(struct SiS_Private *SiS_Pr, unsigned short yesno); |
| 442 | static unsigned short SiS_DoProbeDDC(struct SiS_Private *SiS_Pr); | 415 | static unsigned short SiS_DoProbeDDC(struct SiS_Private *SiS_Pr); |
| 443 | 416 | ||
| 444 | #ifdef SIS300 | 417 | #ifdef CONFIG_FB_SIS_300 |
| 445 | static void SiS_OEM300Setting(struct SiS_Private *SiS_Pr, | 418 | static void SiS_OEM300Setting(struct SiS_Private *SiS_Pr, |
| 446 | unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefTabindex); | 419 | unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefTabindex); |
| 447 | static void SetOEMLCDData2(struct SiS_Private *SiS_Pr, | 420 | static void SetOEMLCDData2(struct SiS_Private *SiS_Pr, |
| 448 | unsigned short ModeNo, unsigned short ModeIdIndex,unsigned short RefTableIndex); | 421 | unsigned short ModeNo, unsigned short ModeIdIndex,unsigned short RefTableIndex); |
| 449 | #endif | 422 | #endif |
| 450 | #ifdef SIS315H | 423 | #ifdef CONFIG_FB_SIS_315 |
| 451 | static void SiS_OEM310Setting(struct SiS_Private *SiS_Pr, | 424 | static void SiS_OEM310Setting(struct SiS_Private *SiS_Pr, |
| 452 | unsigned short ModeNo,unsigned short ModeIdIndex, unsigned short RRTI); | 425 | unsigned short ModeNo,unsigned short ModeIdIndex, unsigned short RRTI); |
| 453 | static void SiS_OEM661Setting(struct SiS_Private *SiS_Pr, | 426 | static void SiS_OEM661Setting(struct SiS_Private *SiS_Pr, |
| @@ -482,15 +455,13 @@ extern void SiS_CalcLCDACRT1Timing(struct SiS_Private *SiS_Pr, unsigned short M | |||
| 482 | extern void SiS_CalcCRRegisters(struct SiS_Private *SiS_Pr, int depth); | 455 | extern void SiS_CalcCRRegisters(struct SiS_Private *SiS_Pr, int depth); |
| 483 | extern unsigned short SiS_GetRefCRTVCLK(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide); | 456 | extern unsigned short SiS_GetRefCRTVCLK(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide); |
| 484 | extern unsigned short SiS_GetRefCRT1CRTC(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide); | 457 | extern unsigned short SiS_GetRefCRT1CRTC(struct SiS_Private *SiS_Pr, unsigned short Index, int UseWide); |
| 485 | #ifdef SIS300 | 458 | #ifdef CONFIG_FB_SIS_300 |
| 486 | extern void SiS_GetFIFOThresholdIndex300(struct SiS_Private *SiS_Pr, unsigned short *tempbx, | 459 | extern void SiS_GetFIFOThresholdIndex300(struct SiS_Private *SiS_Pr, unsigned short *tempbx, |
| 487 | unsigned short *tempcl); | 460 | unsigned short *tempcl); |
| 488 | extern unsigned short SiS_GetFIFOThresholdB300(unsigned short tempbx, unsigned short tempcl); | 461 | extern unsigned short SiS_GetFIFOThresholdB300(unsigned short tempbx, unsigned short tempcl); |
| 489 | extern unsigned short SiS_GetLatencyFactor630(struct SiS_Private *SiS_Pr, unsigned short index); | 462 | extern unsigned short SiS_GetLatencyFactor630(struct SiS_Private *SiS_Pr, unsigned short index); |
| 490 | #ifdef SIS_LINUX_KERNEL | ||
| 491 | extern unsigned int sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg); | 463 | extern unsigned int sisfb_read_nbridge_pci_dword(struct SiS_Private *SiS_Pr, int reg); |
| 492 | extern unsigned int sisfb_read_lpc_pci_dword(struct SiS_Private *SiS_Pr, int reg); | 464 | extern unsigned int sisfb_read_lpc_pci_dword(struct SiS_Private *SiS_Pr, int reg); |
| 493 | #endif | 465 | #endif |
| 494 | #endif | ||
| 495 | 466 | ||
| 496 | #endif | 467 | #endif |
diff --git a/drivers/video/sis/initextlfb.c b/drivers/video/sis/initextlfb.c index 99c04a4855d1..9dec64da4015 100644 --- a/drivers/video/sis/initextlfb.c +++ b/drivers/video/sis/initextlfb.c | |||
| @@ -25,7 +25,6 @@ | |||
| 25 | * Author: Thomas Winischhofer <thomas@winischhofer.net> | 25 | * Author: Thomas Winischhofer <thomas@winischhofer.net> |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | #include "osdef.h" | ||
| 29 | #include "initdef.h" | 28 | #include "initdef.h" |
| 30 | #include "vgatypes.h" | 29 | #include "vgatypes.h" |
| 31 | #include "vstruct.h" | 30 | #include "vstruct.h" |
| @@ -59,7 +58,7 @@ sisfb_mode_rate_to_dclock(struct SiS_Private *SiS_Pr, unsigned char modeno, | |||
| 59 | 58 | ||
| 60 | if(rateindex > 0) rateindex--; | 59 | if(rateindex > 0) rateindex--; |
| 61 | 60 | ||
| 62 | #ifdef SIS315H | 61 | #ifdef CONFIG_FB_SIS_315 |
| 63 | switch(ModeNo) { | 62 | switch(ModeNo) { |
| 64 | case 0x5a: ModeNo = 0x50; break; | 63 | case 0x5a: ModeNo = 0x50; break; |
| 65 | case 0x5b: ModeNo = 0x56; | 64 | case 0x5b: ModeNo = 0x56; |
| @@ -103,7 +102,7 @@ sisfb_mode_rate_to_ddata(struct SiS_Private *SiS_Pr, unsigned char modeno, | |||
| 103 | 102 | ||
| 104 | if(rateindex > 0) rateindex--; | 103 | if(rateindex > 0) rateindex--; |
| 105 | 104 | ||
| 106 | #ifdef SIS315H | 105 | #ifdef CONFIG_FB_SIS_315 |
| 107 | switch(ModeNo) { | 106 | switch(ModeNo) { |
| 108 | case 0x5a: ModeNo = 0x50; break; | 107 | case 0x5a: ModeNo = 0x50; break; |
| 109 | case 0x5b: ModeNo = 0x56; | 108 | case 0x5b: ModeNo = 0x56; |
| @@ -187,7 +186,7 @@ sisfb_gettotalfrommode(struct SiS_Private *SiS_Pr, unsigned char modeno, int *ht | |||
| 187 | 186 | ||
| 188 | if(rateindex > 0) rateindex--; | 187 | if(rateindex > 0) rateindex--; |
| 189 | 188 | ||
| 190 | #ifdef SIS315H | 189 | #ifdef CONFIG_FB_SIS_315 |
| 191 | switch(ModeNo) { | 190 | switch(ModeNo) { |
| 192 | case 0x5a: ModeNo = 0x50; break; | 191 | case 0x5a: ModeNo = 0x50; break; |
| 193 | case 0x5b: ModeNo = 0x56; | 192 | case 0x5b: ModeNo = 0x56; |
diff --git a/drivers/video/sis/osdef.h b/drivers/video/sis/osdef.h deleted file mode 100644 index 6ff8f988a1a7..000000000000 --- a/drivers/video/sis/osdef.h +++ /dev/null | |||
| @@ -1,133 +0,0 @@ | |||
| 1 | /* $XFree86$ */ | ||
| 2 | /* $XdotOrg$ */ | ||
| 3 | /* | ||
| 4 | * OS depending defines | ||
| 5 | * | ||
| 6 | * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria | ||
| 7 | * | ||
| 8 | * If distributed as part of the Linux kernel, the following license terms | ||
| 9 | * apply: | ||
| 10 | * | ||
| 11 | * * This program is free software; you can redistribute it and/or modify | ||
| 12 | * * it under the terms of the GNU General Public License as published by | ||
| 13 | * * the Free Software Foundation; either version 2 of the named License, | ||
| 14 | * * or any later version. | ||
| 15 | * * | ||
| 16 | * * This program is distributed in the hope that it will be useful, | ||
| 17 | * * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 18 | * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 19 | * * GNU General Public License for more details. | ||
| 20 | * * | ||
| 21 | * * You should have received a copy of the GNU General Public License | ||
| 22 | * * along with this program; if not, write to the Free Software | ||
| 23 | * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA | ||
| 24 | * | ||
| 25 | * Otherwise, the following license terms apply: | ||
| 26 | * | ||
| 27 | * * Redistribution and use in source and binary forms, with or without | ||
| 28 | * * modification, are permitted provided that the following conditions | ||
| 29 | * * are met: | ||
| 30 | * * 1) Redistributions of source code must retain the above copyright | ||
| 31 | * * notice, this list of conditions and the following disclaimer. | ||
| 32 | * * 2) Redistributions in binary form must reproduce the above copyright | ||
| 33 | * * notice, this list of conditions and the following disclaimer in the | ||
| 34 | * * documentation and/or other materials provided with the distribution. | ||
| 35 | * * 3) The name of the author may not be used to endorse or promote products | ||
| 36 | * * derived from this software without specific prior written permission. | ||
| 37 | * * | ||
| 38 | * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
| 39 | * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| 40 | * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| 41 | * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 42 | * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| 43 | * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 44 | * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 45 | * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 46 | * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| 47 | * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 48 | * | ||
| 49 | * Author: Thomas Winischhofer <thomas@winischhofer.net> | ||
| 50 | * Silicon Integrated Systems, Inc. (used by permission) | ||
| 51 | * | ||
| 52 | */ | ||
| 53 | |||
| 54 | #ifndef _SIS_OSDEF_H_ | ||
| 55 | #define _SIS_OSDEF_H_ | ||
| 56 | |||
| 57 | /* The choices are: */ | ||
| 58 | #define SIS_LINUX_KERNEL /* Linux kernel framebuffer */ | ||
| 59 | #undef SIS_XORG_XF86 /* XFree86/X.org */ | ||
| 60 | |||
| 61 | #ifdef OutPortByte | ||
| 62 | #undef OutPortByte | ||
| 63 | #endif | ||
| 64 | |||
| 65 | #ifdef OutPortWord | ||
| 66 | #undef OutPortWord | ||
| 67 | #endif | ||
| 68 | |||
| 69 | #ifdef OutPortLong | ||
| 70 | #undef OutPortLong | ||
| 71 | #endif | ||
| 72 | |||
| 73 | #ifdef InPortByte | ||
| 74 | #undef InPortByte | ||
| 75 | #endif | ||
| 76 | |||
| 77 | #ifdef InPortWord | ||
| 78 | #undef InPortWord | ||
| 79 | #endif | ||
| 80 | |||
| 81 | #ifdef InPortLong | ||
| 82 | #undef InPortLong | ||
| 83 | #endif | ||
| 84 | |||
| 85 | /**********************************************************************/ | ||
| 86 | /* LINUX KERNEL */ | ||
| 87 | /**********************************************************************/ | ||
| 88 | |||
| 89 | #ifdef SIS_LINUX_KERNEL | ||
| 90 | |||
| 91 | #ifdef CONFIG_FB_SIS_300 | ||
| 92 | #define SIS300 | ||
| 93 | #endif | ||
| 94 | |||
| 95 | #ifdef CONFIG_FB_SIS_315 | ||
| 96 | #define SIS315H | ||
| 97 | #endif | ||
| 98 | |||
| 99 | #if !defined(SIS300) && !defined(SIS315H) | ||
| 100 | #warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is set | ||
| 101 | #warning sisfb will not work! | ||
| 102 | #endif | ||
| 103 | |||
| 104 | #define OutPortByte(p,v) outb((u8)(v),(SISIOADDRESS)(p)) | ||
| 105 | #define OutPortWord(p,v) outw((u16)(v),(SISIOADDRESS)(p)) | ||
| 106 | #define OutPortLong(p,v) outl((u32)(v),(SISIOADDRESS)(p)) | ||
| 107 | #define InPortByte(p) inb((SISIOADDRESS)(p)) | ||
| 108 | #define InPortWord(p) inw((SISIOADDRESS)(p)) | ||
| 109 | #define InPortLong(p) inl((SISIOADDRESS)(p)) | ||
| 110 | #define SiS_SetMemory(MemoryAddress,MemorySize,value) memset_io(MemoryAddress, value, MemorySize) | ||
| 111 | |||
| 112 | #endif /* LINUX_KERNEL */ | ||
| 113 | |||
| 114 | /**********************************************************************/ | ||
| 115 | /* XFree86/X.org */ | ||
| 116 | /**********************************************************************/ | ||
| 117 | |||
| 118 | #ifdef SIS_XORG_XF86 | ||
| 119 | |||
| 120 | #define SIS300 | ||
| 121 | #define SIS315H | ||
| 122 | |||
| 123 | #define OutPortByte(p,v) outSISREG((IOADDRESS)(p),(CARD8)(v)) | ||
| 124 | #define OutPortWord(p,v) outSISREGW((IOADDRESS)(p),(CARD16)(v)) | ||
| 125 | #define OutPortLong(p,v) outSISREGL((IOADDRESS)(p),(CARD32)(v)) | ||
| 126 | #define InPortByte(p) inSISREG((IOADDRESS)(p)) | ||
| 127 | #define InPortWord(p) inSISREGW((IOADDRESS)(p)) | ||
| 128 | #define InPortLong(p) inSISREGL((IOADDRESS)(p)) | ||
| 129 | #define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize) | ||
| 130 | |||
| 131 | #endif /* XF86 */ | ||
| 132 | |||
| 133 | #endif /* _OSDEF_H_ */ | ||
diff --git a/drivers/video/sis/sis.h b/drivers/video/sis/sis.h index 7c5710e3fb56..80d89d37c414 100644 --- a/drivers/video/sis/sis.h +++ b/drivers/video/sis/sis.h | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | #ifndef _SIS_H_ | 24 | #ifndef _SIS_H_ |
| 25 | #define _SIS_H_ | 25 | #define _SIS_H_ |
| 26 | 26 | ||
| 27 | #include "osdef.h" | ||
| 28 | #include <video/sisfb.h> | 27 | #include <video/sisfb.h> |
| 29 | 28 | ||
| 30 | #include "vgatypes.h" | 29 | #include "vgatypes.h" |
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index 3dde12b0ab06..7e3370f115b6 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c | |||
| @@ -60,6 +60,11 @@ | |||
| 60 | #include "sis.h" | 60 | #include "sis.h" |
| 61 | #include "sis_main.h" | 61 | #include "sis_main.h" |
| 62 | 62 | ||
| 63 | #if !defined(CONFIG_FB_SIS_300) && !defined(CONFIG_FB_SIS_315) | ||
| 64 | #warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is set | ||
| 65 | #warning sisfb will not work! | ||
| 66 | #endif | ||
| 67 | |||
| 63 | static void sisfb_handle_command(struct sis_video_info *ivideo, | 68 | static void sisfb_handle_command(struct sis_video_info *ivideo, |
| 64 | struct sisfb_cmd *sisfb_command); | 69 | struct sisfb_cmd *sisfb_command); |
| 65 | 70 | ||
| @@ -4114,14 +4119,6 @@ sisfb_find_rom(struct pci_dev *pdev) | |||
| 4114 | if(sisfb_check_rom(rom_base, ivideo)) { | 4119 | if(sisfb_check_rom(rom_base, ivideo)) { |
| 4115 | 4120 | ||
| 4116 | if((myrombase = vmalloc(65536))) { | 4121 | if((myrombase = vmalloc(65536))) { |
| 4117 | |||
| 4118 | /* Work around bug in pci/rom.c: Folks forgot to check | ||
| 4119 | * whether the size retrieved from the BIOS image eventually | ||
| 4120 | * is larger than the mapped size | ||
| 4121 | */ | ||
| 4122 | if(pci_resource_len(pdev, PCI_ROM_RESOURCE) < romsize) | ||
| 4123 | romsize = pci_resource_len(pdev, PCI_ROM_RESOURCE); | ||
| 4124 | |||
| 4125 | memcpy_fromio(myrombase, rom_base, | 4122 | memcpy_fromio(myrombase, rom_base, |
| 4126 | (romsize > 65536) ? 65536 : romsize); | 4123 | (romsize > 65536) ? 65536 : romsize); |
| 4127 | } | 4124 | } |
| @@ -4155,23 +4152,6 @@ sisfb_find_rom(struct pci_dev *pdev) | |||
| 4155 | 4152 | ||
| 4156 | } | 4153 | } |
| 4157 | 4154 | ||
| 4158 | #else | ||
| 4159 | |||
| 4160 | pci_read_config_dword(pdev, PCI_ROM_ADDRESS, &temp); | ||
| 4161 | pci_write_config_dword(pdev, PCI_ROM_ADDRESS, | ||
| 4162 | (ivideo->video_base & PCI_ROM_ADDRESS_MASK) | PCI_ROM_ADDRESS_ENABLE); | ||
| 4163 | |||
| 4164 | rom_base = ioremap(ivideo->video_base, 65536); | ||
| 4165 | if(rom_base) { | ||
| 4166 | if(sisfb_check_rom(rom_base, ivideo)) { | ||
| 4167 | if((myrombase = vmalloc(65536))) | ||
| 4168 | memcpy_fromio(myrombase, rom_base, 65536); | ||
| 4169 | } | ||
| 4170 | iounmap(rom_base); | ||
| 4171 | } | ||
| 4172 | |||
| 4173 | pci_write_config_dword(pdev, PCI_ROM_ADDRESS, temp); | ||
| 4174 | |||
| 4175 | #endif | 4155 | #endif |
| 4176 | 4156 | ||
| 4177 | return myrombase; | 4157 | return myrombase; |
diff --git a/drivers/video/sis/vgatypes.h b/drivers/video/sis/vgatypes.h index 81a22eaabfde..12c0dfaf2518 100644 --- a/drivers/video/sis/vgatypes.h +++ b/drivers/video/sis/vgatypes.h | |||
| @@ -55,21 +55,10 @@ | |||
| 55 | 55 | ||
| 56 | #define SISIOMEMTYPE | 56 | #define SISIOMEMTYPE |
| 57 | 57 | ||
| 58 | #ifdef SIS_LINUX_KERNEL | ||
| 59 | typedef unsigned long SISIOADDRESS; | 58 | typedef unsigned long SISIOADDRESS; |
| 60 | #include <linux/types.h> /* Need __iomem */ | 59 | #include <linux/types.h> /* Need __iomem */ |
| 61 | #undef SISIOMEMTYPE | 60 | #undef SISIOMEMTYPE |
| 62 | #define SISIOMEMTYPE __iomem | 61 | #define SISIOMEMTYPE __iomem |
| 63 | #endif | ||
| 64 | |||
| 65 | #ifdef SIS_XORG_XF86 | ||
| 66 | #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,0,0,0) | ||
| 67 | typedef unsigned long IOADDRESS; | ||
| 68 | typedef unsigned long SISIOADDRESS; | ||
| 69 | #else | ||
| 70 | typedef IOADDRESS SISIOADDRESS; | ||
| 71 | #endif | ||
| 72 | #endif | ||
| 73 | 62 | ||
| 74 | typedef enum _SIS_CHIP_TYPE { | 63 | typedef enum _SIS_CHIP_TYPE { |
| 75 | SIS_VGALegacy = 0, | 64 | SIS_VGALegacy = 0, |
diff --git a/drivers/video/sis/vstruct.h b/drivers/video/sis/vstruct.h index bef4aae388d0..ea94d214dcff 100644 --- a/drivers/video/sis/vstruct.h +++ b/drivers/video/sis/vstruct.h | |||
| @@ -233,24 +233,15 @@ struct SiS_Private | |||
| 233 | { | 233 | { |
| 234 | unsigned char ChipType; | 234 | unsigned char ChipType; |
| 235 | unsigned char ChipRevision; | 235 | unsigned char ChipRevision; |
| 236 | #ifdef SIS_XORG_XF86 | ||
| 237 | PCITAG PciTag; | ||
| 238 | #endif | ||
| 239 | #ifdef SIS_LINUX_KERNEL | ||
| 240 | void *ivideo; | 236 | void *ivideo; |
| 241 | #endif | ||
| 242 | unsigned char *VirtualRomBase; | 237 | unsigned char *VirtualRomBase; |
| 243 | bool UseROM; | 238 | bool UseROM; |
| 244 | #ifdef SIS_LINUX_KERNEL | ||
| 245 | unsigned char SISIOMEMTYPE *VideoMemoryAddress; | 239 | unsigned char SISIOMEMTYPE *VideoMemoryAddress; |
| 246 | unsigned int VideoMemorySize; | 240 | unsigned int VideoMemorySize; |
| 247 | #endif | ||
| 248 | SISIOADDRESS IOAddress; | 241 | SISIOADDRESS IOAddress; |
| 249 | SISIOADDRESS IOAddress2; /* For dual chip XGI volari */ | 242 | SISIOADDRESS IOAddress2; /* For dual chip XGI volari */ |
| 250 | 243 | ||
| 251 | #ifdef SIS_LINUX_KERNEL | ||
| 252 | SISIOADDRESS RelIO; | 244 | SISIOADDRESS RelIO; |
| 253 | #endif | ||
| 254 | SISIOADDRESS SiS_P3c4; | 245 | SISIOADDRESS SiS_P3c4; |
| 255 | SISIOADDRESS SiS_P3d4; | 246 | SISIOADDRESS SiS_P3d4; |
| 256 | SISIOADDRESS SiS_P3c0; | 247 | SISIOADDRESS SiS_P3c0; |
| @@ -280,9 +271,6 @@ struct SiS_Private | |||
| 280 | unsigned short SiS_IF_DEF_FSTN; | 271 | unsigned short SiS_IF_DEF_FSTN; |
| 281 | unsigned short SiS_SysFlags; | 272 | unsigned short SiS_SysFlags; |
| 282 | unsigned char SiS_VGAINFO; | 273 | unsigned char SiS_VGAINFO; |
| 283 | #ifdef SIS_XORG_XF86 | ||
| 284 | unsigned short SiS_CP1, SiS_CP2, SiS_CP3, SiS_CP4; | ||
| 285 | #endif | ||
| 286 | bool SiS_UseROM; | 274 | bool SiS_UseROM; |
| 287 | bool SiS_ROMNew; | 275 | bool SiS_ROMNew; |
| 288 | bool SiS_XGIROM; | 276 | bool SiS_XGIROM; |
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 3a43ebf83a49..efb35aa8309a 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c | |||
| @@ -9,19 +9,19 @@ static ssize_t device_show(struct device *_d, | |||
| 9 | struct device_attribute *attr, char *buf) | 9 | struct device_attribute *attr, char *buf) |
| 10 | { | 10 | { |
| 11 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); | 11 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); |
| 12 | return sprintf(buf, "%hu", dev->id.device); | 12 | return sprintf(buf, "0x%04x\n", dev->id.device); |
| 13 | } | 13 | } |
| 14 | static ssize_t vendor_show(struct device *_d, | 14 | static ssize_t vendor_show(struct device *_d, |
| 15 | struct device_attribute *attr, char *buf) | 15 | struct device_attribute *attr, char *buf) |
| 16 | { | 16 | { |
| 17 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); | 17 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); |
| 18 | return sprintf(buf, "%hu", dev->id.vendor); | 18 | return sprintf(buf, "0x%04x\n", dev->id.vendor); |
| 19 | } | 19 | } |
| 20 | static ssize_t status_show(struct device *_d, | 20 | static ssize_t status_show(struct device *_d, |
| 21 | struct device_attribute *attr, char *buf) | 21 | struct device_attribute *attr, char *buf) |
| 22 | { | 22 | { |
| 23 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); | 23 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); |
| 24 | return sprintf(buf, "0x%08x", dev->config->get_status(dev)); | 24 | return sprintf(buf, "0x%08x\n", dev->config->get_status(dev)); |
| 25 | } | 25 | } |
| 26 | static ssize_t modalias_show(struct device *_d, | 26 | static ssize_t modalias_show(struct device *_d, |
| 27 | struct device_attribute *attr, char *buf) | 27 | struct device_attribute *attr, char *buf) |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 1475ed6b575f..cc2f73e03475 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
| @@ -230,9 +230,6 @@ add_head: | |||
| 230 | pr_debug("Added buffer head %i to %p\n", head, vq); | 230 | pr_debug("Added buffer head %i to %p\n", head, vq); |
| 231 | END_USE(vq); | 231 | END_USE(vq); |
| 232 | 232 | ||
| 233 | /* If we're indirect, we can fit many (assuming not OOM). */ | ||
| 234 | if (vq->indirect) | ||
| 235 | return vq->num_free ? vq->vring.num : 0; | ||
| 236 | return vq->num_free; | 233 | return vq->num_free; |
| 237 | } | 234 | } |
| 238 | EXPORT_SYMBOL_GPL(virtqueue_add_buf_gfp); | 235 | EXPORT_SYMBOL_GPL(virtqueue_add_buf_gfp); |
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile index eb8a78d77d9d..533a199e7a3f 100644 --- a/drivers/xen/Makefile +++ b/drivers/xen/Makefile | |||
| @@ -8,9 +8,12 @@ obj-$(CONFIG_BLOCK) += biomerge.o | |||
| 8 | obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o | 8 | obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o |
| 9 | obj-$(CONFIG_XEN_XENCOMM) += xencomm.o | 9 | obj-$(CONFIG_XEN_XENCOMM) += xencomm.o |
| 10 | obj-$(CONFIG_XEN_BALLOON) += balloon.o | 10 | obj-$(CONFIG_XEN_BALLOON) += balloon.o |
| 11 | obj-$(CONFIG_XEN_DEV_EVTCHN) += evtchn.o | 11 | obj-$(CONFIG_XEN_DEV_EVTCHN) += xen-evtchn.o |
| 12 | obj-$(CONFIG_XENFS) += xenfs/ | 12 | obj-$(CONFIG_XENFS) += xenfs/ |
| 13 | obj-$(CONFIG_XEN_SYS_HYPERVISOR) += sys-hypervisor.o | 13 | obj-$(CONFIG_XEN_SYS_HYPERVISOR) += sys-hypervisor.o |
| 14 | obj-$(CONFIG_XEN_PLATFORM_PCI) += platform-pci.o | 14 | obj-$(CONFIG_XEN_PLATFORM_PCI) += platform-pci.o |
| 15 | obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o | 15 | obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o |
| 16 | obj-$(CONFIG_XEN_DOM0) += pci.o | 16 | obj-$(CONFIG_XEN_DOM0) += pci.o |
| 17 | |||
| 18 | xen-evtchn-y := evtchn.o | ||
| 19 | |||
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 500290b150bb..2b17ad5b4b32 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | #include <asm/pgtable.h> | 50 | #include <asm/pgtable.h> |
| 51 | #include <asm/uaccess.h> | 51 | #include <asm/uaccess.h> |
| 52 | #include <asm/tlb.h> | 52 | #include <asm/tlb.h> |
| 53 | #include <asm/e820.h> | ||
| 53 | 54 | ||
| 54 | #include <asm/xen/hypervisor.h> | 55 | #include <asm/xen/hypervisor.h> |
| 55 | #include <asm/xen/hypercall.h> | 56 | #include <asm/xen/hypercall.h> |
| @@ -119,7 +120,7 @@ static void scrub_page(struct page *page) | |||
| 119 | } | 120 | } |
| 120 | 121 | ||
| 121 | /* balloon_append: add the given page to the balloon. */ | 122 | /* balloon_append: add the given page to the balloon. */ |
| 122 | static void balloon_append(struct page *page) | 123 | static void __balloon_append(struct page *page) |
| 123 | { | 124 | { |
| 124 | /* Lowmem is re-populated first, so highmem pages go at list tail. */ | 125 | /* Lowmem is re-populated first, so highmem pages go at list tail. */ |
| 125 | if (PageHighMem(page)) { | 126 | if (PageHighMem(page)) { |
| @@ -130,7 +131,11 @@ static void balloon_append(struct page *page) | |||
| 130 | list_add(&page->lru, &ballooned_pages); | 131 | list_add(&page->lru, &ballooned_pages); |
| 131 | balloon_stats.balloon_low++; | 132 | balloon_stats.balloon_low++; |
| 132 | } | 133 | } |
| 134 | } | ||
| 133 | 135 | ||
| 136 | static void balloon_append(struct page *page) | ||
| 137 | { | ||
| 138 | __balloon_append(page); | ||
| 134 | totalram_pages--; | 139 | totalram_pages--; |
| 135 | } | 140 | } |
| 136 | 141 | ||
| @@ -191,7 +196,7 @@ static unsigned long current_target(void) | |||
| 191 | 196 | ||
| 192 | static int increase_reservation(unsigned long nr_pages) | 197 | static int increase_reservation(unsigned long nr_pages) |
| 193 | { | 198 | { |
| 194 | unsigned long pfn, i, flags; | 199 | unsigned long pfn, i; |
| 195 | struct page *page; | 200 | struct page *page; |
| 196 | long rc; | 201 | long rc; |
| 197 | struct xen_memory_reservation reservation = { | 202 | struct xen_memory_reservation reservation = { |
| @@ -203,8 +208,6 @@ static int increase_reservation(unsigned long nr_pages) | |||
| 203 | if (nr_pages > ARRAY_SIZE(frame_list)) | 208 | if (nr_pages > ARRAY_SIZE(frame_list)) |
| 204 | nr_pages = ARRAY_SIZE(frame_list); | 209 | nr_pages = ARRAY_SIZE(frame_list); |
| 205 | 210 | ||
| 206 | spin_lock_irqsave(&xen_reservation_lock, flags); | ||
| 207 | |||
| 208 | page = balloon_first_page(); | 211 | page = balloon_first_page(); |
| 209 | for (i = 0; i < nr_pages; i++) { | 212 | for (i = 0; i < nr_pages; i++) { |
| 210 | BUG_ON(page == NULL); | 213 | BUG_ON(page == NULL); |
| @@ -247,14 +250,12 @@ static int increase_reservation(unsigned long nr_pages) | |||
| 247 | balloon_stats.current_pages += rc; | 250 | balloon_stats.current_pages += rc; |
| 248 | 251 | ||
| 249 | out: | 252 | out: |
| 250 | spin_unlock_irqrestore(&xen_reservation_lock, flags); | ||
| 251 | |||
| 252 | return rc < 0 ? rc : rc != nr_pages; | 253 | return rc < 0 ? rc : rc != nr_pages; |
| 253 | } | 254 | } |
| 254 | 255 | ||
| 255 | static int decrease_reservation(unsigned long nr_pages) | 256 | static int decrease_reservation(unsigned long nr_pages) |
| 256 | { | 257 | { |
| 257 | unsigned long pfn, i, flags; | 258 | unsigned long pfn, i; |
| 258 | struct page *page; | 259 | struct page *page; |
| 259 | int need_sleep = 0; | 260 | int need_sleep = 0; |
| 260 | int ret; | 261 | int ret; |
| @@ -292,8 +293,6 @@ static int decrease_reservation(unsigned long nr_pages) | |||
| 292 | kmap_flush_unused(); | 293 | kmap_flush_unused(); |
| 293 | flush_tlb_all(); | 294 | flush_tlb_all(); |
| 294 | 295 | ||
| 295 | spin_lock_irqsave(&xen_reservation_lock, flags); | ||
| 296 | |||
| 297 | /* No more mappings: invalidate P2M and add to balloon. */ | 296 | /* No more mappings: invalidate P2M and add to balloon. */ |
| 298 | for (i = 0; i < nr_pages; i++) { | 297 | for (i = 0; i < nr_pages; i++) { |
| 299 | pfn = mfn_to_pfn(frame_list[i]); | 298 | pfn = mfn_to_pfn(frame_list[i]); |
| @@ -308,8 +307,6 @@ static int decrease_reservation(unsigned long nr_pages) | |||
| 308 | 307 | ||
| 309 | balloon_stats.current_pages -= nr_pages; | 308 | balloon_stats.current_pages -= nr_pages; |
| 310 | 309 | ||
| 311 | spin_unlock_irqrestore(&xen_reservation_lock, flags); | ||
| 312 | |||
| 313 | return need_sleep; | 310 | return need_sleep; |
| 314 | } | 311 | } |
| 315 | 312 | ||
| @@ -395,7 +392,7 @@ static struct notifier_block xenstore_notifier; | |||
| 395 | 392 | ||
| 396 | static int __init balloon_init(void) | 393 | static int __init balloon_init(void) |
| 397 | { | 394 | { |
| 398 | unsigned long pfn; | 395 | unsigned long pfn, extra_pfn_end; |
| 399 | struct page *page; | 396 | struct page *page; |
| 400 | 397 | ||
| 401 | if (!xen_pv_domain()) | 398 | if (!xen_pv_domain()) |
| @@ -416,10 +413,15 @@ static int __init balloon_init(void) | |||
| 416 | register_balloon(&balloon_sysdev); | 413 | register_balloon(&balloon_sysdev); |
| 417 | 414 | ||
| 418 | /* Initialise the balloon with excess memory space. */ | 415 | /* Initialise the balloon with excess memory space. */ |
| 419 | for (pfn = xen_start_info->nr_pages; pfn < max_pfn; pfn++) { | 416 | extra_pfn_end = min(e820_end_of_ram_pfn(), |
| 417 | (unsigned long)PFN_DOWN(xen_extra_mem_start + xen_extra_mem_size)); | ||
| 418 | for (pfn = PFN_UP(xen_extra_mem_start); | ||
| 419 | pfn < extra_pfn_end; | ||
| 420 | pfn++) { | ||
| 420 | page = pfn_to_page(pfn); | 421 | page = pfn_to_page(pfn); |
| 421 | if (!PageReserved(page)) | 422 | /* totalram_pages doesn't include the boot-time |
| 422 | balloon_append(page); | 423 | balloon extension, so don't subtract from it. */ |
| 424 | __balloon_append(page); | ||
| 423 | } | 425 | } |
| 424 | 426 | ||
| 425 | target_watch.callback = watch_target; | 427 | target_watch.callback = watch_target; |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 321a0c8346e5..2811bb988ea0 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
| @@ -278,17 +278,17 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu) | |||
| 278 | cpumask_copy(irq_to_desc(irq)->affinity, cpumask_of(cpu)); | 278 | cpumask_copy(irq_to_desc(irq)->affinity, cpumask_of(cpu)); |
| 279 | #endif | 279 | #endif |
| 280 | 280 | ||
| 281 | __clear_bit(chn, cpu_evtchn_mask(cpu_from_irq(irq))); | 281 | clear_bit(chn, cpu_evtchn_mask(cpu_from_irq(irq))); |
| 282 | __set_bit(chn, cpu_evtchn_mask(cpu)); | 282 | set_bit(chn, cpu_evtchn_mask(cpu)); |
| 283 | 283 | ||
| 284 | irq_info[irq].cpu = cpu; | 284 | irq_info[irq].cpu = cpu; |
| 285 | } | 285 | } |
| 286 | 286 | ||
| 287 | static void init_evtchn_cpu_bindings(void) | 287 | static void init_evtchn_cpu_bindings(void) |
| 288 | { | 288 | { |
| 289 | int i; | ||
| 289 | #ifdef CONFIG_SMP | 290 | #ifdef CONFIG_SMP |
| 290 | struct irq_desc *desc; | 291 | struct irq_desc *desc; |
| 291 | int i; | ||
| 292 | 292 | ||
| 293 | /* By default all event channels notify CPU#0. */ | 293 | /* By default all event channels notify CPU#0. */ |
| 294 | for_each_irq_desc(i, desc) { | 294 | for_each_irq_desc(i, desc) { |
| @@ -296,7 +296,10 @@ static void init_evtchn_cpu_bindings(void) | |||
| 296 | } | 296 | } |
| 297 | #endif | 297 | #endif |
| 298 | 298 | ||
| 299 | memset(cpu_evtchn_mask(0), ~0, sizeof(struct cpu_evtchn_s)); | 299 | for_each_possible_cpu(i) |
| 300 | memset(cpu_evtchn_mask(i), | ||
| 301 | (i == 0) ? ~0 : 0, sizeof(struct cpu_evtchn_s)); | ||
| 302 | |||
| 300 | } | 303 | } |
| 301 | 304 | ||
| 302 | static inline void clear_evtchn(int port) | 305 | static inline void clear_evtchn(int port) |
| @@ -752,7 +755,7 @@ int xen_destroy_irq(int irq) | |||
| 752 | goto out; | 755 | goto out; |
| 753 | 756 | ||
| 754 | if (xen_initial_domain()) { | 757 | if (xen_initial_domain()) { |
| 755 | unmap_irq.pirq = info->u.pirq.gsi; | 758 | unmap_irq.pirq = info->u.pirq.pirq; |
| 756 | unmap_irq.domid = DOMID_SELF; | 759 | unmap_irq.domid = DOMID_SELF; |
| 757 | rc = HYPERVISOR_physdev_op(PHYSDEVOP_unmap_pirq, &unmap_irq); | 760 | rc = HYPERVISOR_physdev_op(PHYSDEVOP_unmap_pirq, &unmap_irq); |
| 758 | if (rc) { | 761 | if (rc) { |
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index fec6ba3c08a8..ef11daf0cafe 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c | |||
| @@ -69,20 +69,51 @@ struct per_user_data { | |||
| 69 | const char *name; | 69 | const char *name; |
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | /* Who's bound to each port? */ | 72 | /* |
| 73 | static struct per_user_data *port_user[NR_EVENT_CHANNELS]; | 73 | * Who's bound to each port? This is logically an array of struct |
| 74 | * per_user_data *, but we encode the current enabled-state in bit 0. | ||
| 75 | */ | ||
| 76 | static unsigned long *port_user; | ||
| 74 | static DEFINE_SPINLOCK(port_user_lock); /* protects port_user[] and ring_prod */ | 77 | static DEFINE_SPINLOCK(port_user_lock); /* protects port_user[] and ring_prod */ |
| 75 | 78 | ||
| 76 | irqreturn_t evtchn_interrupt(int irq, void *data) | 79 | static inline struct per_user_data *get_port_user(unsigned port) |
| 80 | { | ||
| 81 | return (struct per_user_data *)(port_user[port] & ~1); | ||
| 82 | } | ||
| 83 | |||
| 84 | static inline void set_port_user(unsigned port, struct per_user_data *u) | ||
| 85 | { | ||
| 86 | port_user[port] = (unsigned long)u; | ||
| 87 | } | ||
| 88 | |||
| 89 | static inline bool get_port_enabled(unsigned port) | ||
| 90 | { | ||
| 91 | return port_user[port] & 1; | ||
| 92 | } | ||
| 93 | |||
| 94 | static inline void set_port_enabled(unsigned port, bool enabled) | ||
| 95 | { | ||
| 96 | if (enabled) | ||
| 97 | port_user[port] |= 1; | ||
| 98 | else | ||
| 99 | port_user[port] &= ~1; | ||
| 100 | } | ||
| 101 | |||
| 102 | static irqreturn_t evtchn_interrupt(int irq, void *data) | ||
| 77 | { | 103 | { |
| 78 | unsigned int port = (unsigned long)data; | 104 | unsigned int port = (unsigned long)data; |
| 79 | struct per_user_data *u; | 105 | struct per_user_data *u; |
| 80 | 106 | ||
| 81 | spin_lock(&port_user_lock); | 107 | spin_lock(&port_user_lock); |
| 82 | 108 | ||
| 83 | u = port_user[port]; | 109 | u = get_port_user(port); |
| 110 | |||
| 111 | WARN(!get_port_enabled(port), | ||
| 112 | "Interrupt for port %d, but apparently not enabled; per-user %p\n", | ||
| 113 | port, u); | ||
| 84 | 114 | ||
| 85 | disable_irq_nosync(irq); | 115 | disable_irq_nosync(irq); |
| 116 | set_port_enabled(port, false); | ||
| 86 | 117 | ||
| 87 | if ((u->ring_prod - u->ring_cons) < EVTCHN_RING_SIZE) { | 118 | if ((u->ring_prod - u->ring_cons) < EVTCHN_RING_SIZE) { |
| 88 | u->ring[EVTCHN_RING_MASK(u->ring_prod)] = port; | 119 | u->ring[EVTCHN_RING_MASK(u->ring_prod)] = port; |
| @@ -92,9 +123,8 @@ irqreturn_t evtchn_interrupt(int irq, void *data) | |||
| 92 | kill_fasync(&u->evtchn_async_queue, | 123 | kill_fasync(&u->evtchn_async_queue, |
| 93 | SIGIO, POLL_IN); | 124 | SIGIO, POLL_IN); |
| 94 | } | 125 | } |
| 95 | } else { | 126 | } else |
| 96 | u->ring_overflow = 1; | 127 | u->ring_overflow = 1; |
| 97 | } | ||
| 98 | 128 | ||
| 99 | spin_unlock(&port_user_lock); | 129 | spin_unlock(&port_user_lock); |
| 100 | 130 | ||
| @@ -198,9 +228,18 @@ static ssize_t evtchn_write(struct file *file, const char __user *buf, | |||
| 198 | goto out; | 228 | goto out; |
| 199 | 229 | ||
| 200 | spin_lock_irq(&port_user_lock); | 230 | spin_lock_irq(&port_user_lock); |
| 201 | for (i = 0; i < (count/sizeof(evtchn_port_t)); i++) | 231 | |
| 202 | if ((kbuf[i] < NR_EVENT_CHANNELS) && (port_user[kbuf[i]] == u)) | 232 | for (i = 0; i < (count/sizeof(evtchn_port_t)); i++) { |
| 203 | enable_irq(irq_from_evtchn(kbuf[i])); | 233 | unsigned port = kbuf[i]; |
| 234 | |||
| 235 | if (port < NR_EVENT_CHANNELS && | ||
| 236 | get_port_user(port) == u && | ||
| 237 | !get_port_enabled(port)) { | ||
| 238 | set_port_enabled(port, true); | ||
| 239 | enable_irq(irq_from_evtchn(port)); | ||
| 240 | } | ||
| 241 | } | ||
| 242 | |||
| 204 | spin_unlock_irq(&port_user_lock); | 243 | spin_unlock_irq(&port_user_lock); |
| 205 | 244 | ||
| 206 | rc = count; | 245 | rc = count; |
| @@ -222,8 +261,9 @@ static int evtchn_bind_to_user(struct per_user_data *u, int port) | |||
| 222 | * interrupt handler yet, and our caller has already | 261 | * interrupt handler yet, and our caller has already |
| 223 | * serialized bind operations.) | 262 | * serialized bind operations.) |
| 224 | */ | 263 | */ |
| 225 | BUG_ON(port_user[port] != NULL); | 264 | BUG_ON(get_port_user(port) != NULL); |
| 226 | port_user[port] = u; | 265 | set_port_user(port, u); |
| 266 | set_port_enabled(port, true); /* start enabled */ | ||
| 227 | 267 | ||
| 228 | rc = bind_evtchn_to_irqhandler(port, evtchn_interrupt, IRQF_DISABLED, | 268 | rc = bind_evtchn_to_irqhandler(port, evtchn_interrupt, IRQF_DISABLED, |
| 229 | u->name, (void *)(unsigned long)port); | 269 | u->name, (void *)(unsigned long)port); |
| @@ -239,10 +279,7 @@ static void evtchn_unbind_from_user(struct per_user_data *u, int port) | |||
| 239 | 279 | ||
| 240 | unbind_from_irqhandler(irq, (void *)(unsigned long)port); | 280 | unbind_from_irqhandler(irq, (void *)(unsigned long)port); |
| 241 | 281 | ||
| 242 | /* make sure we unbind the irq handler before clearing the port */ | 282 | set_port_user(port, NULL); |
| 243 | barrier(); | ||
| 244 | |||
| 245 | port_user[port] = NULL; | ||
| 246 | } | 283 | } |
| 247 | 284 | ||
| 248 | static long evtchn_ioctl(struct file *file, | 285 | static long evtchn_ioctl(struct file *file, |
| @@ -333,15 +370,17 @@ static long evtchn_ioctl(struct file *file, | |||
| 333 | spin_lock_irq(&port_user_lock); | 370 | spin_lock_irq(&port_user_lock); |
| 334 | 371 | ||
| 335 | rc = -ENOTCONN; | 372 | rc = -ENOTCONN; |
| 336 | if (port_user[unbind.port] != u) { | 373 | if (get_port_user(unbind.port) != u) { |
| 337 | spin_unlock_irq(&port_user_lock); | 374 | spin_unlock_irq(&port_user_lock); |
| 338 | break; | 375 | break; |
| 339 | } | 376 | } |
| 340 | 377 | ||
| 341 | evtchn_unbind_from_user(u, unbind.port); | 378 | disable_irq(irq_from_evtchn(unbind.port)); |
| 342 | 379 | ||
| 343 | spin_unlock_irq(&port_user_lock); | 380 | spin_unlock_irq(&port_user_lock); |
| 344 | 381 | ||
| 382 | evtchn_unbind_from_user(u, unbind.port); | ||
| 383 | |||
| 345 | rc = 0; | 384 | rc = 0; |
| 346 | break; | 385 | break; |
| 347 | } | 386 | } |
| @@ -355,7 +394,7 @@ static long evtchn_ioctl(struct file *file, | |||
| 355 | 394 | ||
| 356 | if (notify.port >= NR_EVENT_CHANNELS) { | 395 | if (notify.port >= NR_EVENT_CHANNELS) { |
| 357 | rc = -EINVAL; | 396 | rc = -EINVAL; |
| 358 | } else if (port_user[notify.port] != u) { | 397 | } else if (get_port_user(notify.port) != u) { |
| 359 | rc = -ENOTCONN; | 398 | rc = -ENOTCONN; |
| 360 | } else { | 399 | } else { |
| 361 | notify_remote_via_evtchn(notify.port); | 400 | notify_remote_via_evtchn(notify.port); |
| @@ -431,7 +470,7 @@ static int evtchn_open(struct inode *inode, struct file *filp) | |||
| 431 | 470 | ||
| 432 | filp->private_data = u; | 471 | filp->private_data = u; |
| 433 | 472 | ||
| 434 | return 0; | 473 | return nonseekable_open(inode, filp);; |
| 435 | } | 474 | } |
| 436 | 475 | ||
| 437 | static int evtchn_release(struct inode *inode, struct file *filp) | 476 | static int evtchn_release(struct inode *inode, struct file *filp) |
| @@ -444,14 +483,21 @@ static int evtchn_release(struct inode *inode, struct file *filp) | |||
| 444 | free_page((unsigned long)u->ring); | 483 | free_page((unsigned long)u->ring); |
| 445 | 484 | ||
| 446 | for (i = 0; i < NR_EVENT_CHANNELS; i++) { | 485 | for (i = 0; i < NR_EVENT_CHANNELS; i++) { |
| 447 | if (port_user[i] != u) | 486 | if (get_port_user(i) != u) |
| 448 | continue; | 487 | continue; |
| 449 | 488 | ||
| 450 | evtchn_unbind_from_user(port_user[i], i); | 489 | disable_irq(irq_from_evtchn(i)); |
| 451 | } | 490 | } |
| 452 | 491 | ||
| 453 | spin_unlock_irq(&port_user_lock); | 492 | spin_unlock_irq(&port_user_lock); |
| 454 | 493 | ||
| 494 | for (i = 0; i < NR_EVENT_CHANNELS; i++) { | ||
| 495 | if (get_port_user(i) != u) | ||
| 496 | continue; | ||
| 497 | |||
| 498 | evtchn_unbind_from_user(get_port_user(i), i); | ||
| 499 | } | ||
| 500 | |||
| 455 | kfree(u->name); | 501 | kfree(u->name); |
| 456 | kfree(u); | 502 | kfree(u); |
| 457 | 503 | ||
| @@ -467,12 +513,12 @@ static const struct file_operations evtchn_fops = { | |||
| 467 | .fasync = evtchn_fasync, | 513 | .fasync = evtchn_fasync, |
| 468 | .open = evtchn_open, | 514 | .open = evtchn_open, |
| 469 | .release = evtchn_release, | 515 | .release = evtchn_release, |
| 470 | .llseek = noop_llseek, | 516 | .llseek = no_llseek, |
| 471 | }; | 517 | }; |
| 472 | 518 | ||
| 473 | static struct miscdevice evtchn_miscdev = { | 519 | static struct miscdevice evtchn_miscdev = { |
| 474 | .minor = MISC_DYNAMIC_MINOR, | 520 | .minor = MISC_DYNAMIC_MINOR, |
| 475 | .name = "evtchn", | 521 | .name = "xen/evtchn", |
| 476 | .fops = &evtchn_fops, | 522 | .fops = &evtchn_fops, |
| 477 | }; | 523 | }; |
| 478 | static int __init evtchn_init(void) | 524 | static int __init evtchn_init(void) |
| @@ -482,8 +528,11 @@ static int __init evtchn_init(void) | |||
| 482 | if (!xen_domain()) | 528 | if (!xen_domain()) |
| 483 | return -ENODEV; | 529 | return -ENODEV; |
| 484 | 530 | ||
| 531 | port_user = kcalloc(NR_EVENT_CHANNELS, sizeof(*port_user), GFP_KERNEL); | ||
| 532 | if (port_user == NULL) | ||
| 533 | return -ENOMEM; | ||
| 534 | |||
| 485 | spin_lock_init(&port_user_lock); | 535 | spin_lock_init(&port_user_lock); |
| 486 | memset(port_user, 0, sizeof(port_user)); | ||
| 487 | 536 | ||
| 488 | /* Create '/dev/misc/evtchn'. */ | 537 | /* Create '/dev/misc/evtchn'. */ |
| 489 | err = misc_register(&evtchn_miscdev); | 538 | err = misc_register(&evtchn_miscdev); |
| @@ -499,6 +548,9 @@ static int __init evtchn_init(void) | |||
| 499 | 548 | ||
| 500 | static void __exit evtchn_cleanup(void) | 549 | static void __exit evtchn_cleanup(void) |
| 501 | { | 550 | { |
| 551 | kfree(port_user); | ||
| 552 | port_user = NULL; | ||
| 553 | |||
| 502 | misc_deregister(&evtchn_miscdev); | 554 | misc_deregister(&evtchn_miscdev); |
| 503 | } | 555 | } |
| 504 | 556 | ||
diff --git a/drivers/xen/xenfs/privcmd.c b/drivers/xen/xenfs/privcmd.c index 0f5d4162b22d..dbd3b16fd131 100644 --- a/drivers/xen/xenfs/privcmd.c +++ b/drivers/xen/xenfs/privcmd.c | |||
| @@ -265,9 +265,7 @@ static int mmap_return_errors(void *data, void *state) | |||
| 265 | xen_pfn_t *mfnp = data; | 265 | xen_pfn_t *mfnp = data; |
| 266 | struct mmap_batch_state *st = state; | 266 | struct mmap_batch_state *st = state; |
| 267 | 267 | ||
| 268 | put_user(*mfnp, st->user++); | 268 | return put_user(*mfnp, st->user++); |
| 269 | |||
| 270 | return 0; | ||
| 271 | } | 269 | } |
| 272 | 270 | ||
| 273 | static struct vm_operations_struct privcmd_vm_ops; | 271 | static struct vm_operations_struct privcmd_vm_ops; |
| @@ -322,10 +320,8 @@ static long privcmd_ioctl_mmap_batch(void __user *udata) | |||
| 322 | up_write(&mm->mmap_sem); | 320 | up_write(&mm->mmap_sem); |
| 323 | 321 | ||
| 324 | if (state.err > 0) { | 322 | if (state.err > 0) { |
| 325 | ret = 0; | ||
| 326 | |||
| 327 | state.user = m.arr; | 323 | state.user = m.arr; |
| 328 | traverse_pages(m.num, sizeof(xen_pfn_t), | 324 | ret = traverse_pages(m.num, sizeof(xen_pfn_t), |
| 329 | &pagelist, | 325 | &pagelist, |
| 330 | mmap_return_errors, &state); | 326 | mmap_return_errors, &state); |
| 331 | } | 327 | } |
| @@ -383,8 +379,9 @@ static int privcmd_mmap(struct file *file, struct vm_area_struct *vma) | |||
| 383 | if (xen_feature(XENFEAT_auto_translated_physmap)) | 379 | if (xen_feature(XENFEAT_auto_translated_physmap)) |
| 384 | return -ENOSYS; | 380 | return -ENOSYS; |
| 385 | 381 | ||
| 386 | /* DONTCOPY is essential for Xen as copy_page_range is broken. */ | 382 | /* DONTCOPY is essential for Xen because copy_page_range doesn't know |
| 387 | vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY; | 383 | * how to recreate these mappings */ |
| 384 | vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY | VM_PFNMAP; | ||
| 388 | vma->vm_ops = &privcmd_vm_ops; | 385 | vma->vm_ops = &privcmd_vm_ops; |
| 389 | vma->vm_private_data = NULL; | 386 | vma->vm_private_data = NULL; |
| 390 | 387 | ||
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c index f6339d11d59c..1aa389719846 100644 --- a/drivers/xen/xenfs/super.c +++ b/drivers/xen/xenfs/super.c | |||
| @@ -12,8 +12,6 @@ | |||
| 12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
| 13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
| 14 | #include <linux/magic.h> | 14 | #include <linux/magic.h> |
| 15 | #include <linux/mm.h> | ||
| 16 | #include <linux/backing-dev.h> | ||
| 17 | 15 | ||
| 18 | #include <xen/xen.h> | 16 | #include <xen/xen.h> |
| 19 | 17 | ||
| @@ -24,28 +22,12 @@ | |||
| 24 | MODULE_DESCRIPTION("Xen filesystem"); | 22 | MODULE_DESCRIPTION("Xen filesystem"); |
| 25 | MODULE_LICENSE("GPL"); | 23 | MODULE_LICENSE("GPL"); |
| 26 | 24 | ||
| 27 | static int xenfs_set_page_dirty(struct page *page) | ||
| 28 | { | ||
| 29 | return !TestSetPageDirty(page); | ||
| 30 | } | ||
| 31 | |||
| 32 | static const struct address_space_operations xenfs_aops = { | ||
| 33 | .set_page_dirty = xenfs_set_page_dirty, | ||
| 34 | }; | ||
| 35 | |||
| 36 | static struct backing_dev_info xenfs_backing_dev_info = { | ||
| 37 | .ra_pages = 0, /* No readahead */ | ||
| 38 | .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK, | ||
| 39 | }; | ||
| 40 | |||
| 41 | static struct inode *xenfs_make_inode(struct super_block *sb, int mode) | 25 | static struct inode *xenfs_make_inode(struct super_block *sb, int mode) |
| 42 | { | 26 | { |
| 43 | struct inode *ret = new_inode(sb); | 27 | struct inode *ret = new_inode(sb); |
| 44 | 28 | ||
| 45 | if (ret) { | 29 | if (ret) { |
| 46 | ret->i_mode = mode; | 30 | ret->i_mode = mode; |
| 47 | ret->i_mapping->a_ops = &xenfs_aops; | ||
| 48 | ret->i_mapping->backing_dev_info = &xenfs_backing_dev_info; | ||
| 49 | ret->i_uid = ret->i_gid = 0; | 31 | ret->i_uid = ret->i_gid = 0; |
| 50 | ret->i_blocks = 0; | 32 | ret->i_blocks = 0; |
| 51 | ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; | 33 | ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; |
| @@ -121,9 +103,9 @@ static int xenfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 121 | return rc; | 103 | return rc; |
| 122 | } | 104 | } |
| 123 | 105 | ||
| 124 | static int xenfs_mount(struct file_system_type *fs_type, | 106 | static struct dentry *xenfs_mount(struct file_system_type *fs_type, |
| 125 | int flags, const char *dev_name, | 107 | int flags, const char *dev_name, |
| 126 | void *data) | 108 | void *data) |
| 127 | { | 109 | { |
| 128 | return mount_single(fs_type, flags, data, xenfs_fill_super); | 110 | return mount_single(fs_type, flags, data, xenfs_fill_super); |
| 129 | } | 111 | } |
| @@ -137,25 +119,11 @@ static struct file_system_type xenfs_type = { | |||
| 137 | 119 | ||
| 138 | static int __init xenfs_init(void) | 120 | static int __init xenfs_init(void) |
| 139 | { | 121 | { |
| 140 | int err; | 122 | if (xen_domain()) |
| 141 | if (!xen_domain()) { | 123 | return register_filesystem(&xenfs_type); |
| 142 | printk(KERN_INFO "xenfs: not registering filesystem on non-xen platform\n"); | ||
| 143 | return 0; | ||
| 144 | } | ||
| 145 | |||
| 146 | err = register_filesystem(&xenfs_type); | ||
| 147 | if (err) { | ||
| 148 | printk(KERN_ERR "xenfs: Unable to register filesystem!\n"); | ||
| 149 | goto out; | ||
| 150 | } | ||
| 151 | |||
| 152 | err = bdi_init(&xenfs_backing_dev_info); | ||
| 153 | if (err) | ||
| 154 | unregister_filesystem(&xenfs_type); | ||
| 155 | |||
| 156 | out: | ||
| 157 | 124 | ||
| 158 | return err; | 125 | printk(KERN_INFO "XENFS: not registering filesystem on non-xen platform\n"); |
| 126 | return 0; | ||
| 159 | } | 127 | } |
| 160 | 128 | ||
| 161 | static void __exit xenfs_exit(void) | 129 | static void __exit xenfs_exit(void) |
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index e9c874abc9e1..561438b6a50c 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
| @@ -204,7 +204,7 @@ static int readpage_nounlock(struct file *filp, struct page *page) | |||
| 204 | err = ceph_osdc_readpages(osdc, ceph_vino(inode), &ci->i_layout, | 204 | err = ceph_osdc_readpages(osdc, ceph_vino(inode), &ci->i_layout, |
| 205 | page->index << PAGE_CACHE_SHIFT, &len, | 205 | page->index << PAGE_CACHE_SHIFT, &len, |
| 206 | ci->i_truncate_seq, ci->i_truncate_size, | 206 | ci->i_truncate_seq, ci->i_truncate_size, |
| 207 | &page, 1); | 207 | &page, 1, 0); |
| 208 | if (err == -ENOENT) | 208 | if (err == -ENOENT) |
| 209 | err = 0; | 209 | err = 0; |
| 210 | if (err < 0) { | 210 | if (err < 0) { |
| @@ -287,7 +287,7 @@ static int ceph_readpages(struct file *file, struct address_space *mapping, | |||
| 287 | rc = ceph_osdc_readpages(osdc, ceph_vino(inode), &ci->i_layout, | 287 | rc = ceph_osdc_readpages(osdc, ceph_vino(inode), &ci->i_layout, |
| 288 | offset, &len, | 288 | offset, &len, |
| 289 | ci->i_truncate_seq, ci->i_truncate_size, | 289 | ci->i_truncate_seq, ci->i_truncate_size, |
| 290 | pages, nr_pages); | 290 | pages, nr_pages, 0); |
| 291 | if (rc == -ENOENT) | 291 | if (rc == -ENOENT) |
| 292 | rc = 0; | 292 | rc = 0; |
| 293 | if (rc < 0) | 293 | if (rc < 0) |
| @@ -774,7 +774,7 @@ get_more_pages: | |||
| 774 | snapc, do_sync, | 774 | snapc, do_sync, |
| 775 | ci->i_truncate_seq, | 775 | ci->i_truncate_seq, |
| 776 | ci->i_truncate_size, | 776 | ci->i_truncate_size, |
| 777 | &inode->i_mtime, true, 1); | 777 | &inode->i_mtime, true, 1, 0); |
| 778 | max_pages = req->r_num_pages; | 778 | max_pages = req->r_num_pages; |
| 779 | 779 | ||
| 780 | alloc_page_vec(fsc, req); | 780 | alloc_page_vec(fsc, req); |
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 98ab13e2b71d..60d27bc9eb83 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
| @@ -1430,8 +1430,8 @@ static int try_nonblocking_invalidate(struct inode *inode) | |||
| 1430 | invalidating_gen == ci->i_rdcache_gen) { | 1430 | invalidating_gen == ci->i_rdcache_gen) { |
| 1431 | /* success. */ | 1431 | /* success. */ |
| 1432 | dout("try_nonblocking_invalidate %p success\n", inode); | 1432 | dout("try_nonblocking_invalidate %p success\n", inode); |
| 1433 | ci->i_rdcache_gen = 0; | 1433 | /* save any racing async invalidate some trouble */ |
| 1434 | ci->i_rdcache_revoking = 0; | 1434 | ci->i_rdcache_revoking = ci->i_rdcache_gen - 1; |
| 1435 | return 0; | 1435 | return 0; |
| 1436 | } | 1436 | } |
| 1437 | dout("try_nonblocking_invalidate %p failed\n", inode); | 1437 | dout("try_nonblocking_invalidate %p failed\n", inode); |
| @@ -2273,8 +2273,7 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
| 2273 | { | 2273 | { |
| 2274 | struct ceph_inode_info *ci = ceph_inode(inode); | 2274 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 2275 | int mds = session->s_mds; | 2275 | int mds = session->s_mds; |
| 2276 | unsigned seq = le32_to_cpu(grant->seq); | 2276 | int seq = le32_to_cpu(grant->seq); |
| 2277 | unsigned issue_seq = le32_to_cpu(grant->issue_seq); | ||
| 2278 | int newcaps = le32_to_cpu(grant->caps); | 2277 | int newcaps = le32_to_cpu(grant->caps); |
| 2279 | int issued, implemented, used, wanted, dirty; | 2278 | int issued, implemented, used, wanted, dirty; |
| 2280 | u64 size = le64_to_cpu(grant->size); | 2279 | u64 size = le64_to_cpu(grant->size); |
| @@ -2286,8 +2285,8 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
| 2286 | int revoked_rdcache = 0; | 2285 | int revoked_rdcache = 0; |
| 2287 | int queue_invalidate = 0; | 2286 | int queue_invalidate = 0; |
| 2288 | 2287 | ||
| 2289 | dout("handle_cap_grant inode %p cap %p mds%d seq %u/%u %s\n", | 2288 | dout("handle_cap_grant inode %p cap %p mds%d seq %d %s\n", |
| 2290 | inode, cap, mds, seq, issue_seq, ceph_cap_string(newcaps)); | 2289 | inode, cap, mds, seq, ceph_cap_string(newcaps)); |
| 2291 | dout(" size %llu max_size %llu, i_size %llu\n", size, max_size, | 2290 | dout(" size %llu max_size %llu, i_size %llu\n", size, max_size, |
| 2292 | inode->i_size); | 2291 | inode->i_size); |
| 2293 | 2292 | ||
| @@ -2383,7 +2382,6 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
| 2383 | } | 2382 | } |
| 2384 | 2383 | ||
| 2385 | cap->seq = seq; | 2384 | cap->seq = seq; |
| 2386 | cap->issue_seq = issue_seq; | ||
| 2387 | 2385 | ||
| 2388 | /* file layout may have changed */ | 2386 | /* file layout may have changed */ |
| 2389 | ci->i_layout = grant->layout; | 2387 | ci->i_layout = grant->layout; |
| @@ -2691,6 +2689,11 @@ static void handle_cap_import(struct ceph_mds_client *mdsc, | |||
| 2691 | NULL /* no caps context */); | 2689 | NULL /* no caps context */); |
| 2692 | try_flush_caps(inode, session, NULL); | 2690 | try_flush_caps(inode, session, NULL); |
| 2693 | up_read(&mdsc->snap_rwsem); | 2691 | up_read(&mdsc->snap_rwsem); |
| 2692 | |||
| 2693 | /* make sure we re-request max_size, if necessary */ | ||
| 2694 | spin_lock(&inode->i_lock); | ||
| 2695 | ci->i_requested_max_size = 0; | ||
| 2696 | spin_unlock(&inode->i_lock); | ||
| 2694 | } | 2697 | } |
| 2695 | 2698 | ||
| 2696 | /* | 2699 | /* |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index e0a2dc6fcafc..7d447af84ec4 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
| @@ -336,7 +336,10 @@ more: | |||
| 336 | if (req->r_reply_info.dir_end) { | 336 | if (req->r_reply_info.dir_end) { |
| 337 | kfree(fi->last_name); | 337 | kfree(fi->last_name); |
| 338 | fi->last_name = NULL; | 338 | fi->last_name = NULL; |
| 339 | fi->next_offset = 2; | 339 | if (ceph_frag_is_rightmost(frag)) |
| 340 | fi->next_offset = 2; | ||
| 341 | else | ||
| 342 | fi->next_offset = 0; | ||
| 340 | } else { | 343 | } else { |
| 341 | rinfo = &req->r_reply_info; | 344 | rinfo = &req->r_reply_info; |
| 342 | err = note_last_dentry(fi, | 345 | err = note_last_dentry(fi, |
| @@ -355,18 +358,22 @@ more: | |||
| 355 | u64 pos = ceph_make_fpos(frag, off); | 358 | u64 pos = ceph_make_fpos(frag, off); |
| 356 | struct ceph_mds_reply_inode *in = | 359 | struct ceph_mds_reply_inode *in = |
| 357 | rinfo->dir_in[off - fi->offset].in; | 360 | rinfo->dir_in[off - fi->offset].in; |
| 361 | struct ceph_vino vino; | ||
| 362 | ino_t ino; | ||
| 363 | |||
| 358 | dout("readdir off %d (%d/%d) -> %lld '%.*s' %p\n", | 364 | dout("readdir off %d (%d/%d) -> %lld '%.*s' %p\n", |
| 359 | off, off - fi->offset, rinfo->dir_nr, pos, | 365 | off, off - fi->offset, rinfo->dir_nr, pos, |
| 360 | rinfo->dir_dname_len[off - fi->offset], | 366 | rinfo->dir_dname_len[off - fi->offset], |
| 361 | rinfo->dir_dname[off - fi->offset], in); | 367 | rinfo->dir_dname[off - fi->offset], in); |
| 362 | BUG_ON(!in); | 368 | BUG_ON(!in); |
| 363 | ftype = le32_to_cpu(in->mode) >> 12; | 369 | ftype = le32_to_cpu(in->mode) >> 12; |
| 370 | vino.ino = le64_to_cpu(in->ino); | ||
| 371 | vino.snap = le64_to_cpu(in->snapid); | ||
| 372 | ino = ceph_vino_to_ino(vino); | ||
| 364 | if (filldir(dirent, | 373 | if (filldir(dirent, |
| 365 | rinfo->dir_dname[off - fi->offset], | 374 | rinfo->dir_dname[off - fi->offset], |
| 366 | rinfo->dir_dname_len[off - fi->offset], | 375 | rinfo->dir_dname_len[off - fi->offset], |
| 367 | pos, | 376 | pos, ino, ftype) < 0) { |
| 368 | le64_to_cpu(in->ino), | ||
| 369 | ftype) < 0) { | ||
| 370 | dout("filldir stopping us...\n"); | 377 | dout("filldir stopping us...\n"); |
| 371 | return 0; | 378 | return 0; |
| 372 | } | 379 | } |
| @@ -414,6 +421,7 @@ static void reset_readdir(struct ceph_file_info *fi) | |||
| 414 | fi->last_readdir = NULL; | 421 | fi->last_readdir = NULL; |
| 415 | } | 422 | } |
| 416 | kfree(fi->last_name); | 423 | kfree(fi->last_name); |
| 424 | fi->last_name = NULL; | ||
| 417 | fi->next_offset = 2; /* compensate for . and .. */ | 425 | fi->next_offset = 2; /* compensate for . and .. */ |
| 418 | if (fi->dentry) { | 426 | if (fi->dentry) { |
| 419 | dput(fi->dentry); | 427 | dput(fi->dentry); |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index e77c28cf3690..8d79b8912e31 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
| @@ -154,11 +154,13 @@ int ceph_open(struct inode *inode, struct file *file) | |||
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | /* | 156 | /* |
| 157 | * No need to block if we have any caps. Update wanted set | 157 | * No need to block if we have caps on the auth MDS (for |
| 158 | * write) or any MDS (for read). Update wanted set | ||
| 158 | * asynchronously. | 159 | * asynchronously. |
| 159 | */ | 160 | */ |
| 160 | spin_lock(&inode->i_lock); | 161 | spin_lock(&inode->i_lock); |
| 161 | if (__ceph_is_any_real_caps(ci)) { | 162 | if (__ceph_is_any_real_caps(ci) && |
| 163 | (((fmode & CEPH_FILE_MODE_WR) == 0) || ci->i_auth_cap)) { | ||
| 162 | int mds_wanted = __ceph_caps_mds_wanted(ci); | 164 | int mds_wanted = __ceph_caps_mds_wanted(ci); |
| 163 | int issued = __ceph_caps_issued(ci, NULL); | 165 | int issued = __ceph_caps_issued(ci, NULL); |
| 164 | 166 | ||
| @@ -280,11 +282,12 @@ int ceph_release(struct inode *inode, struct file *file) | |||
| 280 | static int striped_read(struct inode *inode, | 282 | static int striped_read(struct inode *inode, |
| 281 | u64 off, u64 len, | 283 | u64 off, u64 len, |
| 282 | struct page **pages, int num_pages, | 284 | struct page **pages, int num_pages, |
| 283 | int *checkeof) | 285 | int *checkeof, bool align_to_pages) |
| 284 | { | 286 | { |
| 285 | struct ceph_fs_client *fsc = ceph_inode_to_client(inode); | 287 | struct ceph_fs_client *fsc = ceph_inode_to_client(inode); |
| 286 | struct ceph_inode_info *ci = ceph_inode(inode); | 288 | struct ceph_inode_info *ci = ceph_inode(inode); |
| 287 | u64 pos, this_len; | 289 | u64 pos, this_len; |
| 290 | int io_align, page_align; | ||
| 288 | int page_off = off & ~PAGE_CACHE_MASK; /* first byte's offset in page */ | 291 | int page_off = off & ~PAGE_CACHE_MASK; /* first byte's offset in page */ |
| 289 | int left, pages_left; | 292 | int left, pages_left; |
| 290 | int read; | 293 | int read; |
| @@ -300,14 +303,19 @@ static int striped_read(struct inode *inode, | |||
| 300 | page_pos = pages; | 303 | page_pos = pages; |
| 301 | pages_left = num_pages; | 304 | pages_left = num_pages; |
| 302 | read = 0; | 305 | read = 0; |
| 306 | io_align = off & ~PAGE_MASK; | ||
| 303 | 307 | ||
| 304 | more: | 308 | more: |
| 309 | if (align_to_pages) | ||
| 310 | page_align = (pos - io_align) & ~PAGE_MASK; | ||
| 311 | else | ||
| 312 | page_align = pos & ~PAGE_MASK; | ||
| 305 | this_len = left; | 313 | this_len = left; |
| 306 | ret = ceph_osdc_readpages(&fsc->client->osdc, ceph_vino(inode), | 314 | ret = ceph_osdc_readpages(&fsc->client->osdc, ceph_vino(inode), |
| 307 | &ci->i_layout, pos, &this_len, | 315 | &ci->i_layout, pos, &this_len, |
| 308 | ci->i_truncate_seq, | 316 | ci->i_truncate_seq, |
| 309 | ci->i_truncate_size, | 317 | ci->i_truncate_size, |
| 310 | page_pos, pages_left); | 318 | page_pos, pages_left, page_align); |
| 311 | hit_stripe = this_len < left; | 319 | hit_stripe = this_len < left; |
| 312 | was_short = ret >= 0 && ret < this_len; | 320 | was_short = ret >= 0 && ret < this_len; |
| 313 | if (ret == -ENOENT) | 321 | if (ret == -ENOENT) |
| @@ -374,26 +382,25 @@ static ssize_t ceph_sync_read(struct file *file, char __user *data, | |||
| 374 | dout("sync_read on file %p %llu~%u %s\n", file, off, len, | 382 | dout("sync_read on file %p %llu~%u %s\n", file, off, len, |
| 375 | (file->f_flags & O_DIRECT) ? "O_DIRECT" : ""); | 383 | (file->f_flags & O_DIRECT) ? "O_DIRECT" : ""); |
| 376 | 384 | ||
| 377 | if (file->f_flags & O_DIRECT) { | 385 | if (file->f_flags & O_DIRECT) |
| 378 | pages = ceph_get_direct_page_vector(data, num_pages, off, len); | 386 | pages = ceph_get_direct_page_vector(data, num_pages); |
| 379 | 387 | else | |
| 380 | /* | ||
| 381 | * flush any page cache pages in this range. this | ||
| 382 | * will make concurrent normal and O_DIRECT io slow, | ||
| 383 | * but it will at least behave sensibly when they are | ||
| 384 | * in sequence. | ||
| 385 | */ | ||
| 386 | } else { | ||
| 387 | pages = ceph_alloc_page_vector(num_pages, GFP_NOFS); | 388 | pages = ceph_alloc_page_vector(num_pages, GFP_NOFS); |
| 388 | } | ||
| 389 | if (IS_ERR(pages)) | 389 | if (IS_ERR(pages)) |
| 390 | return PTR_ERR(pages); | 390 | return PTR_ERR(pages); |
| 391 | 391 | ||
| 392 | /* | ||
| 393 | * flush any page cache pages in this range. this | ||
| 394 | * will make concurrent normal and sync io slow, | ||
| 395 | * but it will at least behave sensibly when they are | ||
| 396 | * in sequence. | ||
| 397 | */ | ||
| 392 | ret = filemap_write_and_wait(inode->i_mapping); | 398 | ret = filemap_write_and_wait(inode->i_mapping); |
| 393 | if (ret < 0) | 399 | if (ret < 0) |
| 394 | goto done; | 400 | goto done; |
| 395 | 401 | ||
| 396 | ret = striped_read(inode, off, len, pages, num_pages, checkeof); | 402 | ret = striped_read(inode, off, len, pages, num_pages, checkeof, |
| 403 | file->f_flags & O_DIRECT); | ||
| 397 | 404 | ||
| 398 | if (ret >= 0 && (file->f_flags & O_DIRECT) == 0) | 405 | if (ret >= 0 && (file->f_flags & O_DIRECT) == 0) |
| 399 | ret = ceph_copy_page_vector_to_user(pages, data, off, ret); | 406 | ret = ceph_copy_page_vector_to_user(pages, data, off, ret); |
| @@ -448,6 +455,7 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data, | |||
| 448 | int flags; | 455 | int flags; |
| 449 | int do_sync = 0; | 456 | int do_sync = 0; |
| 450 | int check_caps = 0; | 457 | int check_caps = 0; |
| 458 | int page_align, io_align; | ||
| 451 | int ret; | 459 | int ret; |
| 452 | struct timespec mtime = CURRENT_TIME; | 460 | struct timespec mtime = CURRENT_TIME; |
| 453 | 461 | ||
| @@ -462,6 +470,8 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data, | |||
| 462 | else | 470 | else |
| 463 | pos = *offset; | 471 | pos = *offset; |
| 464 | 472 | ||
| 473 | io_align = pos & ~PAGE_MASK; | ||
| 474 | |||
| 465 | ret = filemap_write_and_wait_range(inode->i_mapping, pos, pos + left); | 475 | ret = filemap_write_and_wait_range(inode->i_mapping, pos, pos + left); |
| 466 | if (ret < 0) | 476 | if (ret < 0) |
| 467 | return ret; | 477 | return ret; |
| @@ -486,20 +496,26 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data, | |||
| 486 | */ | 496 | */ |
| 487 | more: | 497 | more: |
| 488 | len = left; | 498 | len = left; |
| 499 | if (file->f_flags & O_DIRECT) | ||
| 500 | /* write from beginning of first page, regardless of | ||
| 501 | io alignment */ | ||
| 502 | page_align = (pos - io_align) & ~PAGE_MASK; | ||
| 503 | else | ||
| 504 | page_align = pos & ~PAGE_MASK; | ||
| 489 | req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout, | 505 | req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout, |
| 490 | ceph_vino(inode), pos, &len, | 506 | ceph_vino(inode), pos, &len, |
| 491 | CEPH_OSD_OP_WRITE, flags, | 507 | CEPH_OSD_OP_WRITE, flags, |
| 492 | ci->i_snap_realm->cached_context, | 508 | ci->i_snap_realm->cached_context, |
| 493 | do_sync, | 509 | do_sync, |
| 494 | ci->i_truncate_seq, ci->i_truncate_size, | 510 | ci->i_truncate_seq, ci->i_truncate_size, |
| 495 | &mtime, false, 2); | 511 | &mtime, false, 2, page_align); |
| 496 | if (!req) | 512 | if (!req) |
| 497 | return -ENOMEM; | 513 | return -ENOMEM; |
| 498 | 514 | ||
| 499 | num_pages = calc_pages_for(pos, len); | 515 | num_pages = calc_pages_for(pos, len); |
| 500 | 516 | ||
| 501 | if (file->f_flags & O_DIRECT) { | 517 | if (file->f_flags & O_DIRECT) { |
| 502 | pages = ceph_get_direct_page_vector(data, num_pages, pos, len); | 518 | pages = ceph_get_direct_page_vector(data, num_pages); |
| 503 | if (IS_ERR(pages)) { | 519 | if (IS_ERR(pages)) { |
| 504 | ret = PTR_ERR(pages); | 520 | ret = PTR_ERR(pages); |
| 505 | goto out; | 521 | goto out; |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 524b80be4482..bf1286588f26 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
| @@ -470,7 +470,9 @@ void ceph_fill_file_time(struct inode *inode, int issued, | |||
| 470 | 470 | ||
| 471 | if (issued & (CEPH_CAP_FILE_EXCL| | 471 | if (issued & (CEPH_CAP_FILE_EXCL| |
| 472 | CEPH_CAP_FILE_WR| | 472 | CEPH_CAP_FILE_WR| |
| 473 | CEPH_CAP_FILE_BUFFER)) { | 473 | CEPH_CAP_FILE_BUFFER| |
| 474 | CEPH_CAP_AUTH_EXCL| | ||
| 475 | CEPH_CAP_XATTR_EXCL)) { | ||
| 474 | if (timespec_compare(ctime, &inode->i_ctime) > 0) { | 476 | if (timespec_compare(ctime, &inode->i_ctime) > 0) { |
| 475 | dout("ctime %ld.%09ld -> %ld.%09ld inc w/ cap\n", | 477 | dout("ctime %ld.%09ld -> %ld.%09ld inc w/ cap\n", |
| 476 | inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec, | 478 | inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec, |
| @@ -510,7 +512,7 @@ void ceph_fill_file_time(struct inode *inode, int issued, | |||
| 510 | warn = 1; | 512 | warn = 1; |
| 511 | } | 513 | } |
| 512 | } else { | 514 | } else { |
| 513 | /* we have no write caps; whatever the MDS says is true */ | 515 | /* we have no write|excl caps; whatever the MDS says is true */ |
| 514 | if (ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) >= 0) { | 516 | if (ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) >= 0) { |
| 515 | inode->i_ctime = *ctime; | 517 | inode->i_ctime = *ctime; |
| 516 | inode->i_mtime = *mtime; | 518 | inode->i_mtime = *mtime; |
| @@ -566,12 +568,17 @@ static int fill_inode(struct inode *inode, | |||
| 566 | 568 | ||
| 567 | /* | 569 | /* |
| 568 | * provided version will be odd if inode value is projected, | 570 | * provided version will be odd if inode value is projected, |
| 569 | * even if stable. skip the update if we have a newer info | 571 | * even if stable. skip the update if we have newer stable |
| 570 | * (e.g., due to inode info racing form multiple MDSs), or if | 572 | * info (ours>=theirs, e.g. due to racing mds replies), unless |
| 571 | * we are getting projected (unstable) inode info. | 573 | * we are getting projected (unstable) info (in which case the |
| 574 | * version is odd, and we want ours>theirs). | ||
| 575 | * us them | ||
| 576 | * 2 2 skip | ||
| 577 | * 3 2 skip | ||
| 578 | * 3 3 update | ||
| 572 | */ | 579 | */ |
| 573 | if (le64_to_cpu(info->version) > 0 && | 580 | if (le64_to_cpu(info->version) > 0 && |
| 574 | (ci->i_version & ~1) > le64_to_cpu(info->version)) | 581 | (ci->i_version & ~1) >= le64_to_cpu(info->version)) |
| 575 | goto no_change; | 582 | goto no_change; |
| 576 | 583 | ||
| 577 | issued = __ceph_caps_issued(ci, &implemented); | 584 | issued = __ceph_caps_issued(ci, &implemented); |
| @@ -605,7 +612,14 @@ static int fill_inode(struct inode *inode, | |||
| 605 | le32_to_cpu(info->time_warp_seq), | 612 | le32_to_cpu(info->time_warp_seq), |
| 606 | &ctime, &mtime, &atime); | 613 | &ctime, &mtime, &atime); |
| 607 | 614 | ||
| 608 | ci->i_max_size = le64_to_cpu(info->max_size); | 615 | /* only update max_size on auth cap */ |
| 616 | if ((info->cap.flags & CEPH_CAP_FLAG_AUTH) && | ||
| 617 | ci->i_max_size != le64_to_cpu(info->max_size)) { | ||
| 618 | dout("max_size %lld -> %llu\n", ci->i_max_size, | ||
| 619 | le64_to_cpu(info->max_size)); | ||
| 620 | ci->i_max_size = le64_to_cpu(info->max_size); | ||
| 621 | } | ||
| 622 | |||
| 609 | ci->i_layout = info->layout; | 623 | ci->i_layout = info->layout; |
| 610 | inode->i_blkbits = fls(le32_to_cpu(info->layout.fl_stripe_unit)) - 1; | 624 | inode->i_blkbits = fls(le32_to_cpu(info->layout.fl_stripe_unit)) - 1; |
| 611 | 625 | ||
| @@ -1054,7 +1068,8 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, | |||
| 1054 | ininfo = rinfo->targeti.in; | 1068 | ininfo = rinfo->targeti.in; |
| 1055 | vino.ino = le64_to_cpu(ininfo->ino); | 1069 | vino.ino = le64_to_cpu(ininfo->ino); |
| 1056 | vino.snap = le64_to_cpu(ininfo->snapid); | 1070 | vino.snap = le64_to_cpu(ininfo->snapid); |
| 1057 | if (!dn->d_inode) { | 1071 | in = dn->d_inode; |
| 1072 | if (!in) { | ||
| 1058 | in = ceph_get_inode(sb, vino); | 1073 | in = ceph_get_inode(sb, vino); |
| 1059 | if (IS_ERR(in)) { | 1074 | if (IS_ERR(in)) { |
| 1060 | pr_err("fill_trace bad get_inode " | 1075 | pr_err("fill_trace bad get_inode " |
| @@ -1385,11 +1400,8 @@ static void ceph_invalidate_work(struct work_struct *work) | |||
| 1385 | spin_lock(&inode->i_lock); | 1400 | spin_lock(&inode->i_lock); |
| 1386 | dout("invalidate_pages %p gen %d revoking %d\n", inode, | 1401 | dout("invalidate_pages %p gen %d revoking %d\n", inode, |
| 1387 | ci->i_rdcache_gen, ci->i_rdcache_revoking); | 1402 | ci->i_rdcache_gen, ci->i_rdcache_revoking); |
| 1388 | if (ci->i_rdcache_gen == 0 || | 1403 | if (ci->i_rdcache_revoking != ci->i_rdcache_gen) { |
| 1389 | ci->i_rdcache_revoking != ci->i_rdcache_gen) { | ||
| 1390 | BUG_ON(ci->i_rdcache_revoking > ci->i_rdcache_gen); | ||
| 1391 | /* nevermind! */ | 1404 | /* nevermind! */ |
| 1392 | ci->i_rdcache_revoking = 0; | ||
| 1393 | spin_unlock(&inode->i_lock); | 1405 | spin_unlock(&inode->i_lock); |
| 1394 | goto out; | 1406 | goto out; |
| 1395 | } | 1407 | } |
| @@ -1399,15 +1411,16 @@ static void ceph_invalidate_work(struct work_struct *work) | |||
| 1399 | ceph_invalidate_nondirty_pages(inode->i_mapping); | 1411 | ceph_invalidate_nondirty_pages(inode->i_mapping); |
| 1400 | 1412 | ||
| 1401 | spin_lock(&inode->i_lock); | 1413 | spin_lock(&inode->i_lock); |
| 1402 | if (orig_gen == ci->i_rdcache_gen) { | 1414 | if (orig_gen == ci->i_rdcache_gen && |
| 1415 | orig_gen == ci->i_rdcache_revoking) { | ||
| 1403 | dout("invalidate_pages %p gen %d successful\n", inode, | 1416 | dout("invalidate_pages %p gen %d successful\n", inode, |
| 1404 | ci->i_rdcache_gen); | 1417 | ci->i_rdcache_gen); |
| 1405 | ci->i_rdcache_gen = 0; | 1418 | ci->i_rdcache_revoking--; |
| 1406 | ci->i_rdcache_revoking = 0; | ||
| 1407 | check = 1; | 1419 | check = 1; |
| 1408 | } else { | 1420 | } else { |
| 1409 | dout("invalidate_pages %p gen %d raced, gen now %d\n", | 1421 | dout("invalidate_pages %p gen %d raced, now %d revoking %d\n", |
| 1410 | inode, orig_gen, ci->i_rdcache_gen); | 1422 | inode, orig_gen, ci->i_rdcache_gen, |
| 1423 | ci->i_rdcache_revoking); | ||
| 1411 | } | 1424 | } |
| 1412 | spin_unlock(&inode->i_lock); | 1425 | spin_unlock(&inode->i_lock); |
| 1413 | 1426 | ||
| @@ -1738,7 +1751,7 @@ int ceph_do_getattr(struct inode *inode, int mask) | |||
| 1738 | return 0; | 1751 | return 0; |
| 1739 | } | 1752 | } |
| 1740 | 1753 | ||
| 1741 | dout("do_getattr inode %p mask %s\n", inode, ceph_cap_string(mask)); | 1754 | dout("do_getattr inode %p mask %s mode 0%o\n", inode, ceph_cap_string(mask), inode->i_mode); |
| 1742 | if (ceph_caps_issued_mask(ceph_inode(inode), mask, 1)) | 1755 | if (ceph_caps_issued_mask(ceph_inode(inode), mask, 1)) |
| 1743 | return 0; | 1756 | return 0; |
| 1744 | 1757 | ||
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 7799cac2b629..098b18508479 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
| @@ -528,6 +528,9 @@ static void __register_request(struct ceph_mds_client *mdsc, | |||
| 528 | ceph_mdsc_get_request(req); | 528 | ceph_mdsc_get_request(req); |
| 529 | __insert_request(mdsc, req); | 529 | __insert_request(mdsc, req); |
| 530 | 530 | ||
| 531 | req->r_uid = current_fsuid(); | ||
| 532 | req->r_gid = current_fsgid(); | ||
| 533 | |||
| 531 | if (dir) { | 534 | if (dir) { |
| 532 | struct ceph_inode_info *ci = ceph_inode(dir); | 535 | struct ceph_inode_info *ci = ceph_inode(dir); |
| 533 | 536 | ||
| @@ -1587,8 +1590,8 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc, | |||
| 1587 | 1590 | ||
| 1588 | head->mdsmap_epoch = cpu_to_le32(mdsc->mdsmap->m_epoch); | 1591 | head->mdsmap_epoch = cpu_to_le32(mdsc->mdsmap->m_epoch); |
| 1589 | head->op = cpu_to_le32(req->r_op); | 1592 | head->op = cpu_to_le32(req->r_op); |
| 1590 | head->caller_uid = cpu_to_le32(current_fsuid()); | 1593 | head->caller_uid = cpu_to_le32(req->r_uid); |
| 1591 | head->caller_gid = cpu_to_le32(current_fsgid()); | 1594 | head->caller_gid = cpu_to_le32(req->r_gid); |
| 1592 | head->args = req->r_args; | 1595 | head->args = req->r_args; |
| 1593 | 1596 | ||
| 1594 | ceph_encode_filepath(&p, end, ino1, path1); | 1597 | ceph_encode_filepath(&p, end, ino1, path1); |
diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h index d66d63c72355..9341fd4f1432 100644 --- a/fs/ceph/mds_client.h +++ b/fs/ceph/mds_client.h | |||
| @@ -170,6 +170,8 @@ struct ceph_mds_request { | |||
| 170 | 170 | ||
| 171 | union ceph_mds_request_args r_args; | 171 | union ceph_mds_request_args r_args; |
| 172 | int r_fmode; /* file mode, if expecting cap */ | 172 | int r_fmode; /* file mode, if expecting cap */ |
| 173 | uid_t r_uid; | ||
| 174 | gid_t r_gid; | ||
| 173 | 175 | ||
| 174 | /* for choosing which mds to send this request to */ | 176 | /* for choosing which mds to send this request to */ |
| 175 | int r_direct_mode; | 177 | int r_direct_mode; |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 1886294e12f7..7f01728a4657 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
| @@ -293,9 +293,7 @@ struct ceph_inode_info { | |||
| 293 | int i_rd_ref, i_rdcache_ref, i_wr_ref; | 293 | int i_rd_ref, i_rdcache_ref, i_wr_ref; |
| 294 | int i_wrbuffer_ref, i_wrbuffer_ref_head; | 294 | int i_wrbuffer_ref, i_wrbuffer_ref_head; |
| 295 | u32 i_shared_gen; /* increment each time we get FILE_SHARED */ | 295 | u32 i_shared_gen; /* increment each time we get FILE_SHARED */ |
| 296 | u32 i_rdcache_gen; /* we increment this each time we get | 296 | u32 i_rdcache_gen; /* incremented each time we get FILE_CACHE. */ |
| 297 | FILE_CACHE. If it's non-zero, we | ||
| 298 | _may_ have cached pages. */ | ||
| 299 | u32 i_rdcache_revoking; /* RDCACHE gen to async invalidate, if any */ | 297 | u32 i_rdcache_revoking; /* RDCACHE gen to async invalidate, if any */ |
| 300 | 298 | ||
| 301 | struct list_head i_unsafe_writes; /* uncommitted sync writes */ | 299 | struct list_head i_unsafe_writes; /* uncommitted sync writes */ |
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index bf5ae883b1bd..eb3bc2fe647e 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
| @@ -331,6 +331,30 @@ mext_out: | |||
| 331 | return err; | 331 | return err; |
| 332 | } | 332 | } |
| 333 | 333 | ||
| 334 | case FITRIM: | ||
| 335 | { | ||
| 336 | struct super_block *sb = inode->i_sb; | ||
| 337 | struct fstrim_range range; | ||
| 338 | int ret = 0; | ||
| 339 | |||
| 340 | if (!capable(CAP_SYS_ADMIN)) | ||
| 341 | return -EPERM; | ||
| 342 | |||
| 343 | if (copy_from_user(&range, (struct fstrim_range *)arg, | ||
| 344 | sizeof(range))) | ||
| 345 | return -EFAULT; | ||
| 346 | |||
| 347 | ret = ext4_trim_fs(sb, &range); | ||
| 348 | if (ret < 0) | ||
| 349 | return ret; | ||
| 350 | |||
| 351 | if (copy_to_user((struct fstrim_range *)arg, &range, | ||
| 352 | sizeof(range))) | ||
| 353 | return -EFAULT; | ||
| 354 | |||
| 355 | return 0; | ||
| 356 | } | ||
| 357 | |||
| 334 | default: | 358 | default: |
| 335 | return -ENOTTY; | 359 | return -ENOTTY; |
| 336 | } | 360 | } |
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 7f5451cd1d38..beacce11ac50 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c | |||
| @@ -237,8 +237,6 @@ static void ext4_end_bio(struct bio *bio, int error) | |||
| 237 | } while (bh != head); | 237 | } while (bh != head); |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | put_io_page(io_end->pages[i]); | ||
| 241 | |||
| 242 | /* | 240 | /* |
| 243 | * If this is a partial write which happened to make | 241 | * If this is a partial write which happened to make |
| 244 | * all buffers uptodate then we can optimize away a | 242 | * all buffers uptodate then we can optimize away a |
| @@ -248,6 +246,8 @@ static void ext4_end_bio(struct bio *bio, int error) | |||
| 248 | */ | 246 | */ |
| 249 | if (!partial_write) | 247 | if (!partial_write) |
| 250 | SetPageUptodate(page); | 248 | SetPageUptodate(page); |
| 249 | |||
| 250 | put_io_page(io_end->pages[i]); | ||
| 251 | } | 251 | } |
| 252 | io_end->num_io_pages = 0; | 252 | io_end->num_io_pages = 0; |
| 253 | inode = io_end->inode; | 253 | inode = io_end->inode; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 61182fe6254e..e32195d6aac3 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
| @@ -1197,7 +1197,6 @@ static const struct super_operations ext4_sops = { | |||
| 1197 | .quota_write = ext4_quota_write, | 1197 | .quota_write = ext4_quota_write, |
| 1198 | #endif | 1198 | #endif |
| 1199 | .bdev_try_to_free_page = bdev_try_to_free_page, | 1199 | .bdev_try_to_free_page = bdev_try_to_free_page, |
| 1200 | .trim_fs = ext4_trim_fs | ||
| 1201 | }; | 1200 | }; |
| 1202 | 1201 | ||
| 1203 | static const struct super_operations ext4_nojournal_sops = { | 1202 | static const struct super_operations ext4_nojournal_sops = { |
| @@ -2799,9 +2798,6 @@ static void ext4_clear_request_list(void) | |||
| 2799 | struct ext4_li_request *elr; | 2798 | struct ext4_li_request *elr; |
| 2800 | 2799 | ||
| 2801 | mutex_lock(&ext4_li_info->li_list_mtx); | 2800 | mutex_lock(&ext4_li_info->li_list_mtx); |
| 2802 | if (list_empty(&ext4_li_info->li_request_list)) | ||
| 2803 | return; | ||
| 2804 | |||
| 2805 | list_for_each_safe(pos, n, &ext4_li_info->li_request_list) { | 2801 | list_for_each_safe(pos, n, &ext4_li_info->li_request_list) { |
| 2806 | elr = list_entry(pos, struct ext4_li_request, | 2802 | elr = list_entry(pos, struct ext4_li_request, |
| 2807 | lr_request); | 2803 | lr_request); |
| @@ -3268,13 +3264,14 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
| 3268 | * Test whether we have more sectors than will fit in sector_t, | 3264 | * Test whether we have more sectors than will fit in sector_t, |
| 3269 | * and whether the max offset is addressable by the page cache. | 3265 | * and whether the max offset is addressable by the page cache. |
| 3270 | */ | 3266 | */ |
| 3271 | ret = generic_check_addressable(sb->s_blocksize_bits, | 3267 | err = generic_check_addressable(sb->s_blocksize_bits, |
| 3272 | ext4_blocks_count(es)); | 3268 | ext4_blocks_count(es)); |
| 3273 | if (ret) { | 3269 | if (err) { |
| 3274 | ext4_msg(sb, KERN_ERR, "filesystem" | 3270 | ext4_msg(sb, KERN_ERR, "filesystem" |
| 3275 | " too large to mount safely on this system"); | 3271 | " too large to mount safely on this system"); |
| 3276 | if (sizeof(sector_t) < 8) | 3272 | if (sizeof(sector_t) < 8) |
| 3277 | ext4_msg(sb, KERN_WARNING, "CONFIG_LBDAF not enabled"); | 3273 | ext4_msg(sb, KERN_WARNING, "CONFIG_LBDAF not enabled"); |
| 3274 | ret = err; | ||
| 3278 | goto failed_mount; | 3275 | goto failed_mount; |
| 3279 | } | 3276 | } |
| 3280 | 3277 | ||
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index c8224587123f..9242d294fe90 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
| @@ -134,6 +134,7 @@ EXPORT_SYMBOL_GPL(fuse_do_open); | |||
| 134 | void fuse_finish_open(struct inode *inode, struct file *file) | 134 | void fuse_finish_open(struct inode *inode, struct file *file) |
| 135 | { | 135 | { |
| 136 | struct fuse_file *ff = file->private_data; | 136 | struct fuse_file *ff = file->private_data; |
| 137 | struct fuse_conn *fc = get_fuse_conn(inode); | ||
| 137 | 138 | ||
| 138 | if (ff->open_flags & FOPEN_DIRECT_IO) | 139 | if (ff->open_flags & FOPEN_DIRECT_IO) |
| 139 | file->f_op = &fuse_direct_io_file_operations; | 140 | file->f_op = &fuse_direct_io_file_operations; |
| @@ -141,6 +142,15 @@ void fuse_finish_open(struct inode *inode, struct file *file) | |||
| 141 | invalidate_inode_pages2(inode->i_mapping); | 142 | invalidate_inode_pages2(inode->i_mapping); |
| 142 | if (ff->open_flags & FOPEN_NONSEEKABLE) | 143 | if (ff->open_flags & FOPEN_NONSEEKABLE) |
| 143 | nonseekable_open(inode, file); | 144 | nonseekable_open(inode, file); |
| 145 | if (fc->atomic_o_trunc && (file->f_flags & O_TRUNC)) { | ||
| 146 | struct fuse_inode *fi = get_fuse_inode(inode); | ||
| 147 | |||
| 148 | spin_lock(&fc->lock); | ||
| 149 | fi->attr_version = ++fc->attr_version; | ||
| 150 | i_size_write(inode, 0); | ||
| 151 | spin_unlock(&fc->lock); | ||
| 152 | fuse_invalidate_attr(inode); | ||
| 153 | } | ||
| 144 | } | 154 | } |
| 145 | 155 | ||
| 146 | int fuse_open_common(struct inode *inode, struct file *file, bool isdir) | 156 | int fuse_open_common(struct inode *inode, struct file *file, bool isdir) |
diff --git a/fs/ioctl.c b/fs/ioctl.c index 4f46752ce4f9..d6cc16476620 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
| @@ -529,41 +529,6 @@ static int ioctl_fsthaw(struct file *filp) | |||
| 529 | return thaw_super(sb); | 529 | return thaw_super(sb); |
| 530 | } | 530 | } |
| 531 | 531 | ||
| 532 | static int ioctl_fstrim(struct file *filp, void __user *argp) | ||
| 533 | { | ||
| 534 | struct super_block *sb = filp->f_path.dentry->d_inode->i_sb; | ||
| 535 | struct fstrim_range range; | ||
| 536 | int ret = 0; | ||
| 537 | |||
| 538 | if (!capable(CAP_SYS_ADMIN)) | ||
| 539 | return -EPERM; | ||
| 540 | |||
| 541 | /* If filesystem doesn't support trim feature, return. */ | ||
| 542 | if (sb->s_op->trim_fs == NULL) | ||
| 543 | return -EOPNOTSUPP; | ||
| 544 | |||
| 545 | /* If a blockdevice-backed filesystem isn't specified, return EINVAL. */ | ||
| 546 | if (sb->s_bdev == NULL) | ||
| 547 | return -EINVAL; | ||
| 548 | |||
| 549 | if (argp == NULL) { | ||
| 550 | range.start = 0; | ||
| 551 | range.len = ULLONG_MAX; | ||
| 552 | range.minlen = 0; | ||
| 553 | } else if (copy_from_user(&range, argp, sizeof(range))) | ||
| 554 | return -EFAULT; | ||
| 555 | |||
| 556 | ret = sb->s_op->trim_fs(sb, &range); | ||
| 557 | if (ret < 0) | ||
| 558 | return ret; | ||
| 559 | |||
| 560 | if ((argp != NULL) && | ||
| 561 | (copy_to_user(argp, &range, sizeof(range)))) | ||
| 562 | return -EFAULT; | ||
| 563 | |||
| 564 | return 0; | ||
| 565 | } | ||
| 566 | |||
| 567 | /* | 532 | /* |
| 568 | * When you add any new common ioctls to the switches above and below | 533 | * When you add any new common ioctls to the switches above and below |
| 569 | * please update compat_sys_ioctl() too. | 534 | * please update compat_sys_ioctl() too. |
| @@ -614,10 +579,6 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | |||
| 614 | error = ioctl_fsthaw(filp); | 579 | error = ioctl_fsthaw(filp); |
| 615 | break; | 580 | break; |
| 616 | 581 | ||
| 617 | case FITRIM: | ||
| 618 | error = ioctl_fstrim(filp, argp); | ||
| 619 | break; | ||
| 620 | |||
| 621 | case FS_IOC_FIEMAP: | 582 | case FS_IOC_FIEMAP: |
| 622 | return ioctl_fiemap(filp, arg); | 583 | return ioctl_fiemap(filp, arg); |
| 623 | 584 | ||
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index c590d155c095..f837ba953529 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
| @@ -899,6 +899,14 @@ journal_t * jbd2_journal_init_dev(struct block_device *bdev, | |||
| 899 | 899 | ||
| 900 | /* journal descriptor can store up to n blocks -bzzz */ | 900 | /* journal descriptor can store up to n blocks -bzzz */ |
| 901 | journal->j_blocksize = blocksize; | 901 | journal->j_blocksize = blocksize; |
| 902 | journal->j_dev = bdev; | ||
| 903 | journal->j_fs_dev = fs_dev; | ||
| 904 | journal->j_blk_offset = start; | ||
| 905 | journal->j_maxlen = len; | ||
| 906 | bdevname(journal->j_dev, journal->j_devname); | ||
| 907 | p = journal->j_devname; | ||
| 908 | while ((p = strchr(p, '/'))) | ||
| 909 | *p = '!'; | ||
| 902 | jbd2_stats_proc_init(journal); | 910 | jbd2_stats_proc_init(journal); |
| 903 | n = journal->j_blocksize / sizeof(journal_block_tag_t); | 911 | n = journal->j_blocksize / sizeof(journal_block_tag_t); |
| 904 | journal->j_wbufsize = n; | 912 | journal->j_wbufsize = n; |
| @@ -908,14 +916,6 @@ journal_t * jbd2_journal_init_dev(struct block_device *bdev, | |||
| 908 | __func__); | 916 | __func__); |
| 909 | goto out_err; | 917 | goto out_err; |
| 910 | } | 918 | } |
| 911 | journal->j_dev = bdev; | ||
| 912 | journal->j_fs_dev = fs_dev; | ||
| 913 | journal->j_blk_offset = start; | ||
| 914 | journal->j_maxlen = len; | ||
| 915 | bdevname(journal->j_dev, journal->j_devname); | ||
| 916 | p = journal->j_devname; | ||
| 917 | while ((p = strchr(p, '/'))) | ||
| 918 | *p = '!'; | ||
| 919 | 919 | ||
| 920 | bh = __getblk(journal->j_dev, start, journal->j_blocksize); | 920 | bh = __getblk(journal->j_dev, start, journal->j_blocksize); |
| 921 | if (!bh) { | 921 | if (!bh) { |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index da6b01d70f01..c126c83b9a45 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
| @@ -706,6 +706,7 @@ static int pagemap_hugetlb_range(pte_t *pte, unsigned long hmask, | |||
| 706 | * skip over unmapped regions. | 706 | * skip over unmapped regions. |
| 707 | */ | 707 | */ |
| 708 | #define PAGEMAP_WALK_SIZE (PMD_SIZE) | 708 | #define PAGEMAP_WALK_SIZE (PMD_SIZE) |
| 709 | #define PAGEMAP_WALK_MASK (PMD_MASK) | ||
| 709 | static ssize_t pagemap_read(struct file *file, char __user *buf, | 710 | static ssize_t pagemap_read(struct file *file, char __user *buf, |
| 710 | size_t count, loff_t *ppos) | 711 | size_t count, loff_t *ppos) |
| 711 | { | 712 | { |
| @@ -776,7 +777,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, | |||
| 776 | unsigned long end; | 777 | unsigned long end; |
| 777 | 778 | ||
| 778 | pm.pos = 0; | 779 | pm.pos = 0; |
| 779 | end = start_vaddr + PAGEMAP_WALK_SIZE; | 780 | end = (start_vaddr + PAGEMAP_WALK_SIZE) & PAGEMAP_WALK_MASK; |
| 780 | /* overflow ? */ | 781 | /* overflow ? */ |
| 781 | if (end < start_vaddr || end > end_vaddr) | 782 | if (end < start_vaddr || end > end_vaddr) |
| 782 | end = end_vaddr; | 783 | end = end_vaddr; |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index bd9763e76bae..79265fdc317a 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
| @@ -183,12 +183,11 @@ int reiserfs_unpack(struct inode *inode, struct file *filp) | |||
| 183 | return 0; | 183 | return 0; |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | /* we need to make sure nobody is changing the file size beneath | ||
| 187 | ** us | ||
| 188 | */ | ||
| 189 | reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb); | ||
| 190 | depth = reiserfs_write_lock_once(inode->i_sb); | 186 | depth = reiserfs_write_lock_once(inode->i_sb); |
| 191 | 187 | ||
| 188 | /* we need to make sure nobody is changing the file size beneath us */ | ||
| 189 | reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb); | ||
| 190 | |||
| 192 | write_from = inode->i_size & (blocksize - 1); | 191 | write_from = inode->i_size & (blocksize - 1); |
| 193 | /* if we are on a block boundary, we are already unpacked. */ | 192 | /* if we are on a block boundary, we are already unpacked. */ |
| 194 | if (write_from == 0) { | 193 | if (write_from == 0) { |
diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h index 01a714119506..bc5590b1a1ac 100644 --- a/include/drm/nouveau_drm.h +++ b/include/drm/nouveau_drm.h | |||
| @@ -80,6 +80,7 @@ struct drm_nouveau_gpuobj_free { | |||
| 80 | #define NOUVEAU_GETPARAM_VM_VRAM_BASE 12 | 80 | #define NOUVEAU_GETPARAM_VM_VRAM_BASE 12 |
| 81 | #define NOUVEAU_GETPARAM_GRAPH_UNITS 13 | 81 | #define NOUVEAU_GETPARAM_GRAPH_UNITS 13 |
| 82 | #define NOUVEAU_GETPARAM_PTIMER_TIME 14 | 82 | #define NOUVEAU_GETPARAM_PTIMER_TIME 14 |
| 83 | #define NOUVEAU_GETPARAM_HAS_BO_USAGE 15 | ||
| 83 | struct drm_nouveau_getparam { | 84 | struct drm_nouveau_getparam { |
| 84 | uint64_t param; | 85 | uint64_t param; |
| 85 | uint64_t value; | 86 | uint64_t value; |
| @@ -95,6 +96,12 @@ struct drm_nouveau_setparam { | |||
| 95 | #define NOUVEAU_GEM_DOMAIN_GART (1 << 2) | 96 | #define NOUVEAU_GEM_DOMAIN_GART (1 << 2) |
| 96 | #define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3) | 97 | #define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3) |
| 97 | 98 | ||
| 99 | #define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00 | ||
| 100 | #define NOUVEAU_GEM_TILE_16BPP 0x00000001 | ||
| 101 | #define NOUVEAU_GEM_TILE_32BPP 0x00000002 | ||
| 102 | #define NOUVEAU_GEM_TILE_ZETA 0x00000004 | ||
| 103 | #define NOUVEAU_GEM_TILE_NONCONTIG 0x00000008 | ||
| 104 | |||
| 98 | struct drm_nouveau_gem_info { | 105 | struct drm_nouveau_gem_info { |
| 99 | uint32_t handle; | 106 | uint32_t handle; |
| 100 | uint32_t domain; | 107 | uint32_t domain; |
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h index f22b2e941686..9e76d35670d2 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h | |||
| @@ -227,8 +227,7 @@ extern int ceph_open_session(struct ceph_client *client); | |||
| 227 | extern void ceph_release_page_vector(struct page **pages, int num_pages); | 227 | extern void ceph_release_page_vector(struct page **pages, int num_pages); |
| 228 | 228 | ||
| 229 | extern struct page **ceph_get_direct_page_vector(const char __user *data, | 229 | extern struct page **ceph_get_direct_page_vector(const char __user *data, |
| 230 | int num_pages, | 230 | int num_pages); |
| 231 | loff_t off, size_t len); | ||
| 232 | extern void ceph_put_page_vector(struct page **pages, int num_pages); | 231 | extern void ceph_put_page_vector(struct page **pages, int num_pages); |
| 233 | extern void ceph_release_page_vector(struct page **pages, int num_pages); | 232 | extern void ceph_release_page_vector(struct page **pages, int num_pages); |
| 234 | extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags); | 233 | extern struct page **ceph_alloc_page_vector(int num_pages, gfp_t flags); |
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index 5956d62c3057..a108b425fee2 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h | |||
| @@ -82,6 +82,7 @@ struct ceph_msg { | |||
| 82 | struct ceph_buffer *middle; | 82 | struct ceph_buffer *middle; |
| 83 | struct page **pages; /* data payload. NOT OWNER. */ | 83 | struct page **pages; /* data payload. NOT OWNER. */ |
| 84 | unsigned nr_pages; /* size of page array */ | 84 | unsigned nr_pages; /* size of page array */ |
| 85 | unsigned page_alignment; /* io offset in first page */ | ||
| 85 | struct ceph_pagelist *pagelist; /* instead of pages */ | 86 | struct ceph_pagelist *pagelist; /* instead of pages */ |
| 86 | struct list_head list_head; | 87 | struct list_head list_head; |
| 87 | struct kref kref; | 88 | struct kref kref; |
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index 6c91fb032c39..a1af29648fb5 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h | |||
| @@ -79,6 +79,7 @@ struct ceph_osd_request { | |||
| 79 | struct ceph_file_layout r_file_layout; | 79 | struct ceph_file_layout r_file_layout; |
| 80 | struct ceph_snap_context *r_snapc; /* snap context for writes */ | 80 | struct ceph_snap_context *r_snapc; /* snap context for writes */ |
| 81 | unsigned r_num_pages; /* size of page array (follows) */ | 81 | unsigned r_num_pages; /* size of page array (follows) */ |
| 82 | unsigned r_page_alignment; /* io offset in first page */ | ||
| 82 | struct page **r_pages; /* pages for data payload */ | 83 | struct page **r_pages; /* pages for data payload */ |
| 83 | int r_pages_from_pool; | 84 | int r_pages_from_pool; |
| 84 | int r_own_pages; /* if true, i own page list */ | 85 | int r_own_pages; /* if true, i own page list */ |
| @@ -194,7 +195,8 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *, | |||
| 194 | int do_sync, u32 truncate_seq, | 195 | int do_sync, u32 truncate_seq, |
| 195 | u64 truncate_size, | 196 | u64 truncate_size, |
| 196 | struct timespec *mtime, | 197 | struct timespec *mtime, |
| 197 | bool use_mempool, int num_reply); | 198 | bool use_mempool, int num_reply, |
| 199 | int page_align); | ||
| 198 | 200 | ||
| 199 | static inline void ceph_osdc_get_request(struct ceph_osd_request *req) | 201 | static inline void ceph_osdc_get_request(struct ceph_osd_request *req) |
| 200 | { | 202 | { |
| @@ -218,7 +220,8 @@ extern int ceph_osdc_readpages(struct ceph_osd_client *osdc, | |||
| 218 | struct ceph_file_layout *layout, | 220 | struct ceph_file_layout *layout, |
| 219 | u64 off, u64 *plen, | 221 | u64 off, u64 *plen, |
| 220 | u32 truncate_seq, u64 truncate_size, | 222 | u32 truncate_seq, u64 truncate_size, |
| 221 | struct page **pages, int nr_pages); | 223 | struct page **pages, int nr_pages, |
| 224 | int page_align); | ||
| 222 | 225 | ||
| 223 | extern int ceph_osdc_writepages(struct ceph_osd_client *osdc, | 226 | extern int ceph_osdc_writepages(struct ceph_osd_client *osdc, |
| 224 | struct ceph_vino vino, | 227 | struct ceph_vino vino, |
diff --git a/include/linux/fb.h b/include/linux/fb.h index 7fca3dc4e475..d1631d37e9e0 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
| @@ -1122,6 +1122,7 @@ extern const struct fb_videomode *fb_find_best_display(const struct fb_monspecs | |||
| 1122 | 1122 | ||
| 1123 | /* drivers/video/fbcmap.c */ | 1123 | /* drivers/video/fbcmap.c */ |
| 1124 | extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp); | 1124 | extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp); |
| 1125 | extern int fb_alloc_cmap_gfp(struct fb_cmap *cmap, int len, int transp, gfp_t flags); | ||
| 1125 | extern void fb_dealloc_cmap(struct fb_cmap *cmap); | 1126 | extern void fb_dealloc_cmap(struct fb_cmap *cmap); |
| 1126 | extern int fb_copy_cmap(const struct fb_cmap *from, struct fb_cmap *to); | 1127 | extern int fb_copy_cmap(const struct fb_cmap *from, struct fb_cmap *to); |
| 1127 | extern int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to); | 1128 | extern int fb_cmap_to_user(const struct fb_cmap *from, struct fb_cmap_user *to); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 334d68a17108..c9e06cc70dad 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -34,9 +34,9 @@ | |||
| 34 | #define SEEK_MAX SEEK_END | 34 | #define SEEK_MAX SEEK_END |
| 35 | 35 | ||
| 36 | struct fstrim_range { | 36 | struct fstrim_range { |
| 37 | uint64_t start; | 37 | __u64 start; |
| 38 | uint64_t len; | 38 | __u64 len; |
| 39 | uint64_t minlen; | 39 | __u64 minlen; |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | /* And dynamically-tunable limits and defaults: */ | 42 | /* And dynamically-tunable limits and defaults: */ |
| @@ -1612,7 +1612,6 @@ struct super_operations { | |||
| 1612 | ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); | 1612 | ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); |
| 1613 | #endif | 1613 | #endif |
| 1614 | int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); | 1614 | int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); |
| 1615 | int (*trim_fs) (struct super_block *, struct fstrim_range *); | ||
| 1616 | }; | 1615 | }; |
| 1617 | 1616 | ||
| 1618 | /* | 1617 | /* |
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h index 1ff81b51b656..dd3c34ebca9a 100644 --- a/include/linux/marvell_phy.h +++ b/include/linux/marvell_phy.h | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #define MARVELL_PHY_ID_88E1118 0x01410e10 | 11 | #define MARVELL_PHY_ID_88E1118 0x01410e10 |
| 12 | #define MARVELL_PHY_ID_88E1121R 0x01410cb0 | 12 | #define MARVELL_PHY_ID_88E1121R 0x01410cb0 |
| 13 | #define MARVELL_PHY_ID_88E1145 0x01410cd0 | 13 | #define MARVELL_PHY_ID_88E1145 0x01410cd0 |
| 14 | #define MARVELL_PHY_ID_88E1149R 0x01410e50 | ||
| 14 | #define MARVELL_PHY_ID_88E1240 0x01410e30 | 15 | #define MARVELL_PHY_ID_88E1240 0x01410e30 |
| 15 | #define MARVELL_PHY_ID_88E1318S 0x01410e90 | 16 | #define MARVELL_PHY_ID_88E1318S 0x01410e90 |
| 16 | 17 | ||
diff --git a/include/linux/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h index a95141eafce3..bd581c6fa085 100644 --- a/include/linux/mfd/wm8350/audio.h +++ b/include/linux/mfd/wm8350/audio.h | |||
| @@ -522,9 +522,6 @@ | |||
| 522 | #define WM8350_MCLK_SEL_PLL_32K 3 | 522 | #define WM8350_MCLK_SEL_PLL_32K 3 |
| 523 | #define WM8350_MCLK_SEL_MCLK 5 | 523 | #define WM8350_MCLK_SEL_MCLK 5 |
| 524 | 524 | ||
| 525 | #define WM8350_MCLK_DIR_OUT 0 | ||
| 526 | #define WM8350_MCLK_DIR_IN 1 | ||
| 527 | |||
| 528 | /* clock divider id's */ | 525 | /* clock divider id's */ |
| 529 | #define WM8350_ADC_CLKDIV 0 | 526 | #define WM8350_ADC_CLKDIV 0 |
| 530 | #define WM8350_DAC_CLKDIV 1 | 527 | #define WM8350_DAC_CLKDIV 1 |
diff --git a/include/linux/module.h b/include/linux/module.h index b29e7458b966..7575bbbdf2a2 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -517,7 +517,7 @@ static inline void __module_get(struct module *module) | |||
| 517 | #define symbol_put_addr(p) do { } while(0) | 517 | #define symbol_put_addr(p) do { } while(0) |
| 518 | 518 | ||
| 519 | #endif /* CONFIG_MODULE_UNLOAD */ | 519 | #endif /* CONFIG_MODULE_UNLOAD */ |
| 520 | int use_module(struct module *a, struct module *b); | 520 | int ref_module(struct module *a, struct module *b); |
| 521 | 521 | ||
| 522 | /* This is a #define so the string doesn't get put in every .o file */ | 522 | /* This is a #define so the string doesn't get put in every .o file */ |
| 523 | #define module_name(mod) \ | 523 | #define module_name(mod) \ |
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h index 5bb13b3db84d..b02195dfc1b0 100644 --- a/include/linux/page_cgroup.h +++ b/include/linux/page_cgroup.h | |||
| @@ -59,8 +59,6 @@ static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \ | |||
| 59 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ | 59 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ |
| 60 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } | 60 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } |
| 61 | 61 | ||
| 62 | TESTPCGFLAG(Locked, LOCK) | ||
| 63 | |||
| 64 | /* Cache flag is set only once (at allocation) */ | 62 | /* Cache flag is set only once (at allocation) */ |
| 65 | TESTPCGFLAG(Cache, CACHE) | 63 | TESTPCGFLAG(Cache, CACHE) |
| 66 | CLEARPCGFLAG(Cache, CACHE) | 64 | CLEARPCGFLAG(Cache, CACHE) |
| @@ -104,6 +102,11 @@ static inline void unlock_page_cgroup(struct page_cgroup *pc) | |||
| 104 | bit_spin_unlock(PCG_LOCK, &pc->flags); | 102 | bit_spin_unlock(PCG_LOCK, &pc->flags); |
| 105 | } | 103 | } |
| 106 | 104 | ||
| 105 | static inline int page_is_cgroup_locked(struct page_cgroup *pc) | ||
| 106 | { | ||
| 107 | return bit_spin_is_locked(PCG_LOCK, &pc->flags); | ||
| 108 | } | ||
| 109 | |||
| 107 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ | 110 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ |
| 108 | struct page_cgroup; | 111 | struct page_cgroup; |
| 109 | 112 | ||
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index d42f274418b8..bbad657a3725 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | #include <linux/if_link.h> | 6 | #include <linux/if_link.h> |
| 7 | #include <linux/if_addr.h> | 7 | #include <linux/if_addr.h> |
| 8 | #include <linux/neighbour.h> | 8 | #include <linux/neighbour.h> |
| 9 | #include <linux/netdevice.h> | ||
| 10 | 9 | ||
| 11 | /* rtnetlink families. Values up to 127 are reserved for real address | 10 | /* rtnetlink families. Values up to 127 are reserved for real address |
| 12 | * families, values above 128 may be used arbitrarily. | 11 | * families, values above 128 may be used arbitrarily. |
| @@ -606,6 +605,7 @@ struct tcamsg { | |||
| 606 | #ifdef __KERNEL__ | 605 | #ifdef __KERNEL__ |
| 607 | 606 | ||
| 608 | #include <linux/mutex.h> | 607 | #include <linux/mutex.h> |
| 608 | #include <linux/netdevice.h> | ||
| 609 | 609 | ||
| 610 | static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str) | 610 | static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str) |
| 611 | { | 611 | { |
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h index cea0c38e7a63..9a52f72527dc 100644 --- a/include/linux/sh_clk.h +++ b/include/linux/sh_clk.h | |||
| @@ -19,11 +19,13 @@ struct clk_mapping { | |||
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | struct clk_ops { | 21 | struct clk_ops { |
| 22 | #ifdef CONFIG_SH_CLK_CPG_LEGACY | ||
| 22 | void (*init)(struct clk *clk); | 23 | void (*init)(struct clk *clk); |
| 24 | #endif | ||
| 23 | int (*enable)(struct clk *clk); | 25 | int (*enable)(struct clk *clk); |
| 24 | void (*disable)(struct clk *clk); | 26 | void (*disable)(struct clk *clk); |
| 25 | unsigned long (*recalc)(struct clk *clk); | 27 | unsigned long (*recalc)(struct clk *clk); |
| 26 | int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id); | 28 | int (*set_rate)(struct clk *clk, unsigned long rate); |
| 27 | int (*set_parent)(struct clk *clk, struct clk *parent); | 29 | int (*set_parent)(struct clk *clk, struct clk *parent); |
| 28 | long (*round_rate)(struct clk *clk, unsigned long rate); | 30 | long (*round_rate)(struct clk *clk, unsigned long rate); |
| 29 | }; | 31 | }; |
| @@ -67,36 +69,6 @@ int clk_register(struct clk *); | |||
| 67 | void clk_unregister(struct clk *); | 69 | void clk_unregister(struct clk *); |
| 68 | void clk_enable_init_clocks(void); | 70 | void clk_enable_init_clocks(void); |
| 69 | 71 | ||
| 70 | /** | ||
| 71 | * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter | ||
| 72 | * @clk: clock source | ||
| 73 | * @rate: desired clock rate in Hz | ||
| 74 | * @algo_id: algorithm id to be passed down to ops->set_rate | ||
| 75 | * | ||
| 76 | * Returns success (0) or negative errno. | ||
| 77 | */ | ||
| 78 | int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id); | ||
| 79 | |||
| 80 | enum clk_sh_algo_id { | ||
| 81 | NO_CHANGE = 0, | ||
| 82 | |||
| 83 | IUS_N1_N1, | ||
| 84 | IUS_322, | ||
| 85 | IUS_522, | ||
| 86 | IUS_N11, | ||
| 87 | |||
| 88 | SB_N1, | ||
| 89 | |||
| 90 | SB3_N1, | ||
| 91 | SB3_32, | ||
| 92 | SB3_43, | ||
| 93 | SB3_54, | ||
| 94 | |||
| 95 | BP_N1, | ||
| 96 | |||
| 97 | IP_N1, | ||
| 98 | }; | ||
| 99 | |||
| 100 | struct clk_div_mult_table { | 72 | struct clk_div_mult_table { |
| 101 | unsigned int *divisors; | 73 | unsigned int *divisors; |
| 102 | unsigned int nr_divisors; | 74 | unsigned int nr_divisors; |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 2a7936d7851d..97b8b7c9b63c 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
| @@ -1355,7 +1355,7 @@ enum wiphy_flags { | |||
| 1355 | WIPHY_FLAG_4ADDR_AP = BIT(5), | 1355 | WIPHY_FLAG_4ADDR_AP = BIT(5), |
| 1356 | WIPHY_FLAG_4ADDR_STATION = BIT(6), | 1356 | WIPHY_FLAG_4ADDR_STATION = BIT(6), |
| 1357 | WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), | 1357 | WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), |
| 1358 | WIPHY_FLAG_IBSS_RSN = BIT(7), | 1358 | WIPHY_FLAG_IBSS_RSN = BIT(8), |
| 1359 | }; | 1359 | }; |
| 1360 | 1360 | ||
| 1361 | struct mac_address { | 1361 | struct mac_address { |
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 55590ab16b3e..6beb1ffc2b7f 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
| @@ -303,7 +303,7 @@ static inline void neigh_confirm(struct neighbour *neigh) | |||
| 303 | 303 | ||
| 304 | static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) | 304 | static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) |
| 305 | { | 305 | { |
| 306 | unsigned long now = ACCESS_ONCE(jiffies); | 306 | unsigned long now = jiffies; |
| 307 | 307 | ||
| 308 | if (neigh->used != now) | 308 | if (neigh->used != now) |
| 309 | neigh->used = now; | 309 | neigh->used = now; |
diff --git a/include/video/da8xx-fb.h b/include/video/da8xx-fb.h index 6316cdabf73f..89d43b3d4cb9 100644 --- a/include/video/da8xx-fb.h +++ b/include/video/da8xx-fb.h | |||
| @@ -99,7 +99,6 @@ struct lcd_sync_arg { | |||
| 99 | #define FBIPUT_COLOR _IOW('F', 6, int) | 99 | #define FBIPUT_COLOR _IOW('F', 6, int) |
| 100 | #define FBIPUT_HSYNC _IOW('F', 9, int) | 100 | #define FBIPUT_HSYNC _IOW('F', 9, int) |
| 101 | #define FBIPUT_VSYNC _IOW('F', 10, int) | 101 | #define FBIPUT_VSYNC _IOW('F', 10, int) |
| 102 | #define FBIO_WAITFORVSYNC _IOW('F', 0x20, u_int32_t) | ||
| 103 | 102 | ||
| 104 | #endif /* ifndef DA8XX_FB_H */ | 103 | #endif /* ifndef DA8XX_FB_H */ |
| 105 | 104 | ||
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h index d7a6c13bde69..eac3ce153719 100644 --- a/include/xen/interface/memory.h +++ b/include/xen/interface/memory.h | |||
| @@ -141,6 +141,19 @@ struct xen_machphys_mfn_list { | |||
| 141 | DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list); | 141 | DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list); |
| 142 | 142 | ||
| 143 | /* | 143 | /* |
| 144 | * Returns the location in virtual address space of the machine_to_phys | ||
| 145 | * mapping table. Architectures which do not have a m2p table, or which do not | ||
| 146 | * map it by default into guest address space, do not implement this command. | ||
| 147 | * arg == addr of xen_machphys_mapping_t. | ||
| 148 | */ | ||
| 149 | #define XENMEM_machphys_mapping 12 | ||
| 150 | struct xen_machphys_mapping { | ||
| 151 | unsigned long v_start, v_end; /* Start and end virtual addresses. */ | ||
| 152 | unsigned long max_mfn; /* Maximum MFN that can be looked up. */ | ||
| 153 | }; | ||
| 154 | DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mapping_t); | ||
| 155 | |||
| 156 | /* | ||
| 144 | * Sets the GPFN at which a particular page appears in the specified guest's | 157 | * Sets the GPFN at which a particular page appears in the specified guest's |
| 145 | * pseudophysical address space. | 158 | * pseudophysical address space. |
| 146 | * arg == addr of xen_add_to_physmap_t. | 159 | * arg == addr of xen_add_to_physmap_t. |
diff --git a/include/xen/page.h b/include/xen/page.h index eaf85fab1263..0be36b976f4b 100644 --- a/include/xen/page.h +++ b/include/xen/page.h | |||
| @@ -1 +1,8 @@ | |||
| 1 | #ifndef _XEN_PAGE_H | ||
| 2 | #define _XEN_PAGE_H | ||
| 3 | |||
| 1 | #include <asm/xen/page.h> | 4 | #include <asm/xen/page.h> |
| 5 | |||
| 6 | extern phys_addr_t xen_extra_mem_start, xen_extra_mem_size; | ||
| 7 | |||
| 8 | #endif /* _XEN_PAGE_H */ | ||
diff --git a/include/xen/privcmd.h b/include/xen/privcmd.h index b42cdfd92fee..17857fb4d550 100644 --- a/include/xen/privcmd.h +++ b/include/xen/privcmd.h | |||
| @@ -34,13 +34,10 @@ | |||
| 34 | #define __LINUX_PUBLIC_PRIVCMD_H__ | 34 | #define __LINUX_PUBLIC_PRIVCMD_H__ |
| 35 | 35 | ||
| 36 | #include <linux/types.h> | 36 | #include <linux/types.h> |
| 37 | #include <linux/compiler.h> | ||
| 37 | 38 | ||
| 38 | typedef unsigned long xen_pfn_t; | 39 | typedef unsigned long xen_pfn_t; |
| 39 | 40 | ||
| 40 | #ifndef __user | ||
| 41 | #define __user | ||
| 42 | #endif | ||
| 43 | |||
| 44 | struct privcmd_hypercall { | 41 | struct privcmd_hypercall { |
| 45 | __u64 op; | 42 | __u64 op; |
| 46 | __u64 arg[5]; | 43 | __u64 arg[5]; |
diff --git a/init/Kconfig b/init/Kconfig index 88c10468db46..c9728992a776 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
| @@ -613,6 +613,19 @@ config CGROUP_MEM_RES_CTLR_SWAP | |||
| 613 | if boot option "noswapaccount" is set, swap will not be accounted. | 613 | if boot option "noswapaccount" is set, swap will not be accounted. |
| 614 | Now, memory usage of swap_cgroup is 2 bytes per entry. If swap page | 614 | Now, memory usage of swap_cgroup is 2 bytes per entry. If swap page |
| 615 | size is 4096bytes, 512k per 1Gbytes of swap. | 615 | size is 4096bytes, 512k per 1Gbytes of swap. |
| 616 | config CGROUP_MEM_RES_CTLR_SWAP_ENABLED | ||
| 617 | bool "Memory Resource Controller Swap Extension enabled by default" | ||
| 618 | depends on CGROUP_MEM_RES_CTLR_SWAP | ||
| 619 | default y | ||
| 620 | help | ||
| 621 | Memory Resource Controller Swap Extension comes with its price in | ||
| 622 | a bigger memory consumption. General purpose distribution kernels | ||
| 623 | which want to enable the feautre but keep it disabled by default | ||
| 624 | and let the user enable it by swapaccount boot command line | ||
| 625 | parameter should have this option unselected. | ||
| 626 | For those who want to have the feature enabled by default should | ||
| 627 | select this option (if, for some reason, they need to disable it | ||
| 628 | then noswapaccount does the trick). | ||
| 616 | 629 | ||
| 617 | menuconfig CGROUP_SCHED | 630 | menuconfig CGROUP_SCHED |
| 618 | bool "Group CPU scheduler" | 631 | bool "Group CPU scheduler" |
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index a8db2570f99a..6f6d091b5757 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c | |||
| @@ -546,7 +546,7 @@ static const struct file_operations kallsyms_operations = { | |||
| 546 | 546 | ||
| 547 | static int __init kallsyms_init(void) | 547 | static int __init kallsyms_init(void) |
| 548 | { | 548 | { |
| 549 | proc_create("kallsyms", 0400, NULL, &kallsyms_operations); | 549 | proc_create("kallsyms", 0444, NULL, &kallsyms_operations); |
| 550 | return 0; | 550 | return 0; |
| 551 | } | 551 | } |
| 552 | device_initcall(kallsyms_init); | 552 | device_initcall(kallsyms_init); |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 2efa8ea07ff7..7a22b4129211 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
| @@ -61,7 +61,14 @@ struct mem_cgroup *root_mem_cgroup __read_mostly; | |||
| 61 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | 61 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP |
| 62 | /* Turned on only when memory cgroup is enabled && really_do_swap_account = 1 */ | 62 | /* Turned on only when memory cgroup is enabled && really_do_swap_account = 1 */ |
| 63 | int do_swap_account __read_mostly; | 63 | int do_swap_account __read_mostly; |
| 64 | static int really_do_swap_account __initdata = 1; /* for remember boot option*/ | 64 | |
| 65 | /* for remember boot option*/ | ||
| 66 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP_ENABLED | ||
| 67 | static int really_do_swap_account __initdata = 1; | ||
| 68 | #else | ||
| 69 | static int really_do_swap_account __initdata = 0; | ||
| 70 | #endif | ||
| 71 | |||
| 65 | #else | 72 | #else |
| 66 | #define do_swap_account (0) | 73 | #define do_swap_account (0) |
| 67 | #endif | 74 | #endif |
| @@ -278,13 +285,14 @@ enum move_type { | |||
| 278 | 285 | ||
| 279 | /* "mc" and its members are protected by cgroup_mutex */ | 286 | /* "mc" and its members are protected by cgroup_mutex */ |
| 280 | static struct move_charge_struct { | 287 | static struct move_charge_struct { |
| 281 | spinlock_t lock; /* for from, to, moving_task */ | 288 | spinlock_t lock; /* for from, to */ |
| 282 | struct mem_cgroup *from; | 289 | struct mem_cgroup *from; |
| 283 | struct mem_cgroup *to; | 290 | struct mem_cgroup *to; |
| 284 | unsigned long precharge; | 291 | unsigned long precharge; |
| 285 | unsigned long moved_charge; | 292 | unsigned long moved_charge; |
| 286 | unsigned long moved_swap; | 293 | unsigned long moved_swap; |
| 287 | struct task_struct *moving_task; /* a task moving charges */ | 294 | struct task_struct *moving_task; /* a task moving charges */ |
| 295 | struct mm_struct *mm; | ||
| 288 | wait_queue_head_t waitq; /* a waitq for other context */ | 296 | wait_queue_head_t waitq; /* a waitq for other context */ |
| 289 | } mc = { | 297 | } mc = { |
| 290 | .lock = __SPIN_LOCK_UNLOCKED(mc.lock), | 298 | .lock = __SPIN_LOCK_UNLOCKED(mc.lock), |
| @@ -2152,7 +2160,7 @@ static void __mem_cgroup_move_account(struct page_cgroup *pc, | |||
| 2152 | { | 2160 | { |
| 2153 | VM_BUG_ON(from == to); | 2161 | VM_BUG_ON(from == to); |
| 2154 | VM_BUG_ON(PageLRU(pc->page)); | 2162 | VM_BUG_ON(PageLRU(pc->page)); |
| 2155 | VM_BUG_ON(!PageCgroupLocked(pc)); | 2163 | VM_BUG_ON(!page_is_cgroup_locked(pc)); |
| 2156 | VM_BUG_ON(!PageCgroupUsed(pc)); | 2164 | VM_BUG_ON(!PageCgroupUsed(pc)); |
| 2157 | VM_BUG_ON(pc->mem_cgroup != from); | 2165 | VM_BUG_ON(pc->mem_cgroup != from); |
| 2158 | 2166 | ||
| @@ -4631,7 +4639,7 @@ static unsigned long mem_cgroup_count_precharge(struct mm_struct *mm) | |||
| 4631 | unsigned long precharge; | 4639 | unsigned long precharge; |
| 4632 | struct vm_area_struct *vma; | 4640 | struct vm_area_struct *vma; |
| 4633 | 4641 | ||
| 4634 | down_read(&mm->mmap_sem); | 4642 | /* We've already held the mmap_sem */ |
| 4635 | for (vma = mm->mmap; vma; vma = vma->vm_next) { | 4643 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
| 4636 | struct mm_walk mem_cgroup_count_precharge_walk = { | 4644 | struct mm_walk mem_cgroup_count_precharge_walk = { |
| 4637 | .pmd_entry = mem_cgroup_count_precharge_pte_range, | 4645 | .pmd_entry = mem_cgroup_count_precharge_pte_range, |
| @@ -4643,7 +4651,6 @@ static unsigned long mem_cgroup_count_precharge(struct mm_struct *mm) | |||
| 4643 | walk_page_range(vma->vm_start, vma->vm_end, | 4651 | walk_page_range(vma->vm_start, vma->vm_end, |
| 4644 | &mem_cgroup_count_precharge_walk); | 4652 | &mem_cgroup_count_precharge_walk); |
| 4645 | } | 4653 | } |
| 4646 | up_read(&mm->mmap_sem); | ||
| 4647 | 4654 | ||
| 4648 | precharge = mc.precharge; | 4655 | precharge = mc.precharge; |
| 4649 | mc.precharge = 0; | 4656 | mc.precharge = 0; |
| @@ -4694,11 +4701,16 @@ static void mem_cgroup_clear_mc(void) | |||
| 4694 | 4701 | ||
| 4695 | mc.moved_swap = 0; | 4702 | mc.moved_swap = 0; |
| 4696 | } | 4703 | } |
| 4704 | if (mc.mm) { | ||
| 4705 | up_read(&mc.mm->mmap_sem); | ||
| 4706 | mmput(mc.mm); | ||
| 4707 | } | ||
| 4697 | spin_lock(&mc.lock); | 4708 | spin_lock(&mc.lock); |
| 4698 | mc.from = NULL; | 4709 | mc.from = NULL; |
| 4699 | mc.to = NULL; | 4710 | mc.to = NULL; |
| 4700 | mc.moving_task = NULL; | ||
| 4701 | spin_unlock(&mc.lock); | 4711 | spin_unlock(&mc.lock); |
| 4712 | mc.moving_task = NULL; | ||
| 4713 | mc.mm = NULL; | ||
| 4702 | mem_cgroup_end_move(from); | 4714 | mem_cgroup_end_move(from); |
| 4703 | memcg_oom_recover(from); | 4715 | memcg_oom_recover(from); |
| 4704 | memcg_oom_recover(to); | 4716 | memcg_oom_recover(to); |
| @@ -4724,12 +4736,21 @@ static int mem_cgroup_can_attach(struct cgroup_subsys *ss, | |||
| 4724 | return 0; | 4736 | return 0; |
| 4725 | /* We move charges only when we move a owner of the mm */ | 4737 | /* We move charges only when we move a owner of the mm */ |
| 4726 | if (mm->owner == p) { | 4738 | if (mm->owner == p) { |
| 4739 | /* | ||
| 4740 | * We do all the move charge works under one mmap_sem to | ||
| 4741 | * avoid deadlock with down_write(&mmap_sem) | ||
| 4742 | * -> try_charge() -> if (mc.moving_task) -> sleep. | ||
| 4743 | */ | ||
| 4744 | down_read(&mm->mmap_sem); | ||
| 4745 | |||
| 4727 | VM_BUG_ON(mc.from); | 4746 | VM_BUG_ON(mc.from); |
| 4728 | VM_BUG_ON(mc.to); | 4747 | VM_BUG_ON(mc.to); |
| 4729 | VM_BUG_ON(mc.precharge); | 4748 | VM_BUG_ON(mc.precharge); |
| 4730 | VM_BUG_ON(mc.moved_charge); | 4749 | VM_BUG_ON(mc.moved_charge); |
| 4731 | VM_BUG_ON(mc.moved_swap); | 4750 | VM_BUG_ON(mc.moved_swap); |
| 4732 | VM_BUG_ON(mc.moving_task); | 4751 | VM_BUG_ON(mc.moving_task); |
| 4752 | VM_BUG_ON(mc.mm); | ||
| 4753 | |||
| 4733 | mem_cgroup_start_move(from); | 4754 | mem_cgroup_start_move(from); |
| 4734 | spin_lock(&mc.lock); | 4755 | spin_lock(&mc.lock); |
| 4735 | mc.from = from; | 4756 | mc.from = from; |
| @@ -4737,14 +4758,16 @@ static int mem_cgroup_can_attach(struct cgroup_subsys *ss, | |||
| 4737 | mc.precharge = 0; | 4758 | mc.precharge = 0; |
| 4738 | mc.moved_charge = 0; | 4759 | mc.moved_charge = 0; |
| 4739 | mc.moved_swap = 0; | 4760 | mc.moved_swap = 0; |
| 4740 | mc.moving_task = current; | ||
| 4741 | spin_unlock(&mc.lock); | 4761 | spin_unlock(&mc.lock); |
| 4762 | mc.moving_task = current; | ||
| 4763 | mc.mm = mm; | ||
| 4742 | 4764 | ||
| 4743 | ret = mem_cgroup_precharge_mc(mm); | 4765 | ret = mem_cgroup_precharge_mc(mm); |
| 4744 | if (ret) | 4766 | if (ret) |
| 4745 | mem_cgroup_clear_mc(); | 4767 | mem_cgroup_clear_mc(); |
| 4746 | } | 4768 | /* We call up_read() and mmput() in clear_mc(). */ |
| 4747 | mmput(mm); | 4769 | } else |
| 4770 | mmput(mm); | ||
| 4748 | } | 4771 | } |
| 4749 | return ret; | 4772 | return ret; |
| 4750 | } | 4773 | } |
| @@ -4832,7 +4855,7 @@ static void mem_cgroup_move_charge(struct mm_struct *mm) | |||
| 4832 | struct vm_area_struct *vma; | 4855 | struct vm_area_struct *vma; |
| 4833 | 4856 | ||
| 4834 | lru_add_drain_all(); | 4857 | lru_add_drain_all(); |
| 4835 | down_read(&mm->mmap_sem); | 4858 | /* We've already held the mmap_sem */ |
| 4836 | for (vma = mm->mmap; vma; vma = vma->vm_next) { | 4859 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
| 4837 | int ret; | 4860 | int ret; |
| 4838 | struct mm_walk mem_cgroup_move_charge_walk = { | 4861 | struct mm_walk mem_cgroup_move_charge_walk = { |
| @@ -4851,7 +4874,6 @@ static void mem_cgroup_move_charge(struct mm_struct *mm) | |||
| 4851 | */ | 4874 | */ |
| 4852 | break; | 4875 | break; |
| 4853 | } | 4876 | } |
| 4854 | up_read(&mm->mmap_sem); | ||
| 4855 | } | 4877 | } |
| 4856 | 4878 | ||
| 4857 | static void mem_cgroup_move_task(struct cgroup_subsys *ss, | 4879 | static void mem_cgroup_move_task(struct cgroup_subsys *ss, |
| @@ -4860,17 +4882,11 @@ static void mem_cgroup_move_task(struct cgroup_subsys *ss, | |||
| 4860 | struct task_struct *p, | 4882 | struct task_struct *p, |
| 4861 | bool threadgroup) | 4883 | bool threadgroup) |
| 4862 | { | 4884 | { |
| 4863 | struct mm_struct *mm; | 4885 | if (!mc.mm) |
| 4864 | |||
| 4865 | if (!mc.to) | ||
| 4866 | /* no need to move charge */ | 4886 | /* no need to move charge */ |
| 4867 | return; | 4887 | return; |
| 4868 | 4888 | ||
| 4869 | mm = get_task_mm(p); | 4889 | mem_cgroup_move_charge(mc.mm); |
| 4870 | if (mm) { | ||
| 4871 | mem_cgroup_move_charge(mm); | ||
| 4872 | mmput(mm); | ||
| 4873 | } | ||
| 4874 | mem_cgroup_clear_mc(); | 4890 | mem_cgroup_clear_mc(); |
| 4875 | } | 4891 | } |
| 4876 | #else /* !CONFIG_MMU */ | 4892 | #else /* !CONFIG_MMU */ |
| @@ -4911,10 +4927,20 @@ struct cgroup_subsys mem_cgroup_subsys = { | |||
| 4911 | }; | 4927 | }; |
| 4912 | 4928 | ||
| 4913 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | 4929 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP |
| 4930 | static int __init enable_swap_account(char *s) | ||
| 4931 | { | ||
| 4932 | /* consider enabled if no parameter or 1 is given */ | ||
| 4933 | if (!s || !strcmp(s, "1")) | ||
| 4934 | really_do_swap_account = 1; | ||
| 4935 | else if (!strcmp(s, "0")) | ||
| 4936 | really_do_swap_account = 0; | ||
| 4937 | return 1; | ||
| 4938 | } | ||
| 4939 | __setup("swapaccount", enable_swap_account); | ||
| 4914 | 4940 | ||
| 4915 | static int __init disable_swap_account(char *s) | 4941 | static int __init disable_swap_account(char *s) |
| 4916 | { | 4942 | { |
| 4917 | really_do_swap_account = 0; | 4943 | enable_swap_account("0"); |
| 4918 | return 1; | 4944 | return 1; |
| 4919 | } | 4945 | } |
| 4920 | __setup("noswapaccount", disable_swap_account); | 4946 | __setup("noswapaccount", disable_swap_account); |
diff --git a/mm/nommu.c b/mm/nommu.c index 3613517c7592..27a9ac588516 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
| @@ -1717,6 +1717,7 @@ void exit_mmap(struct mm_struct *mm) | |||
| 1717 | mm->mmap = vma->vm_next; | 1717 | mm->mmap = vma->vm_next; |
| 1718 | delete_vma_from_mm(vma); | 1718 | delete_vma_from_mm(vma); |
| 1719 | delete_vma(mm, vma); | 1719 | delete_vma(mm, vma); |
| 1720 | cond_resched(); | ||
| 1720 | } | 1721 | } |
| 1721 | 1722 | ||
| 1722 | kleave(""); | 1723 | kleave(""); |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 07a654486f75..e4092704c1a9 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
| @@ -3008,14 +3008,6 @@ static __init_refok int __build_all_zonelists(void *data) | |||
| 3008 | build_zonelist_cache(pgdat); | 3008 | build_zonelist_cache(pgdat); |
| 3009 | } | 3009 | } |
| 3010 | 3010 | ||
| 3011 | #ifdef CONFIG_MEMORY_HOTPLUG | ||
| 3012 | /* Setup real pagesets for the new zone */ | ||
| 3013 | if (data) { | ||
| 3014 | struct zone *zone = data; | ||
| 3015 | setup_zone_pageset(zone); | ||
| 3016 | } | ||
| 3017 | #endif | ||
| 3018 | |||
| 3019 | /* | 3011 | /* |
| 3020 | * Initialize the boot_pagesets that are going to be used | 3012 | * Initialize the boot_pagesets that are going to be used |
| 3021 | * for bootstrapping processors. The real pagesets for | 3013 | * for bootstrapping processors. The real pagesets for |
| @@ -3064,7 +3056,11 @@ void build_all_zonelists(void *data) | |||
| 3064 | } else { | 3056 | } else { |
| 3065 | /* we have to stop all cpus to guarantee there is no user | 3057 | /* we have to stop all cpus to guarantee there is no user |
| 3066 | of zonelist */ | 3058 | of zonelist */ |
| 3067 | stop_machine(__build_all_zonelists, data, NULL); | 3059 | #ifdef CONFIG_MEMORY_HOTPLUG |
| 3060 | if (data) | ||
| 3061 | setup_zone_pageset((struct zone *)data); | ||
| 3062 | #endif | ||
| 3063 | stop_machine(__build_all_zonelists, NULL, NULL); | ||
| 3068 | /* cpuset refresh routine should be here */ | 3064 | /* cpuset refresh routine should be here */ |
| 3069 | } | 3065 | } |
| 3070 | vm_total_pages = nr_free_pagecache_pages(); | 3066 | vm_total_pages = nr_free_pagecache_pages(); |
diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 8b1a2ce21ee5..38cc58b8b2b0 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c | |||
| @@ -139,7 +139,6 @@ int walk_page_range(unsigned long addr, unsigned long end, | |||
| 139 | pgd_t *pgd; | 139 | pgd_t *pgd; |
| 140 | unsigned long next; | 140 | unsigned long next; |
| 141 | int err = 0; | 141 | int err = 0; |
| 142 | struct vm_area_struct *vma; | ||
| 143 | 142 | ||
| 144 | if (addr >= end) | 143 | if (addr >= end) |
| 145 | return err; | 144 | return err; |
| @@ -149,15 +148,17 @@ int walk_page_range(unsigned long addr, unsigned long end, | |||
| 149 | 148 | ||
| 150 | pgd = pgd_offset(walk->mm, addr); | 149 | pgd = pgd_offset(walk->mm, addr); |
| 151 | do { | 150 | do { |
| 151 | struct vm_area_struct *uninitialized_var(vma); | ||
| 152 | |||
| 152 | next = pgd_addr_end(addr, end); | 153 | next = pgd_addr_end(addr, end); |
| 153 | 154 | ||
| 155 | #ifdef CONFIG_HUGETLB_PAGE | ||
| 154 | /* | 156 | /* |
| 155 | * handle hugetlb vma individually because pagetable walk for | 157 | * handle hugetlb vma individually because pagetable walk for |
| 156 | * the hugetlb page is dependent on the architecture and | 158 | * the hugetlb page is dependent on the architecture and |
| 157 | * we can't handled it in the same manner as non-huge pages. | 159 | * we can't handled it in the same manner as non-huge pages. |
| 158 | */ | 160 | */ |
| 159 | vma = find_vma(walk->mm, addr); | 161 | vma = find_vma(walk->mm, addr); |
| 160 | #ifdef CONFIG_HUGETLB_PAGE | ||
| 161 | if (vma && is_vm_hugetlb_page(vma)) { | 162 | if (vma && is_vm_hugetlb_page(vma)) { |
| 162 | if (vma->vm_end < next) | 163 | if (vma->vm_end < next) |
| 163 | next = vma->vm_end; | 164 | next = vma->vm_end; |
diff --git a/net/ceph/buffer.c b/net/ceph/buffer.c index 53d8abfa25d5..bf3e6a13c215 100644 --- a/net/ceph/buffer.c +++ b/net/ceph/buffer.c | |||
| @@ -19,7 +19,7 @@ struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp) | |||
| 19 | if (b->vec.iov_base) { | 19 | if (b->vec.iov_base) { |
| 20 | b->is_vmalloc = false; | 20 | b->is_vmalloc = false; |
| 21 | } else { | 21 | } else { |
| 22 | b->vec.iov_base = __vmalloc(len, gfp, PAGE_KERNEL); | 22 | b->vec.iov_base = __vmalloc(len, gfp | __GFP_HIGHMEM, PAGE_KERNEL); |
| 23 | if (!b->vec.iov_base) { | 23 | if (!b->vec.iov_base) { |
| 24 | kfree(b); | 24 | kfree(b); |
| 25 | return NULL; | 25 | return NULL; |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 0e8157ee5d43..1c7a2ec4f3cc 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
| @@ -540,8 +540,7 @@ static void prepare_write_message(struct ceph_connection *con) | |||
| 540 | /* initialize page iterator */ | 540 | /* initialize page iterator */ |
| 541 | con->out_msg_pos.page = 0; | 541 | con->out_msg_pos.page = 0; |
| 542 | if (m->pages) | 542 | if (m->pages) |
| 543 | con->out_msg_pos.page_pos = | 543 | con->out_msg_pos.page_pos = m->page_alignment; |
| 544 | le16_to_cpu(m->hdr.data_off) & ~PAGE_MASK; | ||
| 545 | else | 544 | else |
| 546 | con->out_msg_pos.page_pos = 0; | 545 | con->out_msg_pos.page_pos = 0; |
| 547 | con->out_msg_pos.data_pos = 0; | 546 | con->out_msg_pos.data_pos = 0; |
| @@ -1491,7 +1490,7 @@ static int read_partial_message(struct ceph_connection *con) | |||
| 1491 | struct ceph_msg *m = con->in_msg; | 1490 | struct ceph_msg *m = con->in_msg; |
| 1492 | int ret; | 1491 | int ret; |
| 1493 | int to, left; | 1492 | int to, left; |
| 1494 | unsigned front_len, middle_len, data_len, data_off; | 1493 | unsigned front_len, middle_len, data_len; |
| 1495 | int datacrc = con->msgr->nocrc; | 1494 | int datacrc = con->msgr->nocrc; |
| 1496 | int skip; | 1495 | int skip; |
| 1497 | u64 seq; | 1496 | u64 seq; |
| @@ -1527,19 +1526,17 @@ static int read_partial_message(struct ceph_connection *con) | |||
| 1527 | data_len = le32_to_cpu(con->in_hdr.data_len); | 1526 | data_len = le32_to_cpu(con->in_hdr.data_len); |
| 1528 | if (data_len > CEPH_MSG_MAX_DATA_LEN) | 1527 | if (data_len > CEPH_MSG_MAX_DATA_LEN) |
| 1529 | return -EIO; | 1528 | return -EIO; |
| 1530 | data_off = le16_to_cpu(con->in_hdr.data_off); | ||
| 1531 | 1529 | ||
| 1532 | /* verify seq# */ | 1530 | /* verify seq# */ |
| 1533 | seq = le64_to_cpu(con->in_hdr.seq); | 1531 | seq = le64_to_cpu(con->in_hdr.seq); |
| 1534 | if ((s64)seq - (s64)con->in_seq < 1) { | 1532 | if ((s64)seq - (s64)con->in_seq < 1) { |
| 1535 | pr_info("skipping %s%lld %s seq %lld, expected %lld\n", | 1533 | pr_info("skipping %s%lld %s seq %lld expected %lld\n", |
| 1536 | ENTITY_NAME(con->peer_name), | 1534 | ENTITY_NAME(con->peer_name), |
| 1537 | ceph_pr_addr(&con->peer_addr.in_addr), | 1535 | ceph_pr_addr(&con->peer_addr.in_addr), |
| 1538 | seq, con->in_seq + 1); | 1536 | seq, con->in_seq + 1); |
| 1539 | con->in_base_pos = -front_len - middle_len - data_len - | 1537 | con->in_base_pos = -front_len - middle_len - data_len - |
| 1540 | sizeof(m->footer); | 1538 | sizeof(m->footer); |
| 1541 | con->in_tag = CEPH_MSGR_TAG_READY; | 1539 | con->in_tag = CEPH_MSGR_TAG_READY; |
| 1542 | con->in_seq++; | ||
| 1543 | return 0; | 1540 | return 0; |
| 1544 | } else if ((s64)seq - (s64)con->in_seq > 1) { | 1541 | } else if ((s64)seq - (s64)con->in_seq > 1) { |
| 1545 | pr_err("read_partial_message bad seq %lld expected %lld\n", | 1542 | pr_err("read_partial_message bad seq %lld expected %lld\n", |
| @@ -1576,7 +1573,7 @@ static int read_partial_message(struct ceph_connection *con) | |||
| 1576 | 1573 | ||
| 1577 | con->in_msg_pos.page = 0; | 1574 | con->in_msg_pos.page = 0; |
| 1578 | if (m->pages) | 1575 | if (m->pages) |
| 1579 | con->in_msg_pos.page_pos = data_off & ~PAGE_MASK; | 1576 | con->in_msg_pos.page_pos = m->page_alignment; |
| 1580 | else | 1577 | else |
| 1581 | con->in_msg_pos.page_pos = 0; | 1578 | con->in_msg_pos.page_pos = 0; |
| 1582 | con->in_msg_pos.data_pos = 0; | 1579 | con->in_msg_pos.data_pos = 0; |
| @@ -2301,6 +2298,7 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags) | |||
| 2301 | 2298 | ||
| 2302 | /* data */ | 2299 | /* data */ |
| 2303 | m->nr_pages = 0; | 2300 | m->nr_pages = 0; |
| 2301 | m->page_alignment = 0; | ||
| 2304 | m->pages = NULL; | 2302 | m->pages = NULL; |
| 2305 | m->pagelist = NULL; | 2303 | m->pagelist = NULL; |
| 2306 | m->bio = NULL; | 2304 | m->bio = NULL; |
| @@ -2370,6 +2368,7 @@ static struct ceph_msg *ceph_alloc_msg(struct ceph_connection *con, | |||
| 2370 | type, front_len); | 2368 | type, front_len); |
| 2371 | return NULL; | 2369 | return NULL; |
| 2372 | } | 2370 | } |
| 2371 | msg->page_alignment = le16_to_cpu(hdr->data_off); | ||
| 2373 | } | 2372 | } |
| 2374 | memcpy(&msg->hdr, &con->in_hdr, sizeof(con->in_hdr)); | 2373 | memcpy(&msg->hdr, &con->in_hdr, sizeof(con->in_hdr)); |
| 2375 | 2374 | ||
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 79391994b3ed..3e20a122ffa2 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
| @@ -71,6 +71,7 @@ void ceph_calc_raw_layout(struct ceph_osd_client *osdc, | |||
| 71 | op->extent.length = objlen; | 71 | op->extent.length = objlen; |
| 72 | } | 72 | } |
| 73 | req->r_num_pages = calc_pages_for(off, *plen); | 73 | req->r_num_pages = calc_pages_for(off, *plen); |
| 74 | req->r_page_alignment = off & ~PAGE_MASK; | ||
| 74 | if (op->op == CEPH_OSD_OP_WRITE) | 75 | if (op->op == CEPH_OSD_OP_WRITE) |
| 75 | op->payload_len = *plen; | 76 | op->payload_len = *plen; |
| 76 | 77 | ||
| @@ -390,6 +391,8 @@ void ceph_osdc_build_request(struct ceph_osd_request *req, | |||
| 390 | req->r_request->hdr.data_len = cpu_to_le32(data_len); | 391 | req->r_request->hdr.data_len = cpu_to_le32(data_len); |
| 391 | } | 392 | } |
| 392 | 393 | ||
| 394 | req->r_request->page_alignment = req->r_page_alignment; | ||
| 395 | |||
| 393 | BUG_ON(p > msg->front.iov_base + msg->front.iov_len); | 396 | BUG_ON(p > msg->front.iov_base + msg->front.iov_len); |
| 394 | msg_size = p - msg->front.iov_base; | 397 | msg_size = p - msg->front.iov_base; |
| 395 | msg->front.iov_len = msg_size; | 398 | msg->front.iov_len = msg_size; |
| @@ -419,7 +422,8 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, | |||
| 419 | u32 truncate_seq, | 422 | u32 truncate_seq, |
| 420 | u64 truncate_size, | 423 | u64 truncate_size, |
| 421 | struct timespec *mtime, | 424 | struct timespec *mtime, |
| 422 | bool use_mempool, int num_reply) | 425 | bool use_mempool, int num_reply, |
| 426 | int page_align) | ||
| 423 | { | 427 | { |
| 424 | struct ceph_osd_req_op ops[3]; | 428 | struct ceph_osd_req_op ops[3]; |
| 425 | struct ceph_osd_request *req; | 429 | struct ceph_osd_request *req; |
| @@ -447,6 +451,10 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, | |||
| 447 | calc_layout(osdc, vino, layout, off, plen, req, ops); | 451 | calc_layout(osdc, vino, layout, off, plen, req, ops); |
| 448 | req->r_file_layout = *layout; /* keep a copy */ | 452 | req->r_file_layout = *layout; /* keep a copy */ |
| 449 | 453 | ||
| 454 | /* in case it differs from natural alignment that calc_layout | ||
| 455 | filled in for us */ | ||
| 456 | req->r_page_alignment = page_align; | ||
| 457 | |||
| 450 | ceph_osdc_build_request(req, off, plen, ops, | 458 | ceph_osdc_build_request(req, off, plen, ops, |
| 451 | snapc, | 459 | snapc, |
| 452 | mtime, | 460 | mtime, |
| @@ -1489,7 +1497,7 @@ int ceph_osdc_readpages(struct ceph_osd_client *osdc, | |||
| 1489 | struct ceph_vino vino, struct ceph_file_layout *layout, | 1497 | struct ceph_vino vino, struct ceph_file_layout *layout, |
| 1490 | u64 off, u64 *plen, | 1498 | u64 off, u64 *plen, |
| 1491 | u32 truncate_seq, u64 truncate_size, | 1499 | u32 truncate_seq, u64 truncate_size, |
| 1492 | struct page **pages, int num_pages) | 1500 | struct page **pages, int num_pages, int page_align) |
| 1493 | { | 1501 | { |
| 1494 | struct ceph_osd_request *req; | 1502 | struct ceph_osd_request *req; |
| 1495 | int rc = 0; | 1503 | int rc = 0; |
| @@ -1499,15 +1507,15 @@ int ceph_osdc_readpages(struct ceph_osd_client *osdc, | |||
| 1499 | req = ceph_osdc_new_request(osdc, layout, vino, off, plen, | 1507 | req = ceph_osdc_new_request(osdc, layout, vino, off, plen, |
| 1500 | CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ, | 1508 | CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ, |
| 1501 | NULL, 0, truncate_seq, truncate_size, NULL, | 1509 | NULL, 0, truncate_seq, truncate_size, NULL, |
| 1502 | false, 1); | 1510 | false, 1, page_align); |
| 1503 | if (!req) | 1511 | if (!req) |
| 1504 | return -ENOMEM; | 1512 | return -ENOMEM; |
| 1505 | 1513 | ||
| 1506 | /* it may be a short read due to an object boundary */ | 1514 | /* it may be a short read due to an object boundary */ |
| 1507 | req->r_pages = pages; | 1515 | req->r_pages = pages; |
| 1508 | 1516 | ||
| 1509 | dout("readpages final extent is %llu~%llu (%d pages)\n", | 1517 | dout("readpages final extent is %llu~%llu (%d pages align %d)\n", |
| 1510 | off, *plen, req->r_num_pages); | 1518 | off, *plen, req->r_num_pages, page_align); |
| 1511 | 1519 | ||
| 1512 | rc = ceph_osdc_start_request(osdc, req, false); | 1520 | rc = ceph_osdc_start_request(osdc, req, false); |
| 1513 | if (!rc) | 1521 | if (!rc) |
| @@ -1533,6 +1541,7 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino, | |||
| 1533 | { | 1541 | { |
| 1534 | struct ceph_osd_request *req; | 1542 | struct ceph_osd_request *req; |
| 1535 | int rc = 0; | 1543 | int rc = 0; |
| 1544 | int page_align = off & ~PAGE_MASK; | ||
| 1536 | 1545 | ||
| 1537 | BUG_ON(vino.snap != CEPH_NOSNAP); | 1546 | BUG_ON(vino.snap != CEPH_NOSNAP); |
| 1538 | req = ceph_osdc_new_request(osdc, layout, vino, off, &len, | 1547 | req = ceph_osdc_new_request(osdc, layout, vino, off, &len, |
| @@ -1541,7 +1550,7 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino, | |||
| 1541 | CEPH_OSD_FLAG_WRITE, | 1550 | CEPH_OSD_FLAG_WRITE, |
| 1542 | snapc, do_sync, | 1551 | snapc, do_sync, |
| 1543 | truncate_seq, truncate_size, mtime, | 1552 | truncate_seq, truncate_size, mtime, |
| 1544 | nofail, 1); | 1553 | nofail, 1, page_align); |
| 1545 | if (!req) | 1554 | if (!req) |
| 1546 | return -ENOMEM; | 1555 | return -ENOMEM; |
| 1547 | 1556 | ||
| @@ -1638,8 +1647,7 @@ static struct ceph_msg *get_reply(struct ceph_connection *con, | |||
| 1638 | m = ceph_msg_get(req->r_reply); | 1647 | m = ceph_msg_get(req->r_reply); |
| 1639 | 1648 | ||
| 1640 | if (data_len > 0) { | 1649 | if (data_len > 0) { |
| 1641 | unsigned data_off = le16_to_cpu(hdr->data_off); | 1650 | int want = calc_pages_for(req->r_page_alignment, data_len); |
| 1642 | int want = calc_pages_for(data_off & ~PAGE_MASK, data_len); | ||
| 1643 | 1651 | ||
| 1644 | if (unlikely(req->r_num_pages < want)) { | 1652 | if (unlikely(req->r_num_pages < want)) { |
| 1645 | pr_warning("tid %lld reply %d > expected %d pages\n", | 1653 | pr_warning("tid %lld reply %d > expected %d pages\n", |
| @@ -1651,6 +1659,7 @@ static struct ceph_msg *get_reply(struct ceph_connection *con, | |||
| 1651 | } | 1659 | } |
| 1652 | m->pages = req->r_pages; | 1660 | m->pages = req->r_pages; |
| 1653 | m->nr_pages = req->r_num_pages; | 1661 | m->nr_pages = req->r_num_pages; |
| 1662 | m->page_alignment = req->r_page_alignment; | ||
| 1654 | #ifdef CONFIG_BLOCK | 1663 | #ifdef CONFIG_BLOCK |
| 1655 | m->bio = req->r_bio; | 1664 | m->bio = req->r_bio; |
| 1656 | #endif | 1665 | #endif |
diff --git a/net/ceph/pagevec.c b/net/ceph/pagevec.c index 54caf0687155..ac34feeb2b3a 100644 --- a/net/ceph/pagevec.c +++ b/net/ceph/pagevec.c | |||
| @@ -13,8 +13,7 @@ | |||
| 13 | * build a vector of user pages | 13 | * build a vector of user pages |
| 14 | */ | 14 | */ |
| 15 | struct page **ceph_get_direct_page_vector(const char __user *data, | 15 | struct page **ceph_get_direct_page_vector(const char __user *data, |
| 16 | int num_pages, | 16 | int num_pages) |
| 17 | loff_t off, size_t len) | ||
| 18 | { | 17 | { |
| 19 | struct page **pages; | 18 | struct page **pages; |
| 20 | int rc; | 19 | int rc; |
diff --git a/net/core/filter.c b/net/core/filter.c index 23e9b2a6b4c8..c1ee800bc080 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
| @@ -589,7 +589,7 @@ int sk_chk_filter(struct sock_filter *filter, int flen) | |||
| 589 | EXPORT_SYMBOL(sk_chk_filter); | 589 | EXPORT_SYMBOL(sk_chk_filter); |
| 590 | 590 | ||
| 591 | /** | 591 | /** |
| 592 | * sk_filter_rcu_release: Release a socket filter by rcu_head | 592 | * sk_filter_rcu_release - Release a socket filter by rcu_head |
| 593 | * @rcu: rcu_head that contains the sk_filter to free | 593 | * @rcu: rcu_head that contains the sk_filter to free |
| 594 | */ | 594 | */ |
| 595 | static void sk_filter_rcu_release(struct rcu_head *rcu) | 595 | static void sk_filter_rcu_release(struct rcu_head *rcu) |
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index a5ff5a89f376..7f902cad10f8 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
| @@ -712,15 +712,21 @@ static void rx_queue_release(struct kobject *kobj) | |||
| 712 | 712 | ||
| 713 | 713 | ||
| 714 | map = rcu_dereference_raw(queue->rps_map); | 714 | map = rcu_dereference_raw(queue->rps_map); |
| 715 | if (map) | 715 | if (map) { |
| 716 | RCU_INIT_POINTER(queue->rps_map, NULL); | ||
| 716 | call_rcu(&map->rcu, rps_map_release); | 717 | call_rcu(&map->rcu, rps_map_release); |
| 718 | } | ||
| 717 | 719 | ||
| 718 | flow_table = rcu_dereference_raw(queue->rps_flow_table); | 720 | flow_table = rcu_dereference_raw(queue->rps_flow_table); |
| 719 | if (flow_table) | 721 | if (flow_table) { |
| 722 | RCU_INIT_POINTER(queue->rps_flow_table, NULL); | ||
| 720 | call_rcu(&flow_table->rcu, rps_dev_flow_table_release); | 723 | call_rcu(&flow_table->rcu, rps_dev_flow_table_release); |
| 724 | } | ||
| 721 | 725 | ||
| 722 | if (atomic_dec_and_test(&first->count)) | 726 | if (atomic_dec_and_test(&first->count)) |
| 723 | kfree(first); | 727 | kfree(first); |
| 728 | else | ||
| 729 | memset(kobj, 0, sizeof(*kobj)); | ||
| 724 | } | 730 | } |
| 725 | 731 | ||
| 726 | static struct kobj_type rx_queue_ktype = { | 732 | static struct kobj_type rx_queue_ktype = { |
diff --git a/net/core/request_sock.c b/net/core/request_sock.c index 7552495aff7a..fceeb37d7161 100644 --- a/net/core/request_sock.c +++ b/net/core/request_sock.c | |||
| @@ -45,9 +45,7 @@ int reqsk_queue_alloc(struct request_sock_queue *queue, | |||
| 45 | nr_table_entries = roundup_pow_of_two(nr_table_entries + 1); | 45 | nr_table_entries = roundup_pow_of_two(nr_table_entries + 1); |
| 46 | lopt_size += nr_table_entries * sizeof(struct request_sock *); | 46 | lopt_size += nr_table_entries * sizeof(struct request_sock *); |
| 47 | if (lopt_size > PAGE_SIZE) | 47 | if (lopt_size > PAGE_SIZE) |
| 48 | lopt = __vmalloc(lopt_size, | 48 | lopt = vzalloc(lopt_size); |
| 49 | GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, | ||
| 50 | PAGE_KERNEL); | ||
| 51 | else | 49 | else |
| 52 | lopt = kzalloc(lopt_size, GFP_KERNEL); | 50 | lopt = kzalloc(lopt_size, GFP_KERNEL); |
| 53 | if (lopt == NULL) | 51 | if (lopt == NULL) |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 200eb538fbb3..0f280348e0fd 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
| @@ -365,7 +365,7 @@ static struct tnode *tnode_alloc(size_t size) | |||
| 365 | if (size <= PAGE_SIZE) | 365 | if (size <= PAGE_SIZE) |
| 366 | return kzalloc(size, GFP_KERNEL); | 366 | return kzalloc(size, GFP_KERNEL); |
| 367 | else | 367 | else |
| 368 | return __vmalloc(size, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); | 368 | return vzalloc(size); |
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | static void __tnode_vfree(struct work_struct *arg) | 371 | static void __tnode_vfree(struct work_struct *arg) |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 96bc7f9475a3..e5d1a44bcbdf 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
| @@ -569,6 +569,9 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) | |||
| 569 | /* No need to clone since we're just using its address. */ | 569 | /* No need to clone since we're just using its address. */ |
| 570 | rt2 = rt; | 570 | rt2 = rt; |
| 571 | 571 | ||
| 572 | if (!fl.nl_u.ip4_u.saddr) | ||
| 573 | fl.nl_u.ip4_u.saddr = rt->rt_src; | ||
| 574 | |||
| 572 | err = xfrm_lookup(net, (struct dst_entry **)&rt, &fl, NULL, 0); | 575 | err = xfrm_lookup(net, (struct dst_entry **)&rt, &fl, NULL, 0); |
| 573 | switch (err) { | 576 | switch (err) { |
| 574 | case 0: | 577 | case 0: |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index b41ce0f0d514..23cc8e1ce8d4 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
| @@ -98,7 +98,11 @@ | |||
| 98 | #endif | 98 | #endif |
| 99 | 99 | ||
| 100 | #define INFINITY_LIFE_TIME 0xFFFFFFFF | 100 | #define INFINITY_LIFE_TIME 0xFFFFFFFF |
| 101 | #define TIME_DELTA(a, b) ((unsigned long)((long)(a) - (long)(b))) | 101 | |
| 102 | static inline u32 cstamp_delta(unsigned long cstamp) | ||
| 103 | { | ||
| 104 | return (cstamp - INITIAL_JIFFIES) * 100UL / HZ; | ||
| 105 | } | ||
| 102 | 106 | ||
| 103 | #define ADDRCONF_TIMER_FUZZ_MINUS (HZ > 50 ? HZ/50 : 1) | 107 | #define ADDRCONF_TIMER_FUZZ_MINUS (HZ > 50 ? HZ/50 : 1) |
| 104 | #define ADDRCONF_TIMER_FUZZ (HZ / 4) | 108 | #define ADDRCONF_TIMER_FUZZ (HZ / 4) |
| @@ -2754,13 +2758,13 @@ static int addrconf_ifdown(struct net_device *dev, int how) | |||
| 2754 | ifa->state = INET6_IFADDR_STATE_DEAD; | 2758 | ifa->state = INET6_IFADDR_STATE_DEAD; |
| 2755 | spin_unlock_bh(&ifa->state_lock); | 2759 | spin_unlock_bh(&ifa->state_lock); |
| 2756 | 2760 | ||
| 2757 | if (state == INET6_IFADDR_STATE_DEAD) { | 2761 | if (state != INET6_IFADDR_STATE_DEAD) { |
| 2758 | in6_ifa_put(ifa); | ||
| 2759 | } else { | ||
| 2760 | __ipv6_ifa_notify(RTM_DELADDR, ifa); | 2762 | __ipv6_ifa_notify(RTM_DELADDR, ifa); |
| 2761 | atomic_notifier_call_chain(&inet6addr_chain, | 2763 | atomic_notifier_call_chain(&inet6addr_chain, |
| 2762 | NETDEV_DOWN, ifa); | 2764 | NETDEV_DOWN, ifa); |
| 2763 | } | 2765 | } |
| 2766 | |||
| 2767 | in6_ifa_put(ifa); | ||
| 2764 | write_lock_bh(&idev->lock); | 2768 | write_lock_bh(&idev->lock); |
| 2765 | } | 2769 | } |
| 2766 | } | 2770 | } |
| @@ -3444,10 +3448,8 @@ static int put_cacheinfo(struct sk_buff *skb, unsigned long cstamp, | |||
| 3444 | { | 3448 | { |
| 3445 | struct ifa_cacheinfo ci; | 3449 | struct ifa_cacheinfo ci; |
| 3446 | 3450 | ||
| 3447 | ci.cstamp = (u32)(TIME_DELTA(cstamp, INITIAL_JIFFIES) / HZ * 100 | 3451 | ci.cstamp = cstamp_delta(cstamp); |
| 3448 | + TIME_DELTA(cstamp, INITIAL_JIFFIES) % HZ * 100 / HZ); | 3452 | ci.tstamp = cstamp_delta(tstamp); |
| 3449 | ci.tstamp = (u32)(TIME_DELTA(tstamp, INITIAL_JIFFIES) / HZ * 100 | ||
| 3450 | + TIME_DELTA(tstamp, INITIAL_JIFFIES) % HZ * 100 / HZ); | ||
| 3451 | ci.ifa_prefered = preferred; | 3453 | ci.ifa_prefered = preferred; |
| 3452 | ci.ifa_valid = valid; | 3454 | ci.ifa_valid = valid; |
| 3453 | 3455 | ||
| @@ -3798,8 +3800,10 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf, | |||
| 3798 | array[DEVCONF_AUTOCONF] = cnf->autoconf; | 3800 | array[DEVCONF_AUTOCONF] = cnf->autoconf; |
| 3799 | array[DEVCONF_DAD_TRANSMITS] = cnf->dad_transmits; | 3801 | array[DEVCONF_DAD_TRANSMITS] = cnf->dad_transmits; |
| 3800 | array[DEVCONF_RTR_SOLICITS] = cnf->rtr_solicits; | 3802 | array[DEVCONF_RTR_SOLICITS] = cnf->rtr_solicits; |
| 3801 | array[DEVCONF_RTR_SOLICIT_INTERVAL] = cnf->rtr_solicit_interval; | 3803 | array[DEVCONF_RTR_SOLICIT_INTERVAL] = |
| 3802 | array[DEVCONF_RTR_SOLICIT_DELAY] = cnf->rtr_solicit_delay; | 3804 | jiffies_to_msecs(cnf->rtr_solicit_interval); |
| 3805 | array[DEVCONF_RTR_SOLICIT_DELAY] = | ||
| 3806 | jiffies_to_msecs(cnf->rtr_solicit_delay); | ||
| 3803 | array[DEVCONF_FORCE_MLD_VERSION] = cnf->force_mld_version; | 3807 | array[DEVCONF_FORCE_MLD_VERSION] = cnf->force_mld_version; |
| 3804 | #ifdef CONFIG_IPV6_PRIVACY | 3808 | #ifdef CONFIG_IPV6_PRIVACY |
| 3805 | array[DEVCONF_USE_TEMPADDR] = cnf->use_tempaddr; | 3809 | array[DEVCONF_USE_TEMPADDR] = cnf->use_tempaddr; |
| @@ -3813,7 +3817,8 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf, | |||
| 3813 | array[DEVCONF_ACCEPT_RA_PINFO] = cnf->accept_ra_pinfo; | 3817 | array[DEVCONF_ACCEPT_RA_PINFO] = cnf->accept_ra_pinfo; |
| 3814 | #ifdef CONFIG_IPV6_ROUTER_PREF | 3818 | #ifdef CONFIG_IPV6_ROUTER_PREF |
| 3815 | array[DEVCONF_ACCEPT_RA_RTR_PREF] = cnf->accept_ra_rtr_pref; | 3819 | array[DEVCONF_ACCEPT_RA_RTR_PREF] = cnf->accept_ra_rtr_pref; |
| 3816 | array[DEVCONF_RTR_PROBE_INTERVAL] = cnf->rtr_probe_interval; | 3820 | array[DEVCONF_RTR_PROBE_INTERVAL] = |
| 3821 | jiffies_to_msecs(cnf->rtr_probe_interval); | ||
| 3817 | #ifdef CONFIG_IPV6_ROUTE_INFO | 3822 | #ifdef CONFIG_IPV6_ROUTE_INFO |
| 3818 | array[DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN] = cnf->accept_ra_rt_info_max_plen; | 3823 | array[DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN] = cnf->accept_ra_rt_info_max_plen; |
| 3819 | #endif | 3824 | #endif |
| @@ -3929,10 +3934,9 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, | |||
| 3929 | NLA_PUT_U32(skb, IFLA_INET6_FLAGS, idev->if_flags); | 3934 | NLA_PUT_U32(skb, IFLA_INET6_FLAGS, idev->if_flags); |
| 3930 | 3935 | ||
| 3931 | ci.max_reasm_len = IPV6_MAXPLEN; | 3936 | ci.max_reasm_len = IPV6_MAXPLEN; |
| 3932 | ci.tstamp = (__u32)(TIME_DELTA(idev->tstamp, INITIAL_JIFFIES) / HZ * 100 | 3937 | ci.tstamp = cstamp_delta(idev->tstamp); |
| 3933 | + TIME_DELTA(idev->tstamp, INITIAL_JIFFIES) % HZ * 100 / HZ); | 3938 | ci.reachable_time = jiffies_to_msecs(idev->nd_parms->reachable_time); |
| 3934 | ci.reachable_time = idev->nd_parms->reachable_time; | 3939 | ci.retrans_time = jiffies_to_msecs(idev->nd_parms->retrans_time); |
| 3935 | ci.retrans_time = idev->nd_parms->retrans_time; | ||
| 3936 | NLA_PUT(skb, IFLA_INET6_CACHEINFO, sizeof(ci), &ci); | 3940 | NLA_PUT(skb, IFLA_INET6_CACHEINFO, sizeof(ci), &ci); |
| 3937 | 3941 | ||
| 3938 | nla = nla_reserve(skb, IFLA_INET6_CONF, DEVCONF_MAX * sizeof(s32)); | 3942 | nla = nla_reserve(skb, IFLA_INET6_CONF, DEVCONF_MAX * sizeof(s32)); |
diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 285761e77d90..f6054f9ccbe3 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c | |||
| @@ -550,22 +550,30 @@ EXPORT_SYMBOL(irttp_close_tsap); | |||
| 550 | */ | 550 | */ |
| 551 | int irttp_udata_request(struct tsap_cb *self, struct sk_buff *skb) | 551 | int irttp_udata_request(struct tsap_cb *self, struct sk_buff *skb) |
| 552 | { | 552 | { |
| 553 | int ret; | ||
| 554 | |||
| 553 | IRDA_ASSERT(self != NULL, return -1;); | 555 | IRDA_ASSERT(self != NULL, return -1;); |
| 554 | IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return -1;); | 556 | IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return -1;); |
| 555 | IRDA_ASSERT(skb != NULL, return -1;); | 557 | IRDA_ASSERT(skb != NULL, return -1;); |
| 556 | 558 | ||
| 557 | IRDA_DEBUG(4, "%s()\n", __func__); | 559 | IRDA_DEBUG(4, "%s()\n", __func__); |
| 558 | 560 | ||
| 561 | /* Take shortcut on zero byte packets */ | ||
| 562 | if (skb->len == 0) { | ||
| 563 | ret = 0; | ||
| 564 | goto err; | ||
| 565 | } | ||
| 566 | |||
| 559 | /* Check that nothing bad happens */ | 567 | /* Check that nothing bad happens */ |
| 560 | if ((skb->len == 0) || (!self->connected)) { | 568 | if (!self->connected) { |
| 561 | IRDA_DEBUG(1, "%s(), No data, or not connected\n", | 569 | IRDA_WARNING("%s(), Not connected\n", __func__); |
| 562 | __func__); | 570 | ret = -ENOTCONN; |
| 563 | goto err; | 571 | goto err; |
| 564 | } | 572 | } |
| 565 | 573 | ||
| 566 | if (skb->len > self->max_seg_size) { | 574 | if (skb->len > self->max_seg_size) { |
| 567 | IRDA_DEBUG(1, "%s(), UData is too large for IrLAP!\n", | 575 | IRDA_ERROR("%s(), UData is too large for IrLAP!\n", __func__); |
| 568 | __func__); | 576 | ret = -EMSGSIZE; |
| 569 | goto err; | 577 | goto err; |
| 570 | } | 578 | } |
| 571 | 579 | ||
| @@ -576,7 +584,7 @@ int irttp_udata_request(struct tsap_cb *self, struct sk_buff *skb) | |||
| 576 | 584 | ||
| 577 | err: | 585 | err: |
| 578 | dev_kfree_skb(skb); | 586 | dev_kfree_skb(skb); |
| 579 | return -1; | 587 | return ret; |
| 580 | } | 588 | } |
| 581 | EXPORT_SYMBOL(irttp_udata_request); | 589 | EXPORT_SYMBOL(irttp_udata_request); |
| 582 | 590 | ||
| @@ -599,9 +607,15 @@ int irttp_data_request(struct tsap_cb *self, struct sk_buff *skb) | |||
| 599 | IRDA_DEBUG(2, "%s() : queue len = %d\n", __func__, | 607 | IRDA_DEBUG(2, "%s() : queue len = %d\n", __func__, |
| 600 | skb_queue_len(&self->tx_queue)); | 608 | skb_queue_len(&self->tx_queue)); |
| 601 | 609 | ||
| 610 | /* Take shortcut on zero byte packets */ | ||
| 611 | if (skb->len == 0) { | ||
| 612 | ret = 0; | ||
| 613 | goto err; | ||
| 614 | } | ||
| 615 | |||
| 602 | /* Check that nothing bad happens */ | 616 | /* Check that nothing bad happens */ |
| 603 | if ((skb->len == 0) || (!self->connected)) { | 617 | if (!self->connected) { |
| 604 | IRDA_WARNING("%s: No data, or not connected\n", __func__); | 618 | IRDA_WARNING("%s: Not connected\n", __func__); |
| 605 | ret = -ENOTCONN; | 619 | ret = -ENOTCONN; |
| 606 | goto err; | 620 | goto err; |
| 607 | } | 621 | } |
diff --git a/net/netfilter/ipvs/Kconfig b/net/netfilter/ipvs/Kconfig index a22dac227055..70bd1d0774c6 100644 --- a/net/netfilter/ipvs/Kconfig +++ b/net/netfilter/ipvs/Kconfig | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | menuconfig IP_VS | 4 | menuconfig IP_VS |
| 5 | tristate "IP virtual server support" | 5 | tristate "IP virtual server support" |
| 6 | depends on NET && INET && NETFILTER | 6 | depends on NET && INET && NETFILTER |
| 7 | depends on (NF_CONNTRACK || NF_CONNTRACK=n) | ||
| 7 | ---help--- | 8 | ---help--- |
| 8 | IP Virtual Server support will let you build a high-performance | 9 | IP Virtual Server support will let you build a high-performance |
| 9 | virtual server based on cluster of two or more real servers. This | 10 | virtual server based on cluster of two or more real servers. This |
diff --git a/net/rds/rdma.c b/net/rds/rdma.c index 8920f2a83327..4e37c1cbe8b2 100644 --- a/net/rds/rdma.c +++ b/net/rds/rdma.c | |||
| @@ -567,7 +567,7 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm, | |||
| 567 | goto out; | 567 | goto out; |
| 568 | } | 568 | } |
| 569 | 569 | ||
| 570 | if (args->nr_local > (u64)UINT_MAX) { | 570 | if (args->nr_local > UIO_MAXIOV) { |
| 571 | ret = -EMSGSIZE; | 571 | ret = -EMSGSIZE; |
| 572 | goto out; | 572 | goto out; |
| 573 | } | 573 | } |
diff --git a/net/wireless/chan.c b/net/wireless/chan.c index d0c92dddb26b..17cd0c04d139 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c | |||
| @@ -44,6 +44,38 @@ rdev_freq_to_chan(struct cfg80211_registered_device *rdev, | |||
| 44 | return chan; | 44 | return chan; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | static bool can_beacon_sec_chan(struct wiphy *wiphy, | ||
| 48 | struct ieee80211_channel *chan, | ||
| 49 | enum nl80211_channel_type channel_type) | ||
| 50 | { | ||
| 51 | struct ieee80211_channel *sec_chan; | ||
| 52 | int diff; | ||
| 53 | |||
| 54 | switch (channel_type) { | ||
| 55 | case NL80211_CHAN_HT40PLUS: | ||
| 56 | diff = 20; | ||
| 57 | break; | ||
| 58 | case NL80211_CHAN_HT40MINUS: | ||
| 59 | diff = -20; | ||
| 60 | break; | ||
| 61 | default: | ||
| 62 | return false; | ||
| 63 | } | ||
| 64 | |||
| 65 | sec_chan = ieee80211_get_channel(wiphy, chan->center_freq + diff); | ||
| 66 | if (!sec_chan) | ||
| 67 | return false; | ||
| 68 | |||
| 69 | /* we'll need a DFS capability later */ | ||
| 70 | if (sec_chan->flags & (IEEE80211_CHAN_DISABLED | | ||
| 71 | IEEE80211_CHAN_PASSIVE_SCAN | | ||
| 72 | IEEE80211_CHAN_NO_IBSS | | ||
| 73 | IEEE80211_CHAN_RADAR)) | ||
| 74 | return false; | ||
| 75 | |||
| 76 | return true; | ||
| 77 | } | ||
| 78 | |||
| 47 | int cfg80211_set_freq(struct cfg80211_registered_device *rdev, | 79 | int cfg80211_set_freq(struct cfg80211_registered_device *rdev, |
| 48 | struct wireless_dev *wdev, int freq, | 80 | struct wireless_dev *wdev, int freq, |
| 49 | enum nl80211_channel_type channel_type) | 81 | enum nl80211_channel_type channel_type) |
| @@ -68,6 +100,28 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev, | |||
| 68 | if (!chan) | 100 | if (!chan) |
| 69 | return -EINVAL; | 101 | return -EINVAL; |
| 70 | 102 | ||
| 103 | /* Both channels should be able to initiate communication */ | ||
| 104 | if (wdev && (wdev->iftype == NL80211_IFTYPE_ADHOC || | ||
| 105 | wdev->iftype == NL80211_IFTYPE_AP || | ||
| 106 | wdev->iftype == NL80211_IFTYPE_AP_VLAN || | ||
| 107 | wdev->iftype == NL80211_IFTYPE_MESH_POINT || | ||
| 108 | wdev->iftype == NL80211_IFTYPE_P2P_GO)) { | ||
| 109 | switch (channel_type) { | ||
| 110 | case NL80211_CHAN_HT40PLUS: | ||
| 111 | case NL80211_CHAN_HT40MINUS: | ||
| 112 | if (!can_beacon_sec_chan(&rdev->wiphy, chan, | ||
| 113 | channel_type)) { | ||
| 114 | printk(KERN_DEBUG | ||
| 115 | "cfg80211: Secondary channel not " | ||
| 116 | "allowed to initiate communication\n"); | ||
| 117 | return -EINVAL; | ||
| 118 | } | ||
| 119 | break; | ||
| 120 | default: | ||
| 121 | break; | ||
| 122 | } | ||
| 123 | } | ||
| 124 | |||
| 71 | result = rdev->ops->set_channel(&rdev->wiphy, | 125 | result = rdev->ops->set_channel(&rdev->wiphy, |
| 72 | wdev ? wdev->netdev : NULL, | 126 | wdev ? wdev->netdev : NULL, |
| 73 | chan, channel_type); | 127 | chan, channel_type); |
diff --git a/net/xfrm/xfrm_hash.c b/net/xfrm/xfrm_hash.c index a2023ec52329..1e98bc0fe0a5 100644 --- a/net/xfrm/xfrm_hash.c +++ b/net/xfrm/xfrm_hash.c | |||
| @@ -19,7 +19,7 @@ struct hlist_head *xfrm_hash_alloc(unsigned int sz) | |||
| 19 | if (sz <= PAGE_SIZE) | 19 | if (sz <= PAGE_SIZE) |
| 20 | n = kzalloc(sz, GFP_KERNEL); | 20 | n = kzalloc(sz, GFP_KERNEL); |
| 21 | else if (hashdist) | 21 | else if (hashdist) |
| 22 | n = __vmalloc(sz, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); | 22 | n = vzalloc(sz); |
| 23 | else | 23 | else |
| 24 | n = (struct hlist_head *) | 24 | n = (struct hlist_head *) |
| 25 | __get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, | 25 | __get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, |
diff --git a/scripts/gfp-translate b/scripts/gfp-translate index d81b968d864e..c9230e158a8f 100644 --- a/scripts/gfp-translate +++ b/scripts/gfp-translate | |||
| @@ -63,7 +63,12 @@ fi | |||
| 63 | 63 | ||
| 64 | # Extract GFP flags from the kernel source | 64 | # Extract GFP flags from the kernel source |
| 65 | TMPFILE=`mktemp -t gfptranslate-XXXXXX` || exit 1 | 65 | TMPFILE=`mktemp -t gfptranslate-XXXXXX` || exit 1 |
| 66 | grep "^#define __GFP" $SOURCE/include/linux/gfp.h | sed -e 's/(__force gfp_t)//' | sed -e 's/u)/)/' | grep -v GFP_BITS | sed -e 's/)\//) \//' > $TMPFILE | 66 | grep -q ___GFP $SOURCE/include/linux/gfp.h |
| 67 | if [ $? -eq 0 ]; then | ||
| 68 | grep "^#define ___GFP" $SOURCE/include/linux/gfp.h | sed -e 's/u$//' | grep -v GFP_BITS > $TMPFILE | ||
| 69 | else | ||
| 70 | grep "^#define __GFP" $SOURCE/include/linux/gfp.h | sed -e 's/(__force gfp_t)//' | sed -e 's/u)/)/' | grep -v GFP_BITS | sed -e 's/)\//) \//' > $TMPFILE | ||
| 71 | fi | ||
| 67 | 72 | ||
| 68 | # Parse the flags | 73 | # Parse the flags |
| 69 | IFS=" | 74 | IFS=" |
diff --git a/sound/atmel/abdac.c b/sound/atmel/abdac.c index f2f41c854221..6e2409181895 100644 --- a/sound/atmel/abdac.c +++ b/sound/atmel/abdac.c | |||
| @@ -420,9 +420,9 @@ static int __devinit atmel_abdac_probe(struct platform_device *pdev) | |||
| 420 | return PTR_ERR(pclk); | 420 | return PTR_ERR(pclk); |
| 421 | } | 421 | } |
| 422 | sample_clk = clk_get(&pdev->dev, "sample_clk"); | 422 | sample_clk = clk_get(&pdev->dev, "sample_clk"); |
| 423 | if (IS_ERR(pclk)) { | 423 | if (IS_ERR(sample_clk)) { |
| 424 | dev_dbg(&pdev->dev, "no sample clock\n"); | 424 | dev_dbg(&pdev->dev, "no sample clock\n"); |
| 425 | retval = PTR_ERR(pclk); | 425 | retval = PTR_ERR(sample_clk); |
| 426 | goto out_put_pclk; | 426 | goto out_put_pclk; |
| 427 | } | 427 | } |
| 428 | clk_enable(pclk); | 428 | clk_enable(pclk); |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index a1707cca9c66..b75db8e9cc0f 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
| @@ -223,7 +223,7 @@ static void xrun_log(struct snd_pcm_substream *substream, | |||
| 223 | entry->jiffies = jiffies; | 223 | entry->jiffies = jiffies; |
| 224 | entry->pos = pos; | 224 | entry->pos = pos; |
| 225 | entry->period_size = runtime->period_size; | 225 | entry->period_size = runtime->period_size; |
| 226 | entry->buffer_size = runtime->buffer_size;; | 226 | entry->buffer_size = runtime->buffer_size; |
| 227 | entry->old_hw_ptr = runtime->status->hw_ptr; | 227 | entry->old_hw_ptr = runtime->status->hw_ptr; |
| 228 | entry->hw_ptr_base = runtime->hw_ptr_base; | 228 | entry->hw_ptr_base = runtime->hw_ptr_base; |
| 229 | log->idx = (log->idx + 1) % XRUN_LOG_CNT; | 229 | log->idx = (log->idx + 1) % XRUN_LOG_CNT; |
diff --git a/sound/oss/dev_table.c b/sound/oss/dev_table.c index 727bdb9ba2dc..d8cf3e58dc76 100644 --- a/sound/oss/dev_table.c +++ b/sound/oss/dev_table.c | |||
| @@ -71,7 +71,7 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver, | |||
| 71 | if (sound_nblocks >= MAX_MEM_BLOCKS) | 71 | if (sound_nblocks >= MAX_MEM_BLOCKS) |
| 72 | sound_nblocks = MAX_MEM_BLOCKS - 1; | 72 | sound_nblocks = MAX_MEM_BLOCKS - 1; |
| 73 | 73 | ||
| 74 | op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct audio_operations))); | 74 | op = (struct audio_operations *) (sound_mem_blocks[sound_nblocks] = vzalloc(sizeof(struct audio_operations))); |
| 75 | sound_nblocks++; | 75 | sound_nblocks++; |
| 76 | if (sound_nblocks >= MAX_MEM_BLOCKS) | 76 | if (sound_nblocks >= MAX_MEM_BLOCKS) |
| 77 | sound_nblocks = MAX_MEM_BLOCKS - 1; | 77 | sound_nblocks = MAX_MEM_BLOCKS - 1; |
| @@ -81,7 +81,6 @@ int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver, | |||
| 81 | sound_unload_audiodev(num); | 81 | sound_unload_audiodev(num); |
| 82 | return -(ENOMEM); | 82 | return -(ENOMEM); |
| 83 | } | 83 | } |
| 84 | memset((char *) op, 0, sizeof(struct audio_operations)); | ||
| 85 | init_waitqueue_head(&op->in_sleeper); | 84 | init_waitqueue_head(&op->in_sleeper); |
| 86 | init_waitqueue_head(&op->out_sleeper); | 85 | init_waitqueue_head(&op->out_sleeper); |
| 87 | init_waitqueue_head(&op->poll_sleeper); | 86 | init_waitqueue_head(&op->poll_sleeper); |
| @@ -128,7 +127,7 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver, | |||
| 128 | /* FIXME: This leaks a mixer_operations struct every time its called | 127 | /* FIXME: This leaks a mixer_operations struct every time its called |
| 129 | until you unload sound! */ | 128 | until you unload sound! */ |
| 130 | 129 | ||
| 131 | op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct mixer_operations))); | 130 | op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vzalloc(sizeof(struct mixer_operations))); |
| 132 | sound_nblocks++; | 131 | sound_nblocks++; |
| 133 | if (sound_nblocks >= MAX_MEM_BLOCKS) | 132 | if (sound_nblocks >= MAX_MEM_BLOCKS) |
| 134 | sound_nblocks = MAX_MEM_BLOCKS - 1; | 133 | sound_nblocks = MAX_MEM_BLOCKS - 1; |
| @@ -137,7 +136,6 @@ int sound_install_mixer(int vers, char *name, struct mixer_operations *driver, | |||
| 137 | printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name); | 136 | printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name); |
| 138 | return -ENOMEM; | 137 | return -ENOMEM; |
| 139 | } | 138 | } |
| 140 | memset((char *) op, 0, sizeof(struct mixer_operations)); | ||
| 141 | memcpy((char *) op, (char *) driver, driver_size); | 139 | memcpy((char *) op, (char *) driver, driver_size); |
| 142 | 140 | ||
| 143 | strlcpy(op->name, name, sizeof(op->name)); | 141 | strlcpy(op->name, name, sizeof(op->name)); |
diff --git a/sound/oss/midibuf.c b/sound/oss/midibuf.c index 782b3b84dac6..ceedb1eff203 100644 --- a/sound/oss/midibuf.c +++ b/sound/oss/midibuf.c | |||
| @@ -178,7 +178,7 @@ int MIDIbuf_open(int dev, struct file *file) | |||
| 178 | return err; | 178 | return err; |
| 179 | 179 | ||
| 180 | parms[dev].prech_timeout = MAX_SCHEDULE_TIMEOUT; | 180 | parms[dev].prech_timeout = MAX_SCHEDULE_TIMEOUT; |
| 181 | midi_in_buf[dev] = (struct midi_buf *) vmalloc(sizeof(struct midi_buf)); | 181 | midi_in_buf[dev] = vmalloc(sizeof(struct midi_buf)); |
| 182 | 182 | ||
| 183 | if (midi_in_buf[dev] == NULL) | 183 | if (midi_in_buf[dev] == NULL) |
| 184 | { | 184 | { |
| @@ -188,7 +188,7 @@ int MIDIbuf_open(int dev, struct file *file) | |||
| 188 | } | 188 | } |
| 189 | midi_in_buf[dev]->len = midi_in_buf[dev]->head = midi_in_buf[dev]->tail = 0; | 189 | midi_in_buf[dev]->len = midi_in_buf[dev]->head = midi_in_buf[dev]->tail = 0; |
| 190 | 190 | ||
| 191 | midi_out_buf[dev] = (struct midi_buf *) vmalloc(sizeof(struct midi_buf)); | 191 | midi_out_buf[dev] = vmalloc(sizeof(struct midi_buf)); |
| 192 | 192 | ||
| 193 | if (midi_out_buf[dev] == NULL) | 193 | if (midi_out_buf[dev] == NULL) |
| 194 | { | 194 | { |
diff --git a/sound/oss/pss.c b/sound/oss/pss.c index e19dd5dcc2de..9b800ce5100e 100644 --- a/sound/oss/pss.c +++ b/sound/oss/pss.c | |||
| @@ -859,7 +859,7 @@ static int pss_coproc_ioctl(void *dev_info, unsigned int cmd, void __user *arg, | |||
| 859 | return 0; | 859 | return 0; |
| 860 | 860 | ||
| 861 | case SNDCTL_COPR_LOAD: | 861 | case SNDCTL_COPR_LOAD: |
| 862 | buf = (copr_buffer *) vmalloc(sizeof(copr_buffer)); | 862 | buf = vmalloc(sizeof(copr_buffer)); |
| 863 | if (buf == NULL) | 863 | if (buf == NULL) |
| 864 | return -ENOSPC; | 864 | return -ENOSPC; |
| 865 | if (copy_from_user(buf, arg, sizeof(copr_buffer))) { | 865 | if (copy_from_user(buf, arg, sizeof(copr_buffer))) { |
| @@ -871,7 +871,7 @@ static int pss_coproc_ioctl(void *dev_info, unsigned int cmd, void __user *arg, | |||
| 871 | return err; | 871 | return err; |
| 872 | 872 | ||
| 873 | case SNDCTL_COPR_SENDMSG: | 873 | case SNDCTL_COPR_SENDMSG: |
| 874 | mbuf = (copr_msg *)vmalloc(sizeof(copr_msg)); | 874 | mbuf = vmalloc(sizeof(copr_msg)); |
| 875 | if (mbuf == NULL) | 875 | if (mbuf == NULL) |
| 876 | return -ENOSPC; | 876 | return -ENOSPC; |
| 877 | if (copy_from_user(mbuf, arg, sizeof(copr_msg))) { | 877 | if (copy_from_user(mbuf, arg, sizeof(copr_msg))) { |
| @@ -895,7 +895,7 @@ static int pss_coproc_ioctl(void *dev_info, unsigned int cmd, void __user *arg, | |||
| 895 | 895 | ||
| 896 | case SNDCTL_COPR_RCVMSG: | 896 | case SNDCTL_COPR_RCVMSG: |
| 897 | err = 0; | 897 | err = 0; |
| 898 | mbuf = (copr_msg *)vmalloc(sizeof(copr_msg)); | 898 | mbuf = vmalloc(sizeof(copr_msg)); |
| 899 | if (mbuf == NULL) | 899 | if (mbuf == NULL) |
| 900 | return -ENOSPC; | 900 | return -ENOSPC; |
| 901 | data = (unsigned short *)mbuf->data; | 901 | data = (unsigned short *)mbuf->data; |
diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c index e85789e53816..5ea1098ac427 100644 --- a/sound/oss/sequencer.c +++ b/sound/oss/sequencer.c | |||
| @@ -1646,13 +1646,13 @@ void sequencer_init(void) | |||
| 1646 | { | 1646 | { |
| 1647 | if (sequencer_ok) | 1647 | if (sequencer_ok) |
| 1648 | return; | 1648 | return; |
| 1649 | queue = (unsigned char *)vmalloc(SEQ_MAX_QUEUE * EV_SZ); | 1649 | queue = vmalloc(SEQ_MAX_QUEUE * EV_SZ); |
| 1650 | if (queue == NULL) | 1650 | if (queue == NULL) |
| 1651 | { | 1651 | { |
| 1652 | printk(KERN_ERR "sequencer: Can't allocate memory for sequencer output queue\n"); | 1652 | printk(KERN_ERR "sequencer: Can't allocate memory for sequencer output queue\n"); |
| 1653 | return; | 1653 | return; |
| 1654 | } | 1654 | } |
| 1655 | iqueue = (unsigned char *)vmalloc(SEQ_MAX_QUEUE * IEV_SZ); | 1655 | iqueue = vmalloc(SEQ_MAX_QUEUE * IEV_SZ); |
| 1656 | if (iqueue == NULL) | 1656 | if (iqueue == NULL) |
| 1657 | { | 1657 | { |
| 1658 | printk(KERN_ERR "sequencer: Can't allocate memory for sequencer input queue\n"); | 1658 | printk(KERN_ERR "sequencer: Can't allocate memory for sequencer input queue\n"); |
diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index 62895a719fcb..22dbd91811a4 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c | |||
| @@ -435,7 +435,7 @@ void __devexit asihpi_adapter_remove(struct pci_dev *pci_dev) | |||
| 435 | struct hpi_message hm; | 435 | struct hpi_message hm; |
| 436 | struct hpi_response hr; | 436 | struct hpi_response hr; |
| 437 | struct hpi_adapter *pa; | 437 | struct hpi_adapter *pa; |
| 438 | pa = (struct hpi_adapter *)pci_get_drvdata(pci_dev); | 438 | pa = pci_get_drvdata(pci_dev); |
| 439 | 439 | ||
| 440 | hpi_init_message_response(&hm, &hr, HPI_OBJ_SUBSYSTEM, | 440 | hpi_init_message_response(&hm, &hr, HPI_OBJ_SUBSYSTEM, |
| 441 | HPI_SUBSYS_DELETE_ADAPTER); | 441 | HPI_SUBSYS_DELETE_ADAPTER); |
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 4679ed83a43b..2f3cacbd5528 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
| @@ -1129,10 +1129,11 @@ snd_azf3328_codec_setdmaa(struct snd_azf3328 *chip, | |||
| 1129 | 1129 | ||
| 1130 | count_areas = size/2; | 1130 | count_areas = size/2; |
| 1131 | addr_area2 = addr+count_areas; | 1131 | addr_area2 = addr+count_areas; |
| 1132 | count_areas--; /* max. index */ | ||
| 1133 | snd_azf3328_dbgcodec("setdma: buffers %08lx[%u] / %08lx[%u]\n", | 1132 | snd_azf3328_dbgcodec("setdma: buffers %08lx[%u] / %08lx[%u]\n", |
| 1134 | addr, count_areas, addr_area2, count_areas); | 1133 | addr, count_areas, addr_area2, count_areas); |
| 1135 | 1134 | ||
| 1135 | count_areas--; /* max. index */ | ||
| 1136 | |||
| 1136 | /* build combined I/O buffer length word */ | 1137 | /* build combined I/O buffer length word */ |
| 1137 | lengths = (count_areas << 16) | (count_areas); | 1138 | lengths = (count_areas << 16) | (count_areas); |
| 1138 | spin_lock_irqsave(&chip->reg_lock, flags); | 1139 | spin_lock_irqsave(&chip->reg_lock, flags); |
| @@ -1740,11 +1741,15 @@ static const struct snd_pcm_hardware snd_azf3328_hardware = | |||
| 1740 | .rate_max = AZF_FREQ_66200, | 1741 | .rate_max = AZF_FREQ_66200, |
| 1741 | .channels_min = 1, | 1742 | .channels_min = 1, |
| 1742 | .channels_max = 2, | 1743 | .channels_max = 2, |
| 1743 | .buffer_bytes_max = 65536, | 1744 | .buffer_bytes_max = (64*1024), |
| 1744 | .period_bytes_min = 64, | 1745 | .period_bytes_min = 1024, |
| 1745 | .period_bytes_max = 65536, | 1746 | .period_bytes_max = (32*1024), |
| 1746 | .periods_min = 1, | 1747 | /* We simply have two DMA areas (instead of a list of descriptors |
| 1747 | .periods_max = 1024, | 1748 | such as other cards); I believe that this is a fixed hardware |
| 1749 | attribute and there isn't much driver magic to be done to expand it. | ||
| 1750 | Thus indicate that we have at least and at most 2 periods. */ | ||
| 1751 | .periods_min = 2, | ||
| 1752 | .periods_max = 2, | ||
| 1748 | /* FIXME: maybe that card actually has a FIFO? | 1753 | /* FIXME: maybe that card actually has a FIFO? |
| 1749 | * Hmm, it seems newer revisions do have one, but we still don't know | 1754 | * Hmm, it seems newer revisions do have one, but we still don't know |
| 1750 | * its size... */ | 1755 | * its size... */ |
| @@ -1980,8 +1985,13 @@ snd_azf3328_timer_stop(struct snd_timer *timer) | |||
| 1980 | chip = snd_timer_chip(timer); | 1985 | chip = snd_timer_chip(timer); |
| 1981 | spin_lock_irqsave(&chip->reg_lock, flags); | 1986 | spin_lock_irqsave(&chip->reg_lock, flags); |
| 1982 | /* disable timer countdown and interrupt */ | 1987 | /* disable timer countdown and interrupt */ |
| 1983 | /* FIXME: should we write TIMER_IRQ_ACK here? */ | 1988 | /* Hmm, should we write TIMER_IRQ_ACK here? |
| 1984 | snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0); | 1989 | YES indeed, otherwise a rogue timer operation - which prompts |
| 1990 | ALSA(?) to call repeated stop() in vain, but NOT start() - | ||
| 1991 | will never end (value 0x03 is kept shown in control byte). | ||
| 1992 | Simply manually poking 0x04 _once_ immediately successfully stops | ||
| 1993 | the hardware/ALSA interrupt activity. */ | ||
| 1994 | snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x04); | ||
| 1985 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1995 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
| 1986 | snd_azf3328_dbgcallleave(); | 1996 | snd_azf3328_dbgcallleave(); |
| 1987 | return 0; | 1997 | return 0; |
diff --git a/sound/pci/ctxfi/ctpcm.c b/sound/pci/ctxfi/ctpcm.c index 85ab43e89212..457d21189b0d 100644 --- a/sound/pci/ctxfi/ctpcm.c +++ b/sound/pci/ctxfi/ctpcm.c | |||
| @@ -129,8 +129,6 @@ static int ct_pcm_playback_open(struct snd_pcm_substream *substream) | |||
| 129 | 129 | ||
| 130 | apcm->substream = substream; | 130 | apcm->substream = substream; |
| 131 | apcm->interrupt = ct_atc_pcm_interrupt; | 131 | apcm->interrupt = ct_atc_pcm_interrupt; |
| 132 | runtime->private_data = apcm; | ||
| 133 | runtime->private_free = ct_atc_pcm_free_substream; | ||
| 134 | if (IEC958 == substream->pcm->device) { | 132 | if (IEC958 == substream->pcm->device) { |
| 135 | runtime->hw = ct_spdif_passthru_playback_hw; | 133 | runtime->hw = ct_spdif_passthru_playback_hw; |
| 136 | atc->spdif_out_passthru(atc, 1); | 134 | atc->spdif_out_passthru(atc, 1); |
| @@ -155,8 +153,12 @@ static int ct_pcm_playback_open(struct snd_pcm_substream *substream) | |||
| 155 | } | 153 | } |
| 156 | 154 | ||
| 157 | apcm->timer = ct_timer_instance_new(atc->timer, apcm); | 155 | apcm->timer = ct_timer_instance_new(atc->timer, apcm); |
| 158 | if (!apcm->timer) | 156 | if (!apcm->timer) { |
| 157 | kfree(apcm); | ||
| 159 | return -ENOMEM; | 158 | return -ENOMEM; |
| 159 | } | ||
| 160 | runtime->private_data = apcm; | ||
| 161 | runtime->private_free = ct_atc_pcm_free_substream; | ||
| 160 | 162 | ||
| 161 | return 0; | 163 | return 0; |
| 162 | } | 164 | } |
| @@ -278,8 +280,6 @@ static int ct_pcm_capture_open(struct snd_pcm_substream *substream) | |||
| 278 | apcm->started = 0; | 280 | apcm->started = 0; |
| 279 | apcm->substream = substream; | 281 | apcm->substream = substream; |
| 280 | apcm->interrupt = ct_atc_pcm_interrupt; | 282 | apcm->interrupt = ct_atc_pcm_interrupt; |
| 281 | runtime->private_data = apcm; | ||
| 282 | runtime->private_free = ct_atc_pcm_free_substream; | ||
| 283 | runtime->hw = ct_pcm_capture_hw; | 283 | runtime->hw = ct_pcm_capture_hw; |
| 284 | runtime->hw.rate_max = atc->rsr * atc->msr; | 284 | runtime->hw.rate_max = atc->rsr * atc->msr; |
| 285 | 285 | ||
| @@ -298,8 +298,12 @@ static int ct_pcm_capture_open(struct snd_pcm_substream *substream) | |||
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | apcm->timer = ct_timer_instance_new(atc->timer, apcm); | 300 | apcm->timer = ct_timer_instance_new(atc->timer, apcm); |
| 301 | if (!apcm->timer) | 301 | if (!apcm->timer) { |
| 302 | kfree(apcm); | ||
| 302 | return -ENOMEM; | 303 | return -ENOMEM; |
| 304 | } | ||
| 305 | runtime->private_data = apcm; | ||
| 306 | runtime->private_free = ct_atc_pcm_free_substream; | ||
| 303 | 307 | ||
| 304 | return 0; | 308 | return 0; |
| 305 | } | 309 | } |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 6361f752b5f3..846d1ead47fd 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
| @@ -3100,6 +3100,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { | |||
| 3100 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), | 3100 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), |
| 3101 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), | 3101 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), |
| 3102 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), | 3102 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), |
| 3103 | SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_HP_LAPTOP), | ||
| 3103 | SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), | 3104 | SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), |
| 3104 | SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), | 3105 | SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), |
| 3105 | SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), | 3106 | SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), |
| @@ -3110,6 +3111,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { | |||
| 3110 | SND_PCI_QUIRK(0x17aa, 0x21b2, "Thinkpad X100e", CXT5066_IDEAPAD), | 3111 | SND_PCI_QUIRK(0x17aa, 0x21b2, "Thinkpad X100e", CXT5066_IDEAPAD), |
| 3111 | SND_PCI_QUIRK(0x17aa, 0x21b3, "Thinkpad Edge 13 (197)", CXT5066_IDEAPAD), | 3112 | SND_PCI_QUIRK(0x17aa, 0x21b3, "Thinkpad Edge 13 (197)", CXT5066_IDEAPAD), |
| 3112 | SND_PCI_QUIRK(0x17aa, 0x21b4, "Thinkpad Edge", CXT5066_IDEAPAD), | 3113 | SND_PCI_QUIRK(0x17aa, 0x21b4, "Thinkpad Edge", CXT5066_IDEAPAD), |
| 3114 | SND_PCI_QUIRK(0x17aa, 0x21c8, "Thinkpad Edge 11", CXT5066_IDEAPAD), | ||
| 3113 | SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), | 3115 | SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), |
| 3114 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G series", CXT5066_IDEAPAD), | 3116 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G series", CXT5066_IDEAPAD), |
| 3115 | SND_PCI_QUIRK(0x17aa, 0x390a, "Lenovo S10-3t", CXT5066_IDEAPAD), | 3117 | SND_PCI_QUIRK(0x17aa, 0x390a, "Lenovo S10-3t", CXT5066_IDEAPAD), |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 5f00589cb791..0ac6aed0c889 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -14623,7 +14623,10 @@ static int alc275_setup_dual_adc(struct hda_codec *codec) | |||
| 14623 | /* different alc269-variants */ | 14623 | /* different alc269-variants */ |
| 14624 | enum { | 14624 | enum { |
| 14625 | ALC269_TYPE_NORMAL, | 14625 | ALC269_TYPE_NORMAL, |
| 14626 | ALC269_TYPE_ALC258, | ||
| 14626 | ALC269_TYPE_ALC259, | 14627 | ALC269_TYPE_ALC259, |
| 14628 | ALC269_TYPE_ALC269VB, | ||
| 14629 | ALC269_TYPE_ALC270, | ||
| 14627 | ALC269_TYPE_ALC271X, | 14630 | ALC269_TYPE_ALC271X, |
| 14628 | }; | 14631 | }; |
| 14629 | 14632 | ||
| @@ -15023,7 +15026,7 @@ static int alc269_fill_coef(struct hda_codec *codec) | |||
| 15023 | static int patch_alc269(struct hda_codec *codec) | 15026 | static int patch_alc269(struct hda_codec *codec) |
| 15024 | { | 15027 | { |
| 15025 | struct alc_spec *spec; | 15028 | struct alc_spec *spec; |
| 15026 | int board_config; | 15029 | int board_config, coef; |
| 15027 | int err; | 15030 | int err; |
| 15028 | 15031 | ||
| 15029 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 15032 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| @@ -15034,14 +15037,23 @@ static int patch_alc269(struct hda_codec *codec) | |||
| 15034 | 15037 | ||
| 15035 | alc_auto_parse_customize_define(codec); | 15038 | alc_auto_parse_customize_define(codec); |
| 15036 | 15039 | ||
| 15037 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ | 15040 | coef = alc_read_coef_idx(codec, 0); |
| 15041 | if ((coef & 0x00f0) == 0x0010) { | ||
| 15038 | if (codec->bus->pci->subsystem_vendor == 0x1025 && | 15042 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
| 15039 | spec->cdefine.platform_type == 1) { | 15043 | spec->cdefine.platform_type == 1) { |
| 15040 | alc_codec_rename(codec, "ALC271X"); | 15044 | alc_codec_rename(codec, "ALC271X"); |
| 15041 | spec->codec_variant = ALC269_TYPE_ALC271X; | 15045 | spec->codec_variant = ALC269_TYPE_ALC271X; |
| 15042 | } else { | 15046 | } else if ((coef & 0xf000) == 0x1000) { |
| 15047 | spec->codec_variant = ALC269_TYPE_ALC270; | ||
| 15048 | } else if ((coef & 0xf000) == 0x2000) { | ||
| 15043 | alc_codec_rename(codec, "ALC259"); | 15049 | alc_codec_rename(codec, "ALC259"); |
| 15044 | spec->codec_variant = ALC269_TYPE_ALC259; | 15050 | spec->codec_variant = ALC269_TYPE_ALC259; |
| 15051 | } else if ((coef & 0xf000) == 0x3000) { | ||
| 15052 | alc_codec_rename(codec, "ALC258"); | ||
| 15053 | spec->codec_variant = ALC269_TYPE_ALC258; | ||
| 15054 | } else { | ||
| 15055 | alc_codec_rename(codec, "ALC269VB"); | ||
| 15056 | spec->codec_variant = ALC269_TYPE_ALC269VB; | ||
| 15045 | } | 15057 | } |
| 15046 | } else | 15058 | } else |
| 15047 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | 15059 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| @@ -15104,7 +15116,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
| 15104 | spec->stream_digital_capture = &alc269_pcm_digital_capture; | 15116 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 15105 | 15117 | ||
| 15106 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ | 15118 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
| 15107 | if (spec->codec_variant != ALC269_TYPE_NORMAL) { | 15119 | if (spec->codec_variant == ALC269_TYPE_NORMAL) { |
| 15108 | spec->adc_nids = alc269_adc_nids; | 15120 | spec->adc_nids = alc269_adc_nids; |
| 15109 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | 15121 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 15110 | spec->capsrc_nids = alc269_capsrc_nids; | 15122 | spec->capsrc_nids = alc269_capsrc_nids; |
| @@ -19298,6 +19310,7 @@ static const struct alc_fixup alc662_fixups[] = { | |||
| 19298 | 19310 | ||
| 19299 | static struct snd_pci_quirk alc662_fixup_tbl[] = { | 19311 | static struct snd_pci_quirk alc662_fixup_tbl[] = { |
| 19300 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), | 19312 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
| 19313 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), | ||
| 19301 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), | 19314 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
| 19302 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), | 19315 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
| 19303 | {} | 19316 | {} |
| @@ -19419,7 +19432,10 @@ static int patch_alc888(struct hda_codec *codec) | |||
| 19419 | { | 19432 | { |
| 19420 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ | 19433 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
| 19421 | kfree(codec->chip_name); | 19434 | kfree(codec->chip_name); |
| 19422 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); | 19435 | if (codec->vendor_id == 0x10ec0887) |
| 19436 | codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); | ||
| 19437 | else | ||
| 19438 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); | ||
| 19423 | if (!codec->chip_name) { | 19439 | if (!codec->chip_name) { |
| 19424 | alc_free(codec); | 19440 | alc_free(codec); |
| 19425 | return -ENOMEM; | 19441 | return -ENOMEM; |
| @@ -19909,7 +19925,7 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
| 19909 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", | 19925 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
| 19910 | .patch = patch_alc882 }, | 19926 | .patch = patch_alc882 }, |
| 19911 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, | 19927 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
| 19912 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, | 19928 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
| 19913 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", | 19929 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
| 19914 | .patch = patch_alc882 }, | 19930 | .patch = patch_alc882 }, |
| 19915 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, | 19931 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 93fa59cc60ef..5c710807dfe5 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
| @@ -389,6 +389,11 @@ static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = { | |||
| 389 | 0x11, 0x20, 0 | 389 | 0x11, 0x20, 0 |
| 390 | }; | 390 | }; |
| 391 | 391 | ||
| 392 | #define STAC92HD87B_NUM_DMICS 1 | ||
| 393 | static hda_nid_t stac92hd87b_dmic_nids[STAC92HD87B_NUM_DMICS + 1] = { | ||
| 394 | 0x11, 0 | ||
| 395 | }; | ||
| 396 | |||
| 392 | #define STAC92HD83XXX_NUM_CAPS 2 | 397 | #define STAC92HD83XXX_NUM_CAPS 2 |
| 393 | static unsigned long stac92hd83xxx_capvols[] = { | 398 | static unsigned long stac92hd83xxx_capvols[] = { |
| 394 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | 399 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| @@ -3486,10 +3491,8 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, | |||
| 3486 | return err; | 3491 | return err; |
| 3487 | } | 3492 | } |
| 3488 | 3493 | ||
| 3489 | if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) { | 3494 | if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) |
| 3490 | snd_hda_add_imux_item(imux, label, index, NULL); | 3495 | snd_hda_add_imux_item(imux, label, index, NULL); |
| 3491 | spec->num_analog_muxes++; | ||
| 3492 | } | ||
| 3493 | } | 3496 | } |
| 3494 | 3497 | ||
| 3495 | return 0; | 3498 | return 0; |
| @@ -5452,12 +5455,17 @@ again: | |||
| 5452 | stac92hd83xxx_brd_tbl[spec->board_config]); | 5455 | stac92hd83xxx_brd_tbl[spec->board_config]); |
| 5453 | 5456 | ||
| 5454 | switch (codec->vendor_id) { | 5457 | switch (codec->vendor_id) { |
| 5458 | case 0x111d76d1: | ||
| 5459 | case 0x111d76d9: | ||
| 5460 | spec->dmic_nids = stac92hd87b_dmic_nids; | ||
| 5461 | spec->num_dmics = stac92xx_connected_ports(codec, | ||
| 5462 | stac92hd87b_dmic_nids, | ||
| 5463 | STAC92HD87B_NUM_DMICS); | ||
| 5464 | /* Fall through */ | ||
| 5455 | case 0x111d7666: | 5465 | case 0x111d7666: |
| 5456 | case 0x111d7667: | 5466 | case 0x111d7667: |
| 5457 | case 0x111d7668: | 5467 | case 0x111d7668: |
| 5458 | case 0x111d7669: | 5468 | case 0x111d7669: |
| 5459 | case 0x111d76d1: | ||
| 5460 | case 0x111d76d9: | ||
| 5461 | spec->num_pins = ARRAY_SIZE(stac92hd88xxx_pin_nids); | 5469 | spec->num_pins = ARRAY_SIZE(stac92hd88xxx_pin_nids); |
| 5462 | spec->pin_nids = stac92hd88xxx_pin_nids; | 5470 | spec->pin_nids = stac92hd88xxx_pin_nids; |
| 5463 | spec->mono_nid = 0; | 5471 | spec->mono_nid = 0; |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 400f9ebd243e..629a5494347a 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
| @@ -1866,6 +1866,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
| 1866 | }, | 1866 | }, |
| 1867 | { | 1867 | { |
| 1868 | .subvendor = 0x1028, | 1868 | .subvendor = 0x1028, |
| 1869 | .subdevice = 0x0182, | ||
| 1870 | .name = "Dell Latitude D610", /* STAC9750/51 */ | ||
| 1871 | .type = AC97_TUNE_HP_ONLY | ||
| 1872 | }, | ||
| 1873 | { | ||
| 1874 | .subvendor = 0x1028, | ||
| 1869 | .subdevice = 0x0186, | 1875 | .subdevice = 0x0186, |
| 1870 | .name = "Dell Latitude D810", /* cf. Malone #41015 */ | 1876 | .name = "Dell Latitude D810", /* cf. Malone #41015 */ |
| 1871 | .type = AC97_TUNE_HP_MUTE_LED | 1877 | .type = AC97_TUNE_HP_MUTE_LED |
diff --git a/sound/pci/mixart/mixart_hwdep.h b/sound/pci/mixart/mixart_hwdep.h index a46f5083db99..812e288ef2e7 100644 --- a/sound/pci/mixart/mixart_hwdep.h +++ b/sound/pci/mixart/mixart_hwdep.h | |||
| @@ -25,11 +25,21 @@ | |||
| 25 | 25 | ||
| 26 | #include <sound/hwdep.h> | 26 | #include <sound/hwdep.h> |
| 27 | 27 | ||
| 28 | #ifndef readl_be | ||
| 28 | #define readl_be(x) be32_to_cpu(__raw_readl(x)) | 29 | #define readl_be(x) be32_to_cpu(__raw_readl(x)) |
| 30 | #endif | ||
| 31 | |||
| 32 | #ifndef writel_be | ||
| 29 | #define writel_be(data,addr) __raw_writel(cpu_to_be32(data),addr) | 33 | #define writel_be(data,addr) __raw_writel(cpu_to_be32(data),addr) |
| 34 | #endif | ||
| 30 | 35 | ||
| 36 | #ifndef readl_le | ||
| 31 | #define readl_le(x) le32_to_cpu(__raw_readl(x)) | 37 | #define readl_le(x) le32_to_cpu(__raw_readl(x)) |
| 38 | #endif | ||
| 39 | |||
| 40 | #ifndef writel_le | ||
| 32 | #define writel_le(data,addr) __raw_writel(cpu_to_le32(data),addr) | 41 | #define writel_le(data,addr) __raw_writel(cpu_to_le32(data),addr) |
| 42 | #endif | ||
| 33 | 43 | ||
| 34 | #define MIXART_MEM(mgr,x) ((mgr)->mem[0].virt + (x)) | 44 | #define MIXART_MEM(mgr,x) ((mgr)->mem[0].virt + (x)) |
| 35 | #define MIXART_REG(mgr,x) ((mgr)->mem[1].virt + (x)) | 45 | #define MIXART_REG(mgr,x) ((mgr)->mem[1].virt + (x)) |
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index 85081172403f..b47cfd45b3b9 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c | |||
| @@ -1228,10 +1228,8 @@ int __devinit snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) | |||
| 1228 | chip->rsrc[i].start + 1, | 1228 | chip->rsrc[i].start + 1, |
| 1229 | rnames[i]) == NULL) { | 1229 | rnames[i]) == NULL) { |
| 1230 | printk(KERN_ERR "snd: can't request rsrc " | 1230 | printk(KERN_ERR "snd: can't request rsrc " |
| 1231 | " %d (%s: 0x%016llx:%016llx)\n", | 1231 | " %d (%s: %pR)\n", |
| 1232 | i, rnames[i], | 1232 | i, rnames[i], &chip->rsrc[i]); |
| 1233 | (unsigned long long)chip->rsrc[i].start, | ||
| 1234 | (unsigned long long)chip->rsrc[i].end); | ||
| 1235 | err = -ENODEV; | 1233 | err = -ENODEV; |
| 1236 | goto __error; | 1234 | goto __error; |
| 1237 | } | 1235 | } |
| @@ -1256,10 +1254,8 @@ int __devinit snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) | |||
| 1256 | chip->rsrc[i].start + 1, | 1254 | chip->rsrc[i].start + 1, |
| 1257 | rnames[i]) == NULL) { | 1255 | rnames[i]) == NULL) { |
| 1258 | printk(KERN_ERR "snd: can't request rsrc " | 1256 | printk(KERN_ERR "snd: can't request rsrc " |
| 1259 | " %d (%s: 0x%016llx:%016llx)\n", | 1257 | " %d (%s: %pR)\n", |
| 1260 | i, rnames[i], | 1258 | i, rnames[i], &chip->rsrc[i]); |
| 1261 | (unsigned long long)chip->rsrc[i].start, | ||
| 1262 | (unsigned long long)chip->rsrc[i].end); | ||
| 1263 | err = -ENODEV; | 1259 | err = -ENODEV; |
| 1264 | goto __error; | 1260 | goto __error; |
| 1265 | } | 1261 | } |
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig index e720d5e6f04c..bee3c94f58b0 100644 --- a/sound/soc/atmel/Kconfig +++ b/sound/soc/atmel/Kconfig | |||
| @@ -16,7 +16,8 @@ config SND_ATMEL_SOC_SSC | |||
| 16 | 16 | ||
| 17 | config SND_AT91_SOC_SAM9G20_WM8731 | 17 | config SND_AT91_SOC_SAM9G20_WM8731 |
| 18 | tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board" | 18 | tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board" |
| 19 | depends on ATMEL_SSC && ARCH_AT91SAM9G20 && SND_ATMEL_SOC | 19 | depends on ATMEL_SSC && ARCH_AT91SAM9G20 && SND_ATMEL_SOC && \ |
| 20 | AT91_PROGRAMMABLE_CLOCKS | ||
| 20 | select SND_ATMEL_SOC_SSC | 21 | select SND_ATMEL_SOC_SSC |
| 21 | select SND_SOC_WM8731 | 22 | select SND_SOC_WM8731 |
| 22 | help | 23 | help |
| @@ -25,7 +26,7 @@ config SND_AT91_SOC_SAM9G20_WM8731 | |||
| 25 | 26 | ||
| 26 | config SND_AT32_SOC_PLAYPAQ | 27 | config SND_AT32_SOC_PLAYPAQ |
| 27 | tristate "SoC Audio support for PlayPaq with WM8510" | 28 | tristate "SoC Audio support for PlayPaq with WM8510" |
| 28 | depends on SND_ATMEL_SOC && BOARD_PLAYPAQ | 29 | depends on SND_ATMEL_SOC && BOARD_PLAYPAQ && AT91_PROGRAMMABLE_CLOCKS |
| 29 | select SND_ATMEL_SOC_SSC | 30 | select SND_ATMEL_SOC_SSC |
| 30 | select SND_SOC_WM8510 | 31 | select SND_SOC_WM8510 |
| 31 | help | 32 | help |
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index bc22ee93a75d..470cb93b1d1f 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c | |||
| @@ -28,6 +28,11 @@ | |||
| 28 | #include <sound/max98088.h> | 28 | #include <sound/max98088.h> |
| 29 | #include "max98088.h" | 29 | #include "max98088.h" |
| 30 | 30 | ||
| 31 | enum max98088_type { | ||
| 32 | MAX98088, | ||
| 33 | MAX98089, | ||
| 34 | }; | ||
| 35 | |||
| 31 | struct max98088_cdata { | 36 | struct max98088_cdata { |
| 32 | unsigned int rate; | 37 | unsigned int rate; |
| 33 | unsigned int fmt; | 38 | unsigned int fmt; |
| @@ -36,6 +41,7 @@ struct max98088_cdata { | |||
| 36 | 41 | ||
| 37 | struct max98088_priv { | 42 | struct max98088_priv { |
| 38 | u8 reg_cache[M98088_REG_CNT]; | 43 | u8 reg_cache[M98088_REG_CNT]; |
| 44 | enum max98088_type devtype; | ||
| 39 | void *control_data; | 45 | void *control_data; |
| 40 | struct max98088_pdata *pdata; | 46 | struct max98088_pdata *pdata; |
| 41 | unsigned int sysclk; | 47 | unsigned int sysclk; |
| @@ -2040,6 +2046,8 @@ static int max98088_i2c_probe(struct i2c_client *i2c, | |||
| 2040 | if (max98088 == NULL) | 2046 | if (max98088 == NULL) |
| 2041 | return -ENOMEM; | 2047 | return -ENOMEM; |
| 2042 | 2048 | ||
| 2049 | max98088->devtype = id->driver_data; | ||
| 2050 | |||
| 2043 | i2c_set_clientdata(i2c, max98088); | 2051 | i2c_set_clientdata(i2c, max98088); |
| 2044 | max98088->control_data = i2c; | 2052 | max98088->control_data = i2c; |
| 2045 | max98088->pdata = i2c->dev.platform_data; | 2053 | max98088->pdata = i2c->dev.platform_data; |
| @@ -2059,7 +2067,8 @@ static int __devexit max98088_i2c_remove(struct i2c_client *client) | |||
| 2059 | } | 2067 | } |
| 2060 | 2068 | ||
| 2061 | static const struct i2c_device_id max98088_i2c_id[] = { | 2069 | static const struct i2c_device_id max98088_i2c_id[] = { |
| 2062 | { "max98088", 0 }, | 2070 | { "max98088", MAX98088 }, |
| 2071 | { "max98089", MAX98089 }, | ||
| 2063 | { } | 2072 | { } |
| 2064 | }; | 2073 | }; |
| 2065 | MODULE_DEVICE_TABLE(i2c, max98088_i2c_id); | 2074 | MODULE_DEVICE_TABLE(i2c, max98088_i2c_id); |
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index 7540a509a6f5..464f0cfa4c7a 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c | |||
| @@ -597,6 +597,7 @@ static struct snd_soc_codec_driver soc_codec_dev_uda134x = { | |||
| 597 | .resume = uda134x_soc_resume, | 597 | .resume = uda134x_soc_resume, |
| 598 | .reg_cache_size = sizeof(uda134x_reg), | 598 | .reg_cache_size = sizeof(uda134x_reg), |
| 599 | .reg_word_size = sizeof(u8), | 599 | .reg_word_size = sizeof(u8), |
| 600 | .reg_cache_default = uda134x_reg, | ||
| 600 | .reg_cache_step = 1, | 601 | .reg_cache_step = 1, |
| 601 | .read = uda134x_read_reg_cache, | 602 | .read = uda134x_read_reg_cache, |
| 602 | .write = uda134x_write, | 603 | .write = uda134x_write, |
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index f4f1fba38eb9..7611add7f8c3 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
| @@ -831,7 +831,7 @@ static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
| 831 | } | 831 | } |
| 832 | 832 | ||
| 833 | /* MCLK direction */ | 833 | /* MCLK direction */ |
| 834 | if (dir == WM8350_MCLK_DIR_OUT) | 834 | if (dir == SND_SOC_CLOCK_OUT) |
| 835 | wm8350_set_bits(wm8350, WM8350_CLOCK_CONTROL_2, | 835 | wm8350_set_bits(wm8350, WM8350_CLOCK_CONTROL_2, |
| 836 | WM8350_MCLK_DIR); | 836 | WM8350_MCLK_DIR); |
| 837 | else | 837 | else |
| @@ -1586,6 +1586,13 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) | |||
| 1586 | wm8350_set_bits(wm8350, WM8350_ROUT2_VOLUME, | 1586 | wm8350_set_bits(wm8350, WM8350_ROUT2_VOLUME, |
| 1587 | WM8350_OUT2_VU | WM8350_OUT2R_MUTE); | 1587 | WM8350_OUT2_VU | WM8350_OUT2R_MUTE); |
| 1588 | 1588 | ||
| 1589 | /* Make sure AIF tristating is disabled by default */ | ||
| 1590 | wm8350_clear_bits(wm8350, WM8350_AI_FORMATING, WM8350_AIF_TRI); | ||
| 1591 | |||
| 1592 | /* Make sure we've got a sane companding setup too */ | ||
| 1593 | wm8350_clear_bits(wm8350, WM8350_ADC_DAC_COMP, | ||
| 1594 | WM8350_DAC_COMP | WM8350_LOOPBACK); | ||
| 1595 | |||
| 1589 | /* Make sure jack detect is disabled to start off with */ | 1596 | /* Make sure jack detect is disabled to start off with */ |
| 1590 | wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, | 1597 | wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, |
| 1591 | WM8350_JDL_ENA | WM8350_JDR_ENA); | 1598 | WM8350_JDL_ENA | WM8350_JDR_ENA); |
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index 04182c464e35..0132a27140ae 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c | |||
| @@ -34,7 +34,6 @@ | |||
| 34 | /* codec private data */ | 34 | /* codec private data */ |
| 35 | struct wm8776_priv { | 35 | struct wm8776_priv { |
| 36 | enum snd_soc_control_type control_type; | 36 | enum snd_soc_control_type control_type; |
| 37 | u16 reg_cache[WM8776_CACHEREGNUM]; | ||
| 38 | int sysclk[2]; | 37 | int sysclk[2]; |
| 39 | }; | 38 | }; |
| 40 | 39 | ||
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 894d0cd3aa9b..e8092745a207 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c | |||
| @@ -3500,8 +3500,11 @@ static ssize_t wm8962_beep_set(struct device *dev, | |||
| 3500 | { | 3500 | { |
| 3501 | struct wm8962_priv *wm8962 = dev_get_drvdata(dev); | 3501 | struct wm8962_priv *wm8962 = dev_get_drvdata(dev); |
| 3502 | long int time; | 3502 | long int time; |
| 3503 | int ret; | ||
| 3503 | 3504 | ||
| 3504 | strict_strtol(buf, 10, &time); | 3505 | ret = strict_strtol(buf, 10, &time); |
| 3506 | if (ret != 0) | ||
| 3507 | return ret; | ||
| 3505 | 3508 | ||
| 3506 | input_event(wm8962->beep, EV_SND, SND_TONE, time); | 3509 | input_event(wm8962->beep, EV_SND, SND_TONE, time); |
| 3507 | 3510 | ||
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 0db59c3aa5d4..830dfdd66c5f 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
| @@ -3903,6 +3903,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
| 3903 | return -ENOMEM; | 3903 | return -ENOMEM; |
| 3904 | snd_soc_codec_set_drvdata(codec, wm8994); | 3904 | snd_soc_codec_set_drvdata(codec, wm8994); |
| 3905 | 3905 | ||
| 3906 | codec->reg_cache = &wm8994->reg_cache; | ||
| 3907 | |||
| 3906 | wm8994->pdata = dev_get_platdata(codec->dev->parent); | 3908 | wm8994->pdata = dev_get_platdata(codec->dev->parent); |
| 3907 | wm8994->codec = codec; | 3909 | wm8994->codec = codec; |
| 3908 | 3910 | ||
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index 2b07b17a6b2d..bc9e6b0b3f6f 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c | |||
| @@ -157,12 +157,23 @@ static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) | |||
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | /* davinci-evm digital audio interface glue - connects codec <--> CPU */ | 159 | /* davinci-evm digital audio interface glue - connects codec <--> CPU */ |
| 160 | static struct snd_soc_dai_link evm_dai = { | 160 | static struct snd_soc_dai_link dm6446_evm_dai = { |
| 161 | .name = "TLV320AIC3X", | 161 | .name = "TLV320AIC3X", |
| 162 | .stream_name = "AIC3X", | 162 | .stream_name = "AIC3X", |
| 163 | .cpu_dai_name = "davinci-mcasp.0", | 163 | .cpu_dai_name = "davinci-mcbsp", |
| 164 | .codec_dai_name = "tlv320aic3x-hifi", | 164 | .codec_dai_name = "tlv320aic3x-hifi", |
| 165 | .codec_name = "tlv320aic3x-codec.0-001a", | 165 | .codec_name = "tlv320aic3x-codec.1-001b", |
| 166 | .platform_name = "davinci-pcm-audio", | ||
| 167 | .init = evm_aic3x_init, | ||
| 168 | .ops = &evm_ops, | ||
| 169 | }; | ||
| 170 | |||
| 171 | static struct snd_soc_dai_link dm355_evm_dai = { | ||
| 172 | .name = "TLV320AIC3X", | ||
| 173 | .stream_name = "AIC3X", | ||
| 174 | .cpu_dai_name = "davinci-mcbsp.1", | ||
| 175 | .codec_dai_name = "tlv320aic3x-hifi", | ||
| 176 | .codec_name = "tlv320aic3x-codec.1-001b", | ||
| 166 | .platform_name = "davinci-pcm-audio", | 177 | .platform_name = "davinci-pcm-audio", |
| 167 | .init = evm_aic3x_init, | 178 | .init = evm_aic3x_init, |
| 168 | .ops = &evm_ops, | 179 | .ops = &evm_ops, |
| @@ -172,10 +183,10 @@ static struct snd_soc_dai_link dm365_evm_dai = { | |||
| 172 | #ifdef CONFIG_SND_DM365_AIC3X_CODEC | 183 | #ifdef CONFIG_SND_DM365_AIC3X_CODEC |
| 173 | .name = "TLV320AIC3X", | 184 | .name = "TLV320AIC3X", |
| 174 | .stream_name = "AIC3X", | 185 | .stream_name = "AIC3X", |
| 175 | .cpu_dai_name = "davinci-i2s", | 186 | .cpu_dai_name = "davinci-mcbsp", |
| 176 | .codec_dai_name = "tlv320aic3x-hifi", | 187 | .codec_dai_name = "tlv320aic3x-hifi", |
| 177 | .init = evm_aic3x_init, | 188 | .init = evm_aic3x_init, |
| 178 | .codec_name = "tlv320aic3x-codec.0-001a", | 189 | .codec_name = "tlv320aic3x-codec.1-0018", |
| 179 | .ops = &evm_ops, | 190 | .ops = &evm_ops, |
| 180 | #elif defined(CONFIG_SND_DM365_VOICE_CODEC) | 191 | #elif defined(CONFIG_SND_DM365_VOICE_CODEC) |
| 181 | .name = "Voice Codec - CQ93VC", | 192 | .name = "Voice Codec - CQ93VC", |
| @@ -219,10 +230,17 @@ static struct snd_soc_dai_link da8xx_evm_dai = { | |||
| 219 | .ops = &evm_ops, | 230 | .ops = &evm_ops, |
| 220 | }; | 231 | }; |
| 221 | 232 | ||
| 222 | /* davinci dm6446, dm355 evm audio machine driver */ | 233 | /* davinci dm6446 evm audio machine driver */ |
| 223 | static struct snd_soc_card snd_soc_card_evm = { | 234 | static struct snd_soc_card dm6446_snd_soc_card_evm = { |
| 224 | .name = "DaVinci EVM", | 235 | .name = "DaVinci DM6446 EVM", |
| 225 | .dai_link = &evm_dai, | 236 | .dai_link = &dm6446_evm_dai, |
| 237 | .num_links = 1, | ||
| 238 | }; | ||
| 239 | |||
| 240 | /* davinci dm355 evm audio machine driver */ | ||
| 241 | static struct snd_soc_card dm355_snd_soc_card_evm = { | ||
| 242 | .name = "DaVinci DM355 EVM", | ||
| 243 | .dai_link = &dm355_evm_dai, | ||
| 226 | .num_links = 1, | 244 | .num_links = 1, |
| 227 | }; | 245 | }; |
| 228 | 246 | ||
| @@ -261,10 +279,10 @@ static int __init evm_init(void) | |||
| 261 | int ret; | 279 | int ret; |
| 262 | 280 | ||
| 263 | if (machine_is_davinci_evm()) { | 281 | if (machine_is_davinci_evm()) { |
| 264 | evm_snd_dev_data = &snd_soc_card_evm; | 282 | evm_snd_dev_data = &dm6446_snd_soc_card_evm; |
| 265 | index = 0; | 283 | index = 0; |
| 266 | } else if (machine_is_davinci_dm355_evm()) { | 284 | } else if (machine_is_davinci_dm355_evm()) { |
| 267 | evm_snd_dev_data = &snd_soc_card_evm; | 285 | evm_snd_dev_data = &dm355_snd_soc_card_evm; |
| 268 | index = 1; | 286 | index = 1; |
| 269 | } else if (machine_is_davinci_dm365_evm()) { | 287 | } else if (machine_is_davinci_dm365_evm()) { |
| 270 | evm_snd_dev_data = &dm365_snd_soc_card_evm; | 288 | evm_snd_dev_data = &dm365_snd_soc_card_evm; |
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index d46b545d41f4..9e0e565e6ed9 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c | |||
| @@ -426,9 +426,6 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, | |||
| 426 | snd_pcm_format_t fmt; | 426 | snd_pcm_format_t fmt; |
| 427 | unsigned element_cnt = 1; | 427 | unsigned element_cnt = 1; |
| 428 | 428 | ||
| 429 | dai->capture_dma_data = dev->dma_params; | ||
| 430 | dai->playback_dma_data = dev->dma_params; | ||
| 431 | |||
| 432 | /* general line settings */ | 429 | /* general line settings */ |
| 433 | spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | 430 | spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); |
| 434 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { | 431 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { |
| @@ -601,6 +598,15 @@ static int davinci_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
| 601 | return ret; | 598 | return ret; |
| 602 | } | 599 | } |
| 603 | 600 | ||
| 601 | static int davinci_i2s_startup(struct snd_pcm_substream *substream, | ||
| 602 | struct snd_soc_dai *dai) | ||
| 603 | { | ||
| 604 | struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
| 605 | |||
| 606 | snd_soc_dai_set_dma_data(dai, substream, dev->dma_params); | ||
| 607 | return 0; | ||
| 608 | } | ||
| 609 | |||
| 604 | static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, | 610 | static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, |
| 605 | struct snd_soc_dai *dai) | 611 | struct snd_soc_dai *dai) |
| 606 | { | 612 | { |
| @@ -612,6 +618,7 @@ static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, | |||
| 612 | #define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 | 618 | #define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 |
| 613 | 619 | ||
| 614 | static struct snd_soc_dai_ops davinci_i2s_dai_ops = { | 620 | static struct snd_soc_dai_ops davinci_i2s_dai_ops = { |
| 621 | .startup = davinci_i2s_startup, | ||
| 615 | .shutdown = davinci_i2s_shutdown, | 622 | .shutdown = davinci_i2s_shutdown, |
| 616 | .prepare = davinci_i2s_prepare, | 623 | .prepare = davinci_i2s_prepare, |
| 617 | .trigger = davinci_i2s_trigger, | 624 | .trigger = davinci_i2s_trigger, |
| @@ -749,7 +756,7 @@ static struct platform_driver davinci_mcbsp_driver = { | |||
| 749 | .probe = davinci_i2s_probe, | 756 | .probe = davinci_i2s_probe, |
| 750 | .remove = davinci_i2s_remove, | 757 | .remove = davinci_i2s_remove, |
| 751 | .driver = { | 758 | .driver = { |
| 752 | .name = "davinci-i2s", | 759 | .name = "davinci-mcbsp", |
| 753 | .owner = THIS_MODULE, | 760 | .owner = THIS_MODULE, |
| 754 | }, | 761 | }, |
| 755 | }; | 762 | }; |
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 86918ee12419..fb55d2c5d704 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
| @@ -715,9 +715,6 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
| 715 | int word_length; | 715 | int word_length; |
| 716 | u8 fifo_level; | 716 | u8 fifo_level; |
| 717 | 717 | ||
| 718 | cpu_dai->capture_dma_data = dev->dma_params; | ||
| 719 | cpu_dai->playback_dma_data = dev->dma_params; | ||
| 720 | |||
| 721 | davinci_hw_common_param(dev, substream->stream); | 718 | davinci_hw_common_param(dev, substream->stream); |
| 722 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 719 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
| 723 | fifo_level = dev->txnumevt; | 720 | fifo_level = dev->txnumevt; |
| @@ -799,7 +796,17 @@ static int davinci_mcasp_trigger(struct snd_pcm_substream *substream, | |||
| 799 | return ret; | 796 | return ret; |
| 800 | } | 797 | } |
| 801 | 798 | ||
| 799 | static int davinci_mcasp_startup(struct snd_pcm_substream *substream, | ||
| 800 | struct snd_soc_dai *dai) | ||
| 801 | { | ||
| 802 | struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
| 803 | |||
| 804 | snd_soc_dai_set_dma_data(dai, substream, dev->dma_params); | ||
| 805 | return 0; | ||
| 806 | } | ||
| 807 | |||
| 802 | static struct snd_soc_dai_ops davinci_mcasp_dai_ops = { | 808 | static struct snd_soc_dai_ops davinci_mcasp_dai_ops = { |
| 809 | .startup = davinci_mcasp_startup, | ||
| 803 | .trigger = davinci_mcasp_trigger, | 810 | .trigger = davinci_mcasp_trigger, |
| 804 | .hw_params = davinci_mcasp_hw_params, | 811 | .hw_params = davinci_mcasp_hw_params, |
| 805 | .set_fmt = davinci_mcasp_set_dai_fmt, | 812 | .set_fmt = davinci_mcasp_set_dai_fmt, |
diff --git a/sound/soc/davinci/davinci-sffsdr.c b/sound/soc/davinci/davinci-sffsdr.c index 009b6521a1bf..6c6666a1f942 100644 --- a/sound/soc/davinci/davinci-sffsdr.c +++ b/sound/soc/davinci/davinci-sffsdr.c | |||
| @@ -84,7 +84,7 @@ static struct snd_soc_ops sffsdr_ops = { | |||
| 84 | static struct snd_soc_dai_link sffsdr_dai = { | 84 | static struct snd_soc_dai_link sffsdr_dai = { |
| 85 | .name = "PCM3008", /* Codec name */ | 85 | .name = "PCM3008", /* Codec name */ |
| 86 | .stream_name = "PCM3008 HiFi", | 86 | .stream_name = "PCM3008 HiFi", |
| 87 | .cpu_dai_name = "davinci-asp.0", | 87 | .cpu_dai_name = "davinci-mcbsp", |
| 88 | .codec_dai_name = "pcm3008-hifi", | 88 | .codec_dai_name = "pcm3008-hifi", |
| 89 | .codec_name = "pcm3008-codec", | 89 | .codec_name = "pcm3008-codec", |
| 90 | .platform_name = "davinci-pcm-audio", | 90 | .platform_name = "davinci-pcm-audio", |
diff --git a/sound/soc/davinci/davinci-vcif.c b/sound/soc/davinci/davinci-vcif.c index ea232f6a2c21..fb4cc1edf339 100644 --- a/sound/soc/davinci/davinci-vcif.c +++ b/sound/soc/davinci/davinci-vcif.c | |||
| @@ -97,9 +97,6 @@ static int davinci_vcif_hw_params(struct snd_pcm_substream *substream, | |||
| 97 | &davinci_vcif_dev->dma_params[substream->stream]; | 97 | &davinci_vcif_dev->dma_params[substream->stream]; |
| 98 | u32 w; | 98 | u32 w; |
| 99 | 99 | ||
| 100 | dai->capture_dma_data = davinci_vcif_dev->dma_params; | ||
| 101 | dai->playback_dma_data = davinci_vcif_dev->dma_params; | ||
| 102 | |||
| 103 | /* Restart the codec before setup */ | 100 | /* Restart the codec before setup */ |
| 104 | davinci_vcif_stop(substream); | 101 | davinci_vcif_stop(substream); |
| 105 | davinci_vcif_start(substream); | 102 | davinci_vcif_start(substream); |
| @@ -174,9 +171,19 @@ static int davinci_vcif_trigger(struct snd_pcm_substream *substream, int cmd, | |||
| 174 | return ret; | 171 | return ret; |
| 175 | } | 172 | } |
| 176 | 173 | ||
| 174 | static int davinci_vcif_startup(struct snd_pcm_substream *substream, | ||
| 175 | struct snd_soc_dai *dai) | ||
| 176 | { | ||
| 177 | struct davinci_vcif_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
| 178 | |||
| 179 | snd_soc_dai_set_dma_data(dai, substream, dev->dma_params); | ||
| 180 | return 0; | ||
| 181 | } | ||
| 182 | |||
| 177 | #define DAVINCI_VCIF_RATES SNDRV_PCM_RATE_8000_48000 | 183 | #define DAVINCI_VCIF_RATES SNDRV_PCM_RATE_8000_48000 |
| 178 | 184 | ||
| 179 | static struct snd_soc_dai_ops davinci_vcif_dai_ops = { | 185 | static struct snd_soc_dai_ops davinci_vcif_dai_ops = { |
| 186 | .startup = davinci_vcif_startup, | ||
| 180 | .trigger = davinci_vcif_trigger, | 187 | .trigger = davinci_vcif_trigger, |
| 181 | .hw_params = davinci_vcif_hw_params, | 188 | .hw_params = davinci_vcif_hw_params, |
| 182 | }; | 189 | }; |
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c index 74ffed41340f..9018fa5bf0db 100644 --- a/sound/soc/fsl/mpc5200_psc_i2s.c +++ b/sound/soc/fsl/mpc5200_psc_i2s.c | |||
| @@ -160,7 +160,7 @@ static int __devinit psc_i2s_of_probe(struct platform_device *op, | |||
| 160 | rc = snd_soc_register_dais(&op->dev, psc_i2s_dai, ARRAY_SIZE(psc_i2s_dai)); | 160 | rc = snd_soc_register_dais(&op->dev, psc_i2s_dai, ARRAY_SIZE(psc_i2s_dai)); |
| 161 | if (rc != 0) { | 161 | if (rc != 0) { |
| 162 | pr_err("Failed to register DAI\n"); | 162 | pr_err("Failed to register DAI\n"); |
| 163 | return 0; | 163 | return rc; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | psc_dma = dev_get_drvdata(&op->dev); | 166 | psc_dma = dev_get_drvdata(&op->dev); |
diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/imx/eukrea-tlv320.c index b59675257ce5..dd4fffdbd177 100644 --- a/sound/soc/imx/eukrea-tlv320.c +++ b/sound/soc/imx/eukrea-tlv320.c | |||
| @@ -34,8 +34,8 @@ static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream, | |||
| 34 | struct snd_pcm_hw_params *params) | 34 | struct snd_pcm_hw_params *params) |
| 35 | { | 35 | { |
| 36 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 36 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 37 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 37 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
| 38 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 38 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
| 39 | int ret; | 39 | int ret; |
| 40 | 40 | ||
| 41 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | | 41 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | |
| @@ -79,10 +79,10 @@ static struct snd_soc_ops eukrea_tlv320_snd_ops = { | |||
| 79 | static struct snd_soc_dai_link eukrea_tlv320_dai = { | 79 | static struct snd_soc_dai_link eukrea_tlv320_dai = { |
| 80 | .name = "tlv320aic23", | 80 | .name = "tlv320aic23", |
| 81 | .stream_name = "TLV320AIC23", | 81 | .stream_name = "TLV320AIC23", |
| 82 | .codec_dai = "tlv320aic23-hifi", | 82 | .codec_dai_name = "tlv320aic23-hifi", |
| 83 | .platform_name = "imx-pcm-audio.0", | 83 | .platform_name = "imx-pcm-audio.0", |
| 84 | .codec_name = "tlv320aic23-codec.0-001a", | 84 | .codec_name = "tlv320aic23-codec.0-001a", |
| 85 | .cpu_dai = "imx-ssi.0", | 85 | .cpu_dai_name = "imx-ssi.0", |
| 86 | .ops = &eukrea_tlv320_snd_ops, | 86 | .ops = &eukrea_tlv320_snd_ops, |
| 87 | }; | 87 | }; |
| 88 | 88 | ||
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c index fd493ee1428e..671ef8dd524c 100644 --- a/sound/soc/imx/imx-pcm-dma-mx2.c +++ b/sound/soc/imx/imx-pcm-dma-mx2.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/dmaengine.h> | ||
| 23 | 24 | ||
| 24 | #include <sound/core.h> | 25 | #include <sound/core.h> |
| 25 | #include <sound/initval.h> | 26 | #include <sound/initval.h> |
| @@ -27,165 +28,146 @@ | |||
| 27 | #include <sound/pcm_params.h> | 28 | #include <sound/pcm_params.h> |
| 28 | #include <sound/soc.h> | 29 | #include <sound/soc.h> |
| 29 | 30 | ||
| 30 | #include <mach/dma-mx1-mx2.h> | 31 | #include <mach/dma.h> |
| 31 | 32 | ||
| 32 | #include "imx-ssi.h" | 33 | #include "imx-ssi.h" |
| 33 | 34 | ||
| 34 | struct imx_pcm_runtime_data { | 35 | struct imx_pcm_runtime_data { |
| 35 | int sg_count; | 36 | int period_bytes; |
| 36 | struct scatterlist *sg_list; | ||
| 37 | int period; | ||
| 38 | int periods; | 37 | int periods; |
| 39 | unsigned long dma_addr; | ||
| 40 | int dma; | 38 | int dma; |
| 41 | struct snd_pcm_substream *substream; | ||
| 42 | unsigned long offset; | 39 | unsigned long offset; |
| 43 | unsigned long size; | 40 | unsigned long size; |
| 44 | unsigned long period_cnt; | ||
| 45 | void *buf; | 41 | void *buf; |
| 46 | int period_time; | 42 | int period_time; |
| 43 | struct dma_async_tx_descriptor *desc; | ||
| 44 | struct dma_chan *dma_chan; | ||
| 45 | struct imx_dma_data dma_data; | ||
| 47 | }; | 46 | }; |
| 48 | 47 | ||
| 49 | /* Called by the DMA framework when a period has elapsed */ | 48 | static void audio_dma_irq(void *data) |
| 50 | static void imx_ssi_dma_progression(int channel, void *data, | ||
| 51 | struct scatterlist *sg) | ||
| 52 | { | 49 | { |
| 53 | struct snd_pcm_substream *substream = data; | 50 | struct snd_pcm_substream *substream = (struct snd_pcm_substream *)data; |
| 54 | struct snd_pcm_runtime *runtime = substream->runtime; | 51 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 55 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 52 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
| 56 | 53 | ||
| 57 | if (!sg) | 54 | iprtd->offset += iprtd->period_bytes; |
| 58 | return; | 55 | iprtd->offset %= iprtd->period_bytes * iprtd->periods; |
| 59 | |||
| 60 | runtime = iprtd->substream->runtime; | ||
| 61 | 56 | ||
| 62 | iprtd->offset = sg->dma_address - runtime->dma_addr; | 57 | snd_pcm_period_elapsed(substream); |
| 63 | |||
| 64 | snd_pcm_period_elapsed(iprtd->substream); | ||
| 65 | } | 58 | } |
| 66 | 59 | ||
| 67 | static void imx_ssi_dma_callback(int channel, void *data) | 60 | static bool filter(struct dma_chan *chan, void *param) |
| 68 | { | 61 | { |
| 69 | pr_err("%s shouldn't be called\n", __func__); | 62 | struct imx_pcm_runtime_data *iprtd = param; |
| 70 | } | ||
| 71 | 63 | ||
| 72 | static void snd_imx_dma_err_callback(int channel, void *data, int err) | 64 | if (!imx_dma_is_general_purpose(chan)) |
| 73 | { | 65 | return false; |
| 74 | struct snd_pcm_substream *substream = data; | ||
| 75 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
| 76 | struct imx_pcm_dma_params *dma_params = | ||
| 77 | snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); | ||
| 78 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
| 79 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | ||
| 80 | int ret; | ||
| 81 | 66 | ||
| 82 | pr_err("DMA timeout on channel %d -%s%s%s%s\n", | 67 | chan->private = &iprtd->dma_data; |
| 83 | channel, | ||
| 84 | err & IMX_DMA_ERR_BURST ? " burst" : "", | ||
| 85 | err & IMX_DMA_ERR_REQUEST ? " request" : "", | ||
| 86 | err & IMX_DMA_ERR_TRANSFER ? " transfer" : "", | ||
| 87 | err & IMX_DMA_ERR_BUFFER ? " buffer" : ""); | ||
| 88 | 68 | ||
| 89 | imx_dma_disable(iprtd->dma); | 69 | return true; |
| 90 | ret = imx_dma_setup_sg(iprtd->dma, iprtd->sg_list, iprtd->sg_count, | ||
| 91 | IMX_DMA_LENGTH_LOOP, dma_params->dma_addr, | ||
| 92 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? | ||
| 93 | DMA_MODE_WRITE : DMA_MODE_READ); | ||
| 94 | if (!ret) | ||
| 95 | imx_dma_enable(iprtd->dma); | ||
| 96 | } | 70 | } |
| 97 | 71 | ||
| 98 | static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream) | 72 | static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream, |
| 73 | struct snd_pcm_hw_params *params) | ||
| 99 | { | 74 | { |
| 100 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 75 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 101 | struct imx_pcm_dma_params *dma_params; | 76 | struct imx_pcm_dma_params *dma_params; |
| 102 | struct snd_pcm_runtime *runtime = substream->runtime; | 77 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 103 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 78 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
| 79 | struct dma_slave_config slave_config; | ||
| 80 | dma_cap_mask_t mask; | ||
| 81 | enum dma_slave_buswidth buswidth; | ||
| 104 | int ret; | 82 | int ret; |
| 105 | 83 | ||
| 106 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | 84 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
| 107 | 85 | ||
| 108 | iprtd->dma = imx_dma_request_by_prio(DRV_NAME, DMA_PRIO_HIGH); | 86 | iprtd->dma_data.peripheral_type = IMX_DMATYPE_SSI; |
| 109 | if (iprtd->dma < 0) { | 87 | iprtd->dma_data.priority = DMA_PRIO_HIGH; |
| 110 | pr_err("Failed to claim the audio DMA\n"); | 88 | iprtd->dma_data.dma_request = dma_params->dma; |
| 111 | return -ENODEV; | ||
| 112 | } | ||
| 113 | 89 | ||
| 114 | ret = imx_dma_setup_handlers(iprtd->dma, | 90 | /* Try to grab a DMA channel */ |
| 115 | imx_ssi_dma_callback, | 91 | dma_cap_zero(mask); |
| 116 | snd_imx_dma_err_callback, substream); | 92 | dma_cap_set(DMA_SLAVE, mask); |
| 117 | if (ret) | 93 | iprtd->dma_chan = dma_request_channel(mask, filter, iprtd); |
| 118 | goto out; | 94 | if (!iprtd->dma_chan) |
| 95 | return -EINVAL; | ||
| 119 | 96 | ||
| 120 | ret = imx_dma_setup_progression_handler(iprtd->dma, | 97 | switch (params_format(params)) { |
| 121 | imx_ssi_dma_progression); | 98 | case SNDRV_PCM_FORMAT_S16_LE: |
| 122 | if (ret) { | 99 | buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES; |
| 123 | pr_err("Failed to setup the DMA handler\n"); | 100 | break; |
| 124 | goto out; | 101 | case SNDRV_PCM_FORMAT_S20_3LE: |
| 102 | case SNDRV_PCM_FORMAT_S24_LE: | ||
| 103 | buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
| 104 | break; | ||
| 105 | default: | ||
| 106 | return 0; | ||
| 125 | } | 107 | } |
| 126 | 108 | ||
| 127 | ret = imx_dma_config_channel(iprtd->dma, | 109 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 128 | IMX_DMA_MEMSIZE_16 | IMX_DMA_TYPE_FIFO, | 110 | slave_config.direction = DMA_TO_DEVICE; |
| 129 | IMX_DMA_MEMSIZE_32 | IMX_DMA_TYPE_LINEAR, | 111 | slave_config.dst_addr = dma_params->dma_addr; |
| 130 | dma_params->dma, 1); | 112 | slave_config.dst_addr_width = buswidth; |
| 131 | if (ret < 0) { | 113 | slave_config.dst_maxburst = dma_params->burstsize; |
| 132 | pr_err("Cannot configure DMA channel: %d\n", ret); | 114 | } else { |
| 133 | goto out; | 115 | slave_config.direction = DMA_FROM_DEVICE; |
| 116 | slave_config.src_addr = dma_params->dma_addr; | ||
| 117 | slave_config.src_addr_width = buswidth; | ||
| 118 | slave_config.src_maxburst = dma_params->burstsize; | ||
| 134 | } | 119 | } |
| 135 | 120 | ||
| 136 | imx_dma_config_burstlen(iprtd->dma, dma_params->burstsize * 2); | 121 | ret = dmaengine_slave_config(iprtd->dma_chan, &slave_config); |
| 122 | if (ret) | ||
| 123 | return ret; | ||
| 137 | 124 | ||
| 138 | return 0; | 125 | return 0; |
| 139 | out: | ||
| 140 | imx_dma_free(iprtd->dma); | ||
| 141 | return ret; | ||
| 142 | } | 126 | } |
| 143 | 127 | ||
| 144 | static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream, | 128 | static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream, |
| 145 | struct snd_pcm_hw_params *params) | 129 | struct snd_pcm_hw_params *params) |
| 146 | { | 130 | { |
| 131 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
| 147 | struct snd_pcm_runtime *runtime = substream->runtime; | 132 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 148 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 133 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
| 149 | int i; | ||
| 150 | unsigned long dma_addr; | 134 | unsigned long dma_addr; |
| 135 | struct dma_chan *chan; | ||
| 136 | struct imx_pcm_dma_params *dma_params; | ||
| 137 | int ret; | ||
| 151 | 138 | ||
| 152 | imx_ssi_dma_alloc(substream); | 139 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
| 140 | ret = imx_ssi_dma_alloc(substream, params); | ||
| 141 | if (ret) | ||
| 142 | return ret; | ||
| 143 | chan = iprtd->dma_chan; | ||
| 153 | 144 | ||
| 154 | iprtd->size = params_buffer_bytes(params); | 145 | iprtd->size = params_buffer_bytes(params); |
| 155 | iprtd->periods = params_periods(params); | 146 | iprtd->periods = params_periods(params); |
| 156 | iprtd->period = params_period_bytes(params); | 147 | iprtd->period_bytes = params_period_bytes(params); |
| 157 | iprtd->offset = 0; | 148 | iprtd->offset = 0; |
| 158 | iprtd->period_time = HZ / (params_rate(params) / | 149 | iprtd->period_time = HZ / (params_rate(params) / |
| 159 | params_period_size(params)); | 150 | params_period_size(params)); |
| 160 | 151 | ||
| 161 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); | 152 | snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); |
| 162 | 153 | ||
| 163 | if (iprtd->sg_count != iprtd->periods) { | ||
| 164 | kfree(iprtd->sg_list); | ||
| 165 | |||
| 166 | iprtd->sg_list = kcalloc(iprtd->periods + 1, | ||
| 167 | sizeof(struct scatterlist), GFP_KERNEL); | ||
| 168 | if (!iprtd->sg_list) | ||
| 169 | return -ENOMEM; | ||
| 170 | iprtd->sg_count = iprtd->periods + 1; | ||
| 171 | } | ||
| 172 | |||
| 173 | sg_init_table(iprtd->sg_list, iprtd->sg_count); | ||
| 174 | dma_addr = runtime->dma_addr; | 154 | dma_addr = runtime->dma_addr; |
| 175 | 155 | ||
| 176 | for (i = 0; i < iprtd->periods; i++) { | 156 | iprtd->buf = (unsigned int *)substream->dma_buffer.area; |
| 177 | iprtd->sg_list[i].page_link = 0; | 157 | |
| 178 | iprtd->sg_list[i].offset = 0; | 158 | iprtd->desc = chan->device->device_prep_dma_cyclic(chan, dma_addr, |
| 179 | iprtd->sg_list[i].dma_address = dma_addr; | 159 | iprtd->period_bytes * iprtd->periods, |
| 180 | iprtd->sg_list[i].length = iprtd->period; | 160 | iprtd->period_bytes, |
| 181 | dma_addr += iprtd->period; | 161 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? |
| 162 | DMA_TO_DEVICE : DMA_FROM_DEVICE); | ||
| 163 | if (!iprtd->desc) { | ||
| 164 | dev_err(&chan->dev->device, "cannot prepare slave dma\n"); | ||
| 165 | return -EINVAL; | ||
| 182 | } | 166 | } |
| 183 | 167 | ||
| 184 | /* close the loop */ | 168 | iprtd->desc->callback = audio_dma_irq; |
| 185 | iprtd->sg_list[iprtd->sg_count - 1].offset = 0; | 169 | iprtd->desc->callback_param = substream; |
| 186 | iprtd->sg_list[iprtd->sg_count - 1].length = 0; | 170 | |
| 187 | iprtd->sg_list[iprtd->sg_count - 1].page_link = | ||
| 188 | ((unsigned long) iprtd->sg_list | 0x01) & ~0x02; | ||
| 189 | return 0; | 171 | return 0; |
| 190 | } | 172 | } |
| 191 | 173 | ||
| @@ -194,41 +176,21 @@ static int snd_imx_pcm_hw_free(struct snd_pcm_substream *substream) | |||
| 194 | struct snd_pcm_runtime *runtime = substream->runtime; | 176 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 195 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 177 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
| 196 | 178 | ||
| 197 | if (iprtd->dma >= 0) { | 179 | if (iprtd->dma_chan) { |
| 198 | imx_dma_free(iprtd->dma); | 180 | dma_release_channel(iprtd->dma_chan); |
| 199 | iprtd->dma = -EINVAL; | 181 | iprtd->dma_chan = NULL; |
| 200 | } | 182 | } |
| 201 | 183 | ||
| 202 | kfree(iprtd->sg_list); | ||
| 203 | iprtd->sg_list = NULL; | ||
| 204 | |||
| 205 | return 0; | 184 | return 0; |
| 206 | } | 185 | } |
| 207 | 186 | ||
| 208 | static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream) | 187 | static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream) |
| 209 | { | 188 | { |
| 210 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
| 211 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 189 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 212 | struct imx_pcm_dma_params *dma_params; | 190 | struct imx_pcm_dma_params *dma_params; |
| 213 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | ||
| 214 | int err; | ||
| 215 | 191 | ||
| 216 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | 192 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
| 217 | 193 | ||
| 218 | iprtd->substream = substream; | ||
| 219 | iprtd->buf = (unsigned int *)substream->dma_buffer.area; | ||
| 220 | iprtd->period_cnt = 0; | ||
| 221 | |||
| 222 | pr_debug("%s: buf: %p period: %d periods: %d\n", | ||
| 223 | __func__, iprtd->buf, iprtd->period, iprtd->periods); | ||
| 224 | |||
| 225 | err = imx_dma_setup_sg(iprtd->dma, iprtd->sg_list, iprtd->sg_count, | ||
| 226 | IMX_DMA_LENGTH_LOOP, dma_params->dma_addr, | ||
| 227 | substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? | ||
| 228 | DMA_MODE_WRITE : DMA_MODE_READ); | ||
| 229 | if (err) | ||
| 230 | return err; | ||
| 231 | |||
| 232 | return 0; | 194 | return 0; |
| 233 | } | 195 | } |
| 234 | 196 | ||
| @@ -241,14 +203,14 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
| 241 | case SNDRV_PCM_TRIGGER_START: | 203 | case SNDRV_PCM_TRIGGER_START: |
| 242 | case SNDRV_PCM_TRIGGER_RESUME: | 204 | case SNDRV_PCM_TRIGGER_RESUME: |
| 243 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 205 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
| 244 | imx_dma_enable(iprtd->dma); | 206 | dmaengine_submit(iprtd->desc); |
| 245 | 207 | ||
| 246 | break; | 208 | break; |
| 247 | 209 | ||
| 248 | case SNDRV_PCM_TRIGGER_STOP: | 210 | case SNDRV_PCM_TRIGGER_STOP: |
| 249 | case SNDRV_PCM_TRIGGER_SUSPEND: | 211 | case SNDRV_PCM_TRIGGER_SUSPEND: |
| 250 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 212 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
| 251 | imx_dma_disable(iprtd->dma); | 213 | dmaengine_terminate_all(iprtd->dma_chan); |
| 252 | 214 | ||
| 253 | break; | 215 | break; |
| 254 | default: | 216 | default: |
| @@ -263,6 +225,9 @@ static snd_pcm_uframes_t snd_imx_pcm_pointer(struct snd_pcm_substream *substream | |||
| 263 | struct snd_pcm_runtime *runtime = substream->runtime; | 225 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 264 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | 226 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
| 265 | 227 | ||
| 228 | pr_debug("%s: %ld %ld\n", __func__, iprtd->offset, | ||
| 229 | bytes_to_frames(substream->runtime, iprtd->offset)); | ||
| 230 | |||
| 266 | return bytes_to_frames(substream->runtime, iprtd->offset); | 231 | return bytes_to_frames(substream->runtime, iprtd->offset); |
| 267 | } | 232 | } |
| 268 | 233 | ||
| @@ -279,7 +244,7 @@ static struct snd_pcm_hardware snd_imx_hardware = { | |||
| 279 | .channels_max = 2, | 244 | .channels_max = 2, |
| 280 | .buffer_bytes_max = IMX_SSI_DMABUF_SIZE, | 245 | .buffer_bytes_max = IMX_SSI_DMABUF_SIZE, |
| 281 | .period_bytes_min = 128, | 246 | .period_bytes_min = 128, |
| 282 | .period_bytes_max = 16 * 1024, | 247 | .period_bytes_max = 65535, /* Limited by SDMA engine */ |
| 283 | .periods_min = 2, | 248 | .periods_min = 2, |
| 284 | .periods_max = 255, | 249 | .periods_max = 255, |
| 285 | .fifo_size = 0, | 250 | .fifo_size = 0, |
| @@ -304,11 +269,23 @@ static int snd_imx_open(struct snd_pcm_substream *substream) | |||
| 304 | } | 269 | } |
| 305 | 270 | ||
| 306 | snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware); | 271 | snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware); |
| 272 | |||
| 273 | return 0; | ||
| 274 | } | ||
| 275 | |||
| 276 | static int snd_imx_close(struct snd_pcm_substream *substream) | ||
| 277 | { | ||
| 278 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
| 279 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; | ||
| 280 | |||
| 281 | kfree(iprtd); | ||
| 282 | |||
| 307 | return 0; | 283 | return 0; |
| 308 | } | 284 | } |
| 309 | 285 | ||
| 310 | static struct snd_pcm_ops imx_pcm_ops = { | 286 | static struct snd_pcm_ops imx_pcm_ops = { |
| 311 | .open = snd_imx_open, | 287 | .open = snd_imx_open, |
| 288 | .close = snd_imx_close, | ||
| 312 | .ioctl = snd_pcm_lib_ioctl, | 289 | .ioctl = snd_pcm_lib_ioctl, |
| 313 | .hw_params = snd_imx_pcm_hw_params, | 290 | .hw_params = snd_imx_pcm_hw_params, |
| 314 | .hw_free = snd_imx_pcm_hw_free, | 291 | .hw_free = snd_imx_pcm_hw_free, |
| @@ -340,7 +317,6 @@ static struct platform_driver imx_pcm_driver = { | |||
| 340 | .name = "imx-pcm-audio", | 317 | .name = "imx-pcm-audio", |
| 341 | .owner = THIS_MODULE, | 318 | .owner = THIS_MODULE, |
| 342 | }, | 319 | }, |
| 343 | |||
| 344 | .probe = imx_soc_platform_probe, | 320 | .probe = imx_soc_platform_probe, |
| 345 | .remove = __devexit_p(imx_soc_platform_remove), | 321 | .remove = __devexit_p(imx_soc_platform_remove), |
| 346 | }; | 322 | }; |
| @@ -356,4 +332,3 @@ static void __exit snd_imx_pcm_exit(void) | |||
| 356 | platform_driver_unregister(&imx_pcm_driver); | 332 | platform_driver_unregister(&imx_pcm_driver); |
| 357 | } | 333 | } |
| 358 | module_exit(snd_imx_pcm_exit); | 334 | module_exit(snd_imx_pcm_exit); |
| 359 | |||
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index d4bd345b0a8d..d2d98c75ee8a 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c | |||
| @@ -439,7 +439,22 @@ void imx_pcm_free(struct snd_pcm *pcm) | |||
| 439 | } | 439 | } |
| 440 | EXPORT_SYMBOL_GPL(imx_pcm_free); | 440 | EXPORT_SYMBOL_GPL(imx_pcm_free); |
| 441 | 441 | ||
| 442 | static int imx_ssi_dai_probe(struct snd_soc_dai *dai) | ||
| 443 | { | ||
| 444 | struct imx_ssi *ssi = dev_get_drvdata(dai->dev); | ||
| 445 | uint32_t val; | ||
| 446 | |||
| 447 | snd_soc_dai_set_drvdata(dai, ssi); | ||
| 448 | |||
| 449 | val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) | | ||
| 450 | SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize); | ||
| 451 | writel(val, ssi->base + SSI_SFCSR); | ||
| 452 | |||
| 453 | return 0; | ||
| 454 | } | ||
| 455 | |||
| 442 | static struct snd_soc_dai_driver imx_ssi_dai = { | 456 | static struct snd_soc_dai_driver imx_ssi_dai = { |
| 457 | .probe = imx_ssi_dai_probe, | ||
| 443 | .playback = { | 458 | .playback = { |
| 444 | .channels_min = 2, | 459 | .channels_min = 2, |
| 445 | .channels_max = 2, | 460 | .channels_max = 2, |
| @@ -455,20 +470,6 @@ static struct snd_soc_dai_driver imx_ssi_dai = { | |||
| 455 | .ops = &imx_ssi_pcm_dai_ops, | 470 | .ops = &imx_ssi_pcm_dai_ops, |
| 456 | }; | 471 | }; |
| 457 | 472 | ||
| 458 | static int imx_ssi_dai_probe(struct snd_soc_dai *dai) | ||
| 459 | { | ||
| 460 | struct imx_ssi *ssi = dev_get_drvdata(dai->dev); | ||
| 461 | uint32_t val; | ||
| 462 | |||
| 463 | snd_soc_dai_set_drvdata(dai, ssi); | ||
| 464 | |||
| 465 | val = SSI_SFCSR_TFWM0(ssi->dma_params_tx.burstsize) | | ||
| 466 | SSI_SFCSR_RFWM0(ssi->dma_params_rx.burstsize); | ||
| 467 | writel(val, ssi->base + SSI_SFCSR); | ||
| 468 | |||
| 469 | return 0; | ||
| 470 | } | ||
| 471 | |||
| 472 | static struct snd_soc_dai_driver imx_ac97_dai = { | 473 | static struct snd_soc_dai_driver imx_ac97_dai = { |
| 473 | .probe = imx_ssi_dai_probe, | 474 | .probe = imx_ssi_dai_probe, |
| 474 | .ac97_control = 1, | 475 | .ac97_control = 1, |
| @@ -677,7 +678,17 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
| 677 | goto failed_register; | 678 | goto failed_register; |
| 678 | } | 679 | } |
| 679 | 680 | ||
| 680 | ssi->soc_platform_pdev = platform_device_alloc("imx-fiq-pcm-audio", pdev->id); | 681 | ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id); |
| 682 | if (!ssi->soc_platform_pdev_fiq) | ||
| 683 | goto failed_pdev_fiq_alloc; | ||
| 684 | platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi); | ||
| 685 | ret = platform_device_add(ssi->soc_platform_pdev_fiq); | ||
| 686 | if (ret) { | ||
| 687 | dev_err(&pdev->dev, "failed to add platform device\n"); | ||
| 688 | goto failed_pdev_fiq_add; | ||
| 689 | } | ||
| 690 | |||
| 691 | ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id); | ||
| 681 | if (!ssi->soc_platform_pdev) | 692 | if (!ssi->soc_platform_pdev) |
| 682 | goto failed_pdev_alloc; | 693 | goto failed_pdev_alloc; |
| 683 | platform_set_drvdata(ssi->soc_platform_pdev, ssi); | 694 | platform_set_drvdata(ssi->soc_platform_pdev, ssi); |
| @@ -692,6 +703,9 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
| 692 | failed_pdev_add: | 703 | failed_pdev_add: |
| 693 | platform_device_put(ssi->soc_platform_pdev); | 704 | platform_device_put(ssi->soc_platform_pdev); |
| 694 | failed_pdev_alloc: | 705 | failed_pdev_alloc: |
| 706 | failed_pdev_fiq_add: | ||
| 707 | platform_device_put(ssi->soc_platform_pdev_fiq); | ||
| 708 | failed_pdev_fiq_alloc: | ||
| 695 | snd_soc_unregister_dai(&pdev->dev); | 709 | snd_soc_unregister_dai(&pdev->dev); |
| 696 | failed_register: | 710 | failed_register: |
| 697 | failed_ac97: | 711 | failed_ac97: |
diff --git a/sound/soc/imx/imx-ssi.h b/sound/soc/imx/imx-ssi.h index 53b780d9b2b0..a4406a134892 100644 --- a/sound/soc/imx/imx-ssi.h +++ b/sound/soc/imx/imx-ssi.h | |||
| @@ -185,6 +185,9 @@ | |||
| 185 | 185 | ||
| 186 | #define DRV_NAME "imx-ssi" | 186 | #define DRV_NAME "imx-ssi" |
| 187 | 187 | ||
| 188 | #include <linux/dmaengine.h> | ||
| 189 | #include <mach/dma.h> | ||
| 190 | |||
| 188 | struct imx_pcm_dma_params { | 191 | struct imx_pcm_dma_params { |
| 189 | int dma; | 192 | int dma; |
| 190 | unsigned long dma_addr; | 193 | unsigned long dma_addr; |
| @@ -212,6 +215,7 @@ struct imx_ssi { | |||
| 212 | int enabled; | 215 | int enabled; |
| 213 | 216 | ||
| 214 | struct platform_device *soc_platform_pdev; | 217 | struct platform_device *soc_platform_pdev; |
| 218 | struct platform_device *soc_platform_pdev_fiq; | ||
| 215 | }; | 219 | }; |
| 216 | 220 | ||
| 217 | struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev, | 221 | struct snd_soc_platform *imx_ssi_fiq_init(struct platform_device *pdev, |
diff --git a/sound/soc/imx/phycore-ac97.c b/sound/soc/imx/phycore-ac97.c index 6a65dd705519..39f23734781a 100644 --- a/sound/soc/imx/phycore-ac97.c +++ b/sound/soc/imx/phycore-ac97.c | |||
| @@ -20,9 +20,6 @@ | |||
| 20 | #include <sound/soc-dapm.h> | 20 | #include <sound/soc-dapm.h> |
| 21 | #include <asm/mach-types.h> | 21 | #include <asm/mach-types.h> |
| 22 | 22 | ||
| 23 | #include "../codecs/wm9712.h" | ||
| 24 | #include "imx-ssi.h" | ||
| 25 | |||
| 26 | static struct snd_soc_card imx_phycore; | 23 | static struct snd_soc_card imx_phycore; |
| 27 | 24 | ||
| 28 | static struct snd_soc_ops imx_phycore_hifi_ops = { | 25 | static struct snd_soc_ops imx_phycore_hifi_ops = { |
| @@ -41,7 +38,7 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] = { | |||
| 41 | }; | 38 | }; |
| 42 | 39 | ||
| 43 | static struct snd_soc_card imx_phycore = { | 40 | static struct snd_soc_card imx_phycore = { |
| 44 | .name = "PhyCORE-audio", | 41 | .name = "PhyCORE-ac97-audio", |
| 45 | .dai_link = imx_phycore_dai_ac97, | 42 | .dai_link = imx_phycore_dai_ac97, |
| 46 | .num_links = ARRAY_SIZE(imx_phycore_dai_ac97), | 43 | .num_links = ARRAY_SIZE(imx_phycore_dai_ac97), |
| 47 | }; | 44 | }; |
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index d211c9fa5a91..7e84f24b9a88 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
| @@ -644,15 +644,23 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, | |||
| 644 | 644 | ||
| 645 | 645 | ||
| 646 | case OMAP_MCBSP_CLKR_SRC_CLKR: | 646 | case OMAP_MCBSP_CLKR_SRC_CLKR: |
| 647 | if (cpu_class_is_omap1()) | ||
| 648 | break; | ||
| 647 | omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKR); | 649 | omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKR); |
| 648 | break; | 650 | break; |
| 649 | case OMAP_MCBSP_CLKR_SRC_CLKX: | 651 | case OMAP_MCBSP_CLKR_SRC_CLKX: |
| 652 | if (cpu_class_is_omap1()) | ||
| 653 | break; | ||
| 650 | omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKX); | 654 | omap2_mcbsp1_mux_clkr_src(CLKR_SRC_CLKX); |
| 651 | break; | 655 | break; |
| 652 | case OMAP_MCBSP_FSR_SRC_FSR: | 656 | case OMAP_MCBSP_FSR_SRC_FSR: |
| 657 | if (cpu_class_is_omap1()) | ||
| 658 | break; | ||
| 653 | omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSR); | 659 | omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSR); |
| 654 | break; | 660 | break; |
| 655 | case OMAP_MCBSP_FSR_SRC_FSX: | 661 | case OMAP_MCBSP_FSR_SRC_FSX: |
| 662 | if (cpu_class_is_omap1()) | ||
| 663 | break; | ||
| 656 | omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSX); | 664 | omap2_mcbsp1_mux_fsr_src(FSR_SRC_FSX); |
| 657 | break; | 665 | break; |
| 658 | default: | 666 | default: |
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index 97e9423615c9..f451acd4935b 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c | |||
| @@ -100,8 +100,13 @@ static int corgi_startup(struct snd_pcm_substream *substream) | |||
| 100 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 100 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 101 | struct snd_soc_codec *codec = rtd->codec; | 101 | struct snd_soc_codec *codec = rtd->codec; |
| 102 | 102 | ||
| 103 | mutex_lock(&codec->mutex); | ||
| 104 | |||
| 103 | /* check the jack status at stream startup */ | 105 | /* check the jack status at stream startup */ |
| 104 | corgi_ext_control(codec); | 106 | corgi_ext_control(codec); |
| 107 | |||
| 108 | mutex_unlock(&codec->mutex); | ||
| 109 | |||
| 105 | return 0; | 110 | return 0; |
| 106 | } | 111 | } |
| 107 | 112 | ||
diff --git a/sound/soc/pxa/magician.c b/sound/soc/pxa/magician.c index b8207ced4072..5ef0526924b9 100644 --- a/sound/soc/pxa/magician.c +++ b/sound/soc/pxa/magician.c | |||
| @@ -72,9 +72,13 @@ static int magician_startup(struct snd_pcm_substream *substream) | |||
| 72 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 72 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 73 | struct snd_soc_codec *codec = rtd->codec; | 73 | struct snd_soc_codec *codec = rtd->codec; |
| 74 | 74 | ||
| 75 | mutex_lock(&codec->mutex); | ||
| 76 | |||
| 75 | /* check the jack status at stream startup */ | 77 | /* check the jack status at stream startup */ |
| 76 | magician_ext_control(codec); | 78 | magician_ext_control(codec); |
| 77 | 79 | ||
| 80 | mutex_unlock(&codec->mutex); | ||
| 81 | |||
| 78 | return 0; | 82 | return 0; |
| 79 | } | 83 | } |
| 80 | 84 | ||
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index af84ee9c5e11..84edd0385a21 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c | |||
| @@ -77,8 +77,13 @@ static int poodle_startup(struct snd_pcm_substream *substream) | |||
| 77 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 77 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 78 | struct snd_soc_codec *codec = rtd->codec; | 78 | struct snd_soc_codec *codec = rtd->codec; |
| 79 | 79 | ||
| 80 | mutex_lock(&codec->mutex); | ||
| 81 | |||
| 80 | /* check the jack status at stream startup */ | 82 | /* check the jack status at stream startup */ |
| 81 | poodle_ext_control(codec); | 83 | poodle_ext_control(codec); |
| 84 | |||
| 85 | mutex_unlock(&codec->mutex); | ||
| 86 | |||
| 82 | return 0; | 87 | return 0; |
| 83 | } | 88 | } |
| 84 | 89 | ||
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index f470f360f4dd..0b30d7de24ec 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c | |||
| @@ -108,8 +108,13 @@ static int spitz_startup(struct snd_pcm_substream *substream) | |||
| 108 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 108 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 109 | struct snd_soc_codec *codec = rtd->codec; | 109 | struct snd_soc_codec *codec = rtd->codec; |
| 110 | 110 | ||
| 111 | mutex_lock(&codec->mutex); | ||
| 112 | |||
| 111 | /* check the jack status at stream startup */ | 113 | /* check the jack status at stream startup */ |
| 112 | spitz_ext_control(codec); | 114 | spitz_ext_control(codec); |
| 115 | |||
| 116 | mutex_unlock(&codec->mutex); | ||
| 117 | |||
| 113 | return 0; | 118 | return 0; |
| 114 | } | 119 | } |
| 115 | 120 | ||
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index 73d0edd8ded9..7b983f935454 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c | |||
| @@ -81,8 +81,13 @@ static int tosa_startup(struct snd_pcm_substream *substream) | |||
| 81 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 81 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 82 | struct snd_soc_codec *codec = rtd->codec; | 82 | struct snd_soc_codec *codec = rtd->codec; |
| 83 | 83 | ||
| 84 | mutex_lock(&codec->mutex); | ||
| 85 | |||
| 84 | /* check the jack status at stream startup */ | 86 | /* check the jack status at stream startup */ |
| 85 | tosa_ext_control(codec); | 87 | tosa_ext_control(codec); |
| 88 | |||
| 89 | mutex_unlock(&codec->mutex); | ||
| 90 | |||
| 86 | return 0; | 91 | return 0; |
| 87 | } | 92 | } |
| 88 | 93 | ||
diff --git a/sound/soc/s3c24xx/Kconfig b/sound/soc/s3c24xx/Kconfig index 8a6b53ccd203..d85bf8a0abb2 100644 --- a/sound/soc/s3c24xx/Kconfig +++ b/sound/soc/s3c24xx/Kconfig | |||
| @@ -2,6 +2,7 @@ config SND_S3C24XX_SOC | |||
| 2 | tristate "SoC Audio for the Samsung S3CXXXX chips" | 2 | tristate "SoC Audio for the Samsung S3CXXXX chips" |
| 3 | depends on ARCH_S3C2410 || ARCH_S3C64XX || ARCH_S5PC100 || ARCH_S5PV210 | 3 | depends on ARCH_S3C2410 || ARCH_S3C64XX || ARCH_S5PC100 || ARCH_S5PV210 |
| 4 | select S3C64XX_DMA if ARCH_S3C64XX | 4 | select S3C64XX_DMA if ARCH_S3C64XX |
| 5 | select S3C2410_DMA if ARCH_S3C2410 | ||
| 5 | help | 6 | help |
| 6 | Say Y or M if you want to add support for codecs attached to | 7 | Say Y or M if you want to add support for codecs attached to |
| 7 | the S3C24XX AC97 or I2S interfaces. You will also need to | 8 | the S3C24XX AC97 or I2S interfaces. You will also need to |
diff --git a/sound/soc/s3c24xx/rx1950_uda1380.c b/sound/soc/s3c24xx/rx1950_uda1380.c index ffd5cf2fb0a9..468cc11fdf47 100644 --- a/sound/soc/s3c24xx/rx1950_uda1380.c +++ b/sound/soc/s3c24xx/rx1950_uda1380.c | |||
| @@ -50,7 +50,6 @@ static unsigned int rates[] = { | |||
| 50 | 16000, | 50 | 16000, |
| 51 | 44100, | 51 | 44100, |
| 52 | 48000, | 52 | 48000, |
| 53 | 88200, | ||
| 54 | }; | 53 | }; |
| 55 | 54 | ||
| 56 | static struct snd_pcm_hw_constraint_list hw_rates = { | 55 | static struct snd_pcm_hw_constraint_list hw_rates = { |
| @@ -130,7 +129,6 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
| 130 | }; | 129 | }; |
| 131 | 130 | ||
| 132 | static struct platform_device *s3c24xx_snd_device; | 131 | static struct platform_device *s3c24xx_snd_device; |
| 133 | static struct clk *xtal; | ||
| 134 | 132 | ||
| 135 | static int rx1950_startup(struct snd_pcm_substream *substream) | 133 | static int rx1950_startup(struct snd_pcm_substream *substream) |
| 136 | { | 134 | { |
| @@ -179,10 +177,8 @@ static int rx1950_hw_params(struct snd_pcm_substream *substream, | |||
| 179 | case 44100: | 177 | case 44100: |
| 180 | case 88200: | 178 | case 88200: |
| 181 | clk_source = S3C24XX_CLKSRC_MPLL; | 179 | clk_source = S3C24XX_CLKSRC_MPLL; |
| 182 | fs_mode = S3C2410_IISMOD_256FS; | 180 | fs_mode = S3C2410_IISMOD_384FS; |
| 183 | div = clk_get_rate(xtal) / (256 * rate); | 181 | div = 1; |
| 184 | if (clk_get_rate(xtal) % (256 * rate) > (128 * rate)) | ||
| 185 | div++; | ||
| 186 | break; | 182 | break; |
| 187 | default: | 183 | default: |
| 188 | printk(KERN_ERR "%s: rate %d is not supported\n", | 184 | printk(KERN_ERR "%s: rate %d is not supported\n", |
| @@ -210,7 +206,7 @@ static int rx1950_hw_params(struct snd_pcm_substream *substream, | |||
| 210 | 206 | ||
| 211 | /* set MCLK division for sample rate */ | 207 | /* set MCLK division for sample rate */ |
| 212 | ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_MCLK, | 208 | ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_MCLK, |
| 213 | S3C2410_IISMOD_384FS); | 209 | fs_mode); |
| 214 | if (ret < 0) | 210 | if (ret < 0) |
| 215 | return ret; | 211 | return ret; |
| 216 | 212 | ||
| @@ -295,17 +291,8 @@ static int __init rx1950_init(void) | |||
| 295 | goto err_plat_add; | 291 | goto err_plat_add; |
| 296 | } | 292 | } |
| 297 | 293 | ||
| 298 | xtal = clk_get(&s3c24xx_snd_device->dev, "xtal"); | ||
| 299 | |||
| 300 | if (IS_ERR(xtal)) { | ||
| 301 | ret = PTR_ERR(xtal); | ||
| 302 | platform_device_unregister(s3c24xx_snd_device); | ||
| 303 | goto err_clk; | ||
| 304 | } | ||
| 305 | |||
| 306 | return 0; | 294 | return 0; |
| 307 | 295 | ||
| 308 | err_clk: | ||
| 309 | err_plat_add: | 296 | err_plat_add: |
| 310 | err_plat_alloc: | 297 | err_plat_alloc: |
| 311 | err_gpio_conf: | 298 | err_gpio_conf: |
| @@ -320,7 +307,6 @@ static void __exit rx1950_exit(void) | |||
| 320 | platform_device_unregister(s3c24xx_snd_device); | 307 | platform_device_unregister(s3c24xx_snd_device); |
| 321 | snd_soc_jack_free_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios), | 308 | snd_soc_jack_free_gpios(&hp_jack, ARRAY_SIZE(hp_jack_gpios), |
| 322 | hp_jack_gpios); | 309 | hp_jack_gpios); |
| 323 | clk_put(xtal); | ||
| 324 | gpio_free(S3C2410_GPA(1)); | 310 | gpio_free(S3C2410_GPA(1)); |
| 325 | } | 311 | } |
| 326 | 312 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 614a8b30d87b..441285ade024 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
| @@ -3043,8 +3043,10 @@ int snd_soc_register_dais(struct device *dev, | |||
| 3043 | for (i = 0; i < count; i++) { | 3043 | for (i = 0; i < count; i++) { |
| 3044 | 3044 | ||
| 3045 | dai = kzalloc(sizeof(struct snd_soc_dai), GFP_KERNEL); | 3045 | dai = kzalloc(sizeof(struct snd_soc_dai), GFP_KERNEL); |
| 3046 | if (dai == NULL) | 3046 | if (dai == NULL) { |
| 3047 | return -ENOMEM; | 3047 | ret = -ENOMEM; |
| 3048 | goto err; | ||
| 3049 | } | ||
| 3048 | 3050 | ||
| 3049 | /* create DAI component name */ | 3051 | /* create DAI component name */ |
| 3050 | dai->name = fmt_multiple_name(dev, &dai_drv[i]); | 3052 | dai->name = fmt_multiple_name(dev, &dai_drv[i]); |
| @@ -3263,9 +3265,6 @@ int snd_soc_register_codec(struct device *dev, | |||
| 3263 | return 0; | 3265 | return 0; |
| 3264 | 3266 | ||
| 3265 | error: | 3267 | error: |
| 3266 | for (i--; i >= 0; i--) | ||
| 3267 | snd_soc_unregister_dai(dev); | ||
| 3268 | |||
| 3269 | if (codec->reg_cache) | 3268 | if (codec->reg_cache) |
| 3270 | kfree(codec->reg_cache); | 3269 | kfree(codec->reg_cache); |
| 3271 | kfree(codec->name); | 3270 | kfree(codec->name); |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 7d85c6496afa..75ed6491222d 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
| @@ -683,12 +683,12 @@ static int dapm_seq_compare(struct snd_soc_dapm_widget *a, | |||
| 683 | struct snd_soc_dapm_widget *b, | 683 | struct snd_soc_dapm_widget *b, |
| 684 | int sort[]) | 684 | int sort[]) |
| 685 | { | 685 | { |
| 686 | if (a->codec != b->codec) | ||
| 687 | return (unsigned long)a - (unsigned long)b; | ||
| 688 | if (sort[a->id] != sort[b->id]) | 686 | if (sort[a->id] != sort[b->id]) |
| 689 | return sort[a->id] - sort[b->id]; | 687 | return sort[a->id] - sort[b->id]; |
| 690 | if (a->reg != b->reg) | 688 | if (a->reg != b->reg) |
| 691 | return a->reg - b->reg; | 689 | return a->reg - b->reg; |
| 690 | if (a->codec != b->codec) | ||
| 691 | return (unsigned long)a->codec - (unsigned long)b->codec; | ||
| 692 | 692 | ||
| 693 | return 0; | 693 | return 0; |
| 694 | } | 694 | } |
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c index 1bc56b2b94e2..337a00241a1f 100644 --- a/sound/spi/at73c213.c +++ b/sound/spi/at73c213.c | |||
| @@ -155,7 +155,7 @@ static int snd_at73c213_set_bitrate(struct snd_at73c213 *chip) | |||
| 155 | if (max_tries < 1) | 155 | if (max_tries < 1) |
| 156 | max_tries = 1; | 156 | max_tries = 1; |
| 157 | 157 | ||
| 158 | /* ssc_div must be a power of 2. */ | 158 | /* ssc_div must be even. */ |
| 159 | ssc_div = (ssc_div + 1) & ~1UL; | 159 | ssc_div = (ssc_div + 1) & ~1UL; |
| 160 | 160 | ||
| 161 | if ((ssc_rate / (ssc_div * 2 * 16)) < BITRATE_MIN) { | 161 | if ((ssc_rate / (ssc_div * 2 * 16)) < BITRATE_MIN) { |
