diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-06-28 07:36:22 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-06-28 07:36:22 -0400 |
commit | accaf69da1d1e64bd77ac0caad77e4cfc3b654c7 (patch) | |
tree | 0402e4fad9cecd428c8c3c228a08f9e31eb63470 | |
parent | 975cc02a904ae385721f1bdb65eb1bcf707dfaf1 (diff) | |
parent | 27516080b21cbcb936440d2a3171867860b9a881 (diff) |
Merge tag 'asoc-v3.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: More updates for v3.11
Some more fixes and enhancements, and also a bunch of refectoring for
AC'97 support which enables more than one AC'97 controller driver to be
built in.
195 files changed, 2186 insertions, 1128 deletions
diff --git a/Documentation/DocBook/media/v4l/dev-codec.xml b/Documentation/DocBook/media/v4l/dev-codec.xml index dca0ecd54dc6..ff44c16fc080 100644 --- a/Documentation/DocBook/media/v4l/dev-codec.xml +++ b/Documentation/DocBook/media/v4l/dev-codec.xml | |||
@@ -1,18 +1,27 @@ | |||
1 | <title>Codec Interface</title> | 1 | <title>Codec Interface</title> |
2 | 2 | ||
3 | <note> | 3 | <para>A V4L2 codec can compress, decompress, transform, or otherwise |
4 | <title>Suspended</title> | 4 | convert video data from one format into another format, in memory. Typically |
5 | such devices are memory-to-memory devices (i.e. devices with the | ||
6 | <constant>V4L2_CAP_VIDEO_M2M</constant> or <constant>V4L2_CAP_VIDEO_M2M_MPLANE</constant> | ||
7 | capability set). | ||
8 | </para> | ||
5 | 9 | ||
6 | <para>This interface has been be suspended from the V4L2 API | 10 | <para>A memory-to-memory video node acts just like a normal video node, but it |
7 | implemented in Linux 2.6 until we have more experience with codec | 11 | supports both output (sending frames from memory to the codec hardware) and |
8 | device interfaces.</para> | 12 | capture (receiving the processed frames from the codec hardware into memory) |
9 | </note> | 13 | stream I/O. An application will have to setup the stream |
14 | I/O for both sides and finally call &VIDIOC-STREAMON; for both capture and output | ||
15 | to start the codec.</para> | ||
10 | 16 | ||
11 | <para>A V4L2 codec can compress, decompress, transform, or otherwise | 17 | <para>Video compression codecs use the MPEG controls to setup their codec parameters |
12 | convert video data from one format into another format, in memory. | 18 | (note that the MPEG controls actually support many more codecs than just MPEG). |
13 | Applications send data to be converted to the driver through a | 19 | See <xref linkend="mpeg-controls"></xref>.</para> |
14 | &func-write; call, and receive the converted data through a | ||
15 | &func-read; call. For efficiency a driver may also support streaming | ||
16 | I/O.</para> | ||
17 | 20 | ||
18 | <para>[to do]</para> | 21 | <para>Memory-to-memory devices can often be used as a shared resource: you can |
22 | open the video node multiple times, each application setting up their own codec properties | ||
23 | that are local to the file handle, and each can use it independently from the others. | ||
24 | The driver will arbitrate access to the codec and reprogram it whenever another file | ||
25 | handler gets access. This is different from the usual video node behavior where the video properties | ||
26 | are global to the device (i.e. changing something through one file handle is visible | ||
27 | through another file handle).</para> | ||
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml index bfc93cdcf696..bfe823dd0f31 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml | |||
@@ -493,7 +493,7 @@ and discussions on the V4L mailing list.</revremark> | |||
493 | </partinfo> | 493 | </partinfo> |
494 | 494 | ||
495 | <title>Video for Linux Two API Specification</title> | 495 | <title>Video for Linux Two API Specification</title> |
496 | <subtitle>Revision 3.9</subtitle> | 496 | <subtitle>Revision 3.10</subtitle> |
497 | 497 | ||
498 | <chapter id="common"> | 498 | <chapter id="common"> |
499 | &sub-common; | 499 | &sub-common; |
diff --git a/Documentation/devicetree/bindings/media/exynos-fimc-lite.txt b/Documentation/devicetree/bindings/media/exynos-fimc-lite.txt index 3f62adfb3e0b..de9f6b78ee51 100644 --- a/Documentation/devicetree/bindings/media/exynos-fimc-lite.txt +++ b/Documentation/devicetree/bindings/media/exynos-fimc-lite.txt | |||
@@ -2,7 +2,7 @@ Exynos4x12/Exynos5 SoC series camera host interface (FIMC-LITE) | |||
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | 4 | ||
5 | - compatible : should be "samsung,exynos4212-fimc" for Exynos4212 and | 5 | - compatible : should be "samsung,exynos4212-fimc-lite" for Exynos4212 and |
6 | Exynos4412 SoCs; | 6 | Exynos4412 SoCs; |
7 | - reg : physical base address and size of the device memory mapped | 7 | - reg : physical base address and size of the device memory mapped |
8 | registers; | 8 | registers; |
diff --git a/Documentation/devicetree/bindings/sound/adi,adau1701.txt b/Documentation/devicetree/bindings/sound/adi,adau1701.txt index 3afeda77b5b9..547a49b56a62 100644 --- a/Documentation/devicetree/bindings/sound/adi,adau1701.txt +++ b/Documentation/devicetree/bindings/sound/adi,adau1701.txt | |||
@@ -11,6 +11,15 @@ Optional properties: | |||
11 | - reset-gpio: A GPIO spec to define which pin is connected to the | 11 | - reset-gpio: A GPIO spec to define which pin is connected to the |
12 | chip's !RESET pin. If specified, the driver will | 12 | chip's !RESET pin. If specified, the driver will |
13 | assert a hardware reset at probe time. | 13 | assert a hardware reset at probe time. |
14 | - adi,pll-mode-gpios: An array of two GPIO specs to describe the GPIOs | ||
15 | the ADAU's PLL config pins are connected to. | ||
16 | The state of the pins are set according to the | ||
17 | configured clock divider on ASoC side before the | ||
18 | firmware is loaded. | ||
19 | - adi,pin-config: An array of 12 numerical values selecting one of the | ||
20 | pin configurations as described in the datasheet, | ||
21 | table 53. Note that the value of this property has | ||
22 | to be prefixed with '/bits/ 8'. | ||
14 | 23 | ||
15 | Examples: | 24 | Examples: |
16 | 25 | ||
@@ -19,5 +28,8 @@ Examples: | |||
19 | compatible = "adi,adau1701"; | 28 | compatible = "adi,adau1701"; |
20 | reg = <0x34>; | 29 | reg = <0x34>; |
21 | reset-gpio = <&gpio 23 0>; | 30 | reset-gpio = <&gpio 23 0>; |
31 | adi,pll-mode-gpios = <&gpio 24 0 &gpio 25 0>; | ||
32 | adi,pin-config = /bits/ 8 <0x4 0x7 0x5 0x5 0x4 0x4 | ||
33 | 0x4 0x4 0x4 0x4 0x4 0x4>; | ||
22 | }; | 34 | }; |
23 | }; | 35 | }; |
diff --git a/Documentation/devicetree/bindings/sound/ti,tas5086.txt b/Documentation/devicetree/bindings/sound/ti,tas5086.txt index 8ea4f5b4818d..d2866a0d6a26 100644 --- a/Documentation/devicetree/bindings/sound/ti,tas5086.txt +++ b/Documentation/devicetree/bindings/sound/ti,tas5086.txt | |||
@@ -20,6 +20,17 @@ Optional properties: | |||
20 | When not specified, the hardware default of 1300ms | 20 | When not specified, the hardware default of 1300ms |
21 | is retained. | 21 | is retained. |
22 | 22 | ||
23 | - ti,mid-z-channel-X: Boolean properties, X being a number from 1 to 6. | ||
24 | If given, channel X will start with the Mid-Z start | ||
25 | sequence, otherwise the default Low-Z scheme is used. | ||
26 | |||
27 | The correct configuration depends on how the power | ||
28 | stages connected to the PWM output pins work. Not all | ||
29 | power stages are compatible to Mid-Z - please refer | ||
30 | to the datasheets for more details. | ||
31 | |||
32 | Most systems should not set any of these properties. | ||
33 | |||
23 | Examples: | 34 | Examples: |
24 | 35 | ||
25 | i2c_bus { | 36 | i2c_bus { |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 10 | 2 | PATCHLEVEL = 10 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc6 | 4 | EXTRAVERSION = -rc7 |
5 | NAME = Unicycling Gorilla | 5 | NAME = Unicycling Gorilla |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 49d993cee512..2651b1da1c56 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1189,6 +1189,16 @@ config PL310_ERRATA_588369 | |||
1189 | is not correctly implemented in PL310 as clean lines are not | 1189 | is not correctly implemented in PL310 as clean lines are not |
1190 | invalidated as a result of these operations. | 1190 | invalidated as a result of these operations. |
1191 | 1191 | ||
1192 | config ARM_ERRATA_643719 | ||
1193 | bool "ARM errata: LoUIS bit field in CLIDR register is incorrect" | ||
1194 | depends on CPU_V7 && SMP | ||
1195 | help | ||
1196 | This option enables the workaround for the 643719 Cortex-A9 (prior to | ||
1197 | r1p0) erratum. On affected cores the LoUIS bit field of the CLIDR | ||
1198 | register returns zero when it should return one. The workaround | ||
1199 | corrects this value, ensuring cache maintenance operations which use | ||
1200 | it behave as intended and avoiding data corruption. | ||
1201 | |||
1192 | config ARM_ERRATA_720789 | 1202 | config ARM_ERRATA_720789 |
1193 | bool "ARM errata: TLBIASIDIS and TLBIMVAIS operations can broadcast a faulty ASID" | 1203 | bool "ARM errata: TLBIASIDIS and TLBIMVAIS operations can broadcast a faulty ASID" |
1194 | depends on CPU_V7 | 1204 | depends on CPU_V7 |
@@ -2006,7 +2016,7 @@ config XIP_PHYS_ADDR | |||
2006 | 2016 | ||
2007 | config KEXEC | 2017 | config KEXEC |
2008 | bool "Kexec system call (EXPERIMENTAL)" | 2018 | bool "Kexec system call (EXPERIMENTAL)" |
2009 | depends on (!SMP || HOTPLUG_CPU) | 2019 | depends on (!SMP || PM_SLEEP_SMP) |
2010 | help | 2020 | help |
2011 | kexec is a system call that implements the ability to shutdown your | 2021 | kexec is a system call that implements the ability to shutdown your |
2012 | current kernel, and to start another kernel. It is like a reboot | 2022 | current kernel, and to start another kernel. It is like a reboot |
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 79e9bdbfc491..120b83bfde20 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile | |||
@@ -116,7 +116,8 @@ targets := vmlinux vmlinux.lds \ | |||
116 | 116 | ||
117 | # Make sure files are removed during clean | 117 | # Make sure files are removed during clean |
118 | extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern \ | 118 | extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern \ |
119 | lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs) | 119 | lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs) \ |
120 | hyp-stub.S | ||
120 | 121 | ||
121 | ifeq ($(CONFIG_FUNCTION_TRACER),y) | 122 | ifeq ($(CONFIG_FUNCTION_TRACER),y) |
122 | ORIG_CFLAGS := $(KBUILD_CFLAGS) | 123 | ORIG_CFLAGS := $(KBUILD_CFLAGS) |
diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi index d1650fb34c0a..ded558bb0f3b 100644 --- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi +++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi | |||
@@ -763,7 +763,7 @@ | |||
763 | }; | 763 | }; |
764 | }; | 764 | }; |
765 | 765 | ||
766 | pinctrl@03680000 { | 766 | pinctrl@03860000 { |
767 | gpz: gpz { | 767 | gpz: gpz { |
768 | gpio-controller; | 768 | gpio-controller; |
769 | #gpio-cells = <2>; | 769 | #gpio-cells = <2>; |
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index 0673524238a6..fc9fb3d526e2 100644 --- a/arch/arm/boot/dts/exynos5250.dtsi +++ b/arch/arm/boot/dts/exynos5250.dtsi | |||
@@ -161,9 +161,9 @@ | |||
161 | interrupts = <0 50 0>; | 161 | interrupts = <0 50 0>; |
162 | }; | 162 | }; |
163 | 163 | ||
164 | pinctrl_3: pinctrl@03680000 { | 164 | pinctrl_3: pinctrl@03860000 { |
165 | compatible = "samsung,exynos5250-pinctrl"; | 165 | compatible = "samsung,exynos5250-pinctrl"; |
166 | reg = <0x0368000 0x1000>; | 166 | reg = <0x03860000 0x1000>; |
167 | interrupts = <0 47 0>; | 167 | interrupts = <0 47 0>; |
168 | }; | 168 | }; |
169 | 169 | ||
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h index bff71388e72a..17d0ae8672fa 100644 --- a/arch/arm/include/asm/cacheflush.h +++ b/arch/arm/include/asm/cacheflush.h | |||
@@ -320,9 +320,7 @@ static inline void flush_anon_page(struct vm_area_struct *vma, | |||
320 | } | 320 | } |
321 | 321 | ||
322 | #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE | 322 | #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE |
323 | static inline void flush_kernel_dcache_page(struct page *page) | 323 | extern void flush_kernel_dcache_page(struct page *); |
324 | { | ||
325 | } | ||
326 | 324 | ||
327 | #define flush_dcache_mmap_lock(mapping) \ | 325 | #define flush_dcache_mmap_lock(mapping) \ |
328 | spin_lock_irq(&(mapping)->tree_lock) | 326 | spin_lock_irq(&(mapping)->tree_lock) |
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c index 8ef8c9337809..4fb074c446bf 100644 --- a/arch/arm/kernel/machine_kexec.c +++ b/arch/arm/kernel/machine_kexec.c | |||
@@ -134,6 +134,10 @@ void machine_kexec(struct kimage *image) | |||
134 | unsigned long reboot_code_buffer_phys; | 134 | unsigned long reboot_code_buffer_phys; |
135 | void *reboot_code_buffer; | 135 | void *reboot_code_buffer; |
136 | 136 | ||
137 | if (num_online_cpus() > 1) { | ||
138 | pr_err("kexec: error: multiple CPUs still online\n"); | ||
139 | return; | ||
140 | } | ||
137 | 141 | ||
138 | page_list = image->head & PAGE_MASK; | 142 | page_list = image->head & PAGE_MASK; |
139 | 143 | ||
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 282de4826abb..6e8931ccf13e 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -184,30 +184,61 @@ int __init reboot_setup(char *str) | |||
184 | 184 | ||
185 | __setup("reboot=", reboot_setup); | 185 | __setup("reboot=", reboot_setup); |
186 | 186 | ||
187 | /* | ||
188 | * Called by kexec, immediately prior to machine_kexec(). | ||
189 | * | ||
190 | * This must completely disable all secondary CPUs; simply causing those CPUs | ||
191 | * to execute e.g. a RAM-based pin loop is not sufficient. This allows the | ||
192 | * kexec'd kernel to use any and all RAM as it sees fit, without having to | ||
193 | * avoid any code or data used by any SW CPU pin loop. The CPU hotplug | ||
194 | * functionality embodied in disable_nonboot_cpus() to achieve this. | ||
195 | */ | ||
187 | void machine_shutdown(void) | 196 | void machine_shutdown(void) |
188 | { | 197 | { |
189 | #ifdef CONFIG_SMP | 198 | disable_nonboot_cpus(); |
190 | smp_send_stop(); | ||
191 | #endif | ||
192 | } | 199 | } |
193 | 200 | ||
201 | /* | ||
202 | * Halting simply requires that the secondary CPUs stop performing any | ||
203 | * activity (executing tasks, handling interrupts). smp_send_stop() | ||
204 | * achieves this. | ||
205 | */ | ||
194 | void machine_halt(void) | 206 | void machine_halt(void) |
195 | { | 207 | { |
196 | machine_shutdown(); | 208 | smp_send_stop(); |
209 | |||
197 | local_irq_disable(); | 210 | local_irq_disable(); |
198 | while (1); | 211 | while (1); |
199 | } | 212 | } |
200 | 213 | ||
214 | /* | ||
215 | * Power-off simply requires that the secondary CPUs stop performing any | ||
216 | * activity (executing tasks, handling interrupts). smp_send_stop() | ||
217 | * achieves this. When the system power is turned off, it will take all CPUs | ||
218 | * with it. | ||
219 | */ | ||
201 | void machine_power_off(void) | 220 | void machine_power_off(void) |
202 | { | 221 | { |
203 | machine_shutdown(); | 222 | smp_send_stop(); |
223 | |||
204 | if (pm_power_off) | 224 | if (pm_power_off) |
205 | pm_power_off(); | 225 | pm_power_off(); |
206 | } | 226 | } |
207 | 227 | ||
228 | /* | ||
229 | * Restart requires that the secondary CPUs stop performing any activity | ||
230 | * while the primary CPU resets the system. Systems with a single CPU can | ||
231 | * use soft_restart() as their machine descriptor's .restart hook, since that | ||
232 | * will cause the only available CPU to reset. Systems with multiple CPUs must | ||
233 | * provide a HW restart implementation, to ensure that all CPUs reset at once. | ||
234 | * This is required so that any code running after reset on the primary CPU | ||
235 | * doesn't have to co-ordinate with other CPUs to ensure they aren't still | ||
236 | * executing pre-reset code, and using RAM that the primary CPU's code wishes | ||
237 | * to use. Implementing such co-ordination would be essentially impossible. | ||
238 | */ | ||
208 | void machine_restart(char *cmd) | 239 | void machine_restart(char *cmd) |
209 | { | 240 | { |
210 | machine_shutdown(); | 241 | smp_send_stop(); |
211 | 242 | ||
212 | arm_pm_restart(reboot_mode, cmd); | 243 | arm_pm_restart(reboot_mode, cmd); |
213 | 244 | ||
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 550d63cef68e..5919eb451bb9 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -651,17 +651,6 @@ void smp_send_reschedule(int cpu) | |||
651 | smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); | 651 | smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); |
652 | } | 652 | } |
653 | 653 | ||
654 | #ifdef CONFIG_HOTPLUG_CPU | ||
655 | static void smp_kill_cpus(cpumask_t *mask) | ||
656 | { | ||
657 | unsigned int cpu; | ||
658 | for_each_cpu(cpu, mask) | ||
659 | platform_cpu_kill(cpu); | ||
660 | } | ||
661 | #else | ||
662 | static void smp_kill_cpus(cpumask_t *mask) { } | ||
663 | #endif | ||
664 | |||
665 | void smp_send_stop(void) | 654 | void smp_send_stop(void) |
666 | { | 655 | { |
667 | unsigned long timeout; | 656 | unsigned long timeout; |
@@ -679,8 +668,6 @@ void smp_send_stop(void) | |||
679 | 668 | ||
680 | if (num_online_cpus() > 1) | 669 | if (num_online_cpus() > 1) |
681 | pr_warning("SMP: failed to stop secondary CPUs\n"); | 670 | pr_warning("SMP: failed to stop secondary CPUs\n"); |
682 | |||
683 | smp_kill_cpus(&mask); | ||
684 | } | 671 | } |
685 | 672 | ||
686 | /* | 673 | /* |
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S index 15451ee4acc8..515b00064da8 100644 --- a/arch/arm/mm/cache-v7.S +++ b/arch/arm/mm/cache-v7.S | |||
@@ -92,6 +92,14 @@ ENTRY(v7_flush_dcache_louis) | |||
92 | mrc p15, 1, r0, c0, c0, 1 @ read clidr, r0 = clidr | 92 | mrc p15, 1, r0, c0, c0, 1 @ read clidr, r0 = clidr |
93 | ALT_SMP(ands r3, r0, #(7 << 21)) @ extract LoUIS from clidr | 93 | ALT_SMP(ands r3, r0, #(7 << 21)) @ extract LoUIS from clidr |
94 | ALT_UP(ands r3, r0, #(7 << 27)) @ extract LoUU from clidr | 94 | ALT_UP(ands r3, r0, #(7 << 27)) @ extract LoUU from clidr |
95 | #ifdef CONFIG_ARM_ERRATA_643719 | ||
96 | ALT_SMP(mrceq p15, 0, r2, c0, c0, 0) @ read main ID register | ||
97 | ALT_UP(moveq pc, lr) @ LoUU is zero, so nothing to do | ||
98 | ldreq r1, =0x410fc090 @ ID of ARM Cortex A9 r0p? | ||
99 | biceq r2, r2, #0x0000000f @ clear minor revision number | ||
100 | teqeq r2, r1 @ test for errata affected core and if so... | ||
101 | orreqs r3, #(1 << 21) @ fix LoUIS value (and set flags state to 'ne') | ||
102 | #endif | ||
95 | ALT_SMP(mov r3, r3, lsr #20) @ r3 = LoUIS * 2 | 103 | ALT_SMP(mov r3, r3, lsr #20) @ r3 = LoUIS * 2 |
96 | ALT_UP(mov r3, r3, lsr #26) @ r3 = LoUU * 2 | 104 | ALT_UP(mov r3, r3, lsr #26) @ r3 = LoUU * 2 |
97 | moveq pc, lr @ return if level == 0 | 105 | moveq pc, lr @ return if level == 0 |
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c index 0d473cce501c..32aa5861119f 100644 --- a/arch/arm/mm/flush.c +++ b/arch/arm/mm/flush.c | |||
@@ -301,6 +301,39 @@ void flush_dcache_page(struct page *page) | |||
301 | EXPORT_SYMBOL(flush_dcache_page); | 301 | EXPORT_SYMBOL(flush_dcache_page); |
302 | 302 | ||
303 | /* | 303 | /* |
304 | * Ensure cache coherency for the kernel mapping of this page. We can | ||
305 | * assume that the page is pinned via kmap. | ||
306 | * | ||
307 | * If the page only exists in the page cache and there are no user | ||
308 | * space mappings, this is a no-op since the page was already marked | ||
309 | * dirty at creation. Otherwise, we need to flush the dirty kernel | ||
310 | * cache lines directly. | ||
311 | */ | ||
312 | void flush_kernel_dcache_page(struct page *page) | ||
313 | { | ||
314 | if (cache_is_vivt() || cache_is_vipt_aliasing()) { | ||
315 | struct address_space *mapping; | ||
316 | |||
317 | mapping = page_mapping(page); | ||
318 | |||
319 | if (!mapping || mapping_mapped(mapping)) { | ||
320 | void *addr; | ||
321 | |||
322 | addr = page_address(page); | ||
323 | /* | ||
324 | * kmap_atomic() doesn't set the page virtual | ||
325 | * address for highmem pages, and | ||
326 | * kunmap_atomic() takes care of cache | ||
327 | * flushing already. | ||
328 | */ | ||
329 | if (!IS_ENABLED(CONFIG_HIGHMEM) || addr) | ||
330 | __cpuc_flush_dcache_area(addr, PAGE_SIZE); | ||
331 | } | ||
332 | } | ||
333 | } | ||
334 | EXPORT_SYMBOL(flush_kernel_dcache_page); | ||
335 | |||
336 | /* | ||
304 | * Flush an anonymous page so that users of get_user_pages() | 337 | * Flush an anonymous page so that users of get_user_pages() |
305 | * can safely access the data. The expected sequence is: | 338 | * can safely access the data. The expected sequence is: |
306 | * | 339 | * |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index e0d8565671a6..4d409e6a552d 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -616,10 +616,12 @@ static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr, | |||
616 | } while (pte++, addr += PAGE_SIZE, addr != end); | 616 | } while (pte++, addr += PAGE_SIZE, addr != end); |
617 | } | 617 | } |
618 | 618 | ||
619 | static void __init map_init_section(pmd_t *pmd, unsigned long addr, | 619 | static void __init __map_init_section(pmd_t *pmd, unsigned long addr, |
620 | unsigned long end, phys_addr_t phys, | 620 | unsigned long end, phys_addr_t phys, |
621 | const struct mem_type *type) | 621 | const struct mem_type *type) |
622 | { | 622 | { |
623 | pmd_t *p = pmd; | ||
624 | |||
623 | #ifndef CONFIG_ARM_LPAE | 625 | #ifndef CONFIG_ARM_LPAE |
624 | /* | 626 | /* |
625 | * In classic MMU format, puds and pmds are folded in to | 627 | * In classic MMU format, puds and pmds are folded in to |
@@ -638,7 +640,7 @@ static void __init map_init_section(pmd_t *pmd, unsigned long addr, | |||
638 | phys += SECTION_SIZE; | 640 | phys += SECTION_SIZE; |
639 | } while (pmd++, addr += SECTION_SIZE, addr != end); | 641 | } while (pmd++, addr += SECTION_SIZE, addr != end); |
640 | 642 | ||
641 | flush_pmd_entry(pmd); | 643 | flush_pmd_entry(p); |
642 | } | 644 | } |
643 | 645 | ||
644 | static void __init alloc_init_pmd(pud_t *pud, unsigned long addr, | 646 | static void __init alloc_init_pmd(pud_t *pud, unsigned long addr, |
@@ -661,7 +663,7 @@ static void __init alloc_init_pmd(pud_t *pud, unsigned long addr, | |||
661 | */ | 663 | */ |
662 | if (type->prot_sect && | 664 | if (type->prot_sect && |
663 | ((addr | next | phys) & ~SECTION_MASK) == 0) { | 665 | ((addr | next | phys) & ~SECTION_MASK) == 0) { |
664 | map_init_section(pmd, addr, next, phys, type); | 666 | __map_init_section(pmd, addr, next, phys, type); |
665 | } else { | 667 | } else { |
666 | alloc_init_pte(pmd, addr, next, | 668 | alloc_init_pte(pmd, addr, next, |
667 | __phys_to_pfn(phys), type); | 669 | __phys_to_pfn(phys), type); |
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index 2c73a7301ff7..4c8c9c10a388 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S | |||
@@ -409,8 +409,8 @@ __v7_ca9mp_proc_info: | |||
409 | */ | 409 | */ |
410 | .type __v7_pj4b_proc_info, #object | 410 | .type __v7_pj4b_proc_info, #object |
411 | __v7_pj4b_proc_info: | 411 | __v7_pj4b_proc_info: |
412 | .long 0x562f5840 | 412 | .long 0x560f5800 |
413 | .long 0xfffffff0 | 413 | .long 0xff0fff00 |
414 | __v7_proc __v7_pj4b_setup | 414 | __v7_proc __v7_pj4b_setup |
415 | .size __v7_pj4b_proc_info, . - __v7_pj4b_proc_info | 415 | .size __v7_pj4b_proc_info, . - __v7_pj4b_proc_info |
416 | 416 | ||
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index 1e49e5eb81e9..9ba33c40cdf8 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c | |||
@@ -1336,6 +1336,7 @@ void perf_callchain_user(struct perf_callchain_entry *entry, | |||
1336 | return; | 1336 | return; |
1337 | } | 1337 | } |
1338 | 1338 | ||
1339 | perf_callchain_store(entry, regs->pc); | ||
1339 | tail = (struct frame_tail __user *)regs->regs[29]; | 1340 | tail = (struct frame_tail __user *)regs->regs[29]; |
1340 | 1341 | ||
1341 | while (entry->nr < PERF_MAX_STACK_DEPTH && | 1342 | while (entry->nr < PERF_MAX_STACK_DEPTH && |
diff --git a/arch/ia64/include/asm/irqflags.h b/arch/ia64/include/asm/irqflags.h index 1bf2cf2f4ab4..cec6c06b52c0 100644 --- a/arch/ia64/include/asm/irqflags.h +++ b/arch/ia64/include/asm/irqflags.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #define _ASM_IA64_IRQFLAGS_H | 11 | #define _ASM_IA64_IRQFLAGS_H |
12 | 12 | ||
13 | #include <asm/pal.h> | 13 | #include <asm/pal.h> |
14 | #include <asm/kregs.h> | ||
14 | 15 | ||
15 | #ifdef CONFIG_IA64_DEBUG_IRQ | 16 | #ifdef CONFIG_IA64_DEBUG_IRQ |
16 | extern unsigned long last_cli_ip; | 17 | extern unsigned long last_cli_ip; |
diff --git a/arch/metag/include/asm/hugetlb.h b/arch/metag/include/asm/hugetlb.h index f545477e61f3..471f481e67f3 100644 --- a/arch/metag/include/asm/hugetlb.h +++ b/arch/metag/include/asm/hugetlb.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _ASM_METAG_HUGETLB_H | 2 | #define _ASM_METAG_HUGETLB_H |
3 | 3 | ||
4 | #include <asm/page.h> | 4 | #include <asm/page.h> |
5 | #include <asm-generic/hugetlb.h> | ||
5 | 6 | ||
6 | 7 | ||
7 | static inline int is_hugepage_only_range(struct mm_struct *mm, | 8 | static inline int is_hugepage_only_range(struct mm_struct *mm, |
diff --git a/arch/mn10300/include/asm/irqflags.h b/arch/mn10300/include/asm/irqflags.h index 678f68d5f37b..8730c0a3c37d 100644 --- a/arch/mn10300/include/asm/irqflags.h +++ b/arch/mn10300/include/asm/irqflags.h | |||
@@ -13,9 +13,8 @@ | |||
13 | #define _ASM_IRQFLAGS_H | 13 | #define _ASM_IRQFLAGS_H |
14 | 14 | ||
15 | #include <asm/cpu-regs.h> | 15 | #include <asm/cpu-regs.h> |
16 | #ifndef __ASSEMBLY__ | 16 | /* linux/smp.h <- linux/irqflags.h needs asm/smp.h first */ |
17 | #include <linux/smp.h> | 17 | #include <asm/smp.h> |
18 | #endif | ||
19 | 18 | ||
20 | /* | 19 | /* |
21 | * interrupt control | 20 | * interrupt control |
diff --git a/arch/mn10300/include/asm/smp.h b/arch/mn10300/include/asm/smp.h index 6745dbe64944..56c42417d428 100644 --- a/arch/mn10300/include/asm/smp.h +++ b/arch/mn10300/include/asm/smp.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #ifndef __ASSEMBLY__ | 24 | #ifndef __ASSEMBLY__ |
25 | #include <linux/threads.h> | 25 | #include <linux/threads.h> |
26 | #include <linux/cpumask.h> | 26 | #include <linux/cpumask.h> |
27 | #include <linux/thread_info.h> | ||
27 | #endif | 28 | #endif |
28 | 29 | ||
29 | #ifdef CONFIG_SMP | 30 | #ifdef CONFIG_SMP |
@@ -85,7 +86,7 @@ extern cpumask_t cpu_boot_map; | |||
85 | extern void smp_init_cpus(void); | 86 | extern void smp_init_cpus(void); |
86 | extern void smp_cache_interrupt(void); | 87 | extern void smp_cache_interrupt(void); |
87 | extern void send_IPI_allbutself(int irq); | 88 | extern void send_IPI_allbutself(int irq); |
88 | extern int smp_nmi_call_function(smp_call_func_t func, void *info, int wait); | 89 | extern int smp_nmi_call_function(void (*func)(void *), void *info, int wait); |
89 | 90 | ||
90 | extern void arch_send_call_function_single_ipi(int cpu); | 91 | extern void arch_send_call_function_single_ipi(int cpu); |
91 | extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); | 92 | extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); |
@@ -100,6 +101,7 @@ extern void __cpu_die(unsigned int cpu); | |||
100 | #ifndef __ASSEMBLY__ | 101 | #ifndef __ASSEMBLY__ |
101 | 102 | ||
102 | static inline void smp_init_cpus(void) {} | 103 | static inline void smp_init_cpus(void) {} |
104 | #define raw_smp_processor_id() 0 | ||
103 | 105 | ||
104 | #endif /* __ASSEMBLY__ */ | 106 | #endif /* __ASSEMBLY__ */ |
105 | #endif /* CONFIG_SMP */ | 107 | #endif /* CONFIG_SMP */ |
diff --git a/arch/parisc/include/asm/mmzone.h b/arch/parisc/include/asm/mmzone.h index cc50d33b7b88..b6b34a0987e7 100644 --- a/arch/parisc/include/asm/mmzone.h +++ b/arch/parisc/include/asm/mmzone.h | |||
@@ -27,7 +27,7 @@ extern struct node_map_data node_data[]; | |||
27 | 27 | ||
28 | #define PFNNID_SHIFT (30 - PAGE_SHIFT) | 28 | #define PFNNID_SHIFT (30 - PAGE_SHIFT) |
29 | #define PFNNID_MAP_MAX 512 /* support 512GB */ | 29 | #define PFNNID_MAP_MAX 512 /* support 512GB */ |
30 | extern unsigned char pfnnid_map[PFNNID_MAP_MAX]; | 30 | extern signed char pfnnid_map[PFNNID_MAP_MAX]; |
31 | 31 | ||
32 | #ifndef CONFIG_64BIT | 32 | #ifndef CONFIG_64BIT |
33 | #define pfn_is_io(pfn) ((pfn & (0xf0000000UL >> PAGE_SHIFT)) == (0xf0000000UL >> PAGE_SHIFT)) | 33 | #define pfn_is_io(pfn) ((pfn & (0xf0000000UL >> PAGE_SHIFT)) == (0xf0000000UL >> PAGE_SHIFT)) |
@@ -46,7 +46,7 @@ static inline int pfn_to_nid(unsigned long pfn) | |||
46 | i = pfn >> PFNNID_SHIFT; | 46 | i = pfn >> PFNNID_SHIFT; |
47 | BUG_ON(i >= ARRAY_SIZE(pfnnid_map)); | 47 | BUG_ON(i >= ARRAY_SIZE(pfnnid_map)); |
48 | 48 | ||
49 | return (int)pfnnid_map[i]; | 49 | return pfnnid_map[i]; |
50 | } | 50 | } |
51 | 51 | ||
52 | static inline int pfn_valid(int pfn) | 52 | static inline int pfn_valid(int pfn) |
diff --git a/arch/parisc/include/asm/pci.h b/arch/parisc/include/asm/pci.h index 3234f492d575..465154076d23 100644 --- a/arch/parisc/include/asm/pci.h +++ b/arch/parisc/include/asm/pci.h | |||
@@ -225,4 +225,9 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) | |||
225 | return channel ? 15 : 14; | 225 | return channel ? 15 : 14; |
226 | } | 226 | } |
227 | 227 | ||
228 | #define HAVE_PCI_MMAP | ||
229 | |||
230 | extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | ||
231 | enum pci_mmap_state mmap_state, int write_combine); | ||
232 | |||
228 | #endif /* __ASM_PARISC_PCI_H */ | 233 | #endif /* __ASM_PARISC_PCI_H */ |
diff --git a/arch/parisc/kernel/hardware.c b/arch/parisc/kernel/hardware.c index 9e2d2e408529..872275659d98 100644 --- a/arch/parisc/kernel/hardware.c +++ b/arch/parisc/kernel/hardware.c | |||
@@ -1205,6 +1205,7 @@ static struct hp_hardware hp_hardware_list[] = { | |||
1205 | {HPHW_FIO, 0x004, 0x00320, 0x0, "Metheus Frame Buffer"}, | 1205 | {HPHW_FIO, 0x004, 0x00320, 0x0, "Metheus Frame Buffer"}, |
1206 | {HPHW_FIO, 0x004, 0x00340, 0x0, "BARCO CX4500 VME Grphx Cnsl"}, | 1206 | {HPHW_FIO, 0x004, 0x00340, 0x0, "BARCO CX4500 VME Grphx Cnsl"}, |
1207 | {HPHW_FIO, 0x004, 0x00360, 0x0, "Hughes TOG VME FDDI"}, | 1207 | {HPHW_FIO, 0x004, 0x00360, 0x0, "Hughes TOG VME FDDI"}, |
1208 | {HPHW_FIO, 0x076, 0x000AD, 0x00, "Crestone Peak RS-232"}, | ||
1208 | {HPHW_IOA, 0x185, 0x0000B, 0x00, "Java BC Summit Port"}, | 1209 | {HPHW_IOA, 0x185, 0x0000B, 0x00, "Java BC Summit Port"}, |
1209 | {HPHW_IOA, 0x1FF, 0x0000B, 0x00, "Hitachi Ghostview Summit Port"}, | 1210 | {HPHW_IOA, 0x1FF, 0x0000B, 0x00, "Hitachi Ghostview Summit Port"}, |
1210 | {HPHW_IOA, 0x580, 0x0000B, 0x10, "U2-IOA BC Runway Port"}, | 1211 | {HPHW_IOA, 0x580, 0x0000B, 0x10, "U2-IOA BC Runway Port"}, |
diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S index 36d7f402e48e..b743a80eaba0 100644 --- a/arch/parisc/kernel/pacache.S +++ b/arch/parisc/kernel/pacache.S | |||
@@ -860,7 +860,7 @@ ENTRY(flush_dcache_page_asm) | |||
860 | #endif | 860 | #endif |
861 | 861 | ||
862 | ldil L%dcache_stride, %r1 | 862 | ldil L%dcache_stride, %r1 |
863 | ldw R%dcache_stride(%r1), %r1 | 863 | ldw R%dcache_stride(%r1), r31 |
864 | 864 | ||
865 | #ifdef CONFIG_64BIT | 865 | #ifdef CONFIG_64BIT |
866 | depdi,z 1, 63-PAGE_SHIFT,1, %r25 | 866 | depdi,z 1, 63-PAGE_SHIFT,1, %r25 |
@@ -868,26 +868,26 @@ ENTRY(flush_dcache_page_asm) | |||
868 | depwi,z 1, 31-PAGE_SHIFT,1, %r25 | 868 | depwi,z 1, 31-PAGE_SHIFT,1, %r25 |
869 | #endif | 869 | #endif |
870 | add %r28, %r25, %r25 | 870 | add %r28, %r25, %r25 |
871 | sub %r25, %r1, %r25 | 871 | sub %r25, r31, %r25 |
872 | 872 | ||
873 | 873 | ||
874 | 1: fdc,m %r1(%r28) | 874 | 1: fdc,m r31(%r28) |
875 | fdc,m %r1(%r28) | 875 | fdc,m r31(%r28) |
876 | fdc,m %r1(%r28) | 876 | fdc,m r31(%r28) |
877 | fdc,m %r1(%r28) | 877 | fdc,m r31(%r28) |
878 | fdc,m %r1(%r28) | 878 | fdc,m r31(%r28) |
879 | fdc,m %r1(%r28) | 879 | fdc,m r31(%r28) |
880 | fdc,m %r1(%r28) | 880 | fdc,m r31(%r28) |
881 | fdc,m %r1(%r28) | 881 | fdc,m r31(%r28) |
882 | fdc,m %r1(%r28) | 882 | fdc,m r31(%r28) |
883 | fdc,m %r1(%r28) | 883 | fdc,m r31(%r28) |
884 | fdc,m %r1(%r28) | 884 | fdc,m r31(%r28) |
885 | fdc,m %r1(%r28) | 885 | fdc,m r31(%r28) |
886 | fdc,m %r1(%r28) | 886 | fdc,m r31(%r28) |
887 | fdc,m %r1(%r28) | 887 | fdc,m r31(%r28) |
888 | fdc,m %r1(%r28) | 888 | fdc,m r31(%r28) |
889 | cmpb,COND(<<) %r28, %r25,1b | 889 | cmpb,COND(<<) %r28, %r25,1b |
890 | fdc,m %r1(%r28) | 890 | fdc,m r31(%r28) |
891 | 891 | ||
892 | sync | 892 | sync |
893 | 893 | ||
@@ -936,7 +936,7 @@ ENTRY(flush_icache_page_asm) | |||
936 | #endif | 936 | #endif |
937 | 937 | ||
938 | ldil L%icache_stride, %r1 | 938 | ldil L%icache_stride, %r1 |
939 | ldw R%icache_stride(%r1), %r1 | 939 | ldw R%icache_stride(%r1), %r31 |
940 | 940 | ||
941 | #ifdef CONFIG_64BIT | 941 | #ifdef CONFIG_64BIT |
942 | depdi,z 1, 63-PAGE_SHIFT,1, %r25 | 942 | depdi,z 1, 63-PAGE_SHIFT,1, %r25 |
@@ -944,28 +944,28 @@ ENTRY(flush_icache_page_asm) | |||
944 | depwi,z 1, 31-PAGE_SHIFT,1, %r25 | 944 | depwi,z 1, 31-PAGE_SHIFT,1, %r25 |
945 | #endif | 945 | #endif |
946 | add %r28, %r25, %r25 | 946 | add %r28, %r25, %r25 |
947 | sub %r25, %r1, %r25 | 947 | sub %r25, %r31, %r25 |
948 | 948 | ||
949 | 949 | ||
950 | /* fic only has the type 26 form on PA1.1, requiring an | 950 | /* fic only has the type 26 form on PA1.1, requiring an |
951 | * explicit space specification, so use %sr4 */ | 951 | * explicit space specification, so use %sr4 */ |
952 | 1: fic,m %r1(%sr4,%r28) | 952 | 1: fic,m %r31(%sr4,%r28) |
953 | fic,m %r1(%sr4,%r28) | 953 | fic,m %r31(%sr4,%r28) |
954 | fic,m %r1(%sr4,%r28) | 954 | fic,m %r31(%sr4,%r28) |
955 | fic,m %r1(%sr4,%r28) | 955 | fic,m %r31(%sr4,%r28) |
956 | fic,m %r1(%sr4,%r28) | 956 | fic,m %r31(%sr4,%r28) |
957 | fic,m %r1(%sr4,%r28) | 957 | fic,m %r31(%sr4,%r28) |
958 | fic,m %r1(%sr4,%r28) | 958 | fic,m %r31(%sr4,%r28) |
959 | fic,m %r1(%sr4,%r28) | 959 | fic,m %r31(%sr4,%r28) |
960 | fic,m %r1(%sr4,%r28) | 960 | fic,m %r31(%sr4,%r28) |
961 | fic,m %r1(%sr4,%r28) | 961 | fic,m %r31(%sr4,%r28) |
962 | fic,m %r1(%sr4,%r28) | 962 | fic,m %r31(%sr4,%r28) |
963 | fic,m %r1(%sr4,%r28) | 963 | fic,m %r31(%sr4,%r28) |
964 | fic,m %r1(%sr4,%r28) | 964 | fic,m %r31(%sr4,%r28) |
965 | fic,m %r1(%sr4,%r28) | 965 | fic,m %r31(%sr4,%r28) |
966 | fic,m %r1(%sr4,%r28) | 966 | fic,m %r31(%sr4,%r28) |
967 | cmpb,COND(<<) %r28, %r25,1b | 967 | cmpb,COND(<<) %r28, %r25,1b |
968 | fic,m %r1(%sr4,%r28) | 968 | fic,m %r31(%sr4,%r28) |
969 | 969 | ||
970 | sync | 970 | sync |
971 | 971 | ||
diff --git a/arch/parisc/kernel/pci.c b/arch/parisc/kernel/pci.c index 60309051875e..64f2764a8cef 100644 --- a/arch/parisc/kernel/pci.c +++ b/arch/parisc/kernel/pci.c | |||
@@ -220,6 +220,33 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res, | |||
220 | } | 220 | } |
221 | 221 | ||
222 | 222 | ||
223 | int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | ||
224 | enum pci_mmap_state mmap_state, int write_combine) | ||
225 | { | ||
226 | unsigned long prot; | ||
227 | |||
228 | /* | ||
229 | * I/O space can be accessed via normal processor loads and stores on | ||
230 | * this platform but for now we elect not to do this and portable | ||
231 | * drivers should not do this anyway. | ||
232 | */ | ||
233 | if (mmap_state == pci_mmap_io) | ||
234 | return -EINVAL; | ||
235 | |||
236 | if (write_combine) | ||
237 | return -EINVAL; | ||
238 | |||
239 | /* | ||
240 | * Ignore write-combine; for now only return uncached mappings. | ||
241 | */ | ||
242 | prot = pgprot_val(vma->vm_page_prot); | ||
243 | prot |= _PAGE_NO_CACHE; | ||
244 | vma->vm_page_prot = __pgprot(prot); | ||
245 | |||
246 | return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, | ||
247 | vma->vm_end - vma->vm_start, vma->vm_page_prot); | ||
248 | } | ||
249 | |||
223 | /* | 250 | /* |
224 | * A driver is enabling the device. We make sure that all the appropriate | 251 | * A driver is enabling the device. We make sure that all the appropriate |
225 | * bits are set to allow the device to operate as the driver is expecting. | 252 | * bits are set to allow the device to operate as the driver is expecting. |
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index 1c965642068b..505b56c6b9b9 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c | |||
@@ -47,7 +47,7 @@ pte_t pg0[PT_INITIAL * PTRS_PER_PTE] __attribute__ ((__section__ (".data..vm0.pt | |||
47 | 47 | ||
48 | #ifdef CONFIG_DISCONTIGMEM | 48 | #ifdef CONFIG_DISCONTIGMEM |
49 | struct node_map_data node_data[MAX_NUMNODES] __read_mostly; | 49 | struct node_map_data node_data[MAX_NUMNODES] __read_mostly; |
50 | unsigned char pfnnid_map[PFNNID_MAP_MAX] __read_mostly; | 50 | signed char pfnnid_map[PFNNID_MAP_MAX] __read_mostly; |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | static struct resource data_resource = { | 53 | static struct resource data_resource = { |
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index 5cd7ad0c1176..1a1b51189773 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c | |||
@@ -673,7 +673,6 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) | |||
673 | ret = s; | 673 | ret = s; |
674 | goto out; | 674 | goto out; |
675 | } | 675 | } |
676 | kvmppc_lazy_ee_enable(); | ||
677 | 676 | ||
678 | kvm_guest_enter(); | 677 | kvm_guest_enter(); |
679 | 678 | ||
@@ -699,6 +698,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) | |||
699 | kvmppc_load_guest_fp(vcpu); | 698 | kvmppc_load_guest_fp(vcpu); |
700 | #endif | 699 | #endif |
701 | 700 | ||
701 | kvmppc_lazy_ee_enable(); | ||
702 | |||
702 | ret = __kvmppc_vcpu_run(kvm_run, vcpu); | 703 | ret = __kvmppc_vcpu_run(kvm_run, vcpu); |
703 | 704 | ||
704 | /* No need for kvm_guest_exit. It's done in handle_exit. | 705 | /* No need for kvm_guest_exit. It's done in handle_exit. |
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 237c8e5f2640..77fdd2cef33b 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
@@ -592,8 +592,14 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud, | |||
592 | do { | 592 | do { |
593 | pmd = pmd_offset(pud, addr); | 593 | pmd = pmd_offset(pud, addr); |
594 | next = pmd_addr_end(addr, end); | 594 | next = pmd_addr_end(addr, end); |
595 | if (pmd_none_or_clear_bad(pmd)) | 595 | if (!is_hugepd(pmd)) { |
596 | /* | ||
597 | * if it is not hugepd pointer, we should already find | ||
598 | * it cleared. | ||
599 | */ | ||
600 | WARN_ON(!pmd_none_or_clear_bad(pmd)); | ||
596 | continue; | 601 | continue; |
602 | } | ||
597 | #ifdef CONFIG_PPC_FSL_BOOK3E | 603 | #ifdef CONFIG_PPC_FSL_BOOK3E |
598 | /* | 604 | /* |
599 | * Increment next by the size of the huge mapping since | 605 | * Increment next by the size of the huge mapping since |
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild index ff18e3cfb6b1..7e4a97fbded4 100644 --- a/arch/sparc/include/asm/Kbuild +++ b/arch/sparc/include/asm/Kbuild | |||
@@ -6,6 +6,7 @@ generic-y += cputime.h | |||
6 | generic-y += div64.h | 6 | generic-y += div64.h |
7 | generic-y += emergency-restart.h | 7 | generic-y += emergency-restart.h |
8 | generic-y += exec.h | 8 | generic-y += exec.h |
9 | generic-y += linkage.h | ||
9 | generic-y += local64.h | 10 | generic-y += local64.h |
10 | generic-y += mutex.h | 11 | generic-y += mutex.h |
11 | generic-y += irq_regs.h | 12 | generic-y += irq_regs.h |
diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h index 15a716934e4d..b836e9297f2a 100644 --- a/arch/sparc/include/asm/leon.h +++ b/arch/sparc/include/asm/leon.h | |||
@@ -135,7 +135,7 @@ static inline int sparc_leon3_cpuid(void) | |||
135 | 135 | ||
136 | #ifdef CONFIG_SMP | 136 | #ifdef CONFIG_SMP |
137 | # define LEON3_IRQ_IPI_DEFAULT 13 | 137 | # define LEON3_IRQ_IPI_DEFAULT 13 |
138 | # define LEON3_IRQ_TICKER (leon3_ticker_irq) | 138 | # define LEON3_IRQ_TICKER (leon3_gptimer_irq) |
139 | # define LEON3_IRQ_CROSS_CALL 15 | 139 | # define LEON3_IRQ_CROSS_CALL 15 |
140 | #endif | 140 | #endif |
141 | 141 | ||
diff --git a/arch/sparc/include/asm/leon_amba.h b/arch/sparc/include/asm/leon_amba.h index f3034eddf468..24ec48c3ff90 100644 --- a/arch/sparc/include/asm/leon_amba.h +++ b/arch/sparc/include/asm/leon_amba.h | |||
@@ -47,6 +47,7 @@ struct amba_prom_registers { | |||
47 | #define LEON3_GPTIMER_LD 4 | 47 | #define LEON3_GPTIMER_LD 4 |
48 | #define LEON3_GPTIMER_IRQEN 8 | 48 | #define LEON3_GPTIMER_IRQEN 8 |
49 | #define LEON3_GPTIMER_SEPIRQ 8 | 49 | #define LEON3_GPTIMER_SEPIRQ 8 |
50 | #define LEON3_GPTIMER_TIMERS 0x7 | ||
50 | 51 | ||
51 | #define LEON23_REG_TIMER_CONTROL_EN 0x00000001 /* 1 = enable counting */ | 52 | #define LEON23_REG_TIMER_CONTROL_EN 0x00000001 /* 1 = enable counting */ |
52 | /* 0 = hold scalar and counter */ | 53 | /* 0 = hold scalar and counter */ |
diff --git a/arch/sparc/include/asm/linkage.h b/arch/sparc/include/asm/linkage.h deleted file mode 100644 index 291c2d01c44f..000000000000 --- a/arch/sparc/include/asm/linkage.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ASM_LINKAGE_H | ||
2 | #define __ASM_LINKAGE_H | ||
3 | |||
4 | /* Nothing to see here... */ | ||
5 | |||
6 | #endif | ||
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c index 75bb608c423e..5ef48dab5636 100644 --- a/arch/sparc/kernel/ds.c +++ b/arch/sparc/kernel/ds.c | |||
@@ -843,7 +843,8 @@ void ldom_reboot(const char *boot_command) | |||
843 | unsigned long len; | 843 | unsigned long len; |
844 | 844 | ||
845 | strcpy(full_boot_str, "boot "); | 845 | strcpy(full_boot_str, "boot "); |
846 | strcpy(full_boot_str + strlen("boot "), boot_command); | 846 | strlcpy(full_boot_str + strlen("boot "), boot_command, |
847 | sizeof(full_boot_str + strlen("boot "))); | ||
847 | len = strlen(full_boot_str); | 848 | len = strlen(full_boot_str); |
848 | 849 | ||
849 | if (reboot_data_supported) { | 850 | if (reboot_data_supported) { |
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c index 7c0231dabe44..b7c68976cbc7 100644 --- a/arch/sparc/kernel/leon_kernel.c +++ b/arch/sparc/kernel/leon_kernel.c | |||
@@ -38,7 +38,6 @@ static DEFINE_SPINLOCK(leon_irq_lock); | |||
38 | 38 | ||
39 | unsigned long leon3_gptimer_irq; /* interrupt controller irq number */ | 39 | unsigned long leon3_gptimer_irq; /* interrupt controller irq number */ |
40 | unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */ | 40 | unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */ |
41 | int leon3_ticker_irq; /* Timer ticker IRQ */ | ||
42 | unsigned int sparc_leon_eirq; | 41 | unsigned int sparc_leon_eirq; |
43 | #define LEON_IMASK(cpu) (&leon3_irqctrl_regs->mask[cpu]) | 42 | #define LEON_IMASK(cpu) (&leon3_irqctrl_regs->mask[cpu]) |
44 | #define LEON_IACK (&leon3_irqctrl_regs->iclear) | 43 | #define LEON_IACK (&leon3_irqctrl_regs->iclear) |
@@ -278,6 +277,9 @@ irqreturn_t leon_percpu_timer_ce_interrupt(int irq, void *unused) | |||
278 | 277 | ||
279 | leon_clear_profile_irq(cpu); | 278 | leon_clear_profile_irq(cpu); |
280 | 279 | ||
280 | if (cpu == boot_cpu_id) | ||
281 | timer_interrupt(irq, NULL); | ||
282 | |||
281 | ce = &per_cpu(sparc32_clockevent, cpu); | 283 | ce = &per_cpu(sparc32_clockevent, cpu); |
282 | 284 | ||
283 | irq_enter(); | 285 | irq_enter(); |
@@ -299,6 +301,7 @@ void __init leon_init_timers(void) | |||
299 | int icsel; | 301 | int icsel; |
300 | int ampopts; | 302 | int ampopts; |
301 | int err; | 303 | int err; |
304 | u32 config; | ||
302 | 305 | ||
303 | sparc_config.get_cycles_offset = leon_cycles_offset; | 306 | sparc_config.get_cycles_offset = leon_cycles_offset; |
304 | sparc_config.cs_period = 1000000 / HZ; | 307 | sparc_config.cs_period = 1000000 / HZ; |
@@ -377,23 +380,6 @@ void __init leon_init_timers(void) | |||
377 | LEON3_BYPASS_STORE_PA( | 380 | LEON3_BYPASS_STORE_PA( |
378 | &leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl, 0); | 381 | &leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl, 0); |
379 | 382 | ||
380 | #ifdef CONFIG_SMP | ||
381 | leon3_ticker_irq = leon3_gptimer_irq + 1 + leon3_gptimer_idx; | ||
382 | |||
383 | if (!(LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->config) & | ||
384 | (1<<LEON3_GPTIMER_SEPIRQ))) { | ||
385 | printk(KERN_ERR "timer not configured with separate irqs\n"); | ||
386 | BUG(); | ||
387 | } | ||
388 | |||
389 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].val, | ||
390 | 0); | ||
391 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].rld, | ||
392 | (((1000000/HZ) - 1))); | ||
393 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].ctrl, | ||
394 | 0); | ||
395 | #endif | ||
396 | |||
397 | /* | 383 | /* |
398 | * The IRQ controller may (if implemented) consist of multiple | 384 | * The IRQ controller may (if implemented) consist of multiple |
399 | * IRQ controllers, each mapped on a 4Kb boundary. | 385 | * IRQ controllers, each mapped on a 4Kb boundary. |
@@ -416,13 +402,6 @@ void __init leon_init_timers(void) | |||
416 | if (eirq != 0) | 402 | if (eirq != 0) |
417 | leon_eirq_setup(eirq); | 403 | leon_eirq_setup(eirq); |
418 | 404 | ||
419 | irq = _leon_build_device_irq(NULL, leon3_gptimer_irq+leon3_gptimer_idx); | ||
420 | err = request_irq(irq, timer_interrupt, IRQF_TIMER, "timer", NULL); | ||
421 | if (err) { | ||
422 | printk(KERN_ERR "unable to attach timer IRQ%d\n", irq); | ||
423 | prom_halt(); | ||
424 | } | ||
425 | |||
426 | #ifdef CONFIG_SMP | 405 | #ifdef CONFIG_SMP |
427 | { | 406 | { |
428 | unsigned long flags; | 407 | unsigned long flags; |
@@ -439,30 +418,31 @@ void __init leon_init_timers(void) | |||
439 | } | 418 | } |
440 | #endif | 419 | #endif |
441 | 420 | ||
442 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl, | 421 | config = LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->config); |
443 | LEON3_GPTIMER_EN | | 422 | if (config & (1 << LEON3_GPTIMER_SEPIRQ)) |
444 | LEON3_GPTIMER_RL | | 423 | leon3_gptimer_irq += leon3_gptimer_idx; |
445 | LEON3_GPTIMER_LD | | 424 | else if ((config & LEON3_GPTIMER_TIMERS) > 1) |
446 | LEON3_GPTIMER_IRQEN); | 425 | pr_warn("GPTIMER uses shared irqs, using other timers of the same core will fail.\n"); |
447 | 426 | ||
448 | #ifdef CONFIG_SMP | 427 | #ifdef CONFIG_SMP |
449 | /* Install per-cpu IRQ handler for broadcasted ticker */ | 428 | /* Install per-cpu IRQ handler for broadcasted ticker */ |
450 | irq = leon_build_device_irq(leon3_ticker_irq, handle_percpu_irq, | 429 | irq = leon_build_device_irq(leon3_gptimer_irq, handle_percpu_irq, |
451 | "per-cpu", 0); | 430 | "per-cpu", 0); |
452 | err = request_irq(irq, leon_percpu_timer_ce_interrupt, | 431 | err = request_irq(irq, leon_percpu_timer_ce_interrupt, |
453 | IRQF_PERCPU | IRQF_TIMER, "ticker", | 432 | IRQF_PERCPU | IRQF_TIMER, "timer", NULL); |
454 | NULL); | 433 | #else |
434 | irq = _leon_build_device_irq(NULL, leon3_gptimer_irq); | ||
435 | err = request_irq(irq, timer_interrupt, IRQF_TIMER, "timer", NULL); | ||
436 | #endif | ||
455 | if (err) { | 437 | if (err) { |
456 | printk(KERN_ERR "unable to attach ticker IRQ%d\n", irq); | 438 | pr_err("Unable to attach timer IRQ%d\n", irq); |
457 | prom_halt(); | 439 | prom_halt(); |
458 | } | 440 | } |
459 | 441 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl, | |
460 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].ctrl, | ||
461 | LEON3_GPTIMER_EN | | 442 | LEON3_GPTIMER_EN | |
462 | LEON3_GPTIMER_RL | | 443 | LEON3_GPTIMER_RL | |
463 | LEON3_GPTIMER_LD | | 444 | LEON3_GPTIMER_LD | |
464 | LEON3_GPTIMER_IRQEN); | 445 | LEON3_GPTIMER_IRQEN); |
465 | #endif | ||
466 | return; | 446 | return; |
467 | bad: | 447 | bad: |
468 | printk(KERN_ERR "No Timer/irqctrl found\n"); | 448 | printk(KERN_ERR "No Timer/irqctrl found\n"); |
diff --git a/arch/sparc/kernel/leon_pci_grpci1.c b/arch/sparc/kernel/leon_pci_grpci1.c index 7739a54315e2..6df26e37f879 100644 --- a/arch/sparc/kernel/leon_pci_grpci1.c +++ b/arch/sparc/kernel/leon_pci_grpci1.c | |||
@@ -536,11 +536,9 @@ static int grpci1_of_probe(struct platform_device *ofdev) | |||
536 | 536 | ||
537 | /* find device register base address */ | 537 | /* find device register base address */ |
538 | res = platform_get_resource(ofdev, IORESOURCE_MEM, 0); | 538 | res = platform_get_resource(ofdev, IORESOURCE_MEM, 0); |
539 | regs = devm_request_and_ioremap(&ofdev->dev, res); | 539 | regs = devm_ioremap_resource(&ofdev->dev, res); |
540 | if (!regs) { | 540 | if (IS_ERR(regs)) |
541 | dev_err(&ofdev->dev, "io-regs mapping failed\n"); | 541 | return PTR_ERR(regs); |
542 | return -EADDRNOTAVAIL; | ||
543 | } | ||
544 | 542 | ||
545 | /* | 543 | /* |
546 | * check that we're in Host Slot and that we can act as a Host Bridge | 544 | * check that we're in Host Slot and that we can act as a Host Bridge |
diff --git a/arch/sparc/kernel/leon_pmc.c b/arch/sparc/kernel/leon_pmc.c index bdf53d9a8d46..b0b3967a2dd2 100644 --- a/arch/sparc/kernel/leon_pmc.c +++ b/arch/sparc/kernel/leon_pmc.c | |||
@@ -47,6 +47,10 @@ void pmc_leon_idle_fixup(void) | |||
47 | * MMU does not get a TLB miss here by using the MMU BYPASS ASI. | 47 | * MMU does not get a TLB miss here by using the MMU BYPASS ASI. |
48 | */ | 48 | */ |
49 | register unsigned int address = (unsigned int)leon3_irqctrl_regs; | 49 | register unsigned int address = (unsigned int)leon3_irqctrl_regs; |
50 | |||
51 | /* Interrupts need to be enabled to not hang the CPU */ | ||
52 | local_irq_enable(); | ||
53 | |||
50 | __asm__ __volatile__ ( | 54 | __asm__ __volatile__ ( |
51 | "wr %%g0, %%asr19\n" | 55 | "wr %%g0, %%asr19\n" |
52 | "lda [%0] %1, %%g0\n" | 56 | "lda [%0] %1, %%g0\n" |
@@ -60,6 +64,9 @@ void pmc_leon_idle_fixup(void) | |||
60 | */ | 64 | */ |
61 | void pmc_leon_idle(void) | 65 | void pmc_leon_idle(void) |
62 | { | 66 | { |
67 | /* Interrupts need to be enabled to not hang the CPU */ | ||
68 | local_irq_enable(); | ||
69 | |||
63 | /* For systems without power-down, this will be no-op */ | 70 | /* For systems without power-down, this will be no-op */ |
64 | __asm__ __volatile__ ("wr %g0, %asr19\n\t"); | 71 | __asm__ __volatile__ ("wr %g0, %asr19\n\t"); |
65 | } | 72 | } |
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c index 38bf80a22f02..1434526970a6 100644 --- a/arch/sparc/kernel/setup_32.c +++ b/arch/sparc/kernel/setup_32.c | |||
@@ -304,7 +304,7 @@ void __init setup_arch(char **cmdline_p) | |||
304 | 304 | ||
305 | /* Initialize PROM console and command line. */ | 305 | /* Initialize PROM console and command line. */ |
306 | *cmdline_p = prom_getbootargs(); | 306 | *cmdline_p = prom_getbootargs(); |
307 | strcpy(boot_command_line, *cmdline_p); | 307 | strlcpy(boot_command_line, *cmdline_p, COMMAND_LINE_SIZE); |
308 | parse_early_param(); | 308 | parse_early_param(); |
309 | 309 | ||
310 | boot_flags_init(*cmdline_p); | 310 | boot_flags_init(*cmdline_p); |
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index 88a127b9c69e..13785547e435 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c | |||
@@ -555,7 +555,7 @@ void __init setup_arch(char **cmdline_p) | |||
555 | { | 555 | { |
556 | /* Initialize PROM console and command line. */ | 556 | /* Initialize PROM console and command line. */ |
557 | *cmdline_p = prom_getbootargs(); | 557 | *cmdline_p = prom_getbootargs(); |
558 | strcpy(boot_command_line, *cmdline_p); | 558 | strlcpy(boot_command_line, *cmdline_p, COMMAND_LINE_SIZE); |
559 | parse_early_param(); | 559 | parse_early_param(); |
560 | 560 | ||
561 | boot_flags_init(*cmdline_p); | 561 | boot_flags_init(*cmdline_p); |
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index a7171997adfd..04fd55a6e461 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
@@ -1098,7 +1098,14 @@ static int __init grab_mblocks(struct mdesc_handle *md) | |||
1098 | m->size = *val; | 1098 | m->size = *val; |
1099 | val = mdesc_get_property(md, node, | 1099 | val = mdesc_get_property(md, node, |
1100 | "address-congruence-offset", NULL); | 1100 | "address-congruence-offset", NULL); |
1101 | m->offset = *val; | 1101 | |
1102 | /* The address-congruence-offset property is optional. | ||
1103 | * Explicity zero it be identifty this. | ||
1104 | */ | ||
1105 | if (val) | ||
1106 | m->offset = *val; | ||
1107 | else | ||
1108 | m->offset = 0UL; | ||
1102 | 1109 | ||
1103 | numadbg("MBLOCK[%d]: base[%llx] size[%llx] offset[%llx]\n", | 1110 | numadbg("MBLOCK[%d]: base[%llx] size[%llx] offset[%llx]\n", |
1104 | count - 1, m->base, m->size, m->offset); | 1111 | count - 1, m->base, m->size, m->offset); |
diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c index 83d89bcb44af..37e7bc4c95b3 100644 --- a/arch/sparc/mm/tlb.c +++ b/arch/sparc/mm/tlb.c | |||
@@ -85,8 +85,8 @@ static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr, | |||
85 | } | 85 | } |
86 | 86 | ||
87 | if (!tb->active) { | 87 | if (!tb->active) { |
88 | global_flush_tlb_page(mm, vaddr); | ||
89 | flush_tsb_user_page(mm, vaddr); | 88 | flush_tsb_user_page(mm, vaddr); |
89 | global_flush_tlb_page(mm, vaddr); | ||
90 | goto out; | 90 | goto out; |
91 | } | 91 | } |
92 | 92 | ||
diff --git a/arch/sparc/prom/bootstr_32.c b/arch/sparc/prom/bootstr_32.c index f5ec32e0d419..d2b49d2365e7 100644 --- a/arch/sparc/prom/bootstr_32.c +++ b/arch/sparc/prom/bootstr_32.c | |||
@@ -23,23 +23,25 @@ prom_getbootargs(void) | |||
23 | return barg_buf; | 23 | return barg_buf; |
24 | } | 24 | } |
25 | 25 | ||
26 | switch(prom_vers) { | 26 | switch (prom_vers) { |
27 | case PROM_V0: | 27 | case PROM_V0: |
28 | cp = barg_buf; | 28 | cp = barg_buf; |
29 | /* Start from 1 and go over fd(0,0,0)kernel */ | 29 | /* Start from 1 and go over fd(0,0,0)kernel */ |
30 | for(iter = 1; iter < 8; iter++) { | 30 | for (iter = 1; iter < 8; iter++) { |
31 | arg = (*(romvec->pv_v0bootargs))->argv[iter]; | 31 | arg = (*(romvec->pv_v0bootargs))->argv[iter]; |
32 | if (arg == NULL) | 32 | if (arg == NULL) |
33 | break; | 33 | break; |
34 | while(*arg != 0) { | 34 | while (*arg != 0) { |
35 | /* Leave place for space and null. */ | 35 | /* Leave place for space and null. */ |
36 | if(cp >= barg_buf + BARG_LEN-2){ | 36 | if (cp >= barg_buf + BARG_LEN - 2) |
37 | /* We might issue a warning here. */ | 37 | /* We might issue a warning here. */ |
38 | break; | 38 | break; |
39 | } | ||
40 | *cp++ = *arg++; | 39 | *cp++ = *arg++; |
41 | } | 40 | } |
42 | *cp++ = ' '; | 41 | *cp++ = ' '; |
42 | if (cp >= barg_buf + BARG_LEN - 1) | ||
43 | /* We might issue a warning here. */ | ||
44 | break; | ||
43 | } | 45 | } |
44 | *cp = 0; | 46 | *cp = 0; |
45 | break; | 47 | break; |
diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c index 92204c3800b5..bd1b2a3ac34e 100644 --- a/arch/sparc/prom/tree_64.c +++ b/arch/sparc/prom/tree_64.c | |||
@@ -39,7 +39,7 @@ inline phandle __prom_getchild(phandle node) | |||
39 | return prom_node_to_node("child", node); | 39 | return prom_node_to_node("child", node); |
40 | } | 40 | } |
41 | 41 | ||
42 | inline phandle prom_getchild(phandle node) | 42 | phandle prom_getchild(phandle node) |
43 | { | 43 | { |
44 | phandle cnode; | 44 | phandle cnode; |
45 | 45 | ||
@@ -72,7 +72,7 @@ inline phandle __prom_getsibling(phandle node) | |||
72 | return prom_node_to_node(prom_peer_name, node); | 72 | return prom_node_to_node(prom_peer_name, node); |
73 | } | 73 | } |
74 | 74 | ||
75 | inline phandle prom_getsibling(phandle node) | 75 | phandle prom_getsibling(phandle node) |
76 | { | 76 | { |
77 | phandle sibnode; | 77 | phandle sibnode; |
78 | 78 | ||
@@ -89,7 +89,7 @@ EXPORT_SYMBOL(prom_getsibling); | |||
89 | /* Return the length in bytes of property 'prop' at node 'node'. | 89 | /* Return the length in bytes of property 'prop' at node 'node'. |
90 | * Return -1 on error. | 90 | * Return -1 on error. |
91 | */ | 91 | */ |
92 | inline int prom_getproplen(phandle node, const char *prop) | 92 | int prom_getproplen(phandle node, const char *prop) |
93 | { | 93 | { |
94 | unsigned long args[6]; | 94 | unsigned long args[6]; |
95 | 95 | ||
@@ -113,8 +113,8 @@ EXPORT_SYMBOL(prom_getproplen); | |||
113 | * 'buffer' which has a size of 'bufsize'. If the acquisition | 113 | * 'buffer' which has a size of 'bufsize'. If the acquisition |
114 | * was successful the length will be returned, else -1 is returned. | 114 | * was successful the length will be returned, else -1 is returned. |
115 | */ | 115 | */ |
116 | inline int prom_getproperty(phandle node, const char *prop, | 116 | int prom_getproperty(phandle node, const char *prop, |
117 | char *buffer, int bufsize) | 117 | char *buffer, int bufsize) |
118 | { | 118 | { |
119 | unsigned long args[8]; | 119 | unsigned long args[8]; |
120 | int plen; | 120 | int plen; |
@@ -141,7 +141,7 @@ EXPORT_SYMBOL(prom_getproperty); | |||
141 | /* Acquire an integer property and return its value. Returns -1 | 141 | /* Acquire an integer property and return its value. Returns -1 |
142 | * on failure. | 142 | * on failure. |
143 | */ | 143 | */ |
144 | inline int prom_getint(phandle node, const char *prop) | 144 | int prom_getint(phandle node, const char *prop) |
145 | { | 145 | { |
146 | int intprop; | 146 | int intprop; |
147 | 147 | ||
@@ -235,7 +235,7 @@ static const char *prom_nextprop_name = "nextprop"; | |||
235 | /* Return the first property type for node 'node'. | 235 | /* Return the first property type for node 'node'. |
236 | * buffer should be at least 32B in length | 236 | * buffer should be at least 32B in length |
237 | */ | 237 | */ |
238 | inline char *prom_firstprop(phandle node, char *buffer) | 238 | char *prom_firstprop(phandle node, char *buffer) |
239 | { | 239 | { |
240 | unsigned long args[7]; | 240 | unsigned long args[7]; |
241 | 241 | ||
@@ -261,7 +261,7 @@ EXPORT_SYMBOL(prom_firstprop); | |||
261 | * at node 'node' . Returns NULL string if no more | 261 | * at node 'node' . Returns NULL string if no more |
262 | * property types for this node. | 262 | * property types for this node. |
263 | */ | 263 | */ |
264 | inline char *prom_nextprop(phandle node, const char *oprop, char *buffer) | 264 | char *prom_nextprop(phandle node, const char *oprop, char *buffer) |
265 | { | 265 | { |
266 | unsigned long args[7]; | 266 | unsigned long args[7]; |
267 | char buf[32]; | 267 | char buf[32]; |
diff --git a/arch/tile/lib/exports.c b/arch/tile/lib/exports.c index 4385cb6fa00a..a93b02a25222 100644 --- a/arch/tile/lib/exports.c +++ b/arch/tile/lib/exports.c | |||
@@ -84,4 +84,6 @@ uint64_t __ashrdi3(uint64_t, unsigned int); | |||
84 | EXPORT_SYMBOL(__ashrdi3); | 84 | EXPORT_SYMBOL(__ashrdi3); |
85 | uint64_t __ashldi3(uint64_t, unsigned int); | 85 | uint64_t __ashldi3(uint64_t, unsigned int); |
86 | EXPORT_SYMBOL(__ashldi3); | 86 | EXPORT_SYMBOL(__ashldi3); |
87 | int __ffsdi2(uint64_t); | ||
88 | EXPORT_SYMBOL(__ffsdi2); | ||
87 | #endif | 89 | #endif |
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index d7d21851e60c..3df3bd544492 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c | |||
@@ -147,7 +147,7 @@ void mconsole_proc(struct mc_request *req) | |||
147 | } | 147 | } |
148 | 148 | ||
149 | do { | 149 | do { |
150 | loff_t pos; | 150 | loff_t pos = file->f_pos; |
151 | mm_segment_t old_fs = get_fs(); | 151 | mm_segment_t old_fs = get_fs(); |
152 | set_fs(KERNEL_DS); | 152 | set_fs(KERNEL_DS); |
153 | len = vfs_read(file, buf, PAGE_SIZE - 1, &pos); | 153 | len = vfs_read(file, buf, PAGE_SIZE - 1, &pos); |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 685692c94f05..fe120da25625 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -2265,6 +2265,7 @@ source "fs/Kconfig.binfmt" | |||
2265 | config IA32_EMULATION | 2265 | config IA32_EMULATION |
2266 | bool "IA32 Emulation" | 2266 | bool "IA32 Emulation" |
2267 | depends on X86_64 | 2267 | depends on X86_64 |
2268 | select BINFMT_ELF | ||
2268 | select COMPAT_BINFMT_ELF | 2269 | select COMPAT_BINFMT_ELF |
2269 | select HAVE_UID16 | 2270 | select HAVE_UID16 |
2270 | ---help--- | 2271 | ---help--- |
diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S index 62fe22cd4cba..477e9d75149b 100644 --- a/arch/x86/crypto/aesni-intel_asm.S +++ b/arch/x86/crypto/aesni-intel_asm.S | |||
@@ -2681,56 +2681,68 @@ ENTRY(aesni_xts_crypt8) | |||
2681 | addq %rcx, KEYP | 2681 | addq %rcx, KEYP |
2682 | 2682 | ||
2683 | movdqa IV, STATE1 | 2683 | movdqa IV, STATE1 |
2684 | pxor 0x00(INP), STATE1 | 2684 | movdqu 0x00(INP), INC |
2685 | pxor INC, STATE1 | ||
2685 | movdqu IV, 0x00(OUTP) | 2686 | movdqu IV, 0x00(OUTP) |
2686 | 2687 | ||
2687 | _aesni_gf128mul_x_ble() | 2688 | _aesni_gf128mul_x_ble() |
2688 | movdqa IV, STATE2 | 2689 | movdqa IV, STATE2 |
2689 | pxor 0x10(INP), STATE2 | 2690 | movdqu 0x10(INP), INC |
2691 | pxor INC, STATE2 | ||
2690 | movdqu IV, 0x10(OUTP) | 2692 | movdqu IV, 0x10(OUTP) |
2691 | 2693 | ||
2692 | _aesni_gf128mul_x_ble() | 2694 | _aesni_gf128mul_x_ble() |
2693 | movdqa IV, STATE3 | 2695 | movdqa IV, STATE3 |
2694 | pxor 0x20(INP), STATE3 | 2696 | movdqu 0x20(INP), INC |
2697 | pxor INC, STATE3 | ||
2695 | movdqu IV, 0x20(OUTP) | 2698 | movdqu IV, 0x20(OUTP) |
2696 | 2699 | ||
2697 | _aesni_gf128mul_x_ble() | 2700 | _aesni_gf128mul_x_ble() |
2698 | movdqa IV, STATE4 | 2701 | movdqa IV, STATE4 |
2699 | pxor 0x30(INP), STATE4 | 2702 | movdqu 0x30(INP), INC |
2703 | pxor INC, STATE4 | ||
2700 | movdqu IV, 0x30(OUTP) | 2704 | movdqu IV, 0x30(OUTP) |
2701 | 2705 | ||
2702 | call *%r11 | 2706 | call *%r11 |
2703 | 2707 | ||
2704 | pxor 0x00(OUTP), STATE1 | 2708 | movdqu 0x00(OUTP), INC |
2709 | pxor INC, STATE1 | ||
2705 | movdqu STATE1, 0x00(OUTP) | 2710 | movdqu STATE1, 0x00(OUTP) |
2706 | 2711 | ||
2707 | _aesni_gf128mul_x_ble() | 2712 | _aesni_gf128mul_x_ble() |
2708 | movdqa IV, STATE1 | 2713 | movdqa IV, STATE1 |
2709 | pxor 0x40(INP), STATE1 | 2714 | movdqu 0x40(INP), INC |
2715 | pxor INC, STATE1 | ||
2710 | movdqu IV, 0x40(OUTP) | 2716 | movdqu IV, 0x40(OUTP) |
2711 | 2717 | ||
2712 | pxor 0x10(OUTP), STATE2 | 2718 | movdqu 0x10(OUTP), INC |
2719 | pxor INC, STATE2 | ||
2713 | movdqu STATE2, 0x10(OUTP) | 2720 | movdqu STATE2, 0x10(OUTP) |
2714 | 2721 | ||
2715 | _aesni_gf128mul_x_ble() | 2722 | _aesni_gf128mul_x_ble() |
2716 | movdqa IV, STATE2 | 2723 | movdqa IV, STATE2 |
2717 | pxor 0x50(INP), STATE2 | 2724 | movdqu 0x50(INP), INC |
2725 | pxor INC, STATE2 | ||
2718 | movdqu IV, 0x50(OUTP) | 2726 | movdqu IV, 0x50(OUTP) |
2719 | 2727 | ||
2720 | pxor 0x20(OUTP), STATE3 | 2728 | movdqu 0x20(OUTP), INC |
2729 | pxor INC, STATE3 | ||
2721 | movdqu STATE3, 0x20(OUTP) | 2730 | movdqu STATE3, 0x20(OUTP) |
2722 | 2731 | ||
2723 | _aesni_gf128mul_x_ble() | 2732 | _aesni_gf128mul_x_ble() |
2724 | movdqa IV, STATE3 | 2733 | movdqa IV, STATE3 |
2725 | pxor 0x60(INP), STATE3 | 2734 | movdqu 0x60(INP), INC |
2735 | pxor INC, STATE3 | ||
2726 | movdqu IV, 0x60(OUTP) | 2736 | movdqu IV, 0x60(OUTP) |
2727 | 2737 | ||
2728 | pxor 0x30(OUTP), STATE4 | 2738 | movdqu 0x30(OUTP), INC |
2739 | pxor INC, STATE4 | ||
2729 | movdqu STATE4, 0x30(OUTP) | 2740 | movdqu STATE4, 0x30(OUTP) |
2730 | 2741 | ||
2731 | _aesni_gf128mul_x_ble() | 2742 | _aesni_gf128mul_x_ble() |
2732 | movdqa IV, STATE4 | 2743 | movdqa IV, STATE4 |
2733 | pxor 0x70(INP), STATE4 | 2744 | movdqu 0x70(INP), INC |
2745 | pxor INC, STATE4 | ||
2734 | movdqu IV, 0x70(OUTP) | 2746 | movdqu IV, 0x70(OUTP) |
2735 | 2747 | ||
2736 | _aesni_gf128mul_x_ble() | 2748 | _aesni_gf128mul_x_ble() |
@@ -2738,16 +2750,20 @@ ENTRY(aesni_xts_crypt8) | |||
2738 | 2750 | ||
2739 | call *%r11 | 2751 | call *%r11 |
2740 | 2752 | ||
2741 | pxor 0x40(OUTP), STATE1 | 2753 | movdqu 0x40(OUTP), INC |
2754 | pxor INC, STATE1 | ||
2742 | movdqu STATE1, 0x40(OUTP) | 2755 | movdqu STATE1, 0x40(OUTP) |
2743 | 2756 | ||
2744 | pxor 0x50(OUTP), STATE2 | 2757 | movdqu 0x50(OUTP), INC |
2758 | pxor INC, STATE2 | ||
2745 | movdqu STATE2, 0x50(OUTP) | 2759 | movdqu STATE2, 0x50(OUTP) |
2746 | 2760 | ||
2747 | pxor 0x60(OUTP), STATE3 | 2761 | movdqu 0x60(OUTP), INC |
2762 | pxor INC, STATE3 | ||
2748 | movdqu STATE3, 0x60(OUTP) | 2763 | movdqu STATE3, 0x60(OUTP) |
2749 | 2764 | ||
2750 | pxor 0x70(OUTP), STATE4 | 2765 | movdqu 0x70(OUTP), INC |
2766 | pxor INC, STATE4 | ||
2751 | movdqu STATE4, 0x70(OUTP) | 2767 | movdqu STATE4, 0x70(OUTP) |
2752 | 2768 | ||
2753 | ret | 2769 | ret |
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c index 805078e08013..52ff81cce008 100644 --- a/arch/x86/ia32/ia32_aout.c +++ b/arch/x86/ia32/ia32_aout.c | |||
@@ -192,7 +192,7 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, | |||
192 | /* struct user */ | 192 | /* struct user */ |
193 | DUMP_WRITE(&dump, sizeof(dump)); | 193 | DUMP_WRITE(&dump, sizeof(dump)); |
194 | /* Now dump all of the user data. Include malloced stuff as well */ | 194 | /* Now dump all of the user data. Include malloced stuff as well */ |
195 | DUMP_SEEK(PAGE_SIZE); | 195 | DUMP_SEEK(PAGE_SIZE - sizeof(dump)); |
196 | /* now we start writing out the user space info */ | 196 | /* now we start writing out the user space info */ |
197 | set_fs(USER_DS); | 197 | set_fs(USER_DS); |
198 | /* Dump the data area */ | 198 | /* Dump the data area */ |
diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h index ba870bb6dd8e..57873beb3292 100644 --- a/arch/x86/include/asm/irq.h +++ b/arch/x86/include/asm/irq.h | |||
@@ -41,4 +41,9 @@ extern int vector_used_by_percpu_irq(unsigned int vector); | |||
41 | 41 | ||
42 | extern void init_ISA_irqs(void); | 42 | extern void init_ISA_irqs(void); |
43 | 43 | ||
44 | #ifdef CONFIG_X86_LOCAL_APIC | ||
45 | void arch_trigger_all_cpu_backtrace(void); | ||
46 | #define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace | ||
47 | #endif | ||
48 | |||
44 | #endif /* _ASM_X86_IRQ_H */ | 49 | #endif /* _ASM_X86_IRQ_H */ |
diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h index 6825e2efd1b4..6bc3985ee473 100644 --- a/arch/x86/include/asm/microcode.h +++ b/arch/x86/include/asm/microcode.h | |||
@@ -60,11 +60,11 @@ static inline void __exit exit_amd_microcode(void) {} | |||
60 | #ifdef CONFIG_MICROCODE_EARLY | 60 | #ifdef CONFIG_MICROCODE_EARLY |
61 | #define MAX_UCODE_COUNT 128 | 61 | #define MAX_UCODE_COUNT 128 |
62 | extern void __init load_ucode_bsp(void); | 62 | extern void __init load_ucode_bsp(void); |
63 | extern __init void load_ucode_ap(void); | 63 | extern void __cpuinit load_ucode_ap(void); |
64 | extern int __init save_microcode_in_initrd(void); | 64 | extern int __init save_microcode_in_initrd(void); |
65 | #else | 65 | #else |
66 | static inline void __init load_ucode_bsp(void) {} | 66 | static inline void __init load_ucode_bsp(void) {} |
67 | static inline __init void load_ucode_ap(void) {} | 67 | static inline void __cpuinit load_ucode_ap(void) {} |
68 | static inline int __init save_microcode_in_initrd(void) | 68 | static inline int __init save_microcode_in_initrd(void) |
69 | { | 69 | { |
70 | return 0; | 70 | return 0; |
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h index c0fa356e90de..86f9301903c8 100644 --- a/arch/x86/include/asm/nmi.h +++ b/arch/x86/include/asm/nmi.h | |||
@@ -18,9 +18,7 @@ extern int proc_nmi_enabled(struct ctl_table *, int , | |||
18 | void __user *, size_t *, loff_t *); | 18 | void __user *, size_t *, loff_t *); |
19 | extern int unknown_nmi_panic; | 19 | extern int unknown_nmi_panic; |
20 | 20 | ||
21 | void arch_trigger_all_cpu_backtrace(void); | 21 | #endif /* CONFIG_X86_LOCAL_APIC */ |
22 | #define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace | ||
23 | #endif | ||
24 | 22 | ||
25 | #define NMI_FLAG_FIRST 1 | 23 | #define NMI_FLAG_FIRST 1 |
26 | 24 | ||
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c index 31cb9ae992b7..a698d7165c96 100644 --- a/arch/x86/kernel/apic/hw_nmi.c +++ b/arch/x86/kernel/apic/hw_nmi.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * | 9 | * |
10 | */ | 10 | */ |
11 | #include <asm/apic.h> | 11 | #include <asm/apic.h> |
12 | #include <asm/nmi.h> | ||
12 | 13 | ||
13 | #include <linux/cpumask.h> | 14 | #include <linux/cpumask.h> |
14 | #include <linux/kdebug.h> | 15 | #include <linux/kdebug.h> |
diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c index 35ffda5d0727..5f90b85ff22e 100644 --- a/arch/x86/kernel/cpu/mtrr/cleanup.c +++ b/arch/x86/kernel/cpu/mtrr/cleanup.c | |||
@@ -714,15 +714,15 @@ int __init mtrr_cleanup(unsigned address_bits) | |||
714 | if (mtrr_tom2) | 714 | if (mtrr_tom2) |
715 | x_remove_size = (mtrr_tom2 >> PAGE_SHIFT) - x_remove_base; | 715 | x_remove_size = (mtrr_tom2 >> PAGE_SHIFT) - x_remove_base; |
716 | 716 | ||
717 | nr_range = x86_get_mtrr_mem_range(range, 0, x_remove_base, x_remove_size); | ||
718 | /* | 717 | /* |
719 | * [0, 1M) should always be covered by var mtrr with WB | 718 | * [0, 1M) should always be covered by var mtrr with WB |
720 | * and fixed mtrrs should take effect before var mtrr for it: | 719 | * and fixed mtrrs should take effect before var mtrr for it: |
721 | */ | 720 | */ |
722 | nr_range = add_range_with_merge(range, RANGE_NUM, nr_range, 0, | 721 | nr_range = add_range_with_merge(range, RANGE_NUM, 0, 0, |
723 | 1ULL<<(20 - PAGE_SHIFT)); | 722 | 1ULL<<(20 - PAGE_SHIFT)); |
724 | /* Sort the ranges: */ | 723 | /* add from var mtrr at last */ |
725 | sort_range(range, nr_range); | 724 | nr_range = x86_get_mtrr_mem_range(range, nr_range, |
725 | x_remove_base, x_remove_size); | ||
726 | 726 | ||
727 | range_sums = sum_ranges(range, nr_range); | 727 | range_sums = sum_ranges(range, nr_range); |
728 | printk(KERN_INFO "total RAM covered: %ldM\n", | 728 | printk(KERN_INFO "total RAM covered: %ldM\n", |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index f60d41ff9a97..a9e22073bd56 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -165,13 +165,13 @@ static struct extra_reg intel_snb_extra_regs[] __read_mostly = { | |||
165 | INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3f807f8fffull, RSP_0), | 165 | INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3f807f8fffull, RSP_0), |
166 | INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3f807f8fffull, RSP_1), | 166 | INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3f807f8fffull, RSP_1), |
167 | INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd), | 167 | INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd), |
168 | INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd), | ||
169 | EVENT_EXTRA_END | 168 | EVENT_EXTRA_END |
170 | }; | 169 | }; |
171 | 170 | ||
172 | static struct extra_reg intel_snbep_extra_regs[] __read_mostly = { | 171 | static struct extra_reg intel_snbep_extra_regs[] __read_mostly = { |
173 | INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3fffff8fffull, RSP_0), | 172 | INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3fffff8fffull, RSP_0), |
174 | INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3fffff8fffull, RSP_1), | 173 | INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3fffff8fffull, RSP_1), |
174 | INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd), | ||
175 | EVENT_EXTRA_END | 175 | EVENT_EXTRA_END |
176 | }; | 176 | }; |
177 | 177 | ||
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index d2c381280e3c..3dd37ebd591b 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -242,6 +242,7 @@ void __init kvmclock_init(void) | |||
242 | if (!mem) | 242 | if (!mem) |
243 | return; | 243 | return; |
244 | hv_clock = __va(mem); | 244 | hv_clock = __va(mem); |
245 | memset(hv_clock, 0, size); | ||
245 | 246 | ||
246 | if (kvm_register_clock("boot clock")) { | 247 | if (kvm_register_clock("boot clock")) { |
247 | hv_clock = NULL; | 248 | hv_clock = NULL; |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 4e7a37ff03ab..81a5f5e8f142 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -277,18 +277,6 @@ void exit_idle(void) | |||
277 | } | 277 | } |
278 | #endif | 278 | #endif |
279 | 279 | ||
280 | void arch_cpu_idle_prepare(void) | ||
281 | { | ||
282 | /* | ||
283 | * If we're the non-boot CPU, nothing set the stack canary up | ||
284 | * for us. CPU0 already has it initialized but no harm in | ||
285 | * doing it again. This is a good place for updating it, as | ||
286 | * we wont ever return from this function (so the invalid | ||
287 | * canaries already on the stack wont ever trigger). | ||
288 | */ | ||
289 | boot_init_stack_canary(); | ||
290 | } | ||
291 | |||
292 | void arch_cpu_idle_enter(void) | 280 | void arch_cpu_idle_enter(void) |
293 | { | 281 | { |
294 | local_touch_nmi(); | 282 | local_touch_nmi(); |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 9c73b51817e4..bfd348e99369 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -372,15 +372,15 @@ static bool __cpuinit match_mc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) | |||
372 | 372 | ||
373 | void __cpuinit set_cpu_sibling_map(int cpu) | 373 | void __cpuinit set_cpu_sibling_map(int cpu) |
374 | { | 374 | { |
375 | bool has_mc = boot_cpu_data.x86_max_cores > 1; | ||
376 | bool has_smt = smp_num_siblings > 1; | 375 | bool has_smt = smp_num_siblings > 1; |
376 | bool has_mp = has_smt || boot_cpu_data.x86_max_cores > 1; | ||
377 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 377 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
378 | struct cpuinfo_x86 *o; | 378 | struct cpuinfo_x86 *o; |
379 | int i; | 379 | int i; |
380 | 380 | ||
381 | cpumask_set_cpu(cpu, cpu_sibling_setup_mask); | 381 | cpumask_set_cpu(cpu, cpu_sibling_setup_mask); |
382 | 382 | ||
383 | if (!has_smt && !has_mc) { | 383 | if (!has_mp) { |
384 | cpumask_set_cpu(cpu, cpu_sibling_mask(cpu)); | 384 | cpumask_set_cpu(cpu, cpu_sibling_mask(cpu)); |
385 | cpumask_set_cpu(cpu, cpu_llc_shared_mask(cpu)); | 385 | cpumask_set_cpu(cpu, cpu_llc_shared_mask(cpu)); |
386 | cpumask_set_cpu(cpu, cpu_core_mask(cpu)); | 386 | cpumask_set_cpu(cpu, cpu_core_mask(cpu)); |
@@ -394,7 +394,7 @@ void __cpuinit set_cpu_sibling_map(int cpu) | |||
394 | if ((i == cpu) || (has_smt && match_smt(c, o))) | 394 | if ((i == cpu) || (has_smt && match_smt(c, o))) |
395 | link_mask(sibling, cpu, i); | 395 | link_mask(sibling, cpu, i); |
396 | 396 | ||
397 | if ((i == cpu) || (has_mc && match_llc(c, o))) | 397 | if ((i == cpu) || (has_mp && match_llc(c, o))) |
398 | link_mask(llc_shared, cpu, i); | 398 | link_mask(llc_shared, cpu, i); |
399 | 399 | ||
400 | } | 400 | } |
@@ -406,7 +406,7 @@ void __cpuinit set_cpu_sibling_map(int cpu) | |||
406 | for_each_cpu(i, cpu_sibling_setup_mask) { | 406 | for_each_cpu(i, cpu_sibling_setup_mask) { |
407 | o = &cpu_data(i); | 407 | o = &cpu_data(i); |
408 | 408 | ||
409 | if ((i == cpu) || (has_mc && match_mc(c, o))) { | 409 | if ((i == cpu) || (has_mp && match_mc(c, o))) { |
410 | link_mask(core, cpu, i); | 410 | link_mask(core, cpu, i); |
411 | 411 | ||
412 | /* | 412 | /* |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 094b5d96ab14..e8ba99c34180 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -582,8 +582,6 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) | |||
582 | if (index != XCR_XFEATURE_ENABLED_MASK) | 582 | if (index != XCR_XFEATURE_ENABLED_MASK) |
583 | return 1; | 583 | return 1; |
584 | xcr0 = xcr; | 584 | xcr0 = xcr; |
585 | if (kvm_x86_ops->get_cpl(vcpu) != 0) | ||
586 | return 1; | ||
587 | if (!(xcr0 & XSTATE_FP)) | 585 | if (!(xcr0 & XSTATE_FP)) |
588 | return 1; | 586 | return 1; |
589 | if ((xcr0 & XSTATE_YMM) && !(xcr0 & XSTATE_SSE)) | 587 | if ((xcr0 & XSTATE_YMM) && !(xcr0 & XSTATE_SSE)) |
@@ -597,7 +595,8 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) | |||
597 | 595 | ||
598 | int kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) | 596 | int kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) |
599 | { | 597 | { |
600 | if (__kvm_set_xcr(vcpu, index, xcr)) { | 598 | if (kvm_x86_ops->get_cpl(vcpu) != 0 || |
599 | __kvm_set_xcr(vcpu, index, xcr)) { | ||
601 | kvm_inject_gp(vcpu, 0); | 600 | kvm_inject_gp(vcpu, 0); |
602 | return 1; | 601 | return 1; |
603 | } | 602 | } |
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 5ae2eb09419e..d2fbcedcf6ea 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -1069,7 +1069,10 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size) | |||
1069 | * that by attempting to use more space than is available. | 1069 | * that by attempting to use more space than is available. |
1070 | */ | 1070 | */ |
1071 | unsigned long dummy_size = remaining_size + 1024; | 1071 | unsigned long dummy_size = remaining_size + 1024; |
1072 | void *dummy = kmalloc(dummy_size, GFP_ATOMIC); | 1072 | void *dummy = kzalloc(dummy_size, GFP_ATOMIC); |
1073 | |||
1074 | if (!dummy) | ||
1075 | return EFI_OUT_OF_RESOURCES; | ||
1073 | 1076 | ||
1074 | status = efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID, | 1077 | status = efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID, |
1075 | EFI_VARIABLE_NON_VOLATILE | | 1078 | EFI_VARIABLE_NON_VOLATILE | |
@@ -1089,6 +1092,8 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size) | |||
1089 | 0, dummy); | 1092 | 0, dummy); |
1090 | } | 1093 | } |
1091 | 1094 | ||
1095 | kfree(dummy); | ||
1096 | |||
1092 | /* | 1097 | /* |
1093 | * The runtime code may now have triggered a garbage collection | 1098 | * The runtime code may now have triggered a garbage collection |
1094 | * run, so check the variable info again | 1099 | * run, so check the variable info again |
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 652fd5ce303c..cab13f2fc28e 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -164,15 +164,24 @@ static int acpi_lpss_create_device(struct acpi_device *adev, | |||
164 | if (dev_desc->clk_required) { | 164 | if (dev_desc->clk_required) { |
165 | ret = register_device_clock(adev, pdata); | 165 | ret = register_device_clock(adev, pdata); |
166 | if (ret) { | 166 | if (ret) { |
167 | /* | 167 | /* Skip the device, but continue the namespace scan. */ |
168 | * Skip the device, but don't terminate the namespace | 168 | ret = 0; |
169 | * scan. | 169 | goto err_out; |
170 | */ | ||
171 | kfree(pdata); | ||
172 | return 0; | ||
173 | } | 170 | } |
174 | } | 171 | } |
175 | 172 | ||
173 | /* | ||
174 | * This works around a known issue in ACPI tables where LPSS devices | ||
175 | * have _PS0 and _PS3 without _PSC (and no power resources), so | ||
176 | * acpi_bus_init_power() will assume that the BIOS has put them into D0. | ||
177 | */ | ||
178 | ret = acpi_device_fix_up_power(adev); | ||
179 | if (ret) { | ||
180 | /* Skip the device, but continue the namespace scan. */ | ||
181 | ret = 0; | ||
182 | goto err_out; | ||
183 | } | ||
184 | |||
176 | adev->driver_data = pdata; | 185 | adev->driver_data = pdata; |
177 | ret = acpi_create_platform_device(adev, id); | 186 | ret = acpi_create_platform_device(adev, id); |
178 | if (ret > 0) | 187 | if (ret > 0) |
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 318fa32a141e..31c217a42839 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
@@ -290,6 +290,26 @@ int acpi_bus_init_power(struct acpi_device *device) | |||
290 | return 0; | 290 | return 0; |
291 | } | 291 | } |
292 | 292 | ||
293 | /** | ||
294 | * acpi_device_fix_up_power - Force device with missing _PSC into D0. | ||
295 | * @device: Device object whose power state is to be fixed up. | ||
296 | * | ||
297 | * Devices without power resources and _PSC, but having _PS0 and _PS3 defined, | ||
298 | * are assumed to be put into D0 by the BIOS. However, in some cases that may | ||
299 | * not be the case and this function should be used then. | ||
300 | */ | ||
301 | int acpi_device_fix_up_power(struct acpi_device *device) | ||
302 | { | ||
303 | int ret = 0; | ||
304 | |||
305 | if (!device->power.flags.power_resources | ||
306 | && !device->power.flags.explicit_get | ||
307 | && device->power.state == ACPI_STATE_D0) | ||
308 | ret = acpi_dev_pm_explicit_set(device, ACPI_STATE_D0); | ||
309 | |||
310 | return ret; | ||
311 | } | ||
312 | |||
293 | int acpi_bus_update_power(acpi_handle handle, int *state_p) | 313 | int acpi_bus_update_power(acpi_handle handle, int *state_p) |
294 | { | 314 | { |
295 | struct acpi_device *device; | 315 | struct acpi_device *device; |
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 4fdea381ef21..ec117c6c996c 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -868,8 +868,10 @@ static ssize_t write_undock(struct device *dev, struct device_attribute *attr, | |||
868 | if (!count) | 868 | if (!count) |
869 | return -EINVAL; | 869 | return -EINVAL; |
870 | 870 | ||
871 | acpi_scan_lock_acquire(); | ||
871 | begin_undock(dock_station); | 872 | begin_undock(dock_station); |
872 | ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST); | 873 | ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST); |
874 | acpi_scan_lock_release(); | ||
873 | return ret ? ret: count; | 875 | return ret ? ret: count; |
874 | } | 876 | } |
875 | static DEVICE_ATTR(undock, S_IWUSR, NULL, write_undock); | 877 | static DEVICE_ATTR(undock, S_IWUSR, NULL, write_undock); |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index f962047c6c85..288bb270f8ed 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -885,6 +885,7 @@ int acpi_add_power_resource(acpi_handle handle) | |||
885 | ACPI_STA_DEFAULT); | 885 | ACPI_STA_DEFAULT); |
886 | mutex_init(&resource->resource_lock); | 886 | mutex_init(&resource->resource_lock); |
887 | INIT_LIST_HEAD(&resource->dependent); | 887 | INIT_LIST_HEAD(&resource->dependent); |
888 | INIT_LIST_HEAD(&resource->list_node); | ||
888 | resource->name = device->pnp.bus_id; | 889 | resource->name = device->pnp.bus_id; |
889 | strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); | 890 | strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); |
890 | strcpy(acpi_device_class(device), ACPI_POWER_CLASS); | 891 | strcpy(acpi_device_class(device), ACPI_POWER_CLASS); |
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index a3868f6c222a..3322b47ab7ca 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c | |||
@@ -304,7 +304,8 @@ static void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi) | |||
304 | } | 304 | } |
305 | 305 | ||
306 | static void acpi_dev_get_irqresource(struct resource *res, u32 gsi, | 306 | static void acpi_dev_get_irqresource(struct resource *res, u32 gsi, |
307 | u8 triggering, u8 polarity, u8 shareable) | 307 | u8 triggering, u8 polarity, u8 shareable, |
308 | bool legacy) | ||
308 | { | 309 | { |
309 | int irq, p, t; | 310 | int irq, p, t; |
310 | 311 | ||
@@ -317,14 +318,19 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi, | |||
317 | * In IO-APIC mode, use overrided attribute. Two reasons: | 318 | * In IO-APIC mode, use overrided attribute. Two reasons: |
318 | * 1. BIOS bug in DSDT | 319 | * 1. BIOS bug in DSDT |
319 | * 2. BIOS uses IO-APIC mode Interrupt Source Override | 320 | * 2. BIOS uses IO-APIC mode Interrupt Source Override |
321 | * | ||
322 | * We do this only if we are dealing with IRQ() or IRQNoFlags() | ||
323 | * resource (the legacy ISA resources). With modern ACPI 5 devices | ||
324 | * using extended IRQ descriptors we take the IRQ configuration | ||
325 | * from _CRS directly. | ||
320 | */ | 326 | */ |
321 | if (!acpi_get_override_irq(gsi, &t, &p)) { | 327 | if (legacy && !acpi_get_override_irq(gsi, &t, &p)) { |
322 | u8 trig = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE; | 328 | u8 trig = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE; |
323 | u8 pol = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH; | 329 | u8 pol = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH; |
324 | 330 | ||
325 | if (triggering != trig || polarity != pol) { | 331 | if (triggering != trig || polarity != pol) { |
326 | pr_warning("ACPI: IRQ %d override to %s, %s\n", gsi, | 332 | pr_warning("ACPI: IRQ %d override to %s, %s\n", gsi, |
327 | t ? "edge" : "level", p ? "low" : "high"); | 333 | t ? "level" : "edge", p ? "low" : "high"); |
328 | triggering = trig; | 334 | triggering = trig; |
329 | polarity = pol; | 335 | polarity = pol; |
330 | } | 336 | } |
@@ -373,7 +379,7 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, | |||
373 | } | 379 | } |
374 | acpi_dev_get_irqresource(res, irq->interrupts[index], | 380 | acpi_dev_get_irqresource(res, irq->interrupts[index], |
375 | irq->triggering, irq->polarity, | 381 | irq->triggering, irq->polarity, |
376 | irq->sharable); | 382 | irq->sharable, true); |
377 | break; | 383 | break; |
378 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | 384 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
379 | ext_irq = &ares->data.extended_irq; | 385 | ext_irq = &ares->data.extended_irq; |
@@ -383,7 +389,7 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, | |||
383 | } | 389 | } |
384 | acpi_dev_get_irqresource(res, ext_irq->interrupts[index], | 390 | acpi_dev_get_irqresource(res, ext_irq->interrupts[index], |
385 | ext_irq->triggering, ext_irq->polarity, | 391 | ext_irq->triggering, ext_irq->polarity, |
386 | ext_irq->sharable); | 392 | ext_irq->sharable, false); |
387 | break; | 393 | break; |
388 | default: | 394 | default: |
389 | return false; | 395 | return false; |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 4b1f9265887f..01e21037d8fe 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -450,8 +450,18 @@ static void fw_load_abort(struct firmware_priv *fw_priv) | |||
450 | { | 450 | { |
451 | struct firmware_buf *buf = fw_priv->buf; | 451 | struct firmware_buf *buf = fw_priv->buf; |
452 | 452 | ||
453 | /* | ||
454 | * There is a small window in which user can write to 'loading' | ||
455 | * between loading done and disappearance of 'loading' | ||
456 | */ | ||
457 | if (test_bit(FW_STATUS_DONE, &buf->status)) | ||
458 | return; | ||
459 | |||
453 | set_bit(FW_STATUS_ABORT, &buf->status); | 460 | set_bit(FW_STATUS_ABORT, &buf->status); |
454 | complete_all(&buf->completion); | 461 | complete_all(&buf->completion); |
462 | |||
463 | /* avoid user action after loading abort */ | ||
464 | fw_priv->buf = NULL; | ||
455 | } | 465 | } |
456 | 466 | ||
457 | #define is_fw_load_aborted(buf) \ | 467 | #define is_fw_load_aborted(buf) \ |
@@ -528,7 +538,12 @@ static ssize_t firmware_loading_show(struct device *dev, | |||
528 | struct device_attribute *attr, char *buf) | 538 | struct device_attribute *attr, char *buf) |
529 | { | 539 | { |
530 | struct firmware_priv *fw_priv = to_firmware_priv(dev); | 540 | struct firmware_priv *fw_priv = to_firmware_priv(dev); |
531 | int loading = test_bit(FW_STATUS_LOADING, &fw_priv->buf->status); | 541 | int loading = 0; |
542 | |||
543 | mutex_lock(&fw_lock); | ||
544 | if (fw_priv->buf) | ||
545 | loading = test_bit(FW_STATUS_LOADING, &fw_priv->buf->status); | ||
546 | mutex_unlock(&fw_lock); | ||
532 | 547 | ||
533 | return sprintf(buf, "%d\n", loading); | 548 | return sprintf(buf, "%d\n", loading); |
534 | } | 549 | } |
@@ -570,12 +585,12 @@ static ssize_t firmware_loading_store(struct device *dev, | |||
570 | const char *buf, size_t count) | 585 | const char *buf, size_t count) |
571 | { | 586 | { |
572 | struct firmware_priv *fw_priv = to_firmware_priv(dev); | 587 | struct firmware_priv *fw_priv = to_firmware_priv(dev); |
573 | struct firmware_buf *fw_buf = fw_priv->buf; | 588 | struct firmware_buf *fw_buf; |
574 | int loading = simple_strtol(buf, NULL, 10); | 589 | int loading = simple_strtol(buf, NULL, 10); |
575 | int i; | 590 | int i; |
576 | 591 | ||
577 | mutex_lock(&fw_lock); | 592 | mutex_lock(&fw_lock); |
578 | 593 | fw_buf = fw_priv->buf; | |
579 | if (!fw_buf) | 594 | if (!fw_buf) |
580 | goto out; | 595 | goto out; |
581 | 596 | ||
@@ -777,10 +792,6 @@ static void firmware_class_timeout_work(struct work_struct *work) | |||
777 | struct firmware_priv, timeout_work.work); | 792 | struct firmware_priv, timeout_work.work); |
778 | 793 | ||
779 | mutex_lock(&fw_lock); | 794 | mutex_lock(&fw_lock); |
780 | if (test_bit(FW_STATUS_DONE, &(fw_priv->buf->status))) { | ||
781 | mutex_unlock(&fw_lock); | ||
782 | return; | ||
783 | } | ||
784 | fw_load_abort(fw_priv); | 795 | fw_load_abort(fw_priv); |
785 | mutex_unlock(&fw_lock); | 796 | mutex_unlock(&fw_lock); |
786 | } | 797 | } |
@@ -861,8 +872,6 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, | |||
861 | 872 | ||
862 | cancel_delayed_work_sync(&fw_priv->timeout_work); | 873 | cancel_delayed_work_sync(&fw_priv->timeout_work); |
863 | 874 | ||
864 | fw_priv->buf = NULL; | ||
865 | |||
866 | device_remove_file(f_dev, &dev_attr_loading); | 875 | device_remove_file(f_dev, &dev_attr_loading); |
867 | err_del_bin_attr: | 876 | err_del_bin_attr: |
868 | device_remove_bin_file(f_dev, &firmware_attr_data); | 877 | device_remove_bin_file(f_dev, &firmware_attr_data); |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 3063452e55da..49394e3f31bc 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1036,12 +1036,16 @@ static const char *rbd_segment_name(struct rbd_device *rbd_dev, u64 offset) | |||
1036 | char *name; | 1036 | char *name; |
1037 | u64 segment; | 1037 | u64 segment; |
1038 | int ret; | 1038 | int ret; |
1039 | char *name_format; | ||
1039 | 1040 | ||
1040 | name = kmem_cache_alloc(rbd_segment_name_cache, GFP_NOIO); | 1041 | name = kmem_cache_alloc(rbd_segment_name_cache, GFP_NOIO); |
1041 | if (!name) | 1042 | if (!name) |
1042 | return NULL; | 1043 | return NULL; |
1043 | segment = offset >> rbd_dev->header.obj_order; | 1044 | segment = offset >> rbd_dev->header.obj_order; |
1044 | ret = snprintf(name, MAX_OBJ_NAME_SIZE + 1, "%s.%012llx", | 1045 | name_format = "%s.%012llx"; |
1046 | if (rbd_dev->image_format == 2) | ||
1047 | name_format = "%s.%016llx"; | ||
1048 | ret = snprintf(name, MAX_OBJ_NAME_SIZE + 1, name_format, | ||
1045 | rbd_dev->header.object_prefix, segment); | 1049 | rbd_dev->header.object_prefix, segment); |
1046 | if (ret < 0 || ret > MAX_OBJ_NAME_SIZE) { | 1050 | if (ret < 0 || ret > MAX_OBJ_NAME_SIZE) { |
1047 | pr_err("error formatting segment name for #%llu (%d)\n", | 1051 | pr_err("error formatting segment name for #%llu (%d)\n", |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 934cfd18f72d..1144e8c7579d 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -1955,6 +1955,7 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb) | |||
1955 | /* XXX the notifier code should handle this better */ | 1955 | /* XXX the notifier code should handle this better */ |
1956 | if (!cn->notifier_head.head) { | 1956 | if (!cn->notifier_head.head) { |
1957 | srcu_cleanup_notifier_head(&cn->notifier_head); | 1957 | srcu_cleanup_notifier_head(&cn->notifier_head); |
1958 | list_del(&cn->node); | ||
1958 | kfree(cn); | 1959 | kfree(cn); |
1959 | } | 1960 | } |
1960 | 1961 | ||
diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk-exynos5250.c index 5c97e75924a8..22d7699e7ced 100644 --- a/drivers/clk/samsung/clk-exynos5250.c +++ b/drivers/clk/samsung/clk-exynos5250.c | |||
@@ -155,7 +155,7 @@ static __initdata unsigned long exynos5250_clk_regs[] = { | |||
155 | 155 | ||
156 | /* list of all parent clock list */ | 156 | /* list of all parent clock list */ |
157 | PNAME(mout_apll_p) = { "fin_pll", "fout_apll", }; | 157 | PNAME(mout_apll_p) = { "fin_pll", "fout_apll", }; |
158 | PNAME(mout_cpu_p) = { "mout_apll", "mout_mpll", }; | 158 | PNAME(mout_cpu_p) = { "mout_apll", "sclk_mpll", }; |
159 | PNAME(mout_mpll_fout_p) = { "fout_mplldiv2", "fout_mpll" }; | 159 | PNAME(mout_mpll_fout_p) = { "fout_mplldiv2", "fout_mpll" }; |
160 | PNAME(mout_mpll_p) = { "fin_pll", "mout_mpll_fout" }; | 160 | PNAME(mout_mpll_p) = { "fin_pll", "mout_mpll_fout" }; |
161 | PNAME(mout_bpll_fout_p) = { "fout_bplldiv2", "fout_bpll" }; | 161 | PNAME(mout_bpll_fout_p) = { "fout_bplldiv2", "fout_bpll" }; |
@@ -208,10 +208,10 @@ struct samsung_fixed_factor_clock exynos5250_fixed_factor_clks[] __initdata = { | |||
208 | }; | 208 | }; |
209 | 209 | ||
210 | struct samsung_mux_clock exynos5250_mux_clks[] __initdata = { | 210 | struct samsung_mux_clock exynos5250_mux_clks[] __initdata = { |
211 | MUX(none, "mout_apll", mout_apll_p, SRC_CPU, 0, 1), | 211 | MUX_A(none, "mout_apll", mout_apll_p, SRC_CPU, 0, 1, "mout_apll"), |
212 | MUX(none, "mout_cpu", mout_cpu_p, SRC_CPU, 16, 1), | 212 | MUX_A(none, "mout_cpu", mout_cpu_p, SRC_CPU, 16, 1, "mout_cpu"), |
213 | MUX(none, "mout_mpll_fout", mout_mpll_fout_p, PLL_DIV2_SEL, 4, 1), | 213 | MUX(none, "mout_mpll_fout", mout_mpll_fout_p, PLL_DIV2_SEL, 4, 1), |
214 | MUX(none, "sclk_mpll", mout_mpll_p, SRC_CORE1, 8, 1), | 214 | MUX_A(none, "sclk_mpll", mout_mpll_p, SRC_CORE1, 8, 1, "mout_mpll"), |
215 | MUX(none, "mout_bpll_fout", mout_bpll_fout_p, PLL_DIV2_SEL, 0, 1), | 215 | MUX(none, "mout_bpll_fout", mout_bpll_fout_p, PLL_DIV2_SEL, 0, 1), |
216 | MUX(none, "sclk_bpll", mout_bpll_p, SRC_CDREX, 0, 1), | 216 | MUX(none, "sclk_bpll", mout_bpll_p, SRC_CDREX, 0, 1), |
217 | MUX(none, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP2, 0, 1), | 217 | MUX(none, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP2, 0, 1), |
@@ -378,7 +378,7 @@ struct samsung_gate_clock exynos5250_gate_clks[] __initdata = { | |||
378 | GATE(hsi2c3, "hsi2c3", "aclk66", GATE_IP_PERIC, 31, 0, 0), | 378 | GATE(hsi2c3, "hsi2c3", "aclk66", GATE_IP_PERIC, 31, 0, 0), |
379 | GATE(chipid, "chipid", "aclk66", GATE_IP_PERIS, 0, 0, 0), | 379 | GATE(chipid, "chipid", "aclk66", GATE_IP_PERIS, 0, 0, 0), |
380 | GATE(sysreg, "sysreg", "aclk66", GATE_IP_PERIS, 1, 0, 0), | 380 | GATE(sysreg, "sysreg", "aclk66", GATE_IP_PERIS, 1, 0, 0), |
381 | GATE(pmu, "pmu", "aclk66", GATE_IP_PERIS, 2, 0, 0), | 381 | GATE(pmu, "pmu", "aclk66", GATE_IP_PERIS, 2, CLK_IGNORE_UNUSED, 0), |
382 | GATE(tzpc0, "tzpc0", "aclk66", GATE_IP_PERIS, 6, 0, 0), | 382 | GATE(tzpc0, "tzpc0", "aclk66", GATE_IP_PERIS, 6, 0, 0), |
383 | GATE(tzpc1, "tzpc1", "aclk66", GATE_IP_PERIS, 7, 0, 0), | 383 | GATE(tzpc1, "tzpc1", "aclk66", GATE_IP_PERIS, 7, 0, 0), |
384 | GATE(tzpc2, "tzpc2", "aclk66", GATE_IP_PERIS, 8, 0, 0), | 384 | GATE(tzpc2, "tzpc2", "aclk66", GATE_IP_PERIS, 8, 0, 0), |
diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c index 89135f6be116..362f12dcd944 100644 --- a/drivers/clk/samsung/clk-pll.c +++ b/drivers/clk/samsung/clk-pll.c | |||
@@ -111,7 +111,8 @@ static unsigned long samsung_pll36xx_recalc_rate(struct clk_hw *hw, | |||
111 | unsigned long parent_rate) | 111 | unsigned long parent_rate) |
112 | { | 112 | { |
113 | struct samsung_clk_pll36xx *pll = to_clk_pll36xx(hw); | 113 | struct samsung_clk_pll36xx *pll = to_clk_pll36xx(hw); |
114 | u32 mdiv, pdiv, sdiv, kdiv, pll_con0, pll_con1; | 114 | u32 mdiv, pdiv, sdiv, pll_con0, pll_con1; |
115 | s16 kdiv; | ||
115 | u64 fvco = parent_rate; | 116 | u64 fvco = parent_rate; |
116 | 117 | ||
117 | pll_con0 = __raw_readl(pll->con_reg); | 118 | pll_con0 = __raw_readl(pll->con_reg); |
@@ -119,7 +120,7 @@ static unsigned long samsung_pll36xx_recalc_rate(struct clk_hw *hw, | |||
119 | mdiv = (pll_con0 >> PLL36XX_MDIV_SHIFT) & PLL36XX_MDIV_MASK; | 120 | mdiv = (pll_con0 >> PLL36XX_MDIV_SHIFT) & PLL36XX_MDIV_MASK; |
120 | pdiv = (pll_con0 >> PLL36XX_PDIV_SHIFT) & PLL36XX_PDIV_MASK; | 121 | pdiv = (pll_con0 >> PLL36XX_PDIV_SHIFT) & PLL36XX_PDIV_MASK; |
121 | sdiv = (pll_con0 >> PLL36XX_SDIV_SHIFT) & PLL36XX_SDIV_MASK; | 122 | sdiv = (pll_con0 >> PLL36XX_SDIV_SHIFT) & PLL36XX_SDIV_MASK; |
122 | kdiv = pll_con1 & PLL36XX_KDIV_MASK; | 123 | kdiv = (s16)(pll_con1 & PLL36XX_KDIV_MASK); |
123 | 124 | ||
124 | fvco *= (mdiv << 16) + kdiv; | 125 | fvco *= (mdiv << 16) + kdiv; |
125 | do_div(fvco, (pdiv << sdiv)); | 126 | do_div(fvco, (pdiv << sdiv)); |
diff --git a/drivers/clk/spear/spear3xx_clock.c b/drivers/clk/spear/spear3xx_clock.c index f9ec43fd1320..080c3c5e33f6 100644 --- a/drivers/clk/spear/spear3xx_clock.c +++ b/drivers/clk/spear/spear3xx_clock.c | |||
@@ -369,7 +369,7 @@ static void __init spear320_clk_init(void __iomem *soc_config_base) | |||
369 | clk_register_clkdev(clk, NULL, "60100000.serial"); | 369 | clk_register_clkdev(clk, NULL, "60100000.serial"); |
370 | } | 370 | } |
371 | #else | 371 | #else |
372 | static inline void spear320_clk_init(void) { } | 372 | static inline void spear320_clk_init(void __iomem *soc_config_base) { } |
373 | #endif | 373 | #endif |
374 | 374 | ||
375 | void __init spear3xx_clk_init(void __iomem *misc_base, void __iomem *soc_config_base) | 375 | void __init spear3xx_clk_init(void __iomem *misc_base, void __iomem *soc_config_base) |
diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c index c6921f538e28..ba99e3844106 100644 --- a/drivers/clk/tegra/clk-tegra30.c +++ b/drivers/clk/tegra/clk-tegra30.c | |||
@@ -1598,6 +1598,12 @@ static void __init tegra30_periph_clk_init(void) | |||
1598 | clk_register_clkdev(clk, "afi", "tegra-pcie"); | 1598 | clk_register_clkdev(clk, "afi", "tegra-pcie"); |
1599 | clks[afi] = clk; | 1599 | clks[afi] = clk; |
1600 | 1600 | ||
1601 | /* pciex */ | ||
1602 | clk = tegra_clk_register_periph_gate("pciex", "pll_e", 0, clk_base, 0, | ||
1603 | 74, &periph_u_regs, periph_clk_enb_refcnt); | ||
1604 | clk_register_clkdev(clk, "pciex", "tegra-pcie"); | ||
1605 | clks[pciex] = clk; | ||
1606 | |||
1601 | /* kfuse */ | 1607 | /* kfuse */ |
1602 | clk = tegra_clk_register_periph_gate("kfuse", "clk_m", | 1608 | clk = tegra_clk_register_periph_gate("kfuse", "clk_m", |
1603 | TEGRA_PERIPH_ON_APB, | 1609 | TEGRA_PERIPH_ON_APB, |
@@ -1716,11 +1722,6 @@ static void __init tegra30_fixed_clk_init(void) | |||
1716 | 1, 0, &cml_lock); | 1722 | 1, 0, &cml_lock); |
1717 | clk_register_clkdev(clk, "cml1", NULL); | 1723 | clk_register_clkdev(clk, "cml1", NULL); |
1718 | clks[cml1] = clk; | 1724 | clks[cml1] = clk; |
1719 | |||
1720 | /* pciex */ | ||
1721 | clk = clk_register_fixed_rate(NULL, "pciex", "pll_e", 0, 100000000); | ||
1722 | clk_register_clkdev(clk, "pciex", NULL); | ||
1723 | clks[pciex] = clk; | ||
1724 | } | 1725 | } |
1725 | 1726 | ||
1726 | static void __init tegra30_osc_clk_init(void) | 1727 | static void __init tegra30_osc_clk_init(void) |
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index dcde35231e25..5b7b9110254b 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c | |||
@@ -190,8 +190,7 @@ struct dma_buf *drm_gem_prime_export(struct drm_device *dev, | |||
190 | if (ret) | 190 | if (ret) |
191 | return ERR_PTR(ret); | 191 | return ERR_PTR(ret); |
192 | } | 192 | } |
193 | return dma_buf_export(obj, &drm_gem_prime_dmabuf_ops, obj->size, | 193 | return dma_buf_export(obj, &drm_gem_prime_dmabuf_ops, obj->size, flags); |
194 | 0600); | ||
195 | } | 194 | } |
196 | EXPORT_SYMBOL(drm_gem_prime_export); | 195 | EXPORT_SYMBOL(drm_gem_prime_export); |
197 | 196 | ||
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 0e5341695922..6948eb88c2b7 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -2687,6 +2687,9 @@ void r600_uvd_rbc_stop(struct radeon_device *rdev) | |||
2687 | int r600_uvd_init(struct radeon_device *rdev) | 2687 | int r600_uvd_init(struct radeon_device *rdev) |
2688 | { | 2688 | { |
2689 | int i, j, r; | 2689 | int i, j, r; |
2690 | /* disable byte swapping */ | ||
2691 | u32 lmi_swap_cntl = 0; | ||
2692 | u32 mp_swap_cntl = 0; | ||
2690 | 2693 | ||
2691 | /* raise clocks while booting up the VCPU */ | 2694 | /* raise clocks while booting up the VCPU */ |
2692 | radeon_set_uvd_clocks(rdev, 53300, 40000); | 2695 | radeon_set_uvd_clocks(rdev, 53300, 40000); |
@@ -2711,9 +2714,13 @@ int r600_uvd_init(struct radeon_device *rdev) | |||
2711 | WREG32(UVD_LMI_CTRL, 0x40 | (1 << 8) | (1 << 13) | | 2714 | WREG32(UVD_LMI_CTRL, 0x40 | (1 << 8) | (1 << 13) | |
2712 | (1 << 21) | (1 << 9) | (1 << 20)); | 2715 | (1 << 21) | (1 << 9) | (1 << 20)); |
2713 | 2716 | ||
2714 | /* disable byte swapping */ | 2717 | #ifdef __BIG_ENDIAN |
2715 | WREG32(UVD_LMI_SWAP_CNTL, 0); | 2718 | /* swap (8 in 32) RB and IB */ |
2716 | WREG32(UVD_MP_SWAP_CNTL, 0); | 2719 | lmi_swap_cntl = 0xa; |
2720 | mp_swap_cntl = 0; | ||
2721 | #endif | ||
2722 | WREG32(UVD_LMI_SWAP_CNTL, lmi_swap_cntl); | ||
2723 | WREG32(UVD_MP_SWAP_CNTL, mp_swap_cntl); | ||
2717 | 2724 | ||
2718 | WREG32(UVD_MPC_SET_MUXA0, 0x40c2040); | 2725 | WREG32(UVD_MPC_SET_MUXA0, 0x40c2040); |
2719 | WREG32(UVD_MPC_SET_MUXA1, 0x0); | 2726 | WREG32(UVD_MPC_SET_MUXA1, 0x0); |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 189973836cff..b0dc0b6cb4e0 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -244,16 +244,6 @@ void radeon_scratch_free(struct radeon_device *rdev, uint32_t reg) | |||
244 | */ | 244 | */ |
245 | void radeon_wb_disable(struct radeon_device *rdev) | 245 | void radeon_wb_disable(struct radeon_device *rdev) |
246 | { | 246 | { |
247 | int r; | ||
248 | |||
249 | if (rdev->wb.wb_obj) { | ||
250 | r = radeon_bo_reserve(rdev->wb.wb_obj, false); | ||
251 | if (unlikely(r != 0)) | ||
252 | return; | ||
253 | radeon_bo_kunmap(rdev->wb.wb_obj); | ||
254 | radeon_bo_unpin(rdev->wb.wb_obj); | ||
255 | radeon_bo_unreserve(rdev->wb.wb_obj); | ||
256 | } | ||
257 | rdev->wb.enabled = false; | 247 | rdev->wb.enabled = false; |
258 | } | 248 | } |
259 | 249 | ||
@@ -269,6 +259,11 @@ void radeon_wb_fini(struct radeon_device *rdev) | |||
269 | { | 259 | { |
270 | radeon_wb_disable(rdev); | 260 | radeon_wb_disable(rdev); |
271 | if (rdev->wb.wb_obj) { | 261 | if (rdev->wb.wb_obj) { |
262 | if (!radeon_bo_reserve(rdev->wb.wb_obj, false)) { | ||
263 | radeon_bo_kunmap(rdev->wb.wb_obj); | ||
264 | radeon_bo_unpin(rdev->wb.wb_obj); | ||
265 | radeon_bo_unreserve(rdev->wb.wb_obj); | ||
266 | } | ||
272 | radeon_bo_unref(&rdev->wb.wb_obj); | 267 | radeon_bo_unref(&rdev->wb.wb_obj); |
273 | rdev->wb.wb = NULL; | 268 | rdev->wb.wb = NULL; |
274 | rdev->wb.wb_obj = NULL; | 269 | rdev->wb.wb_obj = NULL; |
@@ -295,26 +290,26 @@ int radeon_wb_init(struct radeon_device *rdev) | |||
295 | dev_warn(rdev->dev, "(%d) create WB bo failed\n", r); | 290 | dev_warn(rdev->dev, "(%d) create WB bo failed\n", r); |
296 | return r; | 291 | return r; |
297 | } | 292 | } |
298 | } | 293 | r = radeon_bo_reserve(rdev->wb.wb_obj, false); |
299 | r = radeon_bo_reserve(rdev->wb.wb_obj, false); | 294 | if (unlikely(r != 0)) { |
300 | if (unlikely(r != 0)) { | 295 | radeon_wb_fini(rdev); |
301 | radeon_wb_fini(rdev); | 296 | return r; |
302 | return r; | 297 | } |
303 | } | 298 | r = radeon_bo_pin(rdev->wb.wb_obj, RADEON_GEM_DOMAIN_GTT, |
304 | r = radeon_bo_pin(rdev->wb.wb_obj, RADEON_GEM_DOMAIN_GTT, | 299 | &rdev->wb.gpu_addr); |
305 | &rdev->wb.gpu_addr); | 300 | if (r) { |
306 | if (r) { | 301 | radeon_bo_unreserve(rdev->wb.wb_obj); |
302 | dev_warn(rdev->dev, "(%d) pin WB bo failed\n", r); | ||
303 | radeon_wb_fini(rdev); | ||
304 | return r; | ||
305 | } | ||
306 | r = radeon_bo_kmap(rdev->wb.wb_obj, (void **)&rdev->wb.wb); | ||
307 | radeon_bo_unreserve(rdev->wb.wb_obj); | 307 | radeon_bo_unreserve(rdev->wb.wb_obj); |
308 | dev_warn(rdev->dev, "(%d) pin WB bo failed\n", r); | 308 | if (r) { |
309 | radeon_wb_fini(rdev); | 309 | dev_warn(rdev->dev, "(%d) map WB bo failed\n", r); |
310 | return r; | 310 | radeon_wb_fini(rdev); |
311 | } | 311 | return r; |
312 | r = radeon_bo_kmap(rdev->wb.wb_obj, (void **)&rdev->wb.wb); | 312 | } |
313 | radeon_bo_unreserve(rdev->wb.wb_obj); | ||
314 | if (r) { | ||
315 | dev_warn(rdev->dev, "(%d) map WB bo failed\n", r); | ||
316 | radeon_wb_fini(rdev); | ||
317 | return r; | ||
318 | } | 313 | } |
319 | 314 | ||
320 | /* clear wb memory */ | 315 | /* clear wb memory */ |
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 5b937dfe6f65..ddb8f8e04eb5 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c | |||
@@ -63,7 +63,9 @@ static void radeon_fence_write(struct radeon_device *rdev, u32 seq, int ring) | |||
63 | { | 63 | { |
64 | struct radeon_fence_driver *drv = &rdev->fence_drv[ring]; | 64 | struct radeon_fence_driver *drv = &rdev->fence_drv[ring]; |
65 | if (likely(rdev->wb.enabled || !drv->scratch_reg)) { | 65 | if (likely(rdev->wb.enabled || !drv->scratch_reg)) { |
66 | *drv->cpu_addr = cpu_to_le32(seq); | 66 | if (drv->cpu_addr) { |
67 | *drv->cpu_addr = cpu_to_le32(seq); | ||
68 | } | ||
67 | } else { | 69 | } else { |
68 | WREG32(drv->scratch_reg, seq); | 70 | WREG32(drv->scratch_reg, seq); |
69 | } | 71 | } |
@@ -84,7 +86,11 @@ static u32 radeon_fence_read(struct radeon_device *rdev, int ring) | |||
84 | u32 seq = 0; | 86 | u32 seq = 0; |
85 | 87 | ||
86 | if (likely(rdev->wb.enabled || !drv->scratch_reg)) { | 88 | if (likely(rdev->wb.enabled || !drv->scratch_reg)) { |
87 | seq = le32_to_cpu(*drv->cpu_addr); | 89 | if (drv->cpu_addr) { |
90 | seq = le32_to_cpu(*drv->cpu_addr); | ||
91 | } else { | ||
92 | seq = lower_32_bits(atomic64_read(&drv->last_seq)); | ||
93 | } | ||
88 | } else { | 94 | } else { |
89 | seq = RREG32(drv->scratch_reg); | 95 | seq = RREG32(drv->scratch_reg); |
90 | } | 96 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 2c1341f63dc5..43ec4a401f07 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -1197,11 +1197,13 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev, | |||
1197 | int radeon_vm_bo_rmv(struct radeon_device *rdev, | 1197 | int radeon_vm_bo_rmv(struct radeon_device *rdev, |
1198 | struct radeon_bo_va *bo_va) | 1198 | struct radeon_bo_va *bo_va) |
1199 | { | 1199 | { |
1200 | int r; | 1200 | int r = 0; |
1201 | 1201 | ||
1202 | mutex_lock(&rdev->vm_manager.lock); | 1202 | mutex_lock(&rdev->vm_manager.lock); |
1203 | mutex_lock(&bo_va->vm->mutex); | 1203 | mutex_lock(&bo_va->vm->mutex); |
1204 | r = radeon_vm_bo_update_pte(rdev, bo_va->vm, bo_va->bo, NULL); | 1204 | if (bo_va->soffset) { |
1205 | r = radeon_vm_bo_update_pte(rdev, bo_va->vm, bo_va->bo, NULL); | ||
1206 | } | ||
1205 | mutex_unlock(&rdev->vm_manager.lock); | 1207 | mutex_unlock(&rdev->vm_manager.lock); |
1206 | list_del(&bo_va->vm_list); | 1208 | list_del(&bo_va->vm_list); |
1207 | mutex_unlock(&bo_va->vm->mutex); | 1209 | mutex_unlock(&bo_va->vm->mutex); |
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index e17faa7cf732..82434018cbe8 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
@@ -402,6 +402,13 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *ring, unsi | |||
402 | return -ENOMEM; | 402 | return -ENOMEM; |
403 | /* Align requested size with padding so unlock_commit can | 403 | /* Align requested size with padding so unlock_commit can |
404 | * pad safely */ | 404 | * pad safely */ |
405 | radeon_ring_free_size(rdev, ring); | ||
406 | if (ring->ring_free_dw == (ring->ring_size / 4)) { | ||
407 | /* This is an empty ring update lockup info to avoid | ||
408 | * false positive. | ||
409 | */ | ||
410 | radeon_ring_lockup_update(ring); | ||
411 | } | ||
405 | ndw = (ndw + ring->align_mask) & ~ring->align_mask; | 412 | ndw = (ndw + ring->align_mask) & ~ring->align_mask; |
406 | while (ndw > (ring->ring_free_dw - 1)) { | 413 | while (ndw > (ring->ring_free_dw - 1)) { |
407 | radeon_ring_free_size(rdev, ring); | 414 | radeon_ring_free_size(rdev, ring); |
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index 906e5c0ca3b9..cad735dd02c6 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c | |||
@@ -159,7 +159,17 @@ int radeon_uvd_suspend(struct radeon_device *rdev) | |||
159 | if (!r) { | 159 | if (!r) { |
160 | radeon_bo_kunmap(rdev->uvd.vcpu_bo); | 160 | radeon_bo_kunmap(rdev->uvd.vcpu_bo); |
161 | radeon_bo_unpin(rdev->uvd.vcpu_bo); | 161 | radeon_bo_unpin(rdev->uvd.vcpu_bo); |
162 | rdev->uvd.cpu_addr = NULL; | ||
163 | if (!radeon_bo_pin(rdev->uvd.vcpu_bo, RADEON_GEM_DOMAIN_CPU, NULL)) { | ||
164 | radeon_bo_kmap(rdev->uvd.vcpu_bo, &rdev->uvd.cpu_addr); | ||
165 | } | ||
162 | radeon_bo_unreserve(rdev->uvd.vcpu_bo); | 166 | radeon_bo_unreserve(rdev->uvd.vcpu_bo); |
167 | |||
168 | if (rdev->uvd.cpu_addr) { | ||
169 | radeon_fence_driver_start_ring(rdev, R600_RING_TYPE_UVD_INDEX); | ||
170 | } else { | ||
171 | rdev->fence_drv[R600_RING_TYPE_UVD_INDEX].cpu_addr = NULL; | ||
172 | } | ||
163 | } | 173 | } |
164 | return r; | 174 | return r; |
165 | } | 175 | } |
@@ -178,6 +188,10 @@ int radeon_uvd_resume(struct radeon_device *rdev) | |||
178 | return r; | 188 | return r; |
179 | } | 189 | } |
180 | 190 | ||
191 | /* Have been pin in cpu unmap unpin */ | ||
192 | radeon_bo_kunmap(rdev->uvd.vcpu_bo); | ||
193 | radeon_bo_unpin(rdev->uvd.vcpu_bo); | ||
194 | |||
181 | r = radeon_bo_pin(rdev->uvd.vcpu_bo, RADEON_GEM_DOMAIN_VRAM, | 195 | r = radeon_bo_pin(rdev->uvd.vcpu_bo, RADEON_GEM_DOMAIN_VRAM, |
182 | &rdev->uvd.gpu_addr); | 196 | &rdev->uvd.gpu_addr); |
183 | if (r) { | 197 | if (r) { |
@@ -613,19 +627,19 @@ int radeon_uvd_get_create_msg(struct radeon_device *rdev, int ring, | |||
613 | } | 627 | } |
614 | 628 | ||
615 | /* stitch together an UVD create msg */ | 629 | /* stitch together an UVD create msg */ |
616 | msg[0] = 0x00000de4; | 630 | msg[0] = cpu_to_le32(0x00000de4); |
617 | msg[1] = 0x00000000; | 631 | msg[1] = cpu_to_le32(0x00000000); |
618 | msg[2] = handle; | 632 | msg[2] = cpu_to_le32(handle); |
619 | msg[3] = 0x00000000; | 633 | msg[3] = cpu_to_le32(0x00000000); |
620 | msg[4] = 0x00000000; | 634 | msg[4] = cpu_to_le32(0x00000000); |
621 | msg[5] = 0x00000000; | 635 | msg[5] = cpu_to_le32(0x00000000); |
622 | msg[6] = 0x00000000; | 636 | msg[6] = cpu_to_le32(0x00000000); |
623 | msg[7] = 0x00000780; | 637 | msg[7] = cpu_to_le32(0x00000780); |
624 | msg[8] = 0x00000440; | 638 | msg[8] = cpu_to_le32(0x00000440); |
625 | msg[9] = 0x00000000; | 639 | msg[9] = cpu_to_le32(0x00000000); |
626 | msg[10] = 0x01b37000; | 640 | msg[10] = cpu_to_le32(0x01b37000); |
627 | for (i = 11; i < 1024; ++i) | 641 | for (i = 11; i < 1024; ++i) |
628 | msg[i] = 0x0; | 642 | msg[i] = cpu_to_le32(0x0); |
629 | 643 | ||
630 | radeon_bo_kunmap(bo); | 644 | radeon_bo_kunmap(bo); |
631 | radeon_bo_unreserve(bo); | 645 | radeon_bo_unreserve(bo); |
@@ -659,12 +673,12 @@ int radeon_uvd_get_destroy_msg(struct radeon_device *rdev, int ring, | |||
659 | } | 673 | } |
660 | 674 | ||
661 | /* stitch together an UVD destroy msg */ | 675 | /* stitch together an UVD destroy msg */ |
662 | msg[0] = 0x00000de4; | 676 | msg[0] = cpu_to_le32(0x00000de4); |
663 | msg[1] = 0x00000002; | 677 | msg[1] = cpu_to_le32(0x00000002); |
664 | msg[2] = handle; | 678 | msg[2] = cpu_to_le32(handle); |
665 | msg[3] = 0x00000000; | 679 | msg[3] = cpu_to_le32(0x00000000); |
666 | for (i = 4; i < 1024; ++i) | 680 | for (i = 4; i < 1024; ++i) |
667 | msg[i] = 0x0; | 681 | msg[i] = cpu_to_le32(0x0); |
668 | 682 | ||
669 | radeon_bo_kunmap(bo); | 683 | radeon_bo_kunmap(bo); |
670 | radeon_bo_unreserve(bo); | 684 | radeon_bo_unreserve(bo); |
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 1760ceb68b7b..19ceaa60e0f4 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
@@ -705,7 +705,7 @@ static int gic_irq_domain_xlate(struct irq_domain *d, | |||
705 | static int __cpuinit gic_secondary_init(struct notifier_block *nfb, | 705 | static int __cpuinit gic_secondary_init(struct notifier_block *nfb, |
706 | unsigned long action, void *hcpu) | 706 | unsigned long action, void *hcpu) |
707 | { | 707 | { |
708 | if (action == CPU_STARTING) | 708 | if (action == CPU_STARTING || action == CPU_STARTING_FROZEN) |
709 | gic_cpu_init(&gic_data[0]); | 709 | gic_cpu_init(&gic_data[0]); |
710 | return NOTIFY_OK; | 710 | return NOTIFY_OK; |
711 | } | 711 | } |
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index 7f5a7cac6dc7..8270388e2a0d 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig | |||
@@ -136,9 +136,9 @@ config DVB_NET | |||
136 | 136 | ||
137 | # This Kconfig option is used by both PCI and USB drivers | 137 | # This Kconfig option is used by both PCI and USB drivers |
138 | config TTPCI_EEPROM | 138 | config TTPCI_EEPROM |
139 | tristate | 139 | tristate |
140 | depends on I2C | 140 | depends on I2C |
141 | default n | 141 | default n |
142 | 142 | ||
143 | source "drivers/media/dvb-core/Kconfig" | 143 | source "drivers/media/dvb-core/Kconfig" |
144 | 144 | ||
@@ -189,6 +189,12 @@ config MEDIA_SUBDRV_AUTOSELECT | |||
189 | 189 | ||
190 | If unsure say Y. | 190 | If unsure say Y. |
191 | 191 | ||
192 | config MEDIA_ATTACH | ||
193 | bool | ||
194 | depends on MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT || MEDIA_RADIO_SUPPORT | ||
195 | depends on MODULES | ||
196 | default MODULES | ||
197 | |||
192 | source "drivers/media/i2c/Kconfig" | 198 | source "drivers/media/i2c/Kconfig" |
193 | source "drivers/media/tuners/Kconfig" | 199 | source "drivers/media/tuners/Kconfig" |
194 | source "drivers/media/dvb-frontends/Kconfig" | 200 | source "drivers/media/dvb-frontends/Kconfig" |
diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c index cb52438e53ac..9eac5310942f 100644 --- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c +++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c | |||
@@ -956,7 +956,7 @@ static int s5c73m3_oif_enum_frame_interval(struct v4l2_subdev *sd, | |||
956 | 956 | ||
957 | if (fie->pad != OIF_SOURCE_PAD) | 957 | if (fie->pad != OIF_SOURCE_PAD) |
958 | return -EINVAL; | 958 | return -EINVAL; |
959 | if (fie->index > ARRAY_SIZE(s5c73m3_intervals)) | 959 | if (fie->index >= ARRAY_SIZE(s5c73m3_intervals)) |
960 | return -EINVAL; | 960 | return -EINVAL; |
961 | 961 | ||
962 | mutex_lock(&state->lock); | 962 | mutex_lock(&state->lock); |
diff --git a/drivers/media/pci/cx88/cx88-alsa.c b/drivers/media/pci/cx88/cx88-alsa.c index 27d62623274b..aba5b1c649e6 100644 --- a/drivers/media/pci/cx88/cx88-alsa.c +++ b/drivers/media/pci/cx88/cx88-alsa.c | |||
@@ -615,7 +615,7 @@ static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol, | |||
615 | int changed = 0; | 615 | int changed = 0; |
616 | u32 old; | 616 | u32 old; |
617 | 617 | ||
618 | if (core->board.audio_chip == V4L2_IDENT_WM8775) | 618 | if (core->sd_wm8775) |
619 | snd_cx88_wm8775_volume_put(kcontrol, value); | 619 | snd_cx88_wm8775_volume_put(kcontrol, value); |
620 | 620 | ||
621 | left = value->value.integer.value[0] & 0x3f; | 621 | left = value->value.integer.value[0] & 0x3f; |
@@ -682,8 +682,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol, | |||
682 | vol ^= bit; | 682 | vol ^= bit; |
683 | cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol); | 683 | cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol); |
684 | /* Pass mute onto any WM8775 */ | 684 | /* Pass mute onto any WM8775 */ |
685 | if ((core->board.audio_chip == V4L2_IDENT_WM8775) && | 685 | if (core->sd_wm8775 && ((1<<6) == bit)) |
686 | ((1<<6) == bit)) | ||
687 | wm8775_s_ctrl(core, V4L2_CID_AUDIO_MUTE, 0 != (vol & bit)); | 686 | wm8775_s_ctrl(core, V4L2_CID_AUDIO_MUTE, 0 != (vol & bit)); |
688 | ret = 1; | 687 | ret = 1; |
689 | } | 688 | } |
@@ -903,7 +902,7 @@ static int cx88_audio_initdev(struct pci_dev *pci, | |||
903 | goto error; | 902 | goto error; |
904 | 903 | ||
905 | /* If there's a wm8775 then add a Line-In ALC switch */ | 904 | /* If there's a wm8775 then add a Line-In ALC switch */ |
906 | if (core->board.audio_chip == V4L2_IDENT_WM8775) | 905 | if (core->sd_wm8775) |
907 | snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch, chip)); | 906 | snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch, chip)); |
908 | 907 | ||
909 | strcpy (card->driver, "CX88x"); | 908 | strcpy (card->driver, "CX88x"); |
diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c index 1b00615fd395..c7a9be1065c0 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c | |||
@@ -385,8 +385,7 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input) | |||
385 | /* The wm8775 module has the "2" route hardwired into | 385 | /* The wm8775 module has the "2" route hardwired into |
386 | the initialization. Some boards may use different | 386 | the initialization. Some boards may use different |
387 | routes for different inputs. HVR-1300 surely does */ | 387 | routes for different inputs. HVR-1300 surely does */ |
388 | if (core->board.audio_chip && | 388 | if (core->sd_wm8775) { |
389 | core->board.audio_chip == V4L2_IDENT_WM8775) { | ||
390 | call_all(core, audio, s_routing, | 389 | call_all(core, audio, s_routing, |
391 | INPUT(input).audioroute, 0, 0); | 390 | INPUT(input).audioroute, 0, 0); |
392 | } | 391 | } |
@@ -771,8 +770,7 @@ static int video_open(struct file *file) | |||
771 | cx_write(MO_GP1_IO, core->board.radio.gpio1); | 770 | cx_write(MO_GP1_IO, core->board.radio.gpio1); |
772 | cx_write(MO_GP2_IO, core->board.radio.gpio2); | 771 | cx_write(MO_GP2_IO, core->board.radio.gpio2); |
773 | if (core->board.radio.audioroute) { | 772 | if (core->board.radio.audioroute) { |
774 | if(core->board.audio_chip && | 773 | if (core->sd_wm8775) { |
775 | core->board.audio_chip == V4L2_IDENT_WM8775) { | ||
776 | call_all(core, audio, s_routing, | 774 | call_all(core, audio, s_routing, |
777 | core->board.radio.audioroute, 0, 0); | 775 | core->board.radio.audioroute, 0, 0); |
778 | } | 776 | } |
@@ -959,7 +957,7 @@ static int cx8800_s_aud_ctrl(struct v4l2_ctrl *ctrl) | |||
959 | u32 value,mask; | 957 | u32 value,mask; |
960 | 958 | ||
961 | /* Pass changes onto any WM8775 */ | 959 | /* Pass changes onto any WM8775 */ |
962 | if (core->board.audio_chip == V4L2_IDENT_WM8775) { | 960 | if (core->sd_wm8775) { |
963 | switch (ctrl->id) { | 961 | switch (ctrl->id) { |
964 | case V4L2_CID_AUDIO_MUTE: | 962 | case V4L2_CID_AUDIO_MUTE: |
965 | wm8775_s_ctrl(core, ctrl->id, ctrl->val); | 963 | wm8775_s_ctrl(core, ctrl->id, ctrl->val); |
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index 48b8d7af386d..9d1481a60bd9 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c | |||
@@ -576,6 +576,14 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) | |||
576 | return v4l2_m2m_dqbuf(file, ctx->m2m_ctx, buf); | 576 | return v4l2_m2m_dqbuf(file, ctx->m2m_ctx, buf); |
577 | } | 577 | } |
578 | 578 | ||
579 | static int vidioc_create_bufs(struct file *file, void *priv, | ||
580 | struct v4l2_create_buffers *create) | ||
581 | { | ||
582 | struct coda_ctx *ctx = fh_to_ctx(priv); | ||
583 | |||
584 | return v4l2_m2m_create_bufs(file, ctx->m2m_ctx, create); | ||
585 | } | ||
586 | |||
579 | static int vidioc_streamon(struct file *file, void *priv, | 587 | static int vidioc_streamon(struct file *file, void *priv, |
580 | enum v4l2_buf_type type) | 588 | enum v4l2_buf_type type) |
581 | { | 589 | { |
@@ -610,6 +618,7 @@ static const struct v4l2_ioctl_ops coda_ioctl_ops = { | |||
610 | 618 | ||
611 | .vidioc_qbuf = vidioc_qbuf, | 619 | .vidioc_qbuf = vidioc_qbuf, |
612 | .vidioc_dqbuf = vidioc_dqbuf, | 620 | .vidioc_dqbuf = vidioc_dqbuf, |
621 | .vidioc_create_bufs = vidioc_create_bufs, | ||
613 | 622 | ||
614 | .vidioc_streamon = vidioc_streamon, | 623 | .vidioc_streamon = vidioc_streamon, |
615 | .vidioc_streamoff = vidioc_streamoff, | 624 | .vidioc_streamoff = vidioc_streamoff, |
diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index 1802f11e939f..d0b375cf565f 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c | |||
@@ -916,6 +916,21 @@ static int vpbe_display_s_fmt(struct file *file, void *priv, | |||
916 | other video window */ | 916 | other video window */ |
917 | 917 | ||
918 | layer->pix_fmt = *pixfmt; | 918 | layer->pix_fmt = *pixfmt; |
919 | if (pixfmt->pixelformat == V4L2_PIX_FMT_NV12) { | ||
920 | struct vpbe_layer *otherlayer; | ||
921 | |||
922 | otherlayer = _vpbe_display_get_other_win_layer(disp_dev, layer); | ||
923 | /* if other layer is available, only | ||
924 | * claim it, do not configure it | ||
925 | */ | ||
926 | ret = osd_device->ops.request_layer(osd_device, | ||
927 | otherlayer->layer_info.id); | ||
928 | if (ret < 0) { | ||
929 | v4l2_err(&vpbe_dev->v4l2_dev, | ||
930 | "Display Manager failed to allocate layer\n"); | ||
931 | return -EBUSY; | ||
932 | } | ||
933 | } | ||
919 | 934 | ||
920 | /* Get osd layer config */ | 935 | /* Get osd layer config */ |
921 | osd_device->ops.get_layer_config(osd_device, | 936 | osd_device->ops.get_layer_config(osd_device, |
diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c index 8c50d3074866..93609091cb23 100644 --- a/drivers/media/platform/davinci/vpfe_capture.c +++ b/drivers/media/platform/davinci/vpfe_capture.c | |||
@@ -1837,7 +1837,7 @@ static int vpfe_probe(struct platform_device *pdev) | |||
1837 | if (NULL == ccdc_cfg) { | 1837 | if (NULL == ccdc_cfg) { |
1838 | v4l2_err(pdev->dev.driver, | 1838 | v4l2_err(pdev->dev.driver, |
1839 | "Memory allocation failed for ccdc_cfg\n"); | 1839 | "Memory allocation failed for ccdc_cfg\n"); |
1840 | goto probe_free_lock; | 1840 | goto probe_free_dev_mem; |
1841 | } | 1841 | } |
1842 | 1842 | ||
1843 | mutex_lock(&ccdc_lock); | 1843 | mutex_lock(&ccdc_lock); |
@@ -1991,7 +1991,6 @@ probe_out_release_irq: | |||
1991 | free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); | 1991 | free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); |
1992 | probe_free_ccdc_cfg_mem: | 1992 | probe_free_ccdc_cfg_mem: |
1993 | kfree(ccdc_cfg); | 1993 | kfree(ccdc_cfg); |
1994 | probe_free_lock: | ||
1995 | mutex_unlock(&ccdc_lock); | 1994 | mutex_unlock(&ccdc_lock); |
1996 | probe_free_dev_mem: | 1995 | probe_free_dev_mem: |
1997 | kfree(vpfe_dev); | 1996 | kfree(vpfe_dev); |
diff --git a/drivers/media/platform/exynos4-is/fimc-is-regs.c b/drivers/media/platform/exynos4-is/fimc-is-regs.c index b0ff67bc1b05..d05eaa2c8490 100644 --- a/drivers/media/platform/exynos4-is/fimc-is-regs.c +++ b/drivers/media/platform/exynos4-is/fimc-is-regs.c | |||
@@ -174,7 +174,7 @@ int fimc_is_hw_change_mode(struct fimc_is *is) | |||
174 | HIC_CAPTURE_STILL, HIC_CAPTURE_VIDEO, | 174 | HIC_CAPTURE_STILL, HIC_CAPTURE_VIDEO, |
175 | }; | 175 | }; |
176 | 176 | ||
177 | if (WARN_ON(is->config_index > ARRAY_SIZE(cmd))) | 177 | if (WARN_ON(is->config_index >= ARRAY_SIZE(cmd))) |
178 | return -EINVAL; | 178 | return -EINVAL; |
179 | 179 | ||
180 | mcuctl_write(cmd[is->config_index], is, MCUCTL_REG_ISSR(0)); | 180 | mcuctl_write(cmd[is->config_index], is, MCUCTL_REG_ISSR(0)); |
diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 47c6363d04e2..0741945b79ed 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c | |||
@@ -48,7 +48,6 @@ static char *fimc_is_clocks[ISS_CLKS_MAX] = { | |||
48 | [ISS_CLK_LITE0] = "lite0", | 48 | [ISS_CLK_LITE0] = "lite0", |
49 | [ISS_CLK_LITE1] = "lite1", | 49 | [ISS_CLK_LITE1] = "lite1", |
50 | [ISS_CLK_MPLL] = "mpll", | 50 | [ISS_CLK_MPLL] = "mpll", |
51 | [ISS_CLK_SYSREG] = "sysreg", | ||
52 | [ISS_CLK_ISP] = "isp", | 51 | [ISS_CLK_ISP] = "isp", |
53 | [ISS_CLK_DRC] = "drc", | 52 | [ISS_CLK_DRC] = "drc", |
54 | [ISS_CLK_FD] = "fd", | 53 | [ISS_CLK_FD] = "fd", |
@@ -71,7 +70,6 @@ static void fimc_is_put_clocks(struct fimc_is *is) | |||
71 | for (i = 0; i < ISS_CLKS_MAX; i++) { | 70 | for (i = 0; i < ISS_CLKS_MAX; i++) { |
72 | if (IS_ERR(is->clocks[i])) | 71 | if (IS_ERR(is->clocks[i])) |
73 | continue; | 72 | continue; |
74 | clk_unprepare(is->clocks[i]); | ||
75 | clk_put(is->clocks[i]); | 73 | clk_put(is->clocks[i]); |
76 | is->clocks[i] = ERR_PTR(-EINVAL); | 74 | is->clocks[i] = ERR_PTR(-EINVAL); |
77 | } | 75 | } |
@@ -90,12 +88,6 @@ static int fimc_is_get_clocks(struct fimc_is *is) | |||
90 | ret = PTR_ERR(is->clocks[i]); | 88 | ret = PTR_ERR(is->clocks[i]); |
91 | goto err; | 89 | goto err; |
92 | } | 90 | } |
93 | ret = clk_prepare(is->clocks[i]); | ||
94 | if (ret < 0) { | ||
95 | clk_put(is->clocks[i]); | ||
96 | is->clocks[i] = ERR_PTR(-EINVAL); | ||
97 | goto err; | ||
98 | } | ||
99 | } | 91 | } |
100 | 92 | ||
101 | return 0; | 93 | return 0; |
@@ -103,7 +95,7 @@ err: | |||
103 | fimc_is_put_clocks(is); | 95 | fimc_is_put_clocks(is); |
104 | dev_err(&is->pdev->dev, "failed to get clock: %s\n", | 96 | dev_err(&is->pdev->dev, "failed to get clock: %s\n", |
105 | fimc_is_clocks[i]); | 97 | fimc_is_clocks[i]); |
106 | return -ENXIO; | 98 | return ret; |
107 | } | 99 | } |
108 | 100 | ||
109 | static int fimc_is_setup_clocks(struct fimc_is *is) | 101 | static int fimc_is_setup_clocks(struct fimc_is *is) |
@@ -144,7 +136,7 @@ int fimc_is_enable_clocks(struct fimc_is *is) | |||
144 | for (i = 0; i < ISS_GATE_CLKS_MAX; i++) { | 136 | for (i = 0; i < ISS_GATE_CLKS_MAX; i++) { |
145 | if (IS_ERR(is->clocks[i])) | 137 | if (IS_ERR(is->clocks[i])) |
146 | continue; | 138 | continue; |
147 | ret = clk_enable(is->clocks[i]); | 139 | ret = clk_prepare_enable(is->clocks[i]); |
148 | if (ret < 0) { | 140 | if (ret < 0) { |
149 | dev_err(&is->pdev->dev, "clock %s enable failed\n", | 141 | dev_err(&is->pdev->dev, "clock %s enable failed\n", |
150 | fimc_is_clocks[i]); | 142 | fimc_is_clocks[i]); |
@@ -163,7 +155,7 @@ void fimc_is_disable_clocks(struct fimc_is *is) | |||
163 | 155 | ||
164 | for (i = 0; i < ISS_GATE_CLKS_MAX; i++) { | 156 | for (i = 0; i < ISS_GATE_CLKS_MAX; i++) { |
165 | if (!IS_ERR(is->clocks[i])) { | 157 | if (!IS_ERR(is->clocks[i])) { |
166 | clk_disable(is->clocks[i]); | 158 | clk_disable_unprepare(is->clocks[i]); |
167 | pr_debug("disabled clock: %s\n", fimc_is_clocks[i]); | 159 | pr_debug("disabled clock: %s\n", fimc_is_clocks[i]); |
168 | } | 160 | } |
169 | } | 161 | } |
@@ -326,6 +318,11 @@ int fimc_is_start_firmware(struct fimc_is *is) | |||
326 | struct device *dev = &is->pdev->dev; | 318 | struct device *dev = &is->pdev->dev; |
327 | int ret; | 319 | int ret; |
328 | 320 | ||
321 | if (is->fw.f_w == NULL) { | ||
322 | dev_err(dev, "firmware is not loaded\n"); | ||
323 | return -EINVAL; | ||
324 | } | ||
325 | |||
329 | memcpy(is->memory.vaddr, is->fw.f_w->data, is->fw.f_w->size); | 326 | memcpy(is->memory.vaddr, is->fw.f_w->data, is->fw.f_w->size); |
330 | wmb(); | 327 | wmb(); |
331 | 328 | ||
@@ -837,23 +834,11 @@ static int fimc_is_probe(struct platform_device *pdev) | |||
837 | goto err_clk; | 834 | goto err_clk; |
838 | } | 835 | } |
839 | pm_runtime_enable(dev); | 836 | pm_runtime_enable(dev); |
840 | /* | ||
841 | * Enable only the ISP power domain, keep FIMC-IS clocks off until | ||
842 | * the whole clock tree is configured. The ISP power domain needs | ||
843 | * be active in order to acces any CMU_ISP clock registers. | ||
844 | */ | ||
845 | ret = pm_runtime_get_sync(dev); | ||
846 | if (ret < 0) | ||
847 | goto err_irq; | ||
848 | |||
849 | ret = fimc_is_setup_clocks(is); | ||
850 | pm_runtime_put_sync(dev); | ||
851 | 837 | ||
838 | ret = pm_runtime_get_sync(dev); | ||
852 | if (ret < 0) | 839 | if (ret < 0) |
853 | goto err_irq; | 840 | goto err_irq; |
854 | 841 | ||
855 | is->clk_init = true; | ||
856 | |||
857 | is->alloc_ctx = vb2_dma_contig_init_ctx(dev); | 842 | is->alloc_ctx = vb2_dma_contig_init_ctx(dev); |
858 | if (IS_ERR(is->alloc_ctx)) { | 843 | if (IS_ERR(is->alloc_ctx)) { |
859 | ret = PTR_ERR(is->alloc_ctx); | 844 | ret = PTR_ERR(is->alloc_ctx); |
@@ -875,6 +860,8 @@ static int fimc_is_probe(struct platform_device *pdev) | |||
875 | if (ret < 0) | 860 | if (ret < 0) |
876 | goto err_dfs; | 861 | goto err_dfs; |
877 | 862 | ||
863 | pm_runtime_put_sync(dev); | ||
864 | |||
878 | dev_dbg(dev, "FIMC-IS registered successfully\n"); | 865 | dev_dbg(dev, "FIMC-IS registered successfully\n"); |
879 | return 0; | 866 | return 0; |
880 | 867 | ||
@@ -894,9 +881,11 @@ err_clk: | |||
894 | static int fimc_is_runtime_resume(struct device *dev) | 881 | static int fimc_is_runtime_resume(struct device *dev) |
895 | { | 882 | { |
896 | struct fimc_is *is = dev_get_drvdata(dev); | 883 | struct fimc_is *is = dev_get_drvdata(dev); |
884 | int ret; | ||
897 | 885 | ||
898 | if (!is->clk_init) | 886 | ret = fimc_is_setup_clocks(is); |
899 | return 0; | 887 | if (ret) |
888 | return ret; | ||
900 | 889 | ||
901 | return fimc_is_enable_clocks(is); | 890 | return fimc_is_enable_clocks(is); |
902 | } | 891 | } |
@@ -905,9 +894,7 @@ static int fimc_is_runtime_suspend(struct device *dev) | |||
905 | { | 894 | { |
906 | struct fimc_is *is = dev_get_drvdata(dev); | 895 | struct fimc_is *is = dev_get_drvdata(dev); |
907 | 896 | ||
908 | if (is->clk_init) | 897 | fimc_is_disable_clocks(is); |
909 | fimc_is_disable_clocks(is); | ||
910 | |||
911 | return 0; | 898 | return 0; |
912 | } | 899 | } |
913 | 900 | ||
@@ -941,7 +928,8 @@ static int fimc_is_remove(struct platform_device *pdev) | |||
941 | vb2_dma_contig_cleanup_ctx(is->alloc_ctx); | 928 | vb2_dma_contig_cleanup_ctx(is->alloc_ctx); |
942 | fimc_is_put_clocks(is); | 929 | fimc_is_put_clocks(is); |
943 | fimc_is_debugfs_remove(is); | 930 | fimc_is_debugfs_remove(is); |
944 | release_firmware(is->fw.f_w); | 931 | if (is->fw.f_w) |
932 | release_firmware(is->fw.f_w); | ||
945 | fimc_is_free_cpu_memory(is); | 933 | fimc_is_free_cpu_memory(is); |
946 | 934 | ||
947 | return 0; | 935 | return 0; |
diff --git a/drivers/media/platform/exynos4-is/fimc-is.h b/drivers/media/platform/exynos4-is/fimc-is.h index f5275a5b0156..d7db133b493f 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.h +++ b/drivers/media/platform/exynos4-is/fimc-is.h | |||
@@ -73,7 +73,6 @@ enum { | |||
73 | ISS_CLK_LITE0, | 73 | ISS_CLK_LITE0, |
74 | ISS_CLK_LITE1, | 74 | ISS_CLK_LITE1, |
75 | ISS_CLK_MPLL, | 75 | ISS_CLK_MPLL, |
76 | ISS_CLK_SYSREG, | ||
77 | ISS_CLK_ISP, | 76 | ISS_CLK_ISP, |
78 | ISS_CLK_DRC, | 77 | ISS_CLK_DRC, |
79 | ISS_CLK_FD, | 78 | ISS_CLK_FD, |
@@ -265,7 +264,6 @@ struct fimc_is { | |||
265 | spinlock_t slock; | 264 | spinlock_t slock; |
266 | 265 | ||
267 | struct clk *clocks[ISS_CLKS_MAX]; | 266 | struct clk *clocks[ISS_CLKS_MAX]; |
268 | bool clk_init; | ||
269 | void __iomem *regs; | 267 | void __iomem *regs; |
270 | void __iomem *pmu_regs; | 268 | void __iomem *pmu_regs; |
271 | int irq; | 269 | int irq; |
diff --git a/drivers/media/platform/exynos4-is/fimc-isp.c b/drivers/media/platform/exynos4-is/fimc-isp.c index d63947f7b302..7ede30b5910f 100644 --- a/drivers/media/platform/exynos4-is/fimc-isp.c +++ b/drivers/media/platform/exynos4-is/fimc-isp.c | |||
@@ -138,7 +138,7 @@ static int fimc_isp_subdev_get_fmt(struct v4l2_subdev *sd, | |||
138 | return 0; | 138 | return 0; |
139 | } | 139 | } |
140 | 140 | ||
141 | mf->colorspace = V4L2_COLORSPACE_JPEG; | 141 | mf->colorspace = V4L2_COLORSPACE_SRGB; |
142 | 142 | ||
143 | mutex_lock(&isp->subdev_lock); | 143 | mutex_lock(&isp->subdev_lock); |
144 | __is_get_frame_size(is, &cur_fmt); | 144 | __is_get_frame_size(is, &cur_fmt); |
@@ -194,7 +194,7 @@ static int fimc_isp_subdev_set_fmt(struct v4l2_subdev *sd, | |||
194 | v4l2_dbg(1, debug, sd, "%s: pad%d: code: 0x%x, %dx%d\n", | 194 | v4l2_dbg(1, debug, sd, "%s: pad%d: code: 0x%x, %dx%d\n", |
195 | __func__, fmt->pad, mf->code, mf->width, mf->height); | 195 | __func__, fmt->pad, mf->code, mf->width, mf->height); |
196 | 196 | ||
197 | mf->colorspace = V4L2_COLORSPACE_JPEG; | 197 | mf->colorspace = V4L2_COLORSPACE_SRGB; |
198 | 198 | ||
199 | mutex_lock(&isp->subdev_lock); | 199 | mutex_lock(&isp->subdev_lock); |
200 | __isp_subdev_try_format(isp, fmt); | 200 | __isp_subdev_try_format(isp, fmt); |
diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c index a2eda9d5ac87..254d70fe762a 100644 --- a/drivers/media/platform/exynos4-is/mipi-csis.c +++ b/drivers/media/platform/exynos4-is/mipi-csis.c | |||
@@ -746,7 +746,7 @@ static int s5pcsis_parse_dt(struct platform_device *pdev, | |||
746 | node = v4l2_of_get_next_endpoint(node, NULL); | 746 | node = v4l2_of_get_next_endpoint(node, NULL); |
747 | if (!node) { | 747 | if (!node) { |
748 | dev_err(&pdev->dev, "No port node at %s\n", | 748 | dev_err(&pdev->dev, "No port node at %s\n", |
749 | node->full_name); | 749 | pdev->dev.of_node->full_name); |
750 | return -EINVAL; | 750 | return -EINVAL; |
751 | } | 751 | } |
752 | /* Get port node and validate MIPI-CSI channel id. */ | 752 | /* Get port node and validate MIPI-CSI channel id. */ |
diff --git a/drivers/media/platform/s3c-camif/camif-core.h b/drivers/media/platform/s3c-camif/camif-core.h index 261134baa655..35d2fcdc0036 100644 --- a/drivers/media/platform/s3c-camif/camif-core.h +++ b/drivers/media/platform/s3c-camif/camif-core.h | |||
@@ -229,7 +229,7 @@ struct camif_vp { | |||
229 | unsigned int state; | 229 | unsigned int state; |
230 | u16 fmt_flags; | 230 | u16 fmt_flags; |
231 | u8 id; | 231 | u8 id; |
232 | u8 rotation; | 232 | u16 rotation; |
233 | u8 hflip; | 233 | u8 hflip; |
234 | u8 vflip; | 234 | u8 vflip; |
235 | unsigned int offset; | 235 | unsigned int offset; |
diff --git a/drivers/media/platform/s5p-jpeg/Makefile b/drivers/media/platform/s5p-jpeg/Makefile index ddc2900d88a2..d18cb5edd2d5 100644 --- a/drivers/media/platform/s5p-jpeg/Makefile +++ b/drivers/media/platform/s5p-jpeg/Makefile | |||
@@ -1,2 +1,2 @@ | |||
1 | s5p-jpeg-objs := jpeg-core.o | 1 | s5p-jpeg-objs := jpeg-core.o |
2 | obj-$(CONFIG_VIDEO_SAMSUNG_S5P_JPEG) := s5p-jpeg.o | 2 | obj-$(CONFIG_VIDEO_SAMSUNG_S5P_JPEG) += s5p-jpeg.o |
diff --git a/drivers/media/platform/s5p-mfc/Makefile b/drivers/media/platform/s5p-mfc/Makefile index 379008c6d09a..15f59b324fef 100644 --- a/drivers/media/platform/s5p-mfc/Makefile +++ b/drivers/media/platform/s5p-mfc/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | obj-$(CONFIG_VIDEO_SAMSUNG_S5P_MFC) := s5p-mfc.o | 1 | obj-$(CONFIG_VIDEO_SAMSUNG_S5P_MFC) += s5p-mfc.o |
2 | s5p-mfc-y += s5p_mfc.o s5p_mfc_intr.o | 2 | s5p-mfc-y += s5p_mfc.o s5p_mfc_intr.o |
3 | s5p-mfc-y += s5p_mfc_dec.o s5p_mfc_enc.o | 3 | s5p-mfc-y += s5p_mfc_dec.o s5p_mfc_enc.o |
4 | s5p-mfc-y += s5p_mfc_ctrl.o s5p_mfc_pm.o | 4 | s5p-mfc-y += s5p_mfc_ctrl.o s5p_mfc_pm.o |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index 01f9ae0dadb0..d12faa691af8 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c | |||
@@ -397,7 +397,7 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx, | |||
397 | leave_handle_frame: | 397 | leave_handle_frame: |
398 | spin_unlock_irqrestore(&dev->irqlock, flags); | 398 | spin_unlock_irqrestore(&dev->irqlock, flags); |
399 | if ((ctx->src_queue_cnt == 0 && ctx->state != MFCINST_FINISHING) | 399 | if ((ctx->src_queue_cnt == 0 && ctx->state != MFCINST_FINISHING) |
400 | || ctx->dst_queue_cnt < ctx->dpb_count) | 400 | || ctx->dst_queue_cnt < ctx->pb_count) |
401 | clear_work_bit(ctx); | 401 | clear_work_bit(ctx); |
402 | s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev); | 402 | s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev); |
403 | wake_up_ctx(ctx, reason, err); | 403 | wake_up_ctx(ctx, reason, err); |
@@ -473,7 +473,7 @@ static void s5p_mfc_handle_seq_done(struct s5p_mfc_ctx *ctx, | |||
473 | 473 | ||
474 | s5p_mfc_hw_call(dev->mfc_ops, dec_calc_dpb_size, ctx); | 474 | s5p_mfc_hw_call(dev->mfc_ops, dec_calc_dpb_size, ctx); |
475 | 475 | ||
476 | ctx->dpb_count = s5p_mfc_hw_call(dev->mfc_ops, get_dpb_count, | 476 | ctx->pb_count = s5p_mfc_hw_call(dev->mfc_ops, get_dpb_count, |
477 | dev); | 477 | dev); |
478 | ctx->mv_count = s5p_mfc_hw_call(dev->mfc_ops, get_mv_count, | 478 | ctx->mv_count = s5p_mfc_hw_call(dev->mfc_ops, get_mv_count, |
479 | dev); | 479 | dev); |
@@ -562,7 +562,7 @@ static void s5p_mfc_handle_stream_complete(struct s5p_mfc_ctx *ctx, | |||
562 | struct s5p_mfc_dev *dev = ctx->dev; | 562 | struct s5p_mfc_dev *dev = ctx->dev; |
563 | struct s5p_mfc_buf *mb_entry; | 563 | struct s5p_mfc_buf *mb_entry; |
564 | 564 | ||
565 | mfc_debug(2, "Stream completed"); | 565 | mfc_debug(2, "Stream completed\n"); |
566 | 566 | ||
567 | s5p_mfc_clear_int_flags(dev); | 567 | s5p_mfc_clear_int_flags(dev); |
568 | ctx->int_type = reason; | 568 | ctx->int_type = reason; |
@@ -1362,7 +1362,6 @@ static struct s5p_mfc_variant mfc_drvdata_v5 = { | |||
1362 | .port_num = MFC_NUM_PORTS, | 1362 | .port_num = MFC_NUM_PORTS, |
1363 | .buf_size = &buf_size_v5, | 1363 | .buf_size = &buf_size_v5, |
1364 | .buf_align = &mfc_buf_align_v5, | 1364 | .buf_align = &mfc_buf_align_v5, |
1365 | .mclk_name = "sclk_mfc", | ||
1366 | .fw_name = "s5p-mfc.fw", | 1365 | .fw_name = "s5p-mfc.fw", |
1367 | }; | 1366 | }; |
1368 | 1367 | ||
@@ -1389,7 +1388,6 @@ static struct s5p_mfc_variant mfc_drvdata_v6 = { | |||
1389 | .port_num = MFC_NUM_PORTS_V6, | 1388 | .port_num = MFC_NUM_PORTS_V6, |
1390 | .buf_size = &buf_size_v6, | 1389 | .buf_size = &buf_size_v6, |
1391 | .buf_align = &mfc_buf_align_v6, | 1390 | .buf_align = &mfc_buf_align_v6, |
1392 | .mclk_name = "aclk_333", | ||
1393 | .fw_name = "s5p-mfc-v6.fw", | 1391 | .fw_name = "s5p-mfc-v6.fw", |
1394 | }; | 1392 | }; |
1395 | 1393 | ||
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index 202d1d7a37a8..ef4074cd5316 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h | |||
@@ -138,6 +138,7 @@ enum s5p_mfc_inst_state { | |||
138 | MFCINST_INIT = 100, | 138 | MFCINST_INIT = 100, |
139 | MFCINST_GOT_INST, | 139 | MFCINST_GOT_INST, |
140 | MFCINST_HEAD_PARSED, | 140 | MFCINST_HEAD_PARSED, |
141 | MFCINST_HEAD_PRODUCED, | ||
141 | MFCINST_BUFS_SET, | 142 | MFCINST_BUFS_SET, |
142 | MFCINST_RUNNING, | 143 | MFCINST_RUNNING, |
143 | MFCINST_FINISHING, | 144 | MFCINST_FINISHING, |
@@ -231,7 +232,6 @@ struct s5p_mfc_variant { | |||
231 | unsigned int port_num; | 232 | unsigned int port_num; |
232 | struct s5p_mfc_buf_size *buf_size; | 233 | struct s5p_mfc_buf_size *buf_size; |
233 | struct s5p_mfc_buf_align *buf_align; | 234 | struct s5p_mfc_buf_align *buf_align; |
234 | char *mclk_name; | ||
235 | char *fw_name; | 235 | char *fw_name; |
236 | }; | 236 | }; |
237 | 237 | ||
@@ -438,7 +438,7 @@ struct s5p_mfc_enc_params { | |||
438 | u32 rc_framerate_num; | 438 | u32 rc_framerate_num; |
439 | u32 rc_framerate_denom; | 439 | u32 rc_framerate_denom; |
440 | 440 | ||
441 | union { | 441 | struct { |
442 | struct s5p_mfc_h264_enc_params h264; | 442 | struct s5p_mfc_h264_enc_params h264; |
443 | struct s5p_mfc_mpeg4_enc_params mpeg4; | 443 | struct s5p_mfc_mpeg4_enc_params mpeg4; |
444 | } codec; | 444 | } codec; |
@@ -602,7 +602,7 @@ struct s5p_mfc_ctx { | |||
602 | int after_packed_pb; | 602 | int after_packed_pb; |
603 | int sei_fp_parse; | 603 | int sei_fp_parse; |
604 | 604 | ||
605 | int dpb_count; | 605 | int pb_count; |
606 | int total_dpb_count; | 606 | int total_dpb_count; |
607 | int mv_count; | 607 | int mv_count; |
608 | /* Buffers */ | 608 | /* Buffers */ |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c index 2e5f30b40dea..dc1fc94a488d 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | |||
@@ -38,7 +38,7 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) | |||
38 | dev->fw_virt_addr = dma_alloc_coherent(dev->mem_dev_l, dev->fw_size, | 38 | dev->fw_virt_addr = dma_alloc_coherent(dev->mem_dev_l, dev->fw_size, |
39 | &dev->bank1, GFP_KERNEL); | 39 | &dev->bank1, GFP_KERNEL); |
40 | 40 | ||
41 | if (IS_ERR(dev->fw_virt_addr)) { | 41 | if (IS_ERR_OR_NULL(dev->fw_virt_addr)) { |
42 | dev->fw_virt_addr = NULL; | 42 | dev->fw_virt_addr = NULL; |
43 | mfc_err("Allocating bitprocessor buffer failed\n"); | 43 | mfc_err("Allocating bitprocessor buffer failed\n"); |
44 | return -ENOMEM; | 44 | return -ENOMEM; |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_debug.h b/drivers/media/platform/s5p-mfc/s5p_mfc_debug.h index bd5cd4ae993c..8e608f5aa0d7 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_debug.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_debug.h | |||
@@ -30,8 +30,8 @@ extern int debug; | |||
30 | #define mfc_debug(level, fmt, args...) | 30 | #define mfc_debug(level, fmt, args...) |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | #define mfc_debug_enter() mfc_debug(5, "enter") | 33 | #define mfc_debug_enter() mfc_debug(5, "enter\n") |
34 | #define mfc_debug_leave() mfc_debug(5, "leave") | 34 | #define mfc_debug_leave() mfc_debug(5, "leave\n") |
35 | 35 | ||
36 | #define mfc_err(fmt, args...) \ | 36 | #define mfc_err(fmt, args...) \ |
37 | do { \ | 37 | do { \ |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 4af53bd2f182..00b07032f4f0 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | |||
@@ -210,11 +210,11 @@ static int s5p_mfc_ctx_ready(struct s5p_mfc_ctx *ctx) | |||
210 | /* Context is to decode a frame */ | 210 | /* Context is to decode a frame */ |
211 | if (ctx->src_queue_cnt >= 1 && | 211 | if (ctx->src_queue_cnt >= 1 && |
212 | ctx->state == MFCINST_RUNNING && | 212 | ctx->state == MFCINST_RUNNING && |
213 | ctx->dst_queue_cnt >= ctx->dpb_count) | 213 | ctx->dst_queue_cnt >= ctx->pb_count) |
214 | return 1; | 214 | return 1; |
215 | /* Context is to return last frame */ | 215 | /* Context is to return last frame */ |
216 | if (ctx->state == MFCINST_FINISHING && | 216 | if (ctx->state == MFCINST_FINISHING && |
217 | ctx->dst_queue_cnt >= ctx->dpb_count) | 217 | ctx->dst_queue_cnt >= ctx->pb_count) |
218 | return 1; | 218 | return 1; |
219 | /* Context is to set buffers */ | 219 | /* Context is to set buffers */ |
220 | if (ctx->src_queue_cnt >= 1 && | 220 | if (ctx->src_queue_cnt >= 1 && |
@@ -224,7 +224,7 @@ static int s5p_mfc_ctx_ready(struct s5p_mfc_ctx *ctx) | |||
224 | /* Resolution change */ | 224 | /* Resolution change */ |
225 | if ((ctx->state == MFCINST_RES_CHANGE_INIT || | 225 | if ((ctx->state == MFCINST_RES_CHANGE_INIT || |
226 | ctx->state == MFCINST_RES_CHANGE_FLUSH) && | 226 | ctx->state == MFCINST_RES_CHANGE_FLUSH) && |
227 | ctx->dst_queue_cnt >= ctx->dpb_count) | 227 | ctx->dst_queue_cnt >= ctx->pb_count) |
228 | return 1; | 228 | return 1; |
229 | if (ctx->state == MFCINST_RES_CHANGE_END && | 229 | if (ctx->state == MFCINST_RES_CHANGE_END && |
230 | ctx->src_queue_cnt >= 1) | 230 | ctx->src_queue_cnt >= 1) |
@@ -537,7 +537,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
537 | mfc_err("vb2_reqbufs on capture failed\n"); | 537 | mfc_err("vb2_reqbufs on capture failed\n"); |
538 | return ret; | 538 | return ret; |
539 | } | 539 | } |
540 | if (reqbufs->count < ctx->dpb_count) { | 540 | if (reqbufs->count < ctx->pb_count) { |
541 | mfc_err("Not enough buffers allocated\n"); | 541 | mfc_err("Not enough buffers allocated\n"); |
542 | reqbufs->count = 0; | 542 | reqbufs->count = 0; |
543 | s5p_mfc_clock_on(); | 543 | s5p_mfc_clock_on(); |
@@ -751,7 +751,7 @@ static int s5p_mfc_dec_g_v_ctrl(struct v4l2_ctrl *ctrl) | |||
751 | case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: | 751 | case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: |
752 | if (ctx->state >= MFCINST_HEAD_PARSED && | 752 | if (ctx->state >= MFCINST_HEAD_PARSED && |
753 | ctx->state < MFCINST_ABORT) { | 753 | ctx->state < MFCINST_ABORT) { |
754 | ctrl->val = ctx->dpb_count; | 754 | ctrl->val = ctx->pb_count; |
755 | break; | 755 | break; |
756 | } else if (ctx->state != MFCINST_INIT) { | 756 | } else if (ctx->state != MFCINST_INIT) { |
757 | v4l2_err(&dev->v4l2_dev, "Decoding not initialised\n"); | 757 | v4l2_err(&dev->v4l2_dev, "Decoding not initialised\n"); |
@@ -763,7 +763,7 @@ static int s5p_mfc_dec_g_v_ctrl(struct v4l2_ctrl *ctrl) | |||
763 | S5P_MFC_R2H_CMD_SEQ_DONE_RET, 0); | 763 | S5P_MFC_R2H_CMD_SEQ_DONE_RET, 0); |
764 | if (ctx->state >= MFCINST_HEAD_PARSED && | 764 | if (ctx->state >= MFCINST_HEAD_PARSED && |
765 | ctx->state < MFCINST_ABORT) { | 765 | ctx->state < MFCINST_ABORT) { |
766 | ctrl->val = ctx->dpb_count; | 766 | ctrl->val = ctx->pb_count; |
767 | } else { | 767 | } else { |
768 | v4l2_err(&dev->v4l2_dev, "Decoding not initialised\n"); | 768 | v4l2_err(&dev->v4l2_dev, "Decoding not initialised\n"); |
769 | return -EINVAL; | 769 | return -EINVAL; |
@@ -924,10 +924,10 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, | |||
924 | /* Output plane count is 2 - one for Y and one for CbCr */ | 924 | /* Output plane count is 2 - one for Y and one for CbCr */ |
925 | *plane_count = 2; | 925 | *plane_count = 2; |
926 | /* Setup buffer count */ | 926 | /* Setup buffer count */ |
927 | if (*buf_count < ctx->dpb_count) | 927 | if (*buf_count < ctx->pb_count) |
928 | *buf_count = ctx->dpb_count; | 928 | *buf_count = ctx->pb_count; |
929 | if (*buf_count > ctx->dpb_count + MFC_MAX_EXTRA_DPB) | 929 | if (*buf_count > ctx->pb_count + MFC_MAX_EXTRA_DPB) |
930 | *buf_count = ctx->dpb_count + MFC_MAX_EXTRA_DPB; | 930 | *buf_count = ctx->pb_count + MFC_MAX_EXTRA_DPB; |
931 | if (*buf_count > MFC_MAX_BUFFERS) | 931 | if (*buf_count > MFC_MAX_BUFFERS) |
932 | *buf_count = MFC_MAX_BUFFERS; | 932 | *buf_count = MFC_MAX_BUFFERS; |
933 | } else { | 933 | } else { |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 4f6b553c4b2d..2549967b2f85 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | |||
@@ -592,7 +592,7 @@ static int s5p_mfc_ctx_ready(struct s5p_mfc_ctx *ctx) | |||
592 | return 1; | 592 | return 1; |
593 | /* context is ready to encode a frame */ | 593 | /* context is ready to encode a frame */ |
594 | if ((ctx->state == MFCINST_RUNNING || | 594 | if ((ctx->state == MFCINST_RUNNING || |
595 | ctx->state == MFCINST_HEAD_PARSED) && | 595 | ctx->state == MFCINST_HEAD_PRODUCED) && |
596 | ctx->src_queue_cnt >= 1 && ctx->dst_queue_cnt >= 1) | 596 | ctx->src_queue_cnt >= 1 && ctx->dst_queue_cnt >= 1) |
597 | return 1; | 597 | return 1; |
598 | /* context is ready to encode remaining frames */ | 598 | /* context is ready to encode remaining frames */ |
@@ -649,6 +649,7 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx) | |||
649 | struct s5p_mfc_enc_params *p = &ctx->enc_params; | 649 | struct s5p_mfc_enc_params *p = &ctx->enc_params; |
650 | struct s5p_mfc_buf *dst_mb; | 650 | struct s5p_mfc_buf *dst_mb; |
651 | unsigned long flags; | 651 | unsigned long flags; |
652 | unsigned int enc_pb_count; | ||
652 | 653 | ||
653 | if (p->seq_hdr_mode == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE) { | 654 | if (p->seq_hdr_mode == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE) { |
654 | spin_lock_irqsave(&dev->irqlock, flags); | 655 | spin_lock_irqsave(&dev->irqlock, flags); |
@@ -661,18 +662,19 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx) | |||
661 | vb2_buffer_done(dst_mb->b, VB2_BUF_STATE_DONE); | 662 | vb2_buffer_done(dst_mb->b, VB2_BUF_STATE_DONE); |
662 | spin_unlock_irqrestore(&dev->irqlock, flags); | 663 | spin_unlock_irqrestore(&dev->irqlock, flags); |
663 | } | 664 | } |
664 | if (IS_MFCV6(dev)) { | 665 | |
665 | ctx->state = MFCINST_HEAD_PARSED; /* for INIT_BUFFER cmd */ | 666 | if (!IS_MFCV6(dev)) { |
666 | } else { | ||
667 | ctx->state = MFCINST_RUNNING; | 667 | ctx->state = MFCINST_RUNNING; |
668 | if (s5p_mfc_ctx_ready(ctx)) | 668 | if (s5p_mfc_ctx_ready(ctx)) |
669 | set_work_bit_irqsave(ctx); | 669 | set_work_bit_irqsave(ctx); |
670 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); | 670 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); |
671 | } | 671 | } else { |
672 | 672 | enc_pb_count = s5p_mfc_hw_call(dev->mfc_ops, | |
673 | if (IS_MFCV6(dev)) | ||
674 | ctx->dpb_count = s5p_mfc_hw_call(dev->mfc_ops, | ||
675 | get_enc_dpb_count, dev); | 673 | get_enc_dpb_count, dev); |
674 | if (ctx->pb_count < enc_pb_count) | ||
675 | ctx->pb_count = enc_pb_count; | ||
676 | ctx->state = MFCINST_HEAD_PRODUCED; | ||
677 | } | ||
676 | 678 | ||
677 | return 0; | 679 | return 0; |
678 | } | 680 | } |
@@ -717,9 +719,9 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx) | |||
717 | 719 | ||
718 | slice_type = s5p_mfc_hw_call(dev->mfc_ops, get_enc_slice_type, dev); | 720 | slice_type = s5p_mfc_hw_call(dev->mfc_ops, get_enc_slice_type, dev); |
719 | strm_size = s5p_mfc_hw_call(dev->mfc_ops, get_enc_strm_size, dev); | 721 | strm_size = s5p_mfc_hw_call(dev->mfc_ops, get_enc_strm_size, dev); |
720 | mfc_debug(2, "Encoded slice type: %d", slice_type); | 722 | mfc_debug(2, "Encoded slice type: %d\n", slice_type); |
721 | mfc_debug(2, "Encoded stream size: %d", strm_size); | 723 | mfc_debug(2, "Encoded stream size: %d\n", strm_size); |
722 | mfc_debug(2, "Display order: %d", | 724 | mfc_debug(2, "Display order: %d\n", |
723 | mfc_read(dev, S5P_FIMV_ENC_SI_PIC_CNT)); | 725 | mfc_read(dev, S5P_FIMV_ENC_SI_PIC_CNT)); |
724 | spin_lock_irqsave(&dev->irqlock, flags); | 726 | spin_lock_irqsave(&dev->irqlock, flags); |
725 | if (slice_type >= 0) { | 727 | if (slice_type >= 0) { |
@@ -1055,15 +1057,13 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
1055 | } | 1057 | } |
1056 | ctx->capture_state = QUEUE_BUFS_REQUESTED; | 1058 | ctx->capture_state = QUEUE_BUFS_REQUESTED; |
1057 | 1059 | ||
1058 | if (!IS_MFCV6(dev)) { | 1060 | ret = s5p_mfc_hw_call(ctx->dev->mfc_ops, |
1059 | ret = s5p_mfc_hw_call(ctx->dev->mfc_ops, | 1061 | alloc_codec_buffers, ctx); |
1060 | alloc_codec_buffers, ctx); | 1062 | if (ret) { |
1061 | if (ret) { | 1063 | mfc_err("Failed to allocate encoding buffers\n"); |
1062 | mfc_err("Failed to allocate encoding buffers\n"); | 1064 | reqbufs->count = 0; |
1063 | reqbufs->count = 0; | 1065 | ret = vb2_reqbufs(&ctx->vq_dst, reqbufs); |
1064 | ret = vb2_reqbufs(&ctx->vq_dst, reqbufs); | 1066 | return -ENOMEM; |
1065 | return -ENOMEM; | ||
1066 | } | ||
1067 | } | 1067 | } |
1068 | } else if (reqbufs->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { | 1068 | } else if (reqbufs->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { |
1069 | if (ctx->output_state != QUEUE_FREE) { | 1069 | if (ctx->output_state != QUEUE_FREE) { |
@@ -1071,6 +1071,19 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
1071 | ctx->output_state); | 1071 | ctx->output_state); |
1072 | return -EINVAL; | 1072 | return -EINVAL; |
1073 | } | 1073 | } |
1074 | |||
1075 | if (IS_MFCV6(dev)) { | ||
1076 | /* Check for min encoder buffers */ | ||
1077 | if (ctx->pb_count && | ||
1078 | (reqbufs->count < ctx->pb_count)) { | ||
1079 | reqbufs->count = ctx->pb_count; | ||
1080 | mfc_debug(2, "Minimum %d output buffers needed\n", | ||
1081 | ctx->pb_count); | ||
1082 | } else { | ||
1083 | ctx->pb_count = reqbufs->count; | ||
1084 | } | ||
1085 | } | ||
1086 | |||
1074 | ret = vb2_reqbufs(&ctx->vq_src, reqbufs); | 1087 | ret = vb2_reqbufs(&ctx->vq_src, reqbufs); |
1075 | if (ret != 0) { | 1088 | if (ret != 0) { |
1076 | mfc_err("error in vb2_reqbufs() for E(S)\n"); | 1089 | mfc_err("error in vb2_reqbufs() for E(S)\n"); |
@@ -1533,14 +1546,14 @@ int vidioc_encoder_cmd(struct file *file, void *priv, | |||
1533 | 1546 | ||
1534 | spin_lock_irqsave(&dev->irqlock, flags); | 1547 | spin_lock_irqsave(&dev->irqlock, flags); |
1535 | if (list_empty(&ctx->src_queue)) { | 1548 | if (list_empty(&ctx->src_queue)) { |
1536 | mfc_debug(2, "EOS: empty src queue, entering finishing state"); | 1549 | mfc_debug(2, "EOS: empty src queue, entering finishing state\n"); |
1537 | ctx->state = MFCINST_FINISHING; | 1550 | ctx->state = MFCINST_FINISHING; |
1538 | if (s5p_mfc_ctx_ready(ctx)) | 1551 | if (s5p_mfc_ctx_ready(ctx)) |
1539 | set_work_bit_irqsave(ctx); | 1552 | set_work_bit_irqsave(ctx); |
1540 | spin_unlock_irqrestore(&dev->irqlock, flags); | 1553 | spin_unlock_irqrestore(&dev->irqlock, flags); |
1541 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); | 1554 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); |
1542 | } else { | 1555 | } else { |
1543 | mfc_debug(2, "EOS: marking last buffer of stream"); | 1556 | mfc_debug(2, "EOS: marking last buffer of stream\n"); |
1544 | buf = list_entry(ctx->src_queue.prev, | 1557 | buf = list_entry(ctx->src_queue.prev, |
1545 | struct s5p_mfc_buf, list); | 1558 | struct s5p_mfc_buf, list); |
1546 | if (buf->flags & MFC_BUF_FLAG_USED) | 1559 | if (buf->flags & MFC_BUF_FLAG_USED) |
@@ -1609,9 +1622,9 @@ static int check_vb_with_fmt(struct s5p_mfc_fmt *fmt, struct vb2_buffer *vb) | |||
1609 | mfc_err("failed to get plane cookie\n"); | 1622 | mfc_err("failed to get plane cookie\n"); |
1610 | return -EINVAL; | 1623 | return -EINVAL; |
1611 | } | 1624 | } |
1612 | mfc_debug(2, "index: %d, plane[%d] cookie: 0x%08zx", | 1625 | mfc_debug(2, "index: %d, plane[%d] cookie: 0x%08zx\n", |
1613 | vb->v4l2_buf.index, i, | 1626 | vb->v4l2_buf.index, i, |
1614 | vb2_dma_contig_plane_dma_addr(vb, i)); | 1627 | vb2_dma_contig_plane_dma_addr(vb, i)); |
1615 | } | 1628 | } |
1616 | return 0; | 1629 | return 0; |
1617 | } | 1630 | } |
@@ -1760,11 +1773,27 @@ static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count) | |||
1760 | struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv); | 1773 | struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv); |
1761 | struct s5p_mfc_dev *dev = ctx->dev; | 1774 | struct s5p_mfc_dev *dev = ctx->dev; |
1762 | 1775 | ||
1763 | v4l2_ctrl_handler_setup(&ctx->ctrl_handler); | 1776 | if (IS_MFCV6(dev) && (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)) { |
1777 | |||
1778 | if ((ctx->state == MFCINST_GOT_INST) && | ||
1779 | (dev->curr_ctx == ctx->num) && dev->hw_lock) { | ||
1780 | s5p_mfc_wait_for_done_ctx(ctx, | ||
1781 | S5P_MFC_R2H_CMD_SEQ_DONE_RET, | ||
1782 | 0); | ||
1783 | } | ||
1784 | |||
1785 | if (ctx->src_bufs_cnt < ctx->pb_count) { | ||
1786 | mfc_err("Need minimum %d OUTPUT buffers\n", | ||
1787 | ctx->pb_count); | ||
1788 | return -EINVAL; | ||
1789 | } | ||
1790 | } | ||
1791 | |||
1764 | /* If context is ready then dev = work->data;schedule it to run */ | 1792 | /* If context is ready then dev = work->data;schedule it to run */ |
1765 | if (s5p_mfc_ctx_ready(ctx)) | 1793 | if (s5p_mfc_ctx_ready(ctx)) |
1766 | set_work_bit_irqsave(ctx); | 1794 | set_work_bit_irqsave(ctx); |
1767 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); | 1795 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); |
1796 | |||
1768 | return 0; | 1797 | return 0; |
1769 | } | 1798 | } |
1770 | 1799 | ||
@@ -1920,6 +1949,7 @@ int s5p_mfc_enc_ctrls_setup(struct s5p_mfc_ctx *ctx) | |||
1920 | if (controls[i].is_volatile && ctx->ctrls[i]) | 1949 | if (controls[i].is_volatile && ctx->ctrls[i]) |
1921 | ctx->ctrls[i]->flags |= V4L2_CTRL_FLAG_VOLATILE; | 1950 | ctx->ctrls[i]->flags |= V4L2_CTRL_FLAG_VOLATILE; |
1922 | } | 1951 | } |
1952 | v4l2_ctrl_handler_setup(&ctx->ctrl_handler); | ||
1923 | return 0; | 1953 | return 0; |
1924 | } | 1954 | } |
1925 | 1955 | ||
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c index 0af05a2d1cd4..368582b091bf 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c | |||
@@ -1275,8 +1275,8 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx) | |||
1275 | spin_unlock_irqrestore(&dev->irqlock, flags); | 1275 | spin_unlock_irqrestore(&dev->irqlock, flags); |
1276 | dev->curr_ctx = ctx->num; | 1276 | dev->curr_ctx = ctx->num; |
1277 | s5p_mfc_clean_ctx_int_flags(ctx); | 1277 | s5p_mfc_clean_ctx_int_flags(ctx); |
1278 | mfc_debug(2, "encoding buffer with index=%d state=%d", | 1278 | mfc_debug(2, "encoding buffer with index=%d state=%d\n", |
1279 | src_mb ? src_mb->b->v4l2_buf.index : -1, ctx->state); | 1279 | src_mb ? src_mb->b->v4l2_buf.index : -1, ctx->state); |
1280 | s5p_mfc_encode_one_frame_v5(ctx); | 1280 | s5p_mfc_encode_one_frame_v5(ctx); |
1281 | return 0; | 1281 | return 0; |
1282 | } | 1282 | } |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c index 7e76fce2e524..66f0d042357f 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | |||
@@ -62,12 +62,6 @@ static void s5p_mfc_release_dec_desc_buffer_v6(struct s5p_mfc_ctx *ctx) | |||
62 | /* NOP */ | 62 | /* NOP */ |
63 | } | 63 | } |
64 | 64 | ||
65 | static int s5p_mfc_get_dec_status_v6(struct s5p_mfc_dev *dev) | ||
66 | { | ||
67 | /* NOP */ | ||
68 | return -1; | ||
69 | } | ||
70 | |||
71 | /* Allocate codec buffers */ | 65 | /* Allocate codec buffers */ |
72 | static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) | 66 | static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) |
73 | { | 67 | { |
@@ -167,7 +161,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) | |||
167 | S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6); | 161 | S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6); |
168 | ctx->bank1.size = | 162 | ctx->bank1.size = |
169 | ctx->scratch_buf_size + ctx->tmv_buffer_size + | 163 | ctx->scratch_buf_size + ctx->tmv_buffer_size + |
170 | (ctx->dpb_count * (ctx->luma_dpb_size + | 164 | (ctx->pb_count * (ctx->luma_dpb_size + |
171 | ctx->chroma_dpb_size + ctx->me_buffer_size)); | 165 | ctx->chroma_dpb_size + ctx->me_buffer_size)); |
172 | ctx->bank2.size = 0; | 166 | ctx->bank2.size = 0; |
173 | break; | 167 | break; |
@@ -181,7 +175,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) | |||
181 | S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6); | 175 | S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6); |
182 | ctx->bank1.size = | 176 | ctx->bank1.size = |
183 | ctx->scratch_buf_size + ctx->tmv_buffer_size + | 177 | ctx->scratch_buf_size + ctx->tmv_buffer_size + |
184 | (ctx->dpb_count * (ctx->luma_dpb_size + | 178 | (ctx->pb_count * (ctx->luma_dpb_size + |
185 | ctx->chroma_dpb_size + ctx->me_buffer_size)); | 179 | ctx->chroma_dpb_size + ctx->me_buffer_size)); |
186 | ctx->bank2.size = 0; | 180 | ctx->bank2.size = 0; |
187 | break; | 181 | break; |
@@ -198,7 +192,6 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) | |||
198 | } | 192 | } |
199 | BUG_ON(ctx->bank1.dma & ((1 << MFC_BANK1_ALIGN_ORDER) - 1)); | 193 | BUG_ON(ctx->bank1.dma & ((1 << MFC_BANK1_ALIGN_ORDER) - 1)); |
200 | } | 194 | } |
201 | |||
202 | return 0; | 195 | return 0; |
203 | } | 196 | } |
204 | 197 | ||
@@ -449,8 +442,8 @@ static int s5p_mfc_set_enc_stream_buffer_v6(struct s5p_mfc_ctx *ctx, | |||
449 | WRITEL(addr, S5P_FIMV_E_STREAM_BUFFER_ADDR_V6); /* 16B align */ | 442 | WRITEL(addr, S5P_FIMV_E_STREAM_BUFFER_ADDR_V6); /* 16B align */ |
450 | WRITEL(size, S5P_FIMV_E_STREAM_BUFFER_SIZE_V6); | 443 | WRITEL(size, S5P_FIMV_E_STREAM_BUFFER_SIZE_V6); |
451 | 444 | ||
452 | mfc_debug(2, "stream buf addr: 0x%08lx, size: 0x%d", | 445 | mfc_debug(2, "stream buf addr: 0x%08lx, size: 0x%d\n", |
453 | addr, size); | 446 | addr, size); |
454 | 447 | ||
455 | return 0; | 448 | return 0; |
456 | } | 449 | } |
@@ -463,8 +456,8 @@ static void s5p_mfc_set_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx, | |||
463 | WRITEL(y_addr, S5P_FIMV_E_SOURCE_LUMA_ADDR_V6); /* 256B align */ | 456 | WRITEL(y_addr, S5P_FIMV_E_SOURCE_LUMA_ADDR_V6); /* 256B align */ |
464 | WRITEL(c_addr, S5P_FIMV_E_SOURCE_CHROMA_ADDR_V6); | 457 | WRITEL(c_addr, S5P_FIMV_E_SOURCE_CHROMA_ADDR_V6); |
465 | 458 | ||
466 | mfc_debug(2, "enc src y buf addr: 0x%08lx", y_addr); | 459 | mfc_debug(2, "enc src y buf addr: 0x%08lx\n", y_addr); |
467 | mfc_debug(2, "enc src c buf addr: 0x%08lx", c_addr); | 460 | mfc_debug(2, "enc src c buf addr: 0x%08lx\n", c_addr); |
468 | } | 461 | } |
469 | 462 | ||
470 | static void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx, | 463 | static void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx, |
@@ -479,8 +472,8 @@ static void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx, | |||
479 | enc_recon_y_addr = READL(S5P_FIMV_E_RECON_LUMA_DPB_ADDR_V6); | 472 | enc_recon_y_addr = READL(S5P_FIMV_E_RECON_LUMA_DPB_ADDR_V6); |
480 | enc_recon_c_addr = READL(S5P_FIMV_E_RECON_CHROMA_DPB_ADDR_V6); | 473 | enc_recon_c_addr = READL(S5P_FIMV_E_RECON_CHROMA_DPB_ADDR_V6); |
481 | 474 | ||
482 | mfc_debug(2, "recon y addr: 0x%08lx", enc_recon_y_addr); | 475 | mfc_debug(2, "recon y addr: 0x%08lx\n", enc_recon_y_addr); |
483 | mfc_debug(2, "recon c addr: 0x%08lx", enc_recon_c_addr); | 476 | mfc_debug(2, "recon c addr: 0x%08lx\n", enc_recon_c_addr); |
484 | } | 477 | } |
485 | 478 | ||
486 | /* Set encoding ref & codec buffer */ | 479 | /* Set encoding ref & codec buffer */ |
@@ -497,7 +490,7 @@ static int s5p_mfc_set_enc_ref_buffer_v6(struct s5p_mfc_ctx *ctx) | |||
497 | 490 | ||
498 | mfc_debug(2, "Buf1: %p (%d)\n", (void *)buf_addr1, buf_size1); | 491 | mfc_debug(2, "Buf1: %p (%d)\n", (void *)buf_addr1, buf_size1); |
499 | 492 | ||
500 | for (i = 0; i < ctx->dpb_count; i++) { | 493 | for (i = 0; i < ctx->pb_count; i++) { |
501 | WRITEL(buf_addr1, S5P_FIMV_E_LUMA_DPB_V6 + (4 * i)); | 494 | WRITEL(buf_addr1, S5P_FIMV_E_LUMA_DPB_V6 + (4 * i)); |
502 | buf_addr1 += ctx->luma_dpb_size; | 495 | buf_addr1 += ctx->luma_dpb_size; |
503 | WRITEL(buf_addr1, S5P_FIMV_E_CHROMA_DPB_V6 + (4 * i)); | 496 | WRITEL(buf_addr1, S5P_FIMV_E_CHROMA_DPB_V6 + (4 * i)); |
@@ -520,7 +513,7 @@ static int s5p_mfc_set_enc_ref_buffer_v6(struct s5p_mfc_ctx *ctx) | |||
520 | buf_size1 -= ctx->tmv_buffer_size; | 513 | buf_size1 -= ctx->tmv_buffer_size; |
521 | 514 | ||
522 | mfc_debug(2, "Buf1: %u, buf_size1: %d (ref frames %d)\n", | 515 | mfc_debug(2, "Buf1: %u, buf_size1: %d (ref frames %d)\n", |
523 | buf_addr1, buf_size1, ctx->dpb_count); | 516 | buf_addr1, buf_size1, ctx->pb_count); |
524 | if (buf_size1 < 0) { | 517 | if (buf_size1 < 0) { |
525 | mfc_debug(2, "Not enough memory has been allocated.\n"); | 518 | mfc_debug(2, "Not enough memory has been allocated.\n"); |
526 | return -ENOMEM; | 519 | return -ENOMEM; |
@@ -1431,8 +1424,8 @@ static inline int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx) | |||
1431 | src_y_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 0); | 1424 | src_y_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 0); |
1432 | src_c_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 1); | 1425 | src_c_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 1); |
1433 | 1426 | ||
1434 | mfc_debug(2, "enc src y addr: 0x%08lx", src_y_addr); | 1427 | mfc_debug(2, "enc src y addr: 0x%08lx\n", src_y_addr); |
1435 | mfc_debug(2, "enc src c addr: 0x%08lx", src_c_addr); | 1428 | mfc_debug(2, "enc src c addr: 0x%08lx\n", src_c_addr); |
1436 | 1429 | ||
1437 | s5p_mfc_set_enc_frame_buffer_v6(ctx, src_y_addr, src_c_addr); | 1430 | s5p_mfc_set_enc_frame_buffer_v6(ctx, src_y_addr, src_c_addr); |
1438 | 1431 | ||
@@ -1522,22 +1515,6 @@ static inline int s5p_mfc_run_init_enc_buffers(struct s5p_mfc_ctx *ctx) | |||
1522 | struct s5p_mfc_dev *dev = ctx->dev; | 1515 | struct s5p_mfc_dev *dev = ctx->dev; |
1523 | int ret; | 1516 | int ret; |
1524 | 1517 | ||
1525 | ret = s5p_mfc_alloc_codec_buffers_v6(ctx); | ||
1526 | if (ret) { | ||
1527 | mfc_err("Failed to allocate encoding buffers.\n"); | ||
1528 | return -ENOMEM; | ||
1529 | } | ||
1530 | |||
1531 | /* Header was generated now starting processing | ||
1532 | * First set the reference frame buffers | ||
1533 | */ | ||
1534 | if (ctx->capture_state != QUEUE_BUFS_REQUESTED) { | ||
1535 | mfc_err("It seems that destionation buffers were not\n" | ||
1536 | "requested.MFC requires that header should be generated\n" | ||
1537 | "before allocating codec buffer.\n"); | ||
1538 | return -EAGAIN; | ||
1539 | } | ||
1540 | |||
1541 | dev->curr_ctx = ctx->num; | 1518 | dev->curr_ctx = ctx->num; |
1542 | s5p_mfc_clean_ctx_int_flags(ctx); | 1519 | s5p_mfc_clean_ctx_int_flags(ctx); |
1543 | ret = s5p_mfc_set_enc_ref_buffer_v6(ctx); | 1520 | ret = s5p_mfc_set_enc_ref_buffer_v6(ctx); |
@@ -1582,7 +1559,7 @@ static void s5p_mfc_try_run_v6(struct s5p_mfc_dev *dev) | |||
1582 | mfc_debug(1, "Seting new context to %p\n", ctx); | 1559 | mfc_debug(1, "Seting new context to %p\n", ctx); |
1583 | /* Got context to run in ctx */ | 1560 | /* Got context to run in ctx */ |
1584 | mfc_debug(1, "ctx->dst_queue_cnt=%d ctx->dpb_count=%d ctx->src_queue_cnt=%d\n", | 1561 | mfc_debug(1, "ctx->dst_queue_cnt=%d ctx->dpb_count=%d ctx->src_queue_cnt=%d\n", |
1585 | ctx->dst_queue_cnt, ctx->dpb_count, ctx->src_queue_cnt); | 1562 | ctx->dst_queue_cnt, ctx->pb_count, ctx->src_queue_cnt); |
1586 | mfc_debug(1, "ctx->state=%d\n", ctx->state); | 1563 | mfc_debug(1, "ctx->state=%d\n", ctx->state); |
1587 | /* Last frame has already been sent to MFC | 1564 | /* Last frame has already been sent to MFC |
1588 | * Now obtaining frames from MFC buffer */ | 1565 | * Now obtaining frames from MFC buffer */ |
@@ -1647,7 +1624,7 @@ static void s5p_mfc_try_run_v6(struct s5p_mfc_dev *dev) | |||
1647 | case MFCINST_GOT_INST: | 1624 | case MFCINST_GOT_INST: |
1648 | s5p_mfc_run_init_enc(ctx); | 1625 | s5p_mfc_run_init_enc(ctx); |
1649 | break; | 1626 | break; |
1650 | case MFCINST_HEAD_PARSED: /* Only for MFC6.x */ | 1627 | case MFCINST_HEAD_PRODUCED: |
1651 | ret = s5p_mfc_run_init_enc_buffers(ctx); | 1628 | ret = s5p_mfc_run_init_enc_buffers(ctx); |
1652 | break; | 1629 | break; |
1653 | default: | 1630 | default: |
@@ -1730,7 +1707,7 @@ static int s5p_mfc_get_dspl_status_v6(struct s5p_mfc_dev *dev) | |||
1730 | return mfc_read(dev, S5P_FIMV_D_DISPLAY_STATUS_V6); | 1707 | return mfc_read(dev, S5P_FIMV_D_DISPLAY_STATUS_V6); |
1731 | } | 1708 | } |
1732 | 1709 | ||
1733 | static int s5p_mfc_get_decoded_status_v6(struct s5p_mfc_dev *dev) | 1710 | static int s5p_mfc_get_dec_status_v6(struct s5p_mfc_dev *dev) |
1734 | { | 1711 | { |
1735 | return mfc_read(dev, S5P_FIMV_D_DECODED_STATUS_V6); | 1712 | return mfc_read(dev, S5P_FIMV_D_DECODED_STATUS_V6); |
1736 | } | 1713 | } |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c index 6aa38a56aaf2..11d5f1dada32 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c | |||
@@ -50,19 +50,6 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev) | |||
50 | goto err_p_ip_clk; | 50 | goto err_p_ip_clk; |
51 | } | 51 | } |
52 | 52 | ||
53 | pm->clock = clk_get(&dev->plat_dev->dev, dev->variant->mclk_name); | ||
54 | if (IS_ERR(pm->clock)) { | ||
55 | mfc_err("Failed to get MFC clock\n"); | ||
56 | ret = PTR_ERR(pm->clock); | ||
57 | goto err_g_ip_clk_2; | ||
58 | } | ||
59 | |||
60 | ret = clk_prepare(pm->clock); | ||
61 | if (ret) { | ||
62 | mfc_err("Failed to prepare MFC clock\n"); | ||
63 | goto err_p_ip_clk_2; | ||
64 | } | ||
65 | |||
66 | atomic_set(&pm->power, 0); | 53 | atomic_set(&pm->power, 0); |
67 | #ifdef CONFIG_PM_RUNTIME | 54 | #ifdef CONFIG_PM_RUNTIME |
68 | pm->device = &dev->plat_dev->dev; | 55 | pm->device = &dev->plat_dev->dev; |
@@ -72,10 +59,6 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev) | |||
72 | atomic_set(&clk_ref, 0); | 59 | atomic_set(&clk_ref, 0); |
73 | #endif | 60 | #endif |
74 | return 0; | 61 | return 0; |
75 | err_p_ip_clk_2: | ||
76 | clk_put(pm->clock); | ||
77 | err_g_ip_clk_2: | ||
78 | clk_unprepare(pm->clock_gate); | ||
79 | err_p_ip_clk: | 62 | err_p_ip_clk: |
80 | clk_put(pm->clock_gate); | 63 | clk_put(pm->clock_gate); |
81 | err_g_ip_clk: | 64 | err_g_ip_clk: |
@@ -86,8 +69,6 @@ void s5p_mfc_final_pm(struct s5p_mfc_dev *dev) | |||
86 | { | 69 | { |
87 | clk_unprepare(pm->clock_gate); | 70 | clk_unprepare(pm->clock_gate); |
88 | clk_put(pm->clock_gate); | 71 | clk_put(pm->clock_gate); |
89 | clk_unprepare(pm->clock); | ||
90 | clk_put(pm->clock); | ||
91 | #ifdef CONFIG_PM_RUNTIME | 72 | #ifdef CONFIG_PM_RUNTIME |
92 | pm_runtime_disable(pm->device); | 73 | pm_runtime_disable(pm->device); |
93 | #endif | 74 | #endif |
@@ -98,7 +79,7 @@ int s5p_mfc_clock_on(void) | |||
98 | int ret; | 79 | int ret; |
99 | #ifdef CLK_DEBUG | 80 | #ifdef CLK_DEBUG |
100 | atomic_inc(&clk_ref); | 81 | atomic_inc(&clk_ref); |
101 | mfc_debug(3, "+ %d", atomic_read(&clk_ref)); | 82 | mfc_debug(3, "+ %d\n", atomic_read(&clk_ref)); |
102 | #endif | 83 | #endif |
103 | ret = clk_enable(pm->clock_gate); | 84 | ret = clk_enable(pm->clock_gate); |
104 | return ret; | 85 | return ret; |
@@ -108,7 +89,7 @@ void s5p_mfc_clock_off(void) | |||
108 | { | 89 | { |
109 | #ifdef CLK_DEBUG | 90 | #ifdef CLK_DEBUG |
110 | atomic_dec(&clk_ref); | 91 | atomic_dec(&clk_ref); |
111 | mfc_debug(3, "- %d", atomic_read(&clk_ref)); | 92 | mfc_debug(3, "- %d\n", atomic_read(&clk_ref)); |
112 | #endif | 93 | #endif |
113 | clk_disable(pm->clock_gate); | 94 | clk_disable(pm->clock_gate); |
114 | } | 95 | } |
diff --git a/drivers/media/platform/sh_veu.c b/drivers/media/platform/sh_veu.c index 0b32cc3f6a47..59a9deefb242 100644 --- a/drivers/media/platform/sh_veu.c +++ b/drivers/media/platform/sh_veu.c | |||
@@ -905,11 +905,11 @@ static int sh_veu_queue_setup(struct vb2_queue *vq, | |||
905 | if (ftmp.fmt.pix.width != pix->width || | 905 | if (ftmp.fmt.pix.width != pix->width || |
906 | ftmp.fmt.pix.height != pix->height) | 906 | ftmp.fmt.pix.height != pix->height) |
907 | return -EINVAL; | 907 | return -EINVAL; |
908 | size = pix->bytesperline ? pix->bytesperline * pix->height : | 908 | size = pix->bytesperline ? pix->bytesperline * pix->height * fmt->depth / fmt->ydepth : |
909 | pix->width * pix->height * fmt->depth >> 3; | 909 | pix->width * pix->height * fmt->depth / fmt->ydepth; |
910 | } else { | 910 | } else { |
911 | vfmt = sh_veu_get_vfmt(veu, vq->type); | 911 | vfmt = sh_veu_get_vfmt(veu, vq->type); |
912 | size = vfmt->bytesperline * vfmt->frame.height; | 912 | size = vfmt->bytesperline * vfmt->frame.height * vfmt->fmt->depth / vfmt->fmt->ydepth; |
913 | } | 913 | } |
914 | 914 | ||
915 | if (count < 2) | 915 | if (count < 2) |
@@ -1033,8 +1033,6 @@ static int sh_veu_release(struct file *file) | |||
1033 | 1033 | ||
1034 | dev_dbg(veu->dev, "Releasing instance %p\n", veu_file); | 1034 | dev_dbg(veu->dev, "Releasing instance %p\n", veu_file); |
1035 | 1035 | ||
1036 | pm_runtime_put(veu->dev); | ||
1037 | |||
1038 | if (veu_file == veu->capture) { | 1036 | if (veu_file == veu->capture) { |
1039 | veu->capture = NULL; | 1037 | veu->capture = NULL; |
1040 | vb2_queue_release(v4l2_m2m_get_vq(veu->m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE)); | 1038 | vb2_queue_release(v4l2_m2m_get_vq(veu->m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE)); |
@@ -1050,6 +1048,8 @@ static int sh_veu_release(struct file *file) | |||
1050 | veu->m2m_ctx = NULL; | 1048 | veu->m2m_ctx = NULL; |
1051 | } | 1049 | } |
1052 | 1050 | ||
1051 | pm_runtime_put(veu->dev); | ||
1052 | |||
1053 | kfree(veu_file); | 1053 | kfree(veu_file); |
1054 | 1054 | ||
1055 | return 0; | 1055 | return 0; |
@@ -1138,10 +1138,7 @@ static irqreturn_t sh_veu_isr(int irq, void *dev_id) | |||
1138 | 1138 | ||
1139 | veu->xaction++; | 1139 | veu->xaction++; |
1140 | 1140 | ||
1141 | if (!veu->aborting) | 1141 | return IRQ_WAKE_THREAD; |
1142 | return IRQ_WAKE_THREAD; | ||
1143 | |||
1144 | return IRQ_HANDLED; | ||
1145 | } | 1142 | } |
1146 | 1143 | ||
1147 | static int sh_veu_probe(struct platform_device *pdev) | 1144 | static int sh_veu_probe(struct platform_device *pdev) |
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index eea832c5fd01..3a4efbdc7668 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c | |||
@@ -643,9 +643,9 @@ static int soc_camera_close(struct file *file) | |||
643 | 643 | ||
644 | if (ici->ops->init_videobuf2) | 644 | if (ici->ops->init_videobuf2) |
645 | vb2_queue_release(&icd->vb2_vidq); | 645 | vb2_queue_release(&icd->vb2_vidq); |
646 | ici->ops->remove(icd); | ||
647 | |||
648 | __soc_camera_power_off(icd); | 646 | __soc_camera_power_off(icd); |
647 | |||
648 | ici->ops->remove(icd); | ||
649 | } | 649 | } |
650 | 650 | ||
651 | if (icd->streamer == file) | 651 | if (icd->streamer == file) |
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig index c0beee2fa37c..d529ba788f41 100644 --- a/drivers/media/radio/Kconfig +++ b/drivers/media/radio/Kconfig | |||
@@ -22,6 +22,7 @@ config RADIO_SI476X | |||
22 | tristate "Silicon Laboratories Si476x I2C FM Radio" | 22 | tristate "Silicon Laboratories Si476x I2C FM Radio" |
23 | depends on I2C && VIDEO_V4L2 | 23 | depends on I2C && VIDEO_V4L2 |
24 | depends on MFD_SI476X_CORE | 24 | depends on MFD_SI476X_CORE |
25 | depends on SND_SOC | ||
25 | select SND_SOC_SI476X | 26 | select SND_SOC_SI476X |
26 | ---help--- | 27 | ---help--- |
27 | Choose Y here if you have this FM radio chip. | 28 | Choose Y here if you have this FM radio chip. |
diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c index 9430c6a29937..9dc8bafe6486 100644 --- a/drivers/media/radio/radio-si476x.c +++ b/drivers/media/radio/radio-si476x.c | |||
@@ -44,7 +44,7 @@ | |||
44 | 44 | ||
45 | #define FREQ_MUL (10000000 / 625) | 45 | #define FREQ_MUL (10000000 / 625) |
46 | 46 | ||
47 | #define SI476X_PHDIV_STATUS_LINK_LOCKED(status) (0b10000000 & (status)) | 47 | #define SI476X_PHDIV_STATUS_LINK_LOCKED(status) (0x80 & (status)) |
48 | 48 | ||
49 | #define DRIVER_NAME "si476x-radio" | 49 | #define DRIVER_NAME "si476x-radio" |
50 | #define DRIVER_CARD "SI476x AM/FM Receiver" | 50 | #define DRIVER_CARD "SI476x AM/FM Receiver" |
diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig index f6768cad001a..15665debc572 100644 --- a/drivers/media/tuners/Kconfig +++ b/drivers/media/tuners/Kconfig | |||
@@ -1,23 +1,3 @@ | |||
1 | config MEDIA_ATTACH | ||
2 | bool "Load and attach frontend and tuner driver modules as needed" | ||
3 | depends on MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT || MEDIA_RADIO_SUPPORT | ||
4 | depends on MODULES | ||
5 | default y if !EXPERT | ||
6 | help | ||
7 | Remove the static dependency of DVB card drivers on all | ||
8 | frontend modules for all possible card variants. Instead, | ||
9 | allow the card drivers to only load the frontend modules | ||
10 | they require. | ||
11 | |||
12 | Also, tuner module will automatically load a tuner driver | ||
13 | when needed, for analog mode. | ||
14 | |||
15 | This saves several KBytes of memory. | ||
16 | |||
17 | Note: You will need module-init-tools v3.2 or later for this feature. | ||
18 | |||
19 | If unsure say Y. | ||
20 | |||
21 | # Analog TV tuners, auto-loaded via tuner.ko | 1 | # Analog TV tuners, auto-loaded via tuner.ko |
22 | config MEDIA_TUNER | 2 | config MEDIA_TUNER |
23 | tristate | 3 | tristate |
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c index 22015fe1a0f3..2cc8ec70e3b6 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c | |||
@@ -376,7 +376,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d) | |||
376 | struct rtl28xxu_req req_mxl5007t = {0xd9c0, CMD_I2C_RD, 1, buf}; | 376 | struct rtl28xxu_req req_mxl5007t = {0xd9c0, CMD_I2C_RD, 1, buf}; |
377 | struct rtl28xxu_req req_e4000 = {0x02c8, CMD_I2C_RD, 1, buf}; | 377 | struct rtl28xxu_req req_e4000 = {0x02c8, CMD_I2C_RD, 1, buf}; |
378 | struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf}; | 378 | struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf}; |
379 | struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 5, buf}; | 379 | struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 1, buf}; |
380 | 380 | ||
381 | dev_dbg(&d->udev->dev, "%s:\n", __func__); | 381 | dev_dbg(&d->udev->dev, "%s:\n", __func__); |
382 | 382 | ||
@@ -481,9 +481,9 @@ static int rtl2832u_read_config(struct dvb_usb_device *d) | |||
481 | goto found; | 481 | goto found; |
482 | } | 482 | } |
483 | 483 | ||
484 | /* check R820T by reading tuner stats at I2C addr 0x1a */ | 484 | /* check R820T ID register; reg=00 val=69 */ |
485 | ret = rtl28xxu_ctrl_msg(d, &req_r820t); | 485 | ret = rtl28xxu_ctrl_msg(d, &req_r820t); |
486 | if (ret == 0) { | 486 | if (ret == 0 && buf[0] == 0x69) { |
487 | priv->tuner = TUNER_RTL2832_R820T; | 487 | priv->tuner = TUNER_RTL2832_R820T; |
488 | priv->tuner_name = "R820T"; | 488 | priv->tuner_name = "R820T"; |
489 | goto found; | 489 | goto found; |
diff --git a/drivers/media/usb/gspca/sonixb.c b/drivers/media/usb/gspca/sonixb.c index 3fe207e038c7..d7ff3b9687c5 100644 --- a/drivers/media/usb/gspca/sonixb.c +++ b/drivers/media/usb/gspca/sonixb.c | |||
@@ -1159,6 +1159,13 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
1159 | regs[0x01] = 0x44; /* Select 24 Mhz clock */ | 1159 | regs[0x01] = 0x44; /* Select 24 Mhz clock */ |
1160 | regs[0x12] = 0x02; /* Set hstart to 2 */ | 1160 | regs[0x12] = 0x02; /* Set hstart to 2 */ |
1161 | } | 1161 | } |
1162 | break; | ||
1163 | case SENSOR_PAS202: | ||
1164 | /* For some unknown reason we need to increase hstart by 1 on | ||
1165 | the sn9c103, otherwise we get wrong colors (bayer shift). */ | ||
1166 | if (sd->bridge == BRIDGE_103) | ||
1167 | regs[0x12] += 1; | ||
1168 | break; | ||
1162 | } | 1169 | } |
1163 | /* Disable compression when the raw bayer format has been selected */ | 1170 | /* Disable compression when the raw bayer format has been selected */ |
1164 | if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_RAW) | 1171 | if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_RAW) |
diff --git a/drivers/media/usb/pwc/pwc.h b/drivers/media/usb/pwc/pwc.h index 7a6a0d39c2c6..81b017a554bc 100644 --- a/drivers/media/usb/pwc/pwc.h +++ b/drivers/media/usb/pwc/pwc.h | |||
@@ -226,7 +226,7 @@ struct pwc_device | |||
226 | struct list_head queued_bufs; | 226 | struct list_head queued_bufs; |
227 | spinlock_t queued_bufs_lock; /* Protects queued_bufs */ | 227 | spinlock_t queued_bufs_lock; /* Protects queued_bufs */ |
228 | 228 | ||
229 | /* Note if taking both locks v4l2_lock must always be locked first! */ | 229 | /* If taking both locks vb_queue_lock must always be locked first! */ |
230 | struct mutex v4l2_lock; /* Protects everything else */ | 230 | struct mutex v4l2_lock; /* Protects everything else */ |
231 | struct mutex vb_queue_lock; /* Protects vb_queue and capt_file */ | 231 | struct mutex vb_queue_lock; /* Protects vb_queue and capt_file */ |
232 | 232 | ||
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index ebb8e48619a2..fccd08b66d1a 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c | |||
@@ -1835,6 +1835,8 @@ bool v4l2_ctrl_radio_filter(const struct v4l2_ctrl *ctrl) | |||
1835 | { | 1835 | { |
1836 | if (V4L2_CTRL_ID2CLASS(ctrl->id) == V4L2_CTRL_CLASS_FM_TX) | 1836 | if (V4L2_CTRL_ID2CLASS(ctrl->id) == V4L2_CTRL_CLASS_FM_TX) |
1837 | return true; | 1837 | return true; |
1838 | if (V4L2_CTRL_ID2CLASS(ctrl->id) == V4L2_CTRL_CLASS_FM_RX) | ||
1839 | return true; | ||
1838 | switch (ctrl->id) { | 1840 | switch (ctrl->id) { |
1839 | case V4L2_CID_AUDIO_MUTE: | 1841 | case V4L2_CID_AUDIO_MUTE: |
1840 | case V4L2_CID_AUDIO_VOLUME: | 1842 | case V4L2_CID_AUDIO_VOLUME: |
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index f81bda1a48ec..7658586fe5f4 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c | |||
@@ -243,7 +243,6 @@ static void v4l_print_format(const void *arg, bool write_only) | |||
243 | const struct v4l2_vbi_format *vbi; | 243 | const struct v4l2_vbi_format *vbi; |
244 | const struct v4l2_sliced_vbi_format *sliced; | 244 | const struct v4l2_sliced_vbi_format *sliced; |
245 | const struct v4l2_window *win; | 245 | const struct v4l2_window *win; |
246 | const struct v4l2_clip *clip; | ||
247 | unsigned i; | 246 | unsigned i; |
248 | 247 | ||
249 | pr_cont("type=%s", prt_names(p->type, v4l2_type_names)); | 248 | pr_cont("type=%s", prt_names(p->type, v4l2_type_names)); |
@@ -253,7 +252,7 @@ static void v4l_print_format(const void *arg, bool write_only) | |||
253 | pix = &p->fmt.pix; | 252 | pix = &p->fmt.pix; |
254 | pr_cont(", width=%u, height=%u, " | 253 | pr_cont(", width=%u, height=%u, " |
255 | "pixelformat=%c%c%c%c, field=%s, " | 254 | "pixelformat=%c%c%c%c, field=%s, " |
256 | "bytesperline=%u sizeimage=%u, colorspace=%d\n", | 255 | "bytesperline=%u, sizeimage=%u, colorspace=%d\n", |
257 | pix->width, pix->height, | 256 | pix->width, pix->height, |
258 | (pix->pixelformat & 0xff), | 257 | (pix->pixelformat & 0xff), |
259 | (pix->pixelformat >> 8) & 0xff, | 258 | (pix->pixelformat >> 8) & 0xff, |
@@ -284,20 +283,14 @@ static void v4l_print_format(const void *arg, bool write_only) | |||
284 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: | 283 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: |
285 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: | 284 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: |
286 | win = &p->fmt.win; | 285 | win = &p->fmt.win; |
287 | pr_cont(", wxh=%dx%d, x,y=%d,%d, field=%s, " | 286 | /* Note: we can't print the clip list here since the clips |
288 | "chromakey=0x%08x, bitmap=%p, " | 287 | * pointer is a userspace pointer, not a kernelspace |
289 | "global_alpha=0x%02x\n", | 288 | * pointer. */ |
290 | win->w.width, win->w.height, | 289 | pr_cont(", wxh=%dx%d, x,y=%d,%d, field=%s, chromakey=0x%08x, clipcount=%u, clips=%p, bitmap=%p, global_alpha=0x%02x\n", |
291 | win->w.left, win->w.top, | 290 | win->w.width, win->w.height, win->w.left, win->w.top, |
292 | prt_names(win->field, v4l2_field_names), | 291 | prt_names(win->field, v4l2_field_names), |
293 | win->chromakey, win->bitmap, win->global_alpha); | 292 | win->chromakey, win->clipcount, win->clips, |
294 | clip = win->clips; | 293 | win->bitmap, win->global_alpha); |
295 | for (i = 0; i < win->clipcount; i++) { | ||
296 | printk(KERN_DEBUG "clip %u: wxh=%dx%d, x,y=%d,%d\n", | ||
297 | i, clip->c.width, clip->c.height, | ||
298 | clip->c.left, clip->c.top); | ||
299 | clip = clip->next; | ||
300 | } | ||
301 | break; | 294 | break; |
302 | case V4L2_BUF_TYPE_VBI_CAPTURE: | 295 | case V4L2_BUF_TYPE_VBI_CAPTURE: |
303 | case V4L2_BUF_TYPE_VBI_OUTPUT: | 296 | case V4L2_BUF_TYPE_VBI_OUTPUT: |
@@ -332,7 +325,7 @@ static void v4l_print_framebuffer(const void *arg, bool write_only) | |||
332 | 325 | ||
333 | pr_cont("capability=0x%x, flags=0x%x, base=0x%p, width=%u, " | 326 | pr_cont("capability=0x%x, flags=0x%x, base=0x%p, width=%u, " |
334 | "height=%u, pixelformat=%c%c%c%c, " | 327 | "height=%u, pixelformat=%c%c%c%c, " |
335 | "bytesperline=%u sizeimage=%u, colorspace=%d\n", | 328 | "bytesperline=%u, sizeimage=%u, colorspace=%d\n", |
336 | p->capability, p->flags, p->base, | 329 | p->capability, p->flags, p->base, |
337 | p->fmt.width, p->fmt.height, | 330 | p->fmt.width, p->fmt.height, |
338 | (p->fmt.pixelformat & 0xff), | 331 | (p->fmt.pixelformat & 0xff), |
@@ -353,7 +346,7 @@ static void v4l_print_modulator(const void *arg, bool write_only) | |||
353 | const struct v4l2_modulator *p = arg; | 346 | const struct v4l2_modulator *p = arg; |
354 | 347 | ||
355 | if (write_only) | 348 | if (write_only) |
356 | pr_cont("index=%u, txsubchans=0x%x", p->index, p->txsubchans); | 349 | pr_cont("index=%u, txsubchans=0x%x\n", p->index, p->txsubchans); |
357 | else | 350 | else |
358 | pr_cont("index=%u, name=%.*s, capability=0x%x, " | 351 | pr_cont("index=%u, name=%.*s, capability=0x%x, " |
359 | "rangelow=%u, rangehigh=%u, txsubchans=0x%x\n", | 352 | "rangelow=%u, rangehigh=%u, txsubchans=0x%x\n", |
@@ -445,13 +438,13 @@ static void v4l_print_buffer(const void *arg, bool write_only) | |||
445 | for (i = 0; i < p->length; ++i) { | 438 | for (i = 0; i < p->length; ++i) { |
446 | plane = &p->m.planes[i]; | 439 | plane = &p->m.planes[i]; |
447 | printk(KERN_DEBUG | 440 | printk(KERN_DEBUG |
448 | "plane %d: bytesused=%d, data_offset=0x%08x " | 441 | "plane %d: bytesused=%d, data_offset=0x%08x, " |
449 | "offset/userptr=0x%lx, length=%d\n", | 442 | "offset/userptr=0x%lx, length=%d\n", |
450 | i, plane->bytesused, plane->data_offset, | 443 | i, plane->bytesused, plane->data_offset, |
451 | plane->m.userptr, plane->length); | 444 | plane->m.userptr, plane->length); |
452 | } | 445 | } |
453 | } else { | 446 | } else { |
454 | pr_cont("bytesused=%d, offset/userptr=0x%lx, length=%d\n", | 447 | pr_cont(", bytesused=%d, offset/userptr=0x%lx, length=%d\n", |
455 | p->bytesused, p->m.userptr, p->length); | 448 | p->bytesused, p->m.userptr, p->length); |
456 | } | 449 | } |
457 | 450 | ||
@@ -504,6 +497,8 @@ static void v4l_print_streamparm(const void *arg, bool write_only) | |||
504 | c->capability, c->outputmode, | 497 | c->capability, c->outputmode, |
505 | c->timeperframe.numerator, c->timeperframe.denominator, | 498 | c->timeperframe.numerator, c->timeperframe.denominator, |
506 | c->extendedmode, c->writebuffers); | 499 | c->extendedmode, c->writebuffers); |
500 | } else { | ||
501 | pr_cont("\n"); | ||
507 | } | 502 | } |
508 | } | 503 | } |
509 | 504 | ||
@@ -734,11 +729,11 @@ static void v4l_print_frmsizeenum(const void *arg, bool write_only) | |||
734 | p->type); | 729 | p->type); |
735 | switch (p->type) { | 730 | switch (p->type) { |
736 | case V4L2_FRMSIZE_TYPE_DISCRETE: | 731 | case V4L2_FRMSIZE_TYPE_DISCRETE: |
737 | pr_cont(" wxh=%ux%u\n", | 732 | pr_cont(", wxh=%ux%u\n", |
738 | p->discrete.width, p->discrete.height); | 733 | p->discrete.width, p->discrete.height); |
739 | break; | 734 | break; |
740 | case V4L2_FRMSIZE_TYPE_STEPWISE: | 735 | case V4L2_FRMSIZE_TYPE_STEPWISE: |
741 | pr_cont(" min=%ux%u, max=%ux%u, step=%ux%u\n", | 736 | pr_cont(", min=%ux%u, max=%ux%u, step=%ux%u\n", |
742 | p->stepwise.min_width, p->stepwise.min_height, | 737 | p->stepwise.min_width, p->stepwise.min_height, |
743 | p->stepwise.step_width, p->stepwise.step_height, | 738 | p->stepwise.step_width, p->stepwise.step_height, |
744 | p->stepwise.max_width, p->stepwise.max_height); | 739 | p->stepwise.max_width, p->stepwise.max_height); |
@@ -764,12 +759,12 @@ static void v4l_print_frmivalenum(const void *arg, bool write_only) | |||
764 | p->width, p->height, p->type); | 759 | p->width, p->height, p->type); |
765 | switch (p->type) { | 760 | switch (p->type) { |
766 | case V4L2_FRMIVAL_TYPE_DISCRETE: | 761 | case V4L2_FRMIVAL_TYPE_DISCRETE: |
767 | pr_cont(" fps=%d/%d\n", | 762 | pr_cont(", fps=%d/%d\n", |
768 | p->discrete.numerator, | 763 | p->discrete.numerator, |
769 | p->discrete.denominator); | 764 | p->discrete.denominator); |
770 | break; | 765 | break; |
771 | case V4L2_FRMIVAL_TYPE_STEPWISE: | 766 | case V4L2_FRMIVAL_TYPE_STEPWISE: |
772 | pr_cont(" min=%d/%d, max=%d/%d, step=%d/%d\n", | 767 | pr_cont(", min=%d/%d, max=%d/%d, step=%d/%d\n", |
773 | p->stepwise.min.numerator, | 768 | p->stepwise.min.numerator, |
774 | p->stepwise.min.denominator, | 769 | p->stepwise.min.denominator, |
775 | p->stepwise.max.numerator, | 770 | p->stepwise.max.numerator, |
@@ -807,8 +802,8 @@ static void v4l_print_event(const void *arg, bool write_only) | |||
807 | pr_cont("value64=%lld, ", c->value64); | 802 | pr_cont("value64=%lld, ", c->value64); |
808 | else | 803 | else |
809 | pr_cont("value=%d, ", c->value); | 804 | pr_cont("value=%d, ", c->value); |
810 | pr_cont("flags=0x%x, minimum=%d, maximum=%d, step=%d," | 805 | pr_cont("flags=0x%x, minimum=%d, maximum=%d, step=%d, " |
811 | " default_value=%d\n", | 806 | "default_value=%d\n", |
812 | c->flags, c->minimum, c->maximum, | 807 | c->flags, c->minimum, c->maximum, |
813 | c->step, c->default_value); | 808 | c->step, c->default_value); |
814 | break; | 809 | break; |
@@ -845,7 +840,7 @@ static void v4l_print_freq_band(const void *arg, bool write_only) | |||
845 | const struct v4l2_frequency_band *p = arg; | 840 | const struct v4l2_frequency_band *p = arg; |
846 | 841 | ||
847 | pr_cont("tuner=%u, type=%u, index=%u, capability=0x%x, " | 842 | pr_cont("tuner=%u, type=%u, index=%u, capability=0x%x, " |
848 | "rangelow=%u, rangehigh=%u, modulation=0x%x\n", | 843 | "rangelow=%u, rangehigh=%u, modulation=0x%x\n", |
849 | p->tuner, p->type, p->index, | 844 | p->tuner, p->type, p->index, |
850 | p->capability, p->rangelow, | 845 | p->capability, p->rangelow, |
851 | p->rangehigh, p->modulation); | 846 | p->rangehigh, p->modulation); |
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c index 66f599fcb829..e96497f7c3ed 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c | |||
@@ -205,7 +205,7 @@ static void v4l2_m2m_try_run(struct v4l2_m2m_dev *m2m_dev) | |||
205 | static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx) | 205 | static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx) |
206 | { | 206 | { |
207 | struct v4l2_m2m_dev *m2m_dev; | 207 | struct v4l2_m2m_dev *m2m_dev; |
208 | unsigned long flags_job, flags; | 208 | unsigned long flags_job, flags_out, flags_cap; |
209 | 209 | ||
210 | m2m_dev = m2m_ctx->m2m_dev; | 210 | m2m_dev = m2m_ctx->m2m_dev; |
211 | dprintk("Trying to schedule a job for m2m_ctx: %p\n", m2m_ctx); | 211 | dprintk("Trying to schedule a job for m2m_ctx: %p\n", m2m_ctx); |
@@ -223,23 +223,26 @@ static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx) | |||
223 | return; | 223 | return; |
224 | } | 224 | } |
225 | 225 | ||
226 | spin_lock_irqsave(&m2m_ctx->out_q_ctx.rdy_spinlock, flags); | 226 | spin_lock_irqsave(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out); |
227 | if (list_empty(&m2m_ctx->out_q_ctx.rdy_queue)) { | 227 | if (list_empty(&m2m_ctx->out_q_ctx.rdy_queue)) { |
228 | spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags); | 228 | spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, |
229 | flags_out); | ||
229 | spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job); | 230 | spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job); |
230 | dprintk("No input buffers available\n"); | 231 | dprintk("No input buffers available\n"); |
231 | return; | 232 | return; |
232 | } | 233 | } |
233 | spin_lock_irqsave(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags); | 234 | spin_lock_irqsave(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap); |
234 | if (list_empty(&m2m_ctx->cap_q_ctx.rdy_queue)) { | 235 | if (list_empty(&m2m_ctx->cap_q_ctx.rdy_queue)) { |
235 | spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags); | 236 | spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, |
236 | spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags); | 237 | flags_cap); |
238 | spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, | ||
239 | flags_out); | ||
237 | spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job); | 240 | spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job); |
238 | dprintk("No output buffers available\n"); | 241 | dprintk("No output buffers available\n"); |
239 | return; | 242 | return; |
240 | } | 243 | } |
241 | spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags); | 244 | spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap); |
242 | spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags); | 245 | spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out); |
243 | 246 | ||
244 | if (m2m_dev->m2m_ops->job_ready | 247 | if (m2m_dev->m2m_ops->job_ready |
245 | && (!m2m_dev->m2m_ops->job_ready(m2m_ctx->priv))) { | 248 | && (!m2m_dev->m2m_ops->job_ready(m2m_ctx->priv))) { |
@@ -372,6 +375,20 @@ int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | |||
372 | EXPORT_SYMBOL_GPL(v4l2_m2m_dqbuf); | 375 | EXPORT_SYMBOL_GPL(v4l2_m2m_dqbuf); |
373 | 376 | ||
374 | /** | 377 | /** |
378 | * v4l2_m2m_create_bufs() - create a source or destination buffer, depending | ||
379 | * on the type | ||
380 | */ | ||
381 | int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | ||
382 | struct v4l2_create_buffers *create) | ||
383 | { | ||
384 | struct vb2_queue *vq; | ||
385 | |||
386 | vq = v4l2_m2m_get_vq(m2m_ctx, create->format.type); | ||
387 | return vb2_create_bufs(vq, create); | ||
388 | } | ||
389 | EXPORT_SYMBOL_GPL(v4l2_m2m_create_bufs); | ||
390 | |||
391 | /** | ||
375 | * v4l2_m2m_expbuf() - export a source or destination buffer, depending on | 392 | * v4l2_m2m_expbuf() - export a source or destination buffer, depending on |
376 | * the type | 393 | * the type |
377 | */ | 394 | */ |
@@ -486,8 +503,10 @@ unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | |||
486 | if (m2m_ctx->m2m_dev->m2m_ops->unlock) | 503 | if (m2m_ctx->m2m_dev->m2m_ops->unlock) |
487 | m2m_ctx->m2m_dev->m2m_ops->unlock(m2m_ctx->priv); | 504 | m2m_ctx->m2m_dev->m2m_ops->unlock(m2m_ctx->priv); |
488 | 505 | ||
489 | poll_wait(file, &src_q->done_wq, wait); | 506 | if (list_empty(&src_q->done_list)) |
490 | poll_wait(file, &dst_q->done_wq, wait); | 507 | poll_wait(file, &src_q->done_wq, wait); |
508 | if (list_empty(&dst_q->done_list)) | ||
509 | poll_wait(file, &dst_q->done_wq, wait); | ||
491 | 510 | ||
492 | if (m2m_ctx->m2m_dev->m2m_ops->lock) | 511 | if (m2m_ctx->m2m_dev->m2m_ops->lock) |
493 | m2m_ctx->m2m_dev->m2m_ops->lock(m2m_ctx->priv); | 512 | m2m_ctx->m2m_dev->m2m_ops->lock(m2m_ctx->priv); |
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 7d833eefaf4e..e3bdc3be91e1 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c | |||
@@ -2014,7 +2014,8 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) | |||
2014 | if (list_empty(&q->queued_list)) | 2014 | if (list_empty(&q->queued_list)) |
2015 | return res | POLLERR; | 2015 | return res | POLLERR; |
2016 | 2016 | ||
2017 | poll_wait(file, &q->done_wq, wait); | 2017 | if (list_empty(&q->done_list)) |
2018 | poll_wait(file, &q->done_wq, wait); | ||
2018 | 2019 | ||
2019 | /* | 2020 | /* |
2020 | * Take first buffer available for dequeuing. | 2021 | * Take first buffer available for dequeuing. |
diff --git a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c index 6e8bc9d88c41..94d957d203a6 100644 --- a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c +++ b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c | |||
@@ -244,7 +244,7 @@ bnad_debugfs_lseek(struct file *file, loff_t offset, int orig) | |||
244 | file->f_pos += offset; | 244 | file->f_pos += offset; |
245 | break; | 245 | break; |
246 | case 2: | 246 | case 2: |
247 | file->f_pos = debug->buffer_len - offset; | 247 | file->f_pos = debug->buffer_len + offset; |
248 | break; | 248 | break; |
249 | default: | 249 | default: |
250 | return -EINVAL; | 250 | return -EINVAL; |
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index 9544cdc0d1af..e79e006eb9ab 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c | |||
@@ -811,6 +811,70 @@ int iosapic_fixup_irq(void *isi_obj, struct pci_dev *pcidev) | |||
811 | return pcidev->irq; | 811 | return pcidev->irq; |
812 | } | 812 | } |
813 | 813 | ||
814 | static struct iosapic_info *first_isi = NULL; | ||
815 | |||
816 | #ifdef CONFIG_64BIT | ||
817 | int iosapic_serial_irq(int num) | ||
818 | { | ||
819 | struct iosapic_info *isi = first_isi; | ||
820 | struct irt_entry *irte = NULL; /* only used if PAT PDC */ | ||
821 | struct vector_info *vi; | ||
822 | int isi_line; /* line used by device */ | ||
823 | |||
824 | /* lookup IRT entry for isi/slot/pin set */ | ||
825 | irte = &irt_cell[num]; | ||
826 | |||
827 | DBG_IRT("iosapic_serial_irq(): irte %p %x %x %x %x %x %x %x %x\n", | ||
828 | irte, | ||
829 | irte->entry_type, | ||
830 | irte->entry_length, | ||
831 | irte->polarity_trigger, | ||
832 | irte->src_bus_irq_devno, | ||
833 | irte->src_bus_id, | ||
834 | irte->src_seg_id, | ||
835 | irte->dest_iosapic_intin, | ||
836 | (u32) irte->dest_iosapic_addr); | ||
837 | isi_line = irte->dest_iosapic_intin; | ||
838 | |||
839 | /* get vector info for this input line */ | ||
840 | vi = isi->isi_vector + isi_line; | ||
841 | DBG_IRT("iosapic_serial_irq: line %d vi 0x%p\n", isi_line, vi); | ||
842 | |||
843 | /* If this IRQ line has already been setup, skip it */ | ||
844 | if (vi->irte) | ||
845 | goto out; | ||
846 | |||
847 | vi->irte = irte; | ||
848 | |||
849 | /* | ||
850 | * Allocate processor IRQ | ||
851 | * | ||
852 | * XXX/FIXME The txn_alloc_irq() code and related code should be | ||
853 | * moved to enable_irq(). That way we only allocate processor IRQ | ||
854 | * bits for devices that actually have drivers claiming them. | ||
855 | * Right now we assign an IRQ to every PCI device present, | ||
856 | * regardless of whether it's used or not. | ||
857 | */ | ||
858 | vi->txn_irq = txn_alloc_irq(8); | ||
859 | |||
860 | if (vi->txn_irq < 0) | ||
861 | panic("I/O sapic: couldn't get TXN IRQ\n"); | ||
862 | |||
863 | /* enable_irq() will use txn_* to program IRdT */ | ||
864 | vi->txn_addr = txn_alloc_addr(vi->txn_irq); | ||
865 | vi->txn_data = txn_alloc_data(vi->txn_irq); | ||
866 | |||
867 | vi->eoi_addr = isi->addr + IOSAPIC_REG_EOI; | ||
868 | vi->eoi_data = cpu_to_le32(vi->txn_data); | ||
869 | |||
870 | cpu_claim_irq(vi->txn_irq, &iosapic_interrupt_type, vi); | ||
871 | |||
872 | out: | ||
873 | |||
874 | return vi->txn_irq; | ||
875 | } | ||
876 | #endif | ||
877 | |||
814 | 878 | ||
815 | /* | 879 | /* |
816 | ** squirrel away the I/O Sapic Version | 880 | ** squirrel away the I/O Sapic Version |
@@ -877,6 +941,8 @@ void *iosapic_register(unsigned long hpa) | |||
877 | vip->irqline = (unsigned char) cnt; | 941 | vip->irqline = (unsigned char) cnt; |
878 | vip->iosapic = isi; | 942 | vip->iosapic = isi; |
879 | } | 943 | } |
944 | if (!first_isi) | ||
945 | first_isi = isi; | ||
880 | return isi; | 946 | return isi; |
881 | } | 947 | } |
882 | 948 | ||
diff --git a/drivers/scsi/bfa/bfad_debugfs.c b/drivers/scsi/bfa/bfad_debugfs.c index 439c012be763..b63d534192e3 100644 --- a/drivers/scsi/bfa/bfad_debugfs.c +++ b/drivers/scsi/bfa/bfad_debugfs.c | |||
@@ -186,7 +186,7 @@ bfad_debugfs_lseek(struct file *file, loff_t offset, int orig) | |||
186 | file->f_pos += offset; | 186 | file->f_pos += offset; |
187 | break; | 187 | break; |
188 | case 2: | 188 | case 2: |
189 | file->f_pos = debug->buffer_len - offset; | 189 | file->f_pos = debug->buffer_len + offset; |
190 | break; | 190 | break; |
191 | default: | 191 | default: |
192 | return -EINVAL; | 192 | return -EINVAL; |
diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c index adc1f7f471f5..85e1ffd0e5c5 100644 --- a/drivers/scsi/fnic/fnic_debugfs.c +++ b/drivers/scsi/fnic/fnic_debugfs.c | |||
@@ -174,7 +174,7 @@ static loff_t fnic_trace_debugfs_lseek(struct file *file, | |||
174 | pos = file->f_pos + offset; | 174 | pos = file->f_pos + offset; |
175 | break; | 175 | break; |
176 | case 2: | 176 | case 2: |
177 | pos = fnic_dbg_prt->buffer_len - offset; | 177 | pos = fnic_dbg_prt->buffer_len + offset; |
178 | } | 178 | } |
179 | return (pos < 0 || pos > fnic_dbg_prt->buffer_len) ? | 179 | return (pos < 0 || pos > fnic_dbg_prt->buffer_len) ? |
180 | -EINVAL : (file->f_pos = pos); | 180 | -EINVAL : (file->f_pos = pos); |
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index f63f5ff7f274..f525ecb7a9c6 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c | |||
@@ -1178,7 +1178,7 @@ lpfc_debugfs_lseek(struct file *file, loff_t off, int whence) | |||
1178 | pos = file->f_pos + off; | 1178 | pos = file->f_pos + off; |
1179 | break; | 1179 | break; |
1180 | case 2: | 1180 | case 2: |
1181 | pos = debug->len - off; | 1181 | pos = debug->len + off; |
1182 | } | 1182 | } |
1183 | return (pos < 0 || pos > debug->len) ? -EINVAL : (file->f_pos = pos); | 1183 | return (pos < 0 || pos > debug->len) ? -EINVAL : (file->f_pos = pos); |
1184 | } | 1184 | } |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 7a3870f385f6..66b0b26a1381 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
@@ -688,8 +688,12 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd) | |||
688 | * For FCP_READ with CHECK_CONDITION status, clear cmd->bufflen | 688 | * For FCP_READ with CHECK_CONDITION status, clear cmd->bufflen |
689 | * for qla_tgt_xmit_response LLD code | 689 | * for qla_tgt_xmit_response LLD code |
690 | */ | 690 | */ |
691 | if (se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) { | ||
692 | se_cmd->se_cmd_flags &= ~SCF_OVERFLOW_BIT; | ||
693 | se_cmd->residual_count = 0; | ||
694 | } | ||
691 | se_cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT; | 695 | se_cmd->se_cmd_flags |= SCF_UNDERFLOW_BIT; |
692 | se_cmd->residual_count = se_cmd->data_length; | 696 | se_cmd->residual_count += se_cmd->data_length; |
693 | 697 | ||
694 | cmd->bufflen = 0; | 698 | cmd->bufflen = 0; |
695 | } | 699 | } |
diff --git a/drivers/staging/media/davinci_vpfe/Kconfig b/drivers/staging/media/davinci_vpfe/Kconfig index 2e4a28b018e8..12f321dd2399 100644 --- a/drivers/staging/media/davinci_vpfe/Kconfig +++ b/drivers/staging/media/davinci_vpfe/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_DM365_VPFE | 1 | config VIDEO_DM365_VPFE |
2 | tristate "DM365 VPFE Media Controller Capture Driver" | 2 | tristate "DM365 VPFE Media Controller Capture Driver" |
3 | depends on VIDEO_V4L2 && ARCH_DAVINCI_DM365 && !VIDEO_VPFE_CAPTURE | 3 | depends on VIDEO_V4L2 && ARCH_DAVINCI_DM365 && !VIDEO_DM365_ISIF |
4 | select VIDEOBUF2_DMA_CONTIG | 4 | select VIDEOBUF2_DMA_CONTIG |
5 | help | 5 | help |
6 | Support for DM365 VPFE based Media Controller Capture driver. | 6 | Support for DM365 VPFE based Media Controller Capture driver. |
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c index b88e1ddce229..d8ce20d2fbda 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | |||
@@ -639,7 +639,8 @@ static int vpfe_probe(struct platform_device *pdev) | |||
639 | if (ret) | 639 | if (ret) |
640 | goto probe_free_dev_mem; | 640 | goto probe_free_dev_mem; |
641 | 641 | ||
642 | if (vpfe_initialize_modules(vpfe_dev, pdev)) | 642 | ret = vpfe_initialize_modules(vpfe_dev, pdev); |
643 | if (ret) | ||
643 | goto probe_disable_clock; | 644 | goto probe_disable_clock; |
644 | 645 | ||
645 | vpfe_dev->media_dev.dev = vpfe_dev->pdev; | 646 | vpfe_dev->media_dev.dev = vpfe_dev->pdev; |
@@ -663,7 +664,8 @@ static int vpfe_probe(struct platform_device *pdev) | |||
663 | /* set the driver data in platform device */ | 664 | /* set the driver data in platform device */ |
664 | platform_set_drvdata(pdev, vpfe_dev); | 665 | platform_set_drvdata(pdev, vpfe_dev); |
665 | /* register subdevs/entities */ | 666 | /* register subdevs/entities */ |
666 | if (vpfe_register_entities(vpfe_dev)) | 667 | ret = vpfe_register_entities(vpfe_dev); |
668 | if (ret) | ||
667 | goto probe_out_v4l2_unregister; | 669 | goto probe_out_v4l2_unregister; |
668 | 670 | ||
669 | ret = vpfe_attach_irq(vpfe_dev); | 671 | ret = vpfe_attach_irq(vpfe_dev); |
diff --git a/drivers/staging/media/solo6x10/Kconfig b/drivers/staging/media/solo6x10/Kconfig index df6569b997b8..34f3b6d02d2a 100644 --- a/drivers/staging/media/solo6x10/Kconfig +++ b/drivers/staging/media/solo6x10/Kconfig | |||
@@ -5,6 +5,7 @@ config SOLO6X10 | |||
5 | select VIDEOBUF2_DMA_SG | 5 | select VIDEOBUF2_DMA_SG |
6 | select VIDEOBUF2_DMA_CONTIG | 6 | select VIDEOBUF2_DMA_CONTIG |
7 | select SND_PCM | 7 | select SND_PCM |
8 | select FONT_8x16 | ||
8 | ---help--- | 9 | ---help--- |
9 | This driver supports the Softlogic based MPEG-4 and h.264 codec | 10 | This driver supports the Softlogic based MPEG-4 and h.264 codec |
10 | cards. | 11 | cards. |
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index 13e9e715ad2e..8d8b3ff68490 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c | |||
@@ -155,7 +155,7 @@ static ssize_t lio_target_np_store_iser( | |||
155 | struct iscsi_tpg_np *tpg_np_iser = NULL; | 155 | struct iscsi_tpg_np *tpg_np_iser = NULL; |
156 | char *endptr; | 156 | char *endptr; |
157 | u32 op; | 157 | u32 op; |
158 | int rc; | 158 | int rc = 0; |
159 | 159 | ||
160 | op = simple_strtoul(page, &endptr, 0); | 160 | op = simple_strtoul(page, &endptr, 0); |
161 | if ((op != 1) && (op != 0)) { | 161 | if ((op != 1) && (op != 0)) { |
@@ -174,31 +174,32 @@ static ssize_t lio_target_np_store_iser( | |||
174 | return -EINVAL; | 174 | return -EINVAL; |
175 | 175 | ||
176 | if (op) { | 176 | if (op) { |
177 | int rc = request_module("ib_isert"); | 177 | rc = request_module("ib_isert"); |
178 | if (rc != 0) | 178 | if (rc != 0) { |
179 | pr_warn("Unable to request_module for ib_isert\n"); | 179 | pr_warn("Unable to request_module for ib_isert\n"); |
180 | rc = 0; | ||
181 | } | ||
180 | 182 | ||
181 | tpg_np_iser = iscsit_tpg_add_network_portal(tpg, &np->np_sockaddr, | 183 | tpg_np_iser = iscsit_tpg_add_network_portal(tpg, &np->np_sockaddr, |
182 | np->np_ip, tpg_np, ISCSI_INFINIBAND); | 184 | np->np_ip, tpg_np, ISCSI_INFINIBAND); |
183 | if (!tpg_np_iser || IS_ERR(tpg_np_iser)) | 185 | if (IS_ERR(tpg_np_iser)) { |
186 | rc = PTR_ERR(tpg_np_iser); | ||
184 | goto out; | 187 | goto out; |
188 | } | ||
185 | } else { | 189 | } else { |
186 | tpg_np_iser = iscsit_tpg_locate_child_np(tpg_np, ISCSI_INFINIBAND); | 190 | tpg_np_iser = iscsit_tpg_locate_child_np(tpg_np, ISCSI_INFINIBAND); |
187 | if (!tpg_np_iser) | 191 | if (tpg_np_iser) { |
188 | goto out; | 192 | rc = iscsit_tpg_del_network_portal(tpg, tpg_np_iser); |
189 | 193 | if (rc < 0) | |
190 | rc = iscsit_tpg_del_network_portal(tpg, tpg_np_iser); | 194 | goto out; |
191 | if (rc < 0) | 195 | } |
192 | goto out; | ||
193 | } | 196 | } |
194 | 197 | ||
195 | printk("lio_target_np_store_iser() done, op: %d\n", op); | ||
196 | |||
197 | iscsit_put_tpg(tpg); | 198 | iscsit_put_tpg(tpg); |
198 | return count; | 199 | return count; |
199 | out: | 200 | out: |
200 | iscsit_put_tpg(tpg); | 201 | iscsit_put_tpg(tpg); |
201 | return -EINVAL; | 202 | return rc; |
202 | } | 203 | } |
203 | 204 | ||
204 | TF_NP_BASE_ATTR(lio_target, iser, S_IRUGO | S_IWUSR); | 205 | TF_NP_BASE_ATTR(lio_target, iser, S_IRUGO | S_IWUSR); |
diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c index 8e6298cc8839..dcb199da06b9 100644 --- a/drivers/target/iscsi/iscsi_target_erl0.c +++ b/drivers/target/iscsi/iscsi_target_erl0.c | |||
@@ -842,11 +842,11 @@ int iscsit_stop_time2retain_timer(struct iscsi_session *sess) | |||
842 | return 0; | 842 | return 0; |
843 | 843 | ||
844 | sess->time2retain_timer_flags |= ISCSI_TF_STOP; | 844 | sess->time2retain_timer_flags |= ISCSI_TF_STOP; |
845 | spin_unlock_bh(&se_tpg->session_lock); | 845 | spin_unlock(&se_tpg->session_lock); |
846 | 846 | ||
847 | del_timer_sync(&sess->time2retain_timer); | 847 | del_timer_sync(&sess->time2retain_timer); |
848 | 848 | ||
849 | spin_lock_bh(&se_tpg->session_lock); | 849 | spin_lock(&se_tpg->session_lock); |
850 | sess->time2retain_timer_flags &= ~ISCSI_TF_RUNNING; | 850 | sess->time2retain_timer_flags &= ~ISCSI_TF_RUNNING; |
851 | pr_debug("Stopped Time2Retain Timer for SID: %u\n", | 851 | pr_debug("Stopped Time2Retain Timer for SID: %u\n", |
852 | sess->sid); | 852 | sess->sid); |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index bb5d5c5bce65..3402241be87c 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -984,8 +984,6 @@ int iscsi_target_setup_login_socket( | |||
984 | } | 984 | } |
985 | 985 | ||
986 | np->np_transport = t; | 986 | np->np_transport = t; |
987 | printk("Set np->np_transport to %p -> %s\n", np->np_transport, | ||
988 | np->np_transport->name); | ||
989 | return 0; | 987 | return 0; |
990 | } | 988 | } |
991 | 989 | ||
@@ -1002,7 +1000,6 @@ int iscsit_accept_np(struct iscsi_np *np, struct iscsi_conn *conn) | |||
1002 | 1000 | ||
1003 | conn->sock = new_sock; | 1001 | conn->sock = new_sock; |
1004 | conn->login_family = np->np_sockaddr.ss_family; | 1002 | conn->login_family = np->np_sockaddr.ss_family; |
1005 | printk("iSCSI/TCP: Setup conn->sock from new_sock: %p\n", new_sock); | ||
1006 | 1003 | ||
1007 | if (np->np_sockaddr.ss_family == AF_INET6) { | 1004 | if (np->np_sockaddr.ss_family == AF_INET6) { |
1008 | memset(&sock_in6, 0, sizeof(struct sockaddr_in6)); | 1005 | memset(&sock_in6, 0, sizeof(struct sockaddr_in6)); |
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c index 7ad912060e21..cd5018ff9cd7 100644 --- a/drivers/target/iscsi/iscsi_target_nego.c +++ b/drivers/target/iscsi/iscsi_target_nego.c | |||
@@ -721,9 +721,6 @@ int iscsi_target_locate_portal( | |||
721 | 721 | ||
722 | start += strlen(key) + strlen(value) + 2; | 722 | start += strlen(key) + strlen(value) + 2; |
723 | } | 723 | } |
724 | |||
725 | printk("i_buf: %s, s_buf: %s, t_buf: %s\n", i_buf, s_buf, t_buf); | ||
726 | |||
727 | /* | 724 | /* |
728 | * See 5.3. Login Phase. | 725 | * See 5.3. Login Phase. |
729 | */ | 726 | */ |
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index 59bfaecc4e14..abfd99089781 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c | |||
@@ -244,14 +244,9 @@ static void pty_flush_buffer(struct tty_struct *tty) | |||
244 | 244 | ||
245 | static int pty_open(struct tty_struct *tty, struct file *filp) | 245 | static int pty_open(struct tty_struct *tty, struct file *filp) |
246 | { | 246 | { |
247 | int retval = -ENODEV; | ||
248 | |||
249 | if (!tty || !tty->link) | 247 | if (!tty || !tty->link) |
250 | goto out; | 248 | return -ENODEV; |
251 | |||
252 | set_bit(TTY_IO_ERROR, &tty->flags); | ||
253 | 249 | ||
254 | retval = -EIO; | ||
255 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) | 250 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) |
256 | goto out; | 251 | goto out; |
257 | if (test_bit(TTY_PTY_LOCK, &tty->link->flags)) | 252 | if (test_bit(TTY_PTY_LOCK, &tty->link->flags)) |
@@ -262,9 +257,11 @@ static int pty_open(struct tty_struct *tty, struct file *filp) | |||
262 | clear_bit(TTY_IO_ERROR, &tty->flags); | 257 | clear_bit(TTY_IO_ERROR, &tty->flags); |
263 | clear_bit(TTY_OTHER_CLOSED, &tty->link->flags); | 258 | clear_bit(TTY_OTHER_CLOSED, &tty->link->flags); |
264 | set_bit(TTY_THROTTLED, &tty->flags); | 259 | set_bit(TTY_THROTTLED, &tty->flags); |
265 | retval = 0; | 260 | return 0; |
261 | |||
266 | out: | 262 | out: |
267 | return retval; | 263 | set_bit(TTY_IO_ERROR, &tty->flags); |
264 | return -EIO; | ||
268 | } | 265 | } |
269 | 266 | ||
270 | static void pty_set_termios(struct tty_struct *tty, | 267 | static void pty_set_termios(struct tty_struct *tty, |
diff --git a/drivers/tty/serial/8250/8250_gsc.c b/drivers/tty/serial/8250/8250_gsc.c index 097dff9c08ad..bb91b4713ebd 100644 --- a/drivers/tty/serial/8250/8250_gsc.c +++ b/drivers/tty/serial/8250/8250_gsc.c | |||
@@ -30,6 +30,12 @@ static int __init serial_init_chip(struct parisc_device *dev) | |||
30 | unsigned long address; | 30 | unsigned long address; |
31 | int err; | 31 | int err; |
32 | 32 | ||
33 | #ifdef CONFIG_64BIT | ||
34 | extern int iosapic_serial_irq(int cellnum); | ||
35 | if (!dev->irq && (dev->id.sversion == 0xad)) | ||
36 | dev->irq = iosapic_serial_irq(dev->mod_index-1); | ||
37 | #endif | ||
38 | |||
33 | if (!dev->irq) { | 39 | if (!dev->irq) { |
34 | /* We find some unattached serial ports by walking native | 40 | /* We find some unattached serial ports by walking native |
35 | * busses. These should be silently ignored. Otherwise, | 41 | * busses. These should be silently ignored. Otherwise, |
@@ -51,7 +57,8 @@ static int __init serial_init_chip(struct parisc_device *dev) | |||
51 | memset(&uart, 0, sizeof(uart)); | 57 | memset(&uart, 0, sizeof(uart)); |
52 | uart.port.iotype = UPIO_MEM; | 58 | uart.port.iotype = UPIO_MEM; |
53 | /* 7.272727MHz on Lasi. Assumed the same for Dino, Wax and Timi. */ | 59 | /* 7.272727MHz on Lasi. Assumed the same for Dino, Wax and Timi. */ |
54 | uart.port.uartclk = 7272727; | 60 | uart.port.uartclk = (dev->id.sversion != 0xad) ? |
61 | 7272727 : 1843200; | ||
55 | uart.port.mapbase = address; | 62 | uart.port.mapbase = address; |
56 | uart.port.membase = ioremap_nocache(address, 16); | 63 | uart.port.membase = ioremap_nocache(address, 16); |
57 | uart.port.irq = dev->irq; | 64 | uart.port.irq = dev->irq; |
@@ -73,6 +80,7 @@ static struct parisc_device_id serial_tbl[] = { | |||
73 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00075 }, | 80 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00075 }, |
74 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008c }, | 81 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008c }, |
75 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008d }, | 82 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008d }, |
83 | { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x000ad }, | ||
76 | { 0 } | 84 | { 0 } |
77 | }; | 85 | }; |
78 | 86 | ||
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c index fc2c06c66e89..2bd78e2ac8ec 100644 --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c | |||
@@ -289,13 +289,10 @@ static int vt_disallocate(unsigned int vc_num) | |||
289 | struct vc_data *vc = NULL; | 289 | struct vc_data *vc = NULL; |
290 | int ret = 0; | 290 | int ret = 0; |
291 | 291 | ||
292 | if (!vc_num) | ||
293 | return 0; | ||
294 | |||
295 | console_lock(); | 292 | console_lock(); |
296 | if (VT_BUSY(vc_num)) | 293 | if (VT_BUSY(vc_num)) |
297 | ret = -EBUSY; | 294 | ret = -EBUSY; |
298 | else | 295 | else if (vc_num) |
299 | vc = vc_deallocate(vc_num); | 296 | vc = vc_deallocate(vc_num); |
300 | console_unlock(); | 297 | console_unlock(); |
301 | 298 | ||
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 7ef3eb8617a6..2311b1e4e43c 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig | |||
@@ -4,11 +4,17 @@ | |||
4 | menuconfig USB_PHY | 4 | menuconfig USB_PHY |
5 | bool "USB Physical Layer drivers" | 5 | bool "USB Physical Layer drivers" |
6 | help | 6 | help |
7 | USB controllers (those which are host, device or DRD) need a | 7 | Most USB controllers have the physical layer signalling part |
8 | device to handle the physical layer signalling, commonly called | 8 | (commonly called a PHY) built in. However, dual-role devices |
9 | a PHY. | 9 | (a.k.a. USB on-the-go) which support being USB master or slave |
10 | with the same connector often use an external PHY. | ||
10 | 11 | ||
11 | The following drivers add support for such PHY devices. | 12 | The drivers in this submenu add support for such PHY devices. |
13 | They are not needed for standard master-only (or the vast | ||
14 | majority of slave-only) USB interfaces. | ||
15 | |||
16 | If you're not sure if this applies to you, it probably doesn't; | ||
17 | say N here. | ||
12 | 18 | ||
13 | if USB_PHY | 19 | if USB_PHY |
14 | 20 | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index c92c5ed4e580..e581c2549a57 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -172,7 +172,8 @@ static struct usb_device_id ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = { | |||
172 | { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) }, | 172 | { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) }, |
173 | { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) }, | 173 | { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) }, |
174 | { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) }, | 174 | { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) }, |
175 | { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) }, | 175 | { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STEREO_PLUG_ID) }, |
176 | { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) }, | ||
176 | { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) }, | 177 | { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) }, |
177 | }; | 178 | }; |
178 | 179 | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h index b353e7e3d480..4a2423e84d55 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.h +++ b/drivers/usb/serial/ti_usb_3410_5052.h | |||
@@ -52,7 +52,9 @@ | |||
52 | 52 | ||
53 | /* Abbott Diabetics vendor and product ids */ | 53 | /* Abbott Diabetics vendor and product ids */ |
54 | #define ABBOTT_VENDOR_ID 0x1a61 | 54 | #define ABBOTT_VENDOR_ID 0x1a61 |
55 | #define ABBOTT_PRODUCT_ID 0x3410 | 55 | #define ABBOTT_STEREO_PLUG_ID 0x3410 |
56 | #define ABBOTT_PRODUCT_ID ABBOTT_STEREO_PLUG_ID | ||
57 | #define ABBOTT_STRIP_PORT_ID 0x3420 | ||
56 | 58 | ||
57 | /* Commands */ | 59 | /* Commands */ |
58 | #define TI_GET_VERSION 0x01 | 60 | #define TI_GET_VERSION 0x01 |
diff --git a/fs/internal.h b/fs/internal.h index eaa75f75b625..68121584ae37 100644 --- a/fs/internal.h +++ b/fs/internal.h | |||
@@ -132,6 +132,12 @@ extern struct dentry *__d_alloc(struct super_block *, const struct qstr *); | |||
132 | extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *); | 132 | extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *); |
133 | 133 | ||
134 | /* | 134 | /* |
135 | * splice.c | ||
136 | */ | ||
137 | extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, | ||
138 | loff_t *opos, size_t len, unsigned int flags); | ||
139 | |||
140 | /* | ||
135 | * pipe.c | 141 | * pipe.c |
136 | */ | 142 | */ |
137 | extern const struct file_operations pipefifo_fops; | 143 | extern const struct file_operations pipefifo_fops; |
diff --git a/fs/read_write.c b/fs/read_write.c index 03430008704e..2cefa417be34 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -1064,6 +1064,7 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, | |||
1064 | struct fd in, out; | 1064 | struct fd in, out; |
1065 | struct inode *in_inode, *out_inode; | 1065 | struct inode *in_inode, *out_inode; |
1066 | loff_t pos; | 1066 | loff_t pos; |
1067 | loff_t out_pos; | ||
1067 | ssize_t retval; | 1068 | ssize_t retval; |
1068 | int fl; | 1069 | int fl; |
1069 | 1070 | ||
@@ -1077,12 +1078,14 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, | |||
1077 | if (!(in.file->f_mode & FMODE_READ)) | 1078 | if (!(in.file->f_mode & FMODE_READ)) |
1078 | goto fput_in; | 1079 | goto fput_in; |
1079 | retval = -ESPIPE; | 1080 | retval = -ESPIPE; |
1080 | if (!ppos) | 1081 | if (!ppos) { |
1081 | ppos = &in.file->f_pos; | 1082 | pos = in.file->f_pos; |
1082 | else | 1083 | } else { |
1084 | pos = *ppos; | ||
1083 | if (!(in.file->f_mode & FMODE_PREAD)) | 1085 | if (!(in.file->f_mode & FMODE_PREAD)) |
1084 | goto fput_in; | 1086 | goto fput_in; |
1085 | retval = rw_verify_area(READ, in.file, ppos, count); | 1087 | } |
1088 | retval = rw_verify_area(READ, in.file, &pos, count); | ||
1086 | if (retval < 0) | 1089 | if (retval < 0) |
1087 | goto fput_in; | 1090 | goto fput_in; |
1088 | count = retval; | 1091 | count = retval; |
@@ -1099,7 +1102,8 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, | |||
1099 | retval = -EINVAL; | 1102 | retval = -EINVAL; |
1100 | in_inode = file_inode(in.file); | 1103 | in_inode = file_inode(in.file); |
1101 | out_inode = file_inode(out.file); | 1104 | out_inode = file_inode(out.file); |
1102 | retval = rw_verify_area(WRITE, out.file, &out.file->f_pos, count); | 1105 | out_pos = out.file->f_pos; |
1106 | retval = rw_verify_area(WRITE, out.file, &out_pos, count); | ||
1103 | if (retval < 0) | 1107 | if (retval < 0) |
1104 | goto fput_out; | 1108 | goto fput_out; |
1105 | count = retval; | 1109 | count = retval; |
@@ -1107,7 +1111,6 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, | |||
1107 | if (!max) | 1111 | if (!max) |
1108 | max = min(in_inode->i_sb->s_maxbytes, out_inode->i_sb->s_maxbytes); | 1112 | max = min(in_inode->i_sb->s_maxbytes, out_inode->i_sb->s_maxbytes); |
1109 | 1113 | ||
1110 | pos = *ppos; | ||
1111 | if (unlikely(pos + count > max)) { | 1114 | if (unlikely(pos + count > max)) { |
1112 | retval = -EOVERFLOW; | 1115 | retval = -EOVERFLOW; |
1113 | if (pos >= max) | 1116 | if (pos >= max) |
@@ -1126,18 +1129,23 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, | |||
1126 | if (in.file->f_flags & O_NONBLOCK) | 1129 | if (in.file->f_flags & O_NONBLOCK) |
1127 | fl = SPLICE_F_NONBLOCK; | 1130 | fl = SPLICE_F_NONBLOCK; |
1128 | #endif | 1131 | #endif |
1129 | retval = do_splice_direct(in.file, ppos, out.file, count, fl); | 1132 | retval = do_splice_direct(in.file, &pos, out.file, &out_pos, count, fl); |
1130 | 1133 | ||
1131 | if (retval > 0) { | 1134 | if (retval > 0) { |
1132 | add_rchar(current, retval); | 1135 | add_rchar(current, retval); |
1133 | add_wchar(current, retval); | 1136 | add_wchar(current, retval); |
1134 | fsnotify_access(in.file); | 1137 | fsnotify_access(in.file); |
1135 | fsnotify_modify(out.file); | 1138 | fsnotify_modify(out.file); |
1139 | out.file->f_pos = out_pos; | ||
1140 | if (ppos) | ||
1141 | *ppos = pos; | ||
1142 | else | ||
1143 | in.file->f_pos = pos; | ||
1136 | } | 1144 | } |
1137 | 1145 | ||
1138 | inc_syscr(current); | 1146 | inc_syscr(current); |
1139 | inc_syscw(current); | 1147 | inc_syscw(current); |
1140 | if (*ppos > max) | 1148 | if (pos > max) |
1141 | retval = -EOVERFLOW; | 1149 | retval = -EOVERFLOW; |
1142 | 1150 | ||
1143 | fput_out: | 1151 | fput_out: |
diff --git a/fs/splice.c b/fs/splice.c index e6b25598c8c4..9eca476227d5 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -1274,7 +1274,7 @@ static int direct_splice_actor(struct pipe_inode_info *pipe, | |||
1274 | { | 1274 | { |
1275 | struct file *file = sd->u.file; | 1275 | struct file *file = sd->u.file; |
1276 | 1276 | ||
1277 | return do_splice_from(pipe, file, &file->f_pos, sd->total_len, | 1277 | return do_splice_from(pipe, file, sd->opos, sd->total_len, |
1278 | sd->flags); | 1278 | sd->flags); |
1279 | } | 1279 | } |
1280 | 1280 | ||
@@ -1294,7 +1294,7 @@ static int direct_splice_actor(struct pipe_inode_info *pipe, | |||
1294 | * | 1294 | * |
1295 | */ | 1295 | */ |
1296 | long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, | 1296 | long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, |
1297 | size_t len, unsigned int flags) | 1297 | loff_t *opos, size_t len, unsigned int flags) |
1298 | { | 1298 | { |
1299 | struct splice_desc sd = { | 1299 | struct splice_desc sd = { |
1300 | .len = len, | 1300 | .len = len, |
@@ -1302,6 +1302,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, | |||
1302 | .flags = flags, | 1302 | .flags = flags, |
1303 | .pos = *ppos, | 1303 | .pos = *ppos, |
1304 | .u.file = out, | 1304 | .u.file = out, |
1305 | .opos = opos, | ||
1305 | }; | 1306 | }; |
1306 | long ret; | 1307 | long ret; |
1307 | 1308 | ||
@@ -1325,7 +1326,7 @@ static long do_splice(struct file *in, loff_t __user *off_in, | |||
1325 | { | 1326 | { |
1326 | struct pipe_inode_info *ipipe; | 1327 | struct pipe_inode_info *ipipe; |
1327 | struct pipe_inode_info *opipe; | 1328 | struct pipe_inode_info *opipe; |
1328 | loff_t offset, *off; | 1329 | loff_t offset; |
1329 | long ret; | 1330 | long ret; |
1330 | 1331 | ||
1331 | ipipe = get_pipe_info(in); | 1332 | ipipe = get_pipe_info(in); |
@@ -1356,13 +1357,15 @@ static long do_splice(struct file *in, loff_t __user *off_in, | |||
1356 | return -EINVAL; | 1357 | return -EINVAL; |
1357 | if (copy_from_user(&offset, off_out, sizeof(loff_t))) | 1358 | if (copy_from_user(&offset, off_out, sizeof(loff_t))) |
1358 | return -EFAULT; | 1359 | return -EFAULT; |
1359 | off = &offset; | 1360 | } else { |
1360 | } else | 1361 | offset = out->f_pos; |
1361 | off = &out->f_pos; | 1362 | } |
1362 | 1363 | ||
1363 | ret = do_splice_from(ipipe, out, off, len, flags); | 1364 | ret = do_splice_from(ipipe, out, &offset, len, flags); |
1364 | 1365 | ||
1365 | if (off_out && copy_to_user(off_out, off, sizeof(loff_t))) | 1366 | if (!off_out) |
1367 | out->f_pos = offset; | ||
1368 | else if (copy_to_user(off_out, &offset, sizeof(loff_t))) | ||
1366 | ret = -EFAULT; | 1369 | ret = -EFAULT; |
1367 | 1370 | ||
1368 | return ret; | 1371 | return ret; |
@@ -1376,13 +1379,15 @@ static long do_splice(struct file *in, loff_t __user *off_in, | |||
1376 | return -EINVAL; | 1379 | return -EINVAL; |
1377 | if (copy_from_user(&offset, off_in, sizeof(loff_t))) | 1380 | if (copy_from_user(&offset, off_in, sizeof(loff_t))) |
1378 | return -EFAULT; | 1381 | return -EFAULT; |
1379 | off = &offset; | 1382 | } else { |
1380 | } else | 1383 | offset = in->f_pos; |
1381 | off = &in->f_pos; | 1384 | } |
1382 | 1385 | ||
1383 | ret = do_splice_to(in, off, opipe, len, flags); | 1386 | ret = do_splice_to(in, &offset, opipe, len, flags); |
1384 | 1387 | ||
1385 | if (off_in && copy_to_user(off_in, off, sizeof(loff_t))) | 1388 | if (!off_in) |
1389 | in->f_pos = offset; | ||
1390 | else if (copy_to_user(off_in, &offset, sizeof(loff_t))) | ||
1386 | ret = -EFAULT; | 1391 | ret = -EFAULT; |
1387 | 1392 | ||
1388 | return ret; | 1393 | return ret; |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 636c59f2003a..c13c919ab99e 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -382,6 +382,7 @@ const char *acpi_power_state_string(int state); | |||
382 | int acpi_device_get_power(struct acpi_device *device, int *state); | 382 | int acpi_device_get_power(struct acpi_device *device, int *state); |
383 | int acpi_device_set_power(struct acpi_device *device, int state); | 383 | int acpi_device_set_power(struct acpi_device *device, int state); |
384 | int acpi_bus_init_power(struct acpi_device *device); | 384 | int acpi_bus_init_power(struct acpi_device *device); |
385 | int acpi_device_fix_up_power(struct acpi_device *device); | ||
385 | int acpi_bus_update_power(acpi_handle handle, int *state_p); | 386 | int acpi_bus_update_power(acpi_handle handle, int *state_p); |
386 | bool acpi_bus_power_manageable(acpi_handle handle); | 387 | bool acpi_bus_power_manageable(acpi_handle handle); |
387 | 388 | ||
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h index 365f4a61bf04..fc09d7b0dacf 100644 --- a/include/linux/context_tracking.h +++ b/include/linux/context_tracking.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
5 | #include <linux/percpu.h> | 5 | #include <linux/percpu.h> |
6 | #include <linux/vtime.h> | ||
6 | #include <asm/ptrace.h> | 7 | #include <asm/ptrace.h> |
7 | 8 | ||
8 | struct context_tracking { | 9 | struct context_tracking { |
@@ -19,6 +20,26 @@ struct context_tracking { | |||
19 | } state; | 20 | } state; |
20 | }; | 21 | }; |
21 | 22 | ||
23 | static inline void __guest_enter(void) | ||
24 | { | ||
25 | /* | ||
26 | * This is running in ioctl context so we can avoid | ||
27 | * the call to vtime_account() with its unnecessary idle check. | ||
28 | */ | ||
29 | vtime_account_system(current); | ||
30 | current->flags |= PF_VCPU; | ||
31 | } | ||
32 | |||
33 | static inline void __guest_exit(void) | ||
34 | { | ||
35 | /* | ||
36 | * This is running in ioctl context so we can avoid | ||
37 | * the call to vtime_account() with its unnecessary idle check. | ||
38 | */ | ||
39 | vtime_account_system(current); | ||
40 | current->flags &= ~PF_VCPU; | ||
41 | } | ||
42 | |||
22 | #ifdef CONFIG_CONTEXT_TRACKING | 43 | #ifdef CONFIG_CONTEXT_TRACKING |
23 | DECLARE_PER_CPU(struct context_tracking, context_tracking); | 44 | DECLARE_PER_CPU(struct context_tracking, context_tracking); |
24 | 45 | ||
@@ -35,6 +56,9 @@ static inline bool context_tracking_active(void) | |||
35 | extern void user_enter(void); | 56 | extern void user_enter(void); |
36 | extern void user_exit(void); | 57 | extern void user_exit(void); |
37 | 58 | ||
59 | extern void guest_enter(void); | ||
60 | extern void guest_exit(void); | ||
61 | |||
38 | static inline enum ctx_state exception_enter(void) | 62 | static inline enum ctx_state exception_enter(void) |
39 | { | 63 | { |
40 | enum ctx_state prev_ctx; | 64 | enum ctx_state prev_ctx; |
@@ -57,6 +81,17 @@ extern void context_tracking_task_switch(struct task_struct *prev, | |||
57 | static inline bool context_tracking_in_user(void) { return false; } | 81 | static inline bool context_tracking_in_user(void) { return false; } |
58 | static inline void user_enter(void) { } | 82 | static inline void user_enter(void) { } |
59 | static inline void user_exit(void) { } | 83 | static inline void user_exit(void) { } |
84 | |||
85 | static inline void guest_enter(void) | ||
86 | { | ||
87 | __guest_enter(); | ||
88 | } | ||
89 | |||
90 | static inline void guest_exit(void) | ||
91 | { | ||
92 | __guest_exit(); | ||
93 | } | ||
94 | |||
60 | static inline enum ctx_state exception_enter(void) { return 0; } | 95 | static inline enum ctx_state exception_enter(void) { return 0; } |
61 | static inline void exception_exit(enum ctx_state prev_ctx) { } | 96 | static inline void exception_exit(enum ctx_state prev_ctx) { } |
62 | static inline void context_tracking_task_switch(struct task_struct *prev, | 97 | static inline void context_tracking_task_switch(struct task_struct *prev, |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 43db02e9c9fa..65c2be22b601 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2414,8 +2414,6 @@ extern ssize_t generic_file_splice_write(struct pipe_inode_info *, | |||
2414 | struct file *, loff_t *, size_t, unsigned int); | 2414 | struct file *, loff_t *, size_t, unsigned int); |
2415 | extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, | 2415 | extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, |
2416 | struct file *out, loff_t *, size_t len, unsigned int flags); | 2416 | struct file *out, loff_t *, size_t len, unsigned int flags); |
2417 | extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, | ||
2418 | size_t len, unsigned int flags); | ||
2419 | 2417 | ||
2420 | extern void | 2418 | extern void |
2421 | file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); | 2419 | file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index f0eea07d2c2b..8db53cfaccdb 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/ratelimit.h> | 23 | #include <linux/ratelimit.h> |
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/irqflags.h> | 25 | #include <linux/irqflags.h> |
26 | #include <linux/context_tracking.h> | ||
26 | #include <asm/signal.h> | 27 | #include <asm/signal.h> |
27 | 28 | ||
28 | #include <linux/kvm.h> | 29 | #include <linux/kvm.h> |
@@ -760,42 +761,6 @@ static inline int kvm_iommu_unmap_guest(struct kvm *kvm) | |||
760 | } | 761 | } |
761 | #endif | 762 | #endif |
762 | 763 | ||
763 | static inline void __guest_enter(void) | ||
764 | { | ||
765 | /* | ||
766 | * This is running in ioctl context so we can avoid | ||
767 | * the call to vtime_account() with its unnecessary idle check. | ||
768 | */ | ||
769 | vtime_account_system(current); | ||
770 | current->flags |= PF_VCPU; | ||
771 | } | ||
772 | |||
773 | static inline void __guest_exit(void) | ||
774 | { | ||
775 | /* | ||
776 | * This is running in ioctl context so we can avoid | ||
777 | * the call to vtime_account() with its unnecessary idle check. | ||
778 | */ | ||
779 | vtime_account_system(current); | ||
780 | current->flags &= ~PF_VCPU; | ||
781 | } | ||
782 | |||
783 | #ifdef CONFIG_CONTEXT_TRACKING | ||
784 | extern void guest_enter(void); | ||
785 | extern void guest_exit(void); | ||
786 | |||
787 | #else /* !CONFIG_CONTEXT_TRACKING */ | ||
788 | static inline void guest_enter(void) | ||
789 | { | ||
790 | __guest_enter(); | ||
791 | } | ||
792 | |||
793 | static inline void guest_exit(void) | ||
794 | { | ||
795 | __guest_exit(); | ||
796 | } | ||
797 | #endif /* !CONFIG_CONTEXT_TRACKING */ | ||
798 | |||
799 | static inline void kvm_guest_enter(void) | 764 | static inline void kvm_guest_enter(void) |
800 | { | 765 | { |
801 | unsigned long flags; | 766 | unsigned long flags; |
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h index 94ac944d12f0..7e7fbce7a308 100644 --- a/include/linux/mfd/twl6040.h +++ b/include/linux/mfd/twl6040.h | |||
@@ -125,8 +125,15 @@ | |||
125 | 125 | ||
126 | #define TWL6040_HSDACENA (1 << 0) | 126 | #define TWL6040_HSDACENA (1 << 0) |
127 | #define TWL6040_HSDACMODE (1 << 1) | 127 | #define TWL6040_HSDACMODE (1 << 1) |
128 | #define TWL6040_HSDRVENA (1 << 2) | ||
128 | #define TWL6040_HSDRVMODE (1 << 3) | 129 | #define TWL6040_HSDRVMODE (1 << 3) |
129 | 130 | ||
131 | /* HFLCTL/R (0x14/0x16) fields */ | ||
132 | |||
133 | #define TWL6040_HFDACENA (1 << 0) | ||
134 | #define TWL6040_HFPGAENA (1 << 1) | ||
135 | #define TWL6040_HFDRVENA (1 << 4) | ||
136 | |||
130 | /* VIBCTLL/R (0x18/0x1A) fields */ | 137 | /* VIBCTLL/R (0x18/0x1A) fields */ |
131 | 138 | ||
132 | #define TWL6040_VIBENA (1 << 0) | 139 | #define TWL6040_VIBENA (1 << 0) |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index f463a46424e2..c5b6dbf9c2fc 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -389,8 +389,7 @@ struct perf_event { | |||
389 | /* mmap bits */ | 389 | /* mmap bits */ |
390 | struct mutex mmap_mutex; | 390 | struct mutex mmap_mutex; |
391 | atomic_t mmap_count; | 391 | atomic_t mmap_count; |
392 | int mmap_locked; | 392 | |
393 | struct user_struct *mmap_user; | ||
394 | struct ring_buffer *rb; | 393 | struct ring_buffer *rb; |
395 | struct list_head rb_entry; | 394 | struct list_head rb_entry; |
396 | 395 | ||
diff --git a/include/linux/preempt.h b/include/linux/preempt.h index 87a03c746f17..f5d4723cdb3d 100644 --- a/include/linux/preempt.h +++ b/include/linux/preempt.h | |||
@@ -33,9 +33,25 @@ do { \ | |||
33 | preempt_schedule(); \ | 33 | preempt_schedule(); \ |
34 | } while (0) | 34 | } while (0) |
35 | 35 | ||
36 | #ifdef CONFIG_CONTEXT_TRACKING | ||
37 | |||
38 | void preempt_schedule_context(void); | ||
39 | |||
40 | #define preempt_check_resched_context() \ | ||
41 | do { \ | ||
42 | if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \ | ||
43 | preempt_schedule_context(); \ | ||
44 | } while (0) | ||
45 | #else | ||
46 | |||
47 | #define preempt_check_resched_context() preempt_check_resched() | ||
48 | |||
49 | #endif /* CONFIG_CONTEXT_TRACKING */ | ||
50 | |||
36 | #else /* !CONFIG_PREEMPT */ | 51 | #else /* !CONFIG_PREEMPT */ |
37 | 52 | ||
38 | #define preempt_check_resched() do { } while (0) | 53 | #define preempt_check_resched() do { } while (0) |
54 | #define preempt_check_resched_context() do { } while (0) | ||
39 | 55 | ||
40 | #endif /* CONFIG_PREEMPT */ | 56 | #endif /* CONFIG_PREEMPT */ |
41 | 57 | ||
@@ -88,7 +104,7 @@ do { \ | |||
88 | do { \ | 104 | do { \ |
89 | preempt_enable_no_resched_notrace(); \ | 105 | preempt_enable_no_resched_notrace(); \ |
90 | barrier(); \ | 106 | barrier(); \ |
91 | preempt_check_resched(); \ | 107 | preempt_check_resched_context(); \ |
92 | } while (0) | 108 | } while (0) |
93 | 109 | ||
94 | #else /* !CONFIG_PREEMPT_COUNT */ | 110 | #else /* !CONFIG_PREEMPT_COUNT */ |
diff --git a/include/linux/splice.h b/include/linux/splice.h index 09a545a7dfa3..74575cbf2d6f 100644 --- a/include/linux/splice.h +++ b/include/linux/splice.h | |||
@@ -35,6 +35,7 @@ struct splice_desc { | |||
35 | void *data; /* cookie */ | 35 | void *data; /* cookie */ |
36 | } u; | 36 | } u; |
37 | loff_t pos; /* file position */ | 37 | loff_t pos; /* file position */ |
38 | loff_t *opos; /* sendfile: output position */ | ||
38 | size_t num_spliced; /* number of bytes already spliced */ | 39 | size_t num_spliced; /* number of bytes already spliced */ |
39 | bool need_wakeup; /* need to wake up writer */ | 40 | bool need_wakeup; /* need to wake up writer */ |
40 | }; | 41 | }; |
diff --git a/include/linux/vtime.h b/include/linux/vtime.h index 71a5782d8c59..b1dd2db80076 100644 --- a/include/linux/vtime.h +++ b/include/linux/vtime.h | |||
@@ -34,7 +34,7 @@ static inline void vtime_user_exit(struct task_struct *tsk) | |||
34 | } | 34 | } |
35 | extern void vtime_guest_enter(struct task_struct *tsk); | 35 | extern void vtime_guest_enter(struct task_struct *tsk); |
36 | extern void vtime_guest_exit(struct task_struct *tsk); | 36 | extern void vtime_guest_exit(struct task_struct *tsk); |
37 | extern void vtime_init_idle(struct task_struct *tsk); | 37 | extern void vtime_init_idle(struct task_struct *tsk, int cpu); |
38 | #else | 38 | #else |
39 | static inline void vtime_account_irq_exit(struct task_struct *tsk) | 39 | static inline void vtime_account_irq_exit(struct task_struct *tsk) |
40 | { | 40 | { |
@@ -45,7 +45,7 @@ static inline void vtime_user_enter(struct task_struct *tsk) { } | |||
45 | static inline void vtime_user_exit(struct task_struct *tsk) { } | 45 | static inline void vtime_user_exit(struct task_struct *tsk) { } |
46 | static inline void vtime_guest_enter(struct task_struct *tsk) { } | 46 | static inline void vtime_guest_enter(struct task_struct *tsk) { } |
47 | static inline void vtime_guest_exit(struct task_struct *tsk) { } | 47 | static inline void vtime_guest_exit(struct task_struct *tsk) { } |
48 | static inline void vtime_init_idle(struct task_struct *tsk) { } | 48 | static inline void vtime_init_idle(struct task_struct *tsk, int cpu) { } |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | #ifdef CONFIG_IRQ_TIME_ACCOUNTING | 51 | #ifdef CONFIG_IRQ_TIME_ACCOUNTING |
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h index d3eef01da648..0f4555b2a31b 100644 --- a/include/media/v4l2-mem2mem.h +++ b/include/media/v4l2-mem2mem.h | |||
@@ -110,6 +110,8 @@ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | |||
110 | struct v4l2_buffer *buf); | 110 | struct v4l2_buffer *buf); |
111 | int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | 111 | int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
112 | struct v4l2_buffer *buf); | 112 | struct v4l2_buffer *buf); |
113 | int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | ||
114 | struct v4l2_create_buffers *create); | ||
113 | 115 | ||
114 | int v4l2_m2m_expbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | 116 | int v4l2_m2m_expbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
115 | struct v4l2_exportbuffer *eb); | 117 | struct v4l2_exportbuffer *eb); |
diff --git a/include/sound/soc.h b/include/sound/soc.h index 85c15226103b..6eabee7ec15a 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -340,7 +340,7 @@ struct snd_soc_jack_gpio; | |||
340 | 340 | ||
341 | typedef int (*hw_write_t)(void *,const char* ,int); | 341 | typedef int (*hw_write_t)(void *,const char* ,int); |
342 | 342 | ||
343 | extern struct snd_ac97_bus_ops soc_ac97_ops; | 343 | extern struct snd_ac97_bus_ops *soc_ac97_ops; |
344 | 344 | ||
345 | enum snd_soc_control_type { | 345 | enum snd_soc_control_type { |
346 | SND_SOC_I2C = 1, | 346 | SND_SOC_I2C = 1, |
@@ -467,6 +467,8 @@ int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, | |||
467 | struct snd_ac97_bus_ops *ops, int num); | 467 | struct snd_ac97_bus_ops *ops, int num); |
468 | void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); | 468 | void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); |
469 | 469 | ||
470 | int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops); | ||
471 | |||
470 | /* | 472 | /* |
471 | *Controls | 473 | *Controls |
472 | */ | 474 | */ |
diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c index 65349f07b878..383f8231e436 100644 --- a/kernel/context_tracking.c +++ b/kernel/context_tracking.c | |||
@@ -15,7 +15,6 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/context_tracking.h> | 17 | #include <linux/context_tracking.h> |
18 | #include <linux/kvm_host.h> | ||
19 | #include <linux/rcupdate.h> | 18 | #include <linux/rcupdate.h> |
20 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
21 | #include <linux/hardirq.h> | 20 | #include <linux/hardirq.h> |
@@ -71,6 +70,46 @@ void user_enter(void) | |||
71 | local_irq_restore(flags); | 70 | local_irq_restore(flags); |
72 | } | 71 | } |
73 | 72 | ||
73 | #ifdef CONFIG_PREEMPT | ||
74 | /** | ||
75 | * preempt_schedule_context - preempt_schedule called by tracing | ||
76 | * | ||
77 | * The tracing infrastructure uses preempt_enable_notrace to prevent | ||
78 | * recursion and tracing preempt enabling caused by the tracing | ||
79 | * infrastructure itself. But as tracing can happen in areas coming | ||
80 | * from userspace or just about to enter userspace, a preempt enable | ||
81 | * can occur before user_exit() is called. This will cause the scheduler | ||
82 | * to be called when the system is still in usermode. | ||
83 | * | ||
84 | * To prevent this, the preempt_enable_notrace will use this function | ||
85 | * instead of preempt_schedule() to exit user context if needed before | ||
86 | * calling the scheduler. | ||
87 | */ | ||
88 | void __sched notrace preempt_schedule_context(void) | ||
89 | { | ||
90 | struct thread_info *ti = current_thread_info(); | ||
91 | enum ctx_state prev_ctx; | ||
92 | |||
93 | if (likely(ti->preempt_count || irqs_disabled())) | ||
94 | return; | ||
95 | |||
96 | /* | ||
97 | * Need to disable preemption in case user_exit() is traced | ||
98 | * and the tracer calls preempt_enable_notrace() causing | ||
99 | * an infinite recursion. | ||
100 | */ | ||
101 | preempt_disable_notrace(); | ||
102 | prev_ctx = exception_enter(); | ||
103 | preempt_enable_no_resched_notrace(); | ||
104 | |||
105 | preempt_schedule(); | ||
106 | |||
107 | preempt_disable_notrace(); | ||
108 | exception_exit(prev_ctx); | ||
109 | preempt_enable_notrace(); | ||
110 | } | ||
111 | EXPORT_SYMBOL_GPL(preempt_schedule_context); | ||
112 | #endif /* CONFIG_PREEMPT */ | ||
74 | 113 | ||
75 | /** | 114 | /** |
76 | * user_exit - Inform the context tracking that the CPU is | 115 | * user_exit - Inform the context tracking that the CPU is |
diff --git a/kernel/cpu/idle.c b/kernel/cpu/idle.c index d5585f5e038e..e695c0a0bcb5 100644 --- a/kernel/cpu/idle.c +++ b/kernel/cpu/idle.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/cpu.h> | 5 | #include <linux/cpu.h> |
6 | #include <linux/tick.h> | 6 | #include <linux/tick.h> |
7 | #include <linux/mm.h> | 7 | #include <linux/mm.h> |
8 | #include <linux/stackprotector.h> | ||
8 | 9 | ||
9 | #include <asm/tlb.h> | 10 | #include <asm/tlb.h> |
10 | 11 | ||
@@ -58,6 +59,7 @@ void __weak arch_cpu_idle_dead(void) { } | |||
58 | void __weak arch_cpu_idle(void) | 59 | void __weak arch_cpu_idle(void) |
59 | { | 60 | { |
60 | cpu_idle_force_poll = 1; | 61 | cpu_idle_force_poll = 1; |
62 | local_irq_enable(); | ||
61 | } | 63 | } |
62 | 64 | ||
63 | /* | 65 | /* |
@@ -112,6 +114,21 @@ static void cpu_idle_loop(void) | |||
112 | 114 | ||
113 | void cpu_startup_entry(enum cpuhp_state state) | 115 | void cpu_startup_entry(enum cpuhp_state state) |
114 | { | 116 | { |
117 | /* | ||
118 | * This #ifdef needs to die, but it's too late in the cycle to | ||
119 | * make this generic (arm and sh have never invoked the canary | ||
120 | * init for the non boot cpus!). Will be fixed in 3.11 | ||
121 | */ | ||
122 | #ifdef CONFIG_X86 | ||
123 | /* | ||
124 | * If we're the non-boot CPU, nothing set the stack canary up | ||
125 | * for us. The boot CPU already has it initialized but no harm | ||
126 | * in doing it again. This is a good place for updating it, as | ||
127 | * we wont ever return from this function (so the invalid | ||
128 | * canaries already on the stack wont ever trigger). | ||
129 | */ | ||
130 | boot_init_stack_canary(); | ||
131 | #endif | ||
115 | current_set_polling(); | 132 | current_set_polling(); |
116 | arch_cpu_idle_prepare(); | 133 | arch_cpu_idle_prepare(); |
117 | cpu_idle_loop(); | 134 | cpu_idle_loop(); |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 9dc297faf7c0..b391907d5352 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -196,9 +196,6 @@ static void cpu_ctx_sched_in(struct perf_cpu_context *cpuctx, | |||
196 | static void update_context_time(struct perf_event_context *ctx); | 196 | static void update_context_time(struct perf_event_context *ctx); |
197 | static u64 perf_event_time(struct perf_event *event); | 197 | static u64 perf_event_time(struct perf_event *event); |
198 | 198 | ||
199 | static void ring_buffer_attach(struct perf_event *event, | ||
200 | struct ring_buffer *rb); | ||
201 | |||
202 | void __weak perf_event_print_debug(void) { } | 199 | void __weak perf_event_print_debug(void) { } |
203 | 200 | ||
204 | extern __weak const char *perf_pmu_name(void) | 201 | extern __weak const char *perf_pmu_name(void) |
@@ -2918,6 +2915,7 @@ static void free_event_rcu(struct rcu_head *head) | |||
2918 | } | 2915 | } |
2919 | 2916 | ||
2920 | static void ring_buffer_put(struct ring_buffer *rb); | 2917 | static void ring_buffer_put(struct ring_buffer *rb); |
2918 | static void ring_buffer_detach(struct perf_event *event, struct ring_buffer *rb); | ||
2921 | 2919 | ||
2922 | static void free_event(struct perf_event *event) | 2920 | static void free_event(struct perf_event *event) |
2923 | { | 2921 | { |
@@ -2942,15 +2940,30 @@ static void free_event(struct perf_event *event) | |||
2942 | if (has_branch_stack(event)) { | 2940 | if (has_branch_stack(event)) { |
2943 | static_key_slow_dec_deferred(&perf_sched_events); | 2941 | static_key_slow_dec_deferred(&perf_sched_events); |
2944 | /* is system-wide event */ | 2942 | /* is system-wide event */ |
2945 | if (!(event->attach_state & PERF_ATTACH_TASK)) | 2943 | if (!(event->attach_state & PERF_ATTACH_TASK)) { |
2946 | atomic_dec(&per_cpu(perf_branch_stack_events, | 2944 | atomic_dec(&per_cpu(perf_branch_stack_events, |
2947 | event->cpu)); | 2945 | event->cpu)); |
2946 | } | ||
2948 | } | 2947 | } |
2949 | } | 2948 | } |
2950 | 2949 | ||
2951 | if (event->rb) { | 2950 | if (event->rb) { |
2952 | ring_buffer_put(event->rb); | 2951 | struct ring_buffer *rb; |
2953 | event->rb = NULL; | 2952 | |
2953 | /* | ||
2954 | * Can happen when we close an event with re-directed output. | ||
2955 | * | ||
2956 | * Since we have a 0 refcount, perf_mmap_close() will skip | ||
2957 | * over us; possibly making our ring_buffer_put() the last. | ||
2958 | */ | ||
2959 | mutex_lock(&event->mmap_mutex); | ||
2960 | rb = event->rb; | ||
2961 | if (rb) { | ||
2962 | rcu_assign_pointer(event->rb, NULL); | ||
2963 | ring_buffer_detach(event, rb); | ||
2964 | ring_buffer_put(rb); /* could be last */ | ||
2965 | } | ||
2966 | mutex_unlock(&event->mmap_mutex); | ||
2954 | } | 2967 | } |
2955 | 2968 | ||
2956 | if (is_cgroup_event(event)) | 2969 | if (is_cgroup_event(event)) |
@@ -3188,30 +3201,13 @@ static unsigned int perf_poll(struct file *file, poll_table *wait) | |||
3188 | unsigned int events = POLL_HUP; | 3201 | unsigned int events = POLL_HUP; |
3189 | 3202 | ||
3190 | /* | 3203 | /* |
3191 | * Race between perf_event_set_output() and perf_poll(): perf_poll() | 3204 | * Pin the event->rb by taking event->mmap_mutex; otherwise |
3192 | * grabs the rb reference but perf_event_set_output() overrides it. | 3205 | * perf_event_set_output() can swizzle our rb and make us miss wakeups. |
3193 | * Here is the timeline for two threads T1, T2: | ||
3194 | * t0: T1, rb = rcu_dereference(event->rb) | ||
3195 | * t1: T2, old_rb = event->rb | ||
3196 | * t2: T2, event->rb = new rb | ||
3197 | * t3: T2, ring_buffer_detach(old_rb) | ||
3198 | * t4: T1, ring_buffer_attach(rb1) | ||
3199 | * t5: T1, poll_wait(event->waitq) | ||
3200 | * | ||
3201 | * To avoid this problem, we grab mmap_mutex in perf_poll() | ||
3202 | * thereby ensuring that the assignment of the new ring buffer | ||
3203 | * and the detachment of the old buffer appear atomic to perf_poll() | ||
3204 | */ | 3206 | */ |
3205 | mutex_lock(&event->mmap_mutex); | 3207 | mutex_lock(&event->mmap_mutex); |
3206 | 3208 | rb = event->rb; | |
3207 | rcu_read_lock(); | 3209 | if (rb) |
3208 | rb = rcu_dereference(event->rb); | ||
3209 | if (rb) { | ||
3210 | ring_buffer_attach(event, rb); | ||
3211 | events = atomic_xchg(&rb->poll, 0); | 3210 | events = atomic_xchg(&rb->poll, 0); |
3212 | } | ||
3213 | rcu_read_unlock(); | ||
3214 | |||
3215 | mutex_unlock(&event->mmap_mutex); | 3211 | mutex_unlock(&event->mmap_mutex); |
3216 | 3212 | ||
3217 | poll_wait(file, &event->waitq, wait); | 3213 | poll_wait(file, &event->waitq, wait); |
@@ -3521,16 +3517,12 @@ static void ring_buffer_attach(struct perf_event *event, | |||
3521 | return; | 3517 | return; |
3522 | 3518 | ||
3523 | spin_lock_irqsave(&rb->event_lock, flags); | 3519 | spin_lock_irqsave(&rb->event_lock, flags); |
3524 | if (!list_empty(&event->rb_entry)) | 3520 | if (list_empty(&event->rb_entry)) |
3525 | goto unlock; | 3521 | list_add(&event->rb_entry, &rb->event_list); |
3526 | |||
3527 | list_add(&event->rb_entry, &rb->event_list); | ||
3528 | unlock: | ||
3529 | spin_unlock_irqrestore(&rb->event_lock, flags); | 3522 | spin_unlock_irqrestore(&rb->event_lock, flags); |
3530 | } | 3523 | } |
3531 | 3524 | ||
3532 | static void ring_buffer_detach(struct perf_event *event, | 3525 | static void ring_buffer_detach(struct perf_event *event, struct ring_buffer *rb) |
3533 | struct ring_buffer *rb) | ||
3534 | { | 3526 | { |
3535 | unsigned long flags; | 3527 | unsigned long flags; |
3536 | 3528 | ||
@@ -3549,13 +3541,10 @@ static void ring_buffer_wakeup(struct perf_event *event) | |||
3549 | 3541 | ||
3550 | rcu_read_lock(); | 3542 | rcu_read_lock(); |
3551 | rb = rcu_dereference(event->rb); | 3543 | rb = rcu_dereference(event->rb); |
3552 | if (!rb) | 3544 | if (rb) { |
3553 | goto unlock; | 3545 | list_for_each_entry_rcu(event, &rb->event_list, rb_entry) |
3554 | 3546 | wake_up_all(&event->waitq); | |
3555 | list_for_each_entry_rcu(event, &rb->event_list, rb_entry) | 3547 | } |
3556 | wake_up_all(&event->waitq); | ||
3557 | |||
3558 | unlock: | ||
3559 | rcu_read_unlock(); | 3548 | rcu_read_unlock(); |
3560 | } | 3549 | } |
3561 | 3550 | ||
@@ -3584,18 +3573,10 @@ static struct ring_buffer *ring_buffer_get(struct perf_event *event) | |||
3584 | 3573 | ||
3585 | static void ring_buffer_put(struct ring_buffer *rb) | 3574 | static void ring_buffer_put(struct ring_buffer *rb) |
3586 | { | 3575 | { |
3587 | struct perf_event *event, *n; | ||
3588 | unsigned long flags; | ||
3589 | |||
3590 | if (!atomic_dec_and_test(&rb->refcount)) | 3576 | if (!atomic_dec_and_test(&rb->refcount)) |
3591 | return; | 3577 | return; |
3592 | 3578 | ||
3593 | spin_lock_irqsave(&rb->event_lock, flags); | 3579 | WARN_ON_ONCE(!list_empty(&rb->event_list)); |
3594 | list_for_each_entry_safe(event, n, &rb->event_list, rb_entry) { | ||
3595 | list_del_init(&event->rb_entry); | ||
3596 | wake_up_all(&event->waitq); | ||
3597 | } | ||
3598 | spin_unlock_irqrestore(&rb->event_lock, flags); | ||
3599 | 3580 | ||
3600 | call_rcu(&rb->rcu_head, rb_free_rcu); | 3581 | call_rcu(&rb->rcu_head, rb_free_rcu); |
3601 | } | 3582 | } |
@@ -3605,26 +3586,100 @@ static void perf_mmap_open(struct vm_area_struct *vma) | |||
3605 | struct perf_event *event = vma->vm_file->private_data; | 3586 | struct perf_event *event = vma->vm_file->private_data; |
3606 | 3587 | ||
3607 | atomic_inc(&event->mmap_count); | 3588 | atomic_inc(&event->mmap_count); |
3589 | atomic_inc(&event->rb->mmap_count); | ||
3608 | } | 3590 | } |
3609 | 3591 | ||
3592 | /* | ||
3593 | * A buffer can be mmap()ed multiple times; either directly through the same | ||
3594 | * event, or through other events by use of perf_event_set_output(). | ||
3595 | * | ||
3596 | * In order to undo the VM accounting done by perf_mmap() we need to destroy | ||
3597 | * the buffer here, where we still have a VM context. This means we need | ||
3598 | * to detach all events redirecting to us. | ||
3599 | */ | ||
3610 | static void perf_mmap_close(struct vm_area_struct *vma) | 3600 | static void perf_mmap_close(struct vm_area_struct *vma) |
3611 | { | 3601 | { |
3612 | struct perf_event *event = vma->vm_file->private_data; | 3602 | struct perf_event *event = vma->vm_file->private_data; |
3613 | 3603 | ||
3614 | if (atomic_dec_and_mutex_lock(&event->mmap_count, &event->mmap_mutex)) { | 3604 | struct ring_buffer *rb = event->rb; |
3615 | unsigned long size = perf_data_size(event->rb); | 3605 | struct user_struct *mmap_user = rb->mmap_user; |
3616 | struct user_struct *user = event->mmap_user; | 3606 | int mmap_locked = rb->mmap_locked; |
3617 | struct ring_buffer *rb = event->rb; | 3607 | unsigned long size = perf_data_size(rb); |
3608 | |||
3609 | atomic_dec(&rb->mmap_count); | ||
3610 | |||
3611 | if (!atomic_dec_and_mutex_lock(&event->mmap_count, &event->mmap_mutex)) | ||
3612 | return; | ||
3618 | 3613 | ||
3619 | atomic_long_sub((size >> PAGE_SHIFT) + 1, &user->locked_vm); | 3614 | /* Detach current event from the buffer. */ |
3620 | vma->vm_mm->pinned_vm -= event->mmap_locked; | 3615 | rcu_assign_pointer(event->rb, NULL); |
3621 | rcu_assign_pointer(event->rb, NULL); | 3616 | ring_buffer_detach(event, rb); |
3622 | ring_buffer_detach(event, rb); | 3617 | mutex_unlock(&event->mmap_mutex); |
3618 | |||
3619 | /* If there's still other mmap()s of this buffer, we're done. */ | ||
3620 | if (atomic_read(&rb->mmap_count)) { | ||
3621 | ring_buffer_put(rb); /* can't be last */ | ||
3622 | return; | ||
3623 | } | ||
3624 | |||
3625 | /* | ||
3626 | * No other mmap()s, detach from all other events that might redirect | ||
3627 | * into the now unreachable buffer. Somewhat complicated by the | ||
3628 | * fact that rb::event_lock otherwise nests inside mmap_mutex. | ||
3629 | */ | ||
3630 | again: | ||
3631 | rcu_read_lock(); | ||
3632 | list_for_each_entry_rcu(event, &rb->event_list, rb_entry) { | ||
3633 | if (!atomic_long_inc_not_zero(&event->refcount)) { | ||
3634 | /* | ||
3635 | * This event is en-route to free_event() which will | ||
3636 | * detach it and remove it from the list. | ||
3637 | */ | ||
3638 | continue; | ||
3639 | } | ||
3640 | rcu_read_unlock(); | ||
3641 | |||
3642 | mutex_lock(&event->mmap_mutex); | ||
3643 | /* | ||
3644 | * Check we didn't race with perf_event_set_output() which can | ||
3645 | * swizzle the rb from under us while we were waiting to | ||
3646 | * acquire mmap_mutex. | ||
3647 | * | ||
3648 | * If we find a different rb; ignore this event, a next | ||
3649 | * iteration will no longer find it on the list. We have to | ||
3650 | * still restart the iteration to make sure we're not now | ||
3651 | * iterating the wrong list. | ||
3652 | */ | ||
3653 | if (event->rb == rb) { | ||
3654 | rcu_assign_pointer(event->rb, NULL); | ||
3655 | ring_buffer_detach(event, rb); | ||
3656 | ring_buffer_put(rb); /* can't be last, we still have one */ | ||
3657 | } | ||
3623 | mutex_unlock(&event->mmap_mutex); | 3658 | mutex_unlock(&event->mmap_mutex); |
3659 | put_event(event); | ||
3624 | 3660 | ||
3625 | ring_buffer_put(rb); | 3661 | /* |
3626 | free_uid(user); | 3662 | * Restart the iteration; either we're on the wrong list or |
3663 | * destroyed its integrity by doing a deletion. | ||
3664 | */ | ||
3665 | goto again; | ||
3627 | } | 3666 | } |
3667 | rcu_read_unlock(); | ||
3668 | |||
3669 | /* | ||
3670 | * It could be there's still a few 0-ref events on the list; they'll | ||
3671 | * get cleaned up by free_event() -- they'll also still have their | ||
3672 | * ref on the rb and will free it whenever they are done with it. | ||
3673 | * | ||
3674 | * Aside from that, this buffer is 'fully' detached and unmapped, | ||
3675 | * undo the VM accounting. | ||
3676 | */ | ||
3677 | |||
3678 | atomic_long_sub((size >> PAGE_SHIFT) + 1, &mmap_user->locked_vm); | ||
3679 | vma->vm_mm->pinned_vm -= mmap_locked; | ||
3680 | free_uid(mmap_user); | ||
3681 | |||
3682 | ring_buffer_put(rb); /* could be last */ | ||
3628 | } | 3683 | } |
3629 | 3684 | ||
3630 | static const struct vm_operations_struct perf_mmap_vmops = { | 3685 | static const struct vm_operations_struct perf_mmap_vmops = { |
@@ -3674,12 +3729,24 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma) | |||
3674 | return -EINVAL; | 3729 | return -EINVAL; |
3675 | 3730 | ||
3676 | WARN_ON_ONCE(event->ctx->parent_ctx); | 3731 | WARN_ON_ONCE(event->ctx->parent_ctx); |
3732 | again: | ||
3677 | mutex_lock(&event->mmap_mutex); | 3733 | mutex_lock(&event->mmap_mutex); |
3678 | if (event->rb) { | 3734 | if (event->rb) { |
3679 | if (event->rb->nr_pages == nr_pages) | 3735 | if (event->rb->nr_pages != nr_pages) { |
3680 | atomic_inc(&event->rb->refcount); | ||
3681 | else | ||
3682 | ret = -EINVAL; | 3736 | ret = -EINVAL; |
3737 | goto unlock; | ||
3738 | } | ||
3739 | |||
3740 | if (!atomic_inc_not_zero(&event->rb->mmap_count)) { | ||
3741 | /* | ||
3742 | * Raced against perf_mmap_close() through | ||
3743 | * perf_event_set_output(). Try again, hope for better | ||
3744 | * luck. | ||
3745 | */ | ||
3746 | mutex_unlock(&event->mmap_mutex); | ||
3747 | goto again; | ||
3748 | } | ||
3749 | |||
3683 | goto unlock; | 3750 | goto unlock; |
3684 | } | 3751 | } |
3685 | 3752 | ||
@@ -3720,12 +3787,16 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma) | |||
3720 | ret = -ENOMEM; | 3787 | ret = -ENOMEM; |
3721 | goto unlock; | 3788 | goto unlock; |
3722 | } | 3789 | } |
3723 | rcu_assign_pointer(event->rb, rb); | 3790 | |
3791 | atomic_set(&rb->mmap_count, 1); | ||
3792 | rb->mmap_locked = extra; | ||
3793 | rb->mmap_user = get_current_user(); | ||
3724 | 3794 | ||
3725 | atomic_long_add(user_extra, &user->locked_vm); | 3795 | atomic_long_add(user_extra, &user->locked_vm); |
3726 | event->mmap_locked = extra; | 3796 | vma->vm_mm->pinned_vm += extra; |
3727 | event->mmap_user = get_current_user(); | 3797 | |
3728 | vma->vm_mm->pinned_vm += event->mmap_locked; | 3798 | ring_buffer_attach(event, rb); |
3799 | rcu_assign_pointer(event->rb, rb); | ||
3729 | 3800 | ||
3730 | perf_event_update_userpage(event); | 3801 | perf_event_update_userpage(event); |
3731 | 3802 | ||
@@ -3734,7 +3805,11 @@ unlock: | |||
3734 | atomic_inc(&event->mmap_count); | 3805 | atomic_inc(&event->mmap_count); |
3735 | mutex_unlock(&event->mmap_mutex); | 3806 | mutex_unlock(&event->mmap_mutex); |
3736 | 3807 | ||
3737 | vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; | 3808 | /* |
3809 | * Since pinned accounting is per vm we cannot allow fork() to copy our | ||
3810 | * vma. | ||
3811 | */ | ||
3812 | vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND | VM_DONTDUMP; | ||
3738 | vma->vm_ops = &perf_mmap_vmops; | 3813 | vma->vm_ops = &perf_mmap_vmops; |
3739 | 3814 | ||
3740 | return ret; | 3815 | return ret; |
@@ -6412,6 +6487,8 @@ set: | |||
6412 | if (atomic_read(&event->mmap_count)) | 6487 | if (atomic_read(&event->mmap_count)) |
6413 | goto unlock; | 6488 | goto unlock; |
6414 | 6489 | ||
6490 | old_rb = event->rb; | ||
6491 | |||
6415 | if (output_event) { | 6492 | if (output_event) { |
6416 | /* get the rb we want to redirect to */ | 6493 | /* get the rb we want to redirect to */ |
6417 | rb = ring_buffer_get(output_event); | 6494 | rb = ring_buffer_get(output_event); |
@@ -6419,16 +6496,28 @@ set: | |||
6419 | goto unlock; | 6496 | goto unlock; |
6420 | } | 6497 | } |
6421 | 6498 | ||
6422 | old_rb = event->rb; | ||
6423 | rcu_assign_pointer(event->rb, rb); | ||
6424 | if (old_rb) | 6499 | if (old_rb) |
6425 | ring_buffer_detach(event, old_rb); | 6500 | ring_buffer_detach(event, old_rb); |
6501 | |||
6502 | if (rb) | ||
6503 | ring_buffer_attach(event, rb); | ||
6504 | |||
6505 | rcu_assign_pointer(event->rb, rb); | ||
6506 | |||
6507 | if (old_rb) { | ||
6508 | ring_buffer_put(old_rb); | ||
6509 | /* | ||
6510 | * Since we detached before setting the new rb, so that we | ||
6511 | * could attach the new rb, we could have missed a wakeup. | ||
6512 | * Provide it now. | ||
6513 | */ | ||
6514 | wake_up_all(&event->waitq); | ||
6515 | } | ||
6516 | |||
6426 | ret = 0; | 6517 | ret = 0; |
6427 | unlock: | 6518 | unlock: |
6428 | mutex_unlock(&event->mmap_mutex); | 6519 | mutex_unlock(&event->mmap_mutex); |
6429 | 6520 | ||
6430 | if (old_rb) | ||
6431 | ring_buffer_put(old_rb); | ||
6432 | out: | 6521 | out: |
6433 | return ret; | 6522 | return ret; |
6434 | } | 6523 | } |
diff --git a/kernel/events/internal.h b/kernel/events/internal.h index eb675c4d59df..ca6599723be5 100644 --- a/kernel/events/internal.h +++ b/kernel/events/internal.h | |||
@@ -31,6 +31,10 @@ struct ring_buffer { | |||
31 | spinlock_t event_lock; | 31 | spinlock_t event_lock; |
32 | struct list_head event_list; | 32 | struct list_head event_list; |
33 | 33 | ||
34 | atomic_t mmap_count; | ||
35 | unsigned long mmap_locked; | ||
36 | struct user_struct *mmap_user; | ||
37 | |||
34 | struct perf_event_mmap_page *user_page; | 38 | struct perf_event_mmap_page *user_page; |
35 | void *data_pages[0]; | 39 | void *data_pages[0]; |
36 | }; | 40 | }; |
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 3fed7f0cbcdf..bddf3b201a48 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -467,6 +467,7 @@ static struct kprobe *__kprobes get_optimized_kprobe(unsigned long addr) | |||
467 | /* Optimization staging list, protected by kprobe_mutex */ | 467 | /* Optimization staging list, protected by kprobe_mutex */ |
468 | static LIST_HEAD(optimizing_list); | 468 | static LIST_HEAD(optimizing_list); |
469 | static LIST_HEAD(unoptimizing_list); | 469 | static LIST_HEAD(unoptimizing_list); |
470 | static LIST_HEAD(freeing_list); | ||
470 | 471 | ||
471 | static void kprobe_optimizer(struct work_struct *work); | 472 | static void kprobe_optimizer(struct work_struct *work); |
472 | static DECLARE_DELAYED_WORK(optimizing_work, kprobe_optimizer); | 473 | static DECLARE_DELAYED_WORK(optimizing_work, kprobe_optimizer); |
@@ -504,7 +505,7 @@ static __kprobes void do_optimize_kprobes(void) | |||
504 | * Unoptimize (replace a jump with a breakpoint and remove the breakpoint | 505 | * Unoptimize (replace a jump with a breakpoint and remove the breakpoint |
505 | * if need) kprobes listed on unoptimizing_list. | 506 | * if need) kprobes listed on unoptimizing_list. |
506 | */ | 507 | */ |
507 | static __kprobes void do_unoptimize_kprobes(struct list_head *free_list) | 508 | static __kprobes void do_unoptimize_kprobes(void) |
508 | { | 509 | { |
509 | struct optimized_kprobe *op, *tmp; | 510 | struct optimized_kprobe *op, *tmp; |
510 | 511 | ||
@@ -515,9 +516,9 @@ static __kprobes void do_unoptimize_kprobes(struct list_head *free_list) | |||
515 | /* Ditto to do_optimize_kprobes */ | 516 | /* Ditto to do_optimize_kprobes */ |
516 | get_online_cpus(); | 517 | get_online_cpus(); |
517 | mutex_lock(&text_mutex); | 518 | mutex_lock(&text_mutex); |
518 | arch_unoptimize_kprobes(&unoptimizing_list, free_list); | 519 | arch_unoptimize_kprobes(&unoptimizing_list, &freeing_list); |
519 | /* Loop free_list for disarming */ | 520 | /* Loop free_list for disarming */ |
520 | list_for_each_entry_safe(op, tmp, free_list, list) { | 521 | list_for_each_entry_safe(op, tmp, &freeing_list, list) { |
521 | /* Disarm probes if marked disabled */ | 522 | /* Disarm probes if marked disabled */ |
522 | if (kprobe_disabled(&op->kp)) | 523 | if (kprobe_disabled(&op->kp)) |
523 | arch_disarm_kprobe(&op->kp); | 524 | arch_disarm_kprobe(&op->kp); |
@@ -536,11 +537,11 @@ static __kprobes void do_unoptimize_kprobes(struct list_head *free_list) | |||
536 | } | 537 | } |
537 | 538 | ||
538 | /* Reclaim all kprobes on the free_list */ | 539 | /* Reclaim all kprobes on the free_list */ |
539 | static __kprobes void do_free_cleaned_kprobes(struct list_head *free_list) | 540 | static __kprobes void do_free_cleaned_kprobes(void) |
540 | { | 541 | { |
541 | struct optimized_kprobe *op, *tmp; | 542 | struct optimized_kprobe *op, *tmp; |
542 | 543 | ||
543 | list_for_each_entry_safe(op, tmp, free_list, list) { | 544 | list_for_each_entry_safe(op, tmp, &freeing_list, list) { |
544 | BUG_ON(!kprobe_unused(&op->kp)); | 545 | BUG_ON(!kprobe_unused(&op->kp)); |
545 | list_del_init(&op->list); | 546 | list_del_init(&op->list); |
546 | free_aggr_kprobe(&op->kp); | 547 | free_aggr_kprobe(&op->kp); |
@@ -556,8 +557,6 @@ static __kprobes void kick_kprobe_optimizer(void) | |||
556 | /* Kprobe jump optimizer */ | 557 | /* Kprobe jump optimizer */ |
557 | static __kprobes void kprobe_optimizer(struct work_struct *work) | 558 | static __kprobes void kprobe_optimizer(struct work_struct *work) |
558 | { | 559 | { |
559 | LIST_HEAD(free_list); | ||
560 | |||
561 | mutex_lock(&kprobe_mutex); | 560 | mutex_lock(&kprobe_mutex); |
562 | /* Lock modules while optimizing kprobes */ | 561 | /* Lock modules while optimizing kprobes */ |
563 | mutex_lock(&module_mutex); | 562 | mutex_lock(&module_mutex); |
@@ -566,7 +565,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work) | |||
566 | * Step 1: Unoptimize kprobes and collect cleaned (unused and disarmed) | 565 | * Step 1: Unoptimize kprobes and collect cleaned (unused and disarmed) |
567 | * kprobes before waiting for quiesence period. | 566 | * kprobes before waiting for quiesence period. |
568 | */ | 567 | */ |
569 | do_unoptimize_kprobes(&free_list); | 568 | do_unoptimize_kprobes(); |
570 | 569 | ||
571 | /* | 570 | /* |
572 | * Step 2: Wait for quiesence period to ensure all running interrupts | 571 | * Step 2: Wait for quiesence period to ensure all running interrupts |
@@ -581,7 +580,7 @@ static __kprobes void kprobe_optimizer(struct work_struct *work) | |||
581 | do_optimize_kprobes(); | 580 | do_optimize_kprobes(); |
582 | 581 | ||
583 | /* Step 4: Free cleaned kprobes after quiesence period */ | 582 | /* Step 4: Free cleaned kprobes after quiesence period */ |
584 | do_free_cleaned_kprobes(&free_list); | 583 | do_free_cleaned_kprobes(); |
585 | 584 | ||
586 | mutex_unlock(&module_mutex); | 585 | mutex_unlock(&module_mutex); |
587 | mutex_unlock(&kprobe_mutex); | 586 | mutex_unlock(&kprobe_mutex); |
@@ -723,8 +722,19 @@ static void __kprobes kill_optimized_kprobe(struct kprobe *p) | |||
723 | if (!list_empty(&op->list)) | 722 | if (!list_empty(&op->list)) |
724 | /* Dequeue from the (un)optimization queue */ | 723 | /* Dequeue from the (un)optimization queue */ |
725 | list_del_init(&op->list); | 724 | list_del_init(&op->list); |
726 | |||
727 | op->kp.flags &= ~KPROBE_FLAG_OPTIMIZED; | 725 | op->kp.flags &= ~KPROBE_FLAG_OPTIMIZED; |
726 | |||
727 | if (kprobe_unused(p)) { | ||
728 | /* Enqueue if it is unused */ | ||
729 | list_add(&op->list, &freeing_list); | ||
730 | /* | ||
731 | * Remove unused probes from the hash list. After waiting | ||
732 | * for synchronization, this probe is reclaimed. | ||
733 | * (reclaiming is done by do_free_cleaned_kprobes().) | ||
734 | */ | ||
735 | hlist_del_rcu(&op->kp.hlist); | ||
736 | } | ||
737 | |||
728 | /* Don't touch the code, because it is already freed. */ | 738 | /* Don't touch the code, because it is already freed. */ |
729 | arch_remove_optimized_kprobe(op); | 739 | arch_remove_optimized_kprobe(op); |
730 | } | 740 | } |
diff --git a/kernel/range.c b/kernel/range.c index eb911dbce267..322ea8e93e4b 100644 --- a/kernel/range.c +++ b/kernel/range.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
5 | #include <linux/init.h> | 5 | #include <linux/init.h> |
6 | #include <linux/sort.h> | 6 | #include <linux/sort.h> |
7 | 7 | #include <linux/string.h> | |
8 | #include <linux/range.h> | 8 | #include <linux/range.h> |
9 | 9 | ||
10 | int add_range(struct range *range, int az, int nr_range, u64 start, u64 end) | 10 | int add_range(struct range *range, int az, int nr_range, u64 start, u64 end) |
@@ -32,9 +32,8 @@ int add_range_with_merge(struct range *range, int az, int nr_range, | |||
32 | if (start >= end) | 32 | if (start >= end) |
33 | return nr_range; | 33 | return nr_range; |
34 | 34 | ||
35 | /* Try to merge it with old one: */ | 35 | /* get new start/end: */ |
36 | for (i = 0; i < nr_range; i++) { | 36 | for (i = 0; i < nr_range; i++) { |
37 | u64 final_start, final_end; | ||
38 | u64 common_start, common_end; | 37 | u64 common_start, common_end; |
39 | 38 | ||
40 | if (!range[i].end) | 39 | if (!range[i].end) |
@@ -45,14 +44,16 @@ int add_range_with_merge(struct range *range, int az, int nr_range, | |||
45 | if (common_start > common_end) | 44 | if (common_start > common_end) |
46 | continue; | 45 | continue; |
47 | 46 | ||
48 | final_start = min(range[i].start, start); | 47 | /* new start/end, will add it back at last */ |
49 | final_end = max(range[i].end, end); | 48 | start = min(range[i].start, start); |
49 | end = max(range[i].end, end); | ||
50 | 50 | ||
51 | /* clear it and add it back for further merge */ | 51 | memmove(&range[i], &range[i + 1], |
52 | range[i].start = 0; | 52 | (nr_range - (i + 1)) * sizeof(range[i])); |
53 | range[i].end = 0; | 53 | range[nr_range - 1].start = 0; |
54 | return add_range_with_merge(range, az, nr_range, | 54 | range[nr_range - 1].end = 0; |
55 | final_start, final_end); | 55 | nr_range--; |
56 | i--; | ||
56 | } | 57 | } |
57 | 58 | ||
58 | /* Need to add it: */ | 59 | /* Need to add it: */ |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 58453b8272fd..e8b335016c52 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -633,7 +633,19 @@ void wake_up_nohz_cpu(int cpu) | |||
633 | static inline bool got_nohz_idle_kick(void) | 633 | static inline bool got_nohz_idle_kick(void) |
634 | { | 634 | { |
635 | int cpu = smp_processor_id(); | 635 | int cpu = smp_processor_id(); |
636 | return idle_cpu(cpu) && test_bit(NOHZ_BALANCE_KICK, nohz_flags(cpu)); | 636 | |
637 | if (!test_bit(NOHZ_BALANCE_KICK, nohz_flags(cpu))) | ||
638 | return false; | ||
639 | |||
640 | if (idle_cpu(cpu) && !need_resched()) | ||
641 | return true; | ||
642 | |||
643 | /* | ||
644 | * We can't run Idle Load Balance on this CPU for this time so we | ||
645 | * cancel it and clear NOHZ_BALANCE_KICK | ||
646 | */ | ||
647 | clear_bit(NOHZ_BALANCE_KICK, nohz_flags(cpu)); | ||
648 | return false; | ||
637 | } | 649 | } |
638 | 650 | ||
639 | #else /* CONFIG_NO_HZ_COMMON */ | 651 | #else /* CONFIG_NO_HZ_COMMON */ |
@@ -1393,8 +1405,9 @@ static void sched_ttwu_pending(void) | |||
1393 | 1405 | ||
1394 | void scheduler_ipi(void) | 1406 | void scheduler_ipi(void) |
1395 | { | 1407 | { |
1396 | if (llist_empty(&this_rq()->wake_list) && !got_nohz_idle_kick() | 1408 | if (llist_empty(&this_rq()->wake_list) |
1397 | && !tick_nohz_full_cpu(smp_processor_id())) | 1409 | && !tick_nohz_full_cpu(smp_processor_id()) |
1410 | && !got_nohz_idle_kick()) | ||
1398 | return; | 1411 | return; |
1399 | 1412 | ||
1400 | /* | 1413 | /* |
@@ -1417,7 +1430,7 @@ void scheduler_ipi(void) | |||
1417 | /* | 1430 | /* |
1418 | * Check if someone kicked us for doing the nohz idle load balance. | 1431 | * Check if someone kicked us for doing the nohz idle load balance. |
1419 | */ | 1432 | */ |
1420 | if (unlikely(got_nohz_idle_kick() && !need_resched())) { | 1433 | if (unlikely(got_nohz_idle_kick())) { |
1421 | this_rq()->idle_balance = 1; | 1434 | this_rq()->idle_balance = 1; |
1422 | raise_softirq_irqoff(SCHED_SOFTIRQ); | 1435 | raise_softirq_irqoff(SCHED_SOFTIRQ); |
1423 | } | 1436 | } |
@@ -4745,7 +4758,7 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu) | |||
4745 | */ | 4758 | */ |
4746 | idle->sched_class = &idle_sched_class; | 4759 | idle->sched_class = &idle_sched_class; |
4747 | ftrace_graph_init_idle_task(idle, cpu); | 4760 | ftrace_graph_init_idle_task(idle, cpu); |
4748 | vtime_init_idle(idle); | 4761 | vtime_init_idle(idle, cpu); |
4749 | #if defined(CONFIG_SMP) | 4762 | #if defined(CONFIG_SMP) |
4750 | sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu); | 4763 | sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu); |
4751 | #endif | 4764 | #endif |
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index cc2dc3eea8a3..b5ccba22603b 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c | |||
@@ -747,17 +747,17 @@ void arch_vtime_task_switch(struct task_struct *prev) | |||
747 | 747 | ||
748 | write_seqlock(¤t->vtime_seqlock); | 748 | write_seqlock(¤t->vtime_seqlock); |
749 | current->vtime_snap_whence = VTIME_SYS; | 749 | current->vtime_snap_whence = VTIME_SYS; |
750 | current->vtime_snap = sched_clock(); | 750 | current->vtime_snap = sched_clock_cpu(smp_processor_id()); |
751 | write_sequnlock(¤t->vtime_seqlock); | 751 | write_sequnlock(¤t->vtime_seqlock); |
752 | } | 752 | } |
753 | 753 | ||
754 | void vtime_init_idle(struct task_struct *t) | 754 | void vtime_init_idle(struct task_struct *t, int cpu) |
755 | { | 755 | { |
756 | unsigned long flags; | 756 | unsigned long flags; |
757 | 757 | ||
758 | write_seqlock_irqsave(&t->vtime_seqlock, flags); | 758 | write_seqlock_irqsave(&t->vtime_seqlock, flags); |
759 | t->vtime_snap_whence = VTIME_SYS; | 759 | t->vtime_snap_whence = VTIME_SYS; |
760 | t->vtime_snap = sched_clock(); | 760 | t->vtime_snap = sched_clock_cpu(cpu); |
761 | write_sequnlock_irqrestore(&t->vtime_seqlock, flags); | 761 | write_sequnlock_irqrestore(&t->vtime_seqlock, flags); |
762 | } | 762 | } |
763 | 763 | ||
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 0c739423b0f9..b4c245580b79 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -698,10 +698,6 @@ void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | |||
698 | 698 | ||
699 | bc->event_handler = tick_handle_oneshot_broadcast; | 699 | bc->event_handler = tick_handle_oneshot_broadcast; |
700 | 700 | ||
701 | /* Take the do_timer update */ | ||
702 | if (!tick_nohz_full_cpu(cpu)) | ||
703 | tick_do_timer_cpu = cpu; | ||
704 | |||
705 | /* | 701 | /* |
706 | * We must be careful here. There might be other CPUs | 702 | * We must be careful here. There might be other CPUs |
707 | * waiting for periodic broadcast. We need to set the | 703 | * waiting for periodic broadcast. We need to set the |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index f4208138fbf4..0cf1c1453181 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -306,7 +306,7 @@ static int __cpuinit tick_nohz_cpu_down_callback(struct notifier_block *nfb, | |||
306 | * we can't safely shutdown that CPU. | 306 | * we can't safely shutdown that CPU. |
307 | */ | 307 | */ |
308 | if (have_nohz_full_mask && tick_do_timer_cpu == cpu) | 308 | if (have_nohz_full_mask && tick_do_timer_cpu == cpu) |
309 | return -EINVAL; | 309 | return NOTIFY_BAD; |
310 | break; | 310 | break; |
311 | } | 311 | } |
312 | return NOTIFY_OK; | 312 | return NOTIFY_OK; |
diff --git a/mm/slab_common.c b/mm/slab_common.c index ff3218a0f5e1..2d414508e9ec 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c | |||
@@ -373,8 +373,10 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags) | |||
373 | { | 373 | { |
374 | int index; | 374 | int index; |
375 | 375 | ||
376 | if (WARN_ON_ONCE(size > KMALLOC_MAX_SIZE)) | 376 | if (size > KMALLOC_MAX_SIZE) { |
377 | WARN_ON_ONCE(!(flags & __GFP_NOWARN)); | ||
377 | return NULL; | 378 | return NULL; |
379 | } | ||
378 | 380 | ||
379 | if (size <= 192) { | 381 | if (size <= 192) { |
380 | if (!size) | 382 | if (!size) |
diff --git a/sound/soc/au1x/ac97c.c b/sound/soc/au1x/ac97c.c index 44b8dcecf571..d6f7694fcad4 100644 --- a/sound/soc/au1x/ac97c.c +++ b/sound/soc/au1x/ac97c.c | |||
@@ -179,13 +179,12 @@ static void au1xac97c_ac97_cold_reset(struct snd_ac97 *ac97) | |||
179 | } | 179 | } |
180 | 180 | ||
181 | /* AC97 controller operations */ | 181 | /* AC97 controller operations */ |
182 | struct snd_ac97_bus_ops soc_ac97_ops = { | 182 | static struct snd_ac97_bus_ops ac97c_bus_ops = { |
183 | .read = au1xac97c_ac97_read, | 183 | .read = au1xac97c_ac97_read, |
184 | .write = au1xac97c_ac97_write, | 184 | .write = au1xac97c_ac97_write, |
185 | .reset = au1xac97c_ac97_cold_reset, | 185 | .reset = au1xac97c_ac97_cold_reset, |
186 | .warm_reset = au1xac97c_ac97_warm_reset, | 186 | .warm_reset = au1xac97c_ac97_warm_reset, |
187 | }; | 187 | }; |
188 | EXPORT_SYMBOL_GPL(soc_ac97_ops); /* globals be gone! */ | ||
189 | 188 | ||
190 | static int alchemy_ac97c_startup(struct snd_pcm_substream *substream, | 189 | static int alchemy_ac97c_startup(struct snd_pcm_substream *substream, |
191 | struct snd_soc_dai *dai) | 190 | struct snd_soc_dai *dai) |
@@ -272,6 +271,10 @@ static int au1xac97c_drvprobe(struct platform_device *pdev) | |||
272 | 271 | ||
273 | platform_set_drvdata(pdev, ctx); | 272 | platform_set_drvdata(pdev, ctx); |
274 | 273 | ||
274 | ret = snd_soc_set_ac97_ops(&ac97c_bus_ops); | ||
275 | if (ret) | ||
276 | return ret; | ||
277 | |||
275 | ret = snd_soc_register_component(&pdev->dev, &au1xac97c_component, | 278 | ret = snd_soc_register_component(&pdev->dev, &au1xac97c_component, |
276 | &au1xac97c_dai_driver, 1); | 279 | &au1xac97c_dai_driver, 1); |
277 | if (ret) | 280 | if (ret) |
@@ -338,19 +341,7 @@ static struct platform_driver au1xac97c_driver = { | |||
338 | .remove = au1xac97c_drvremove, | 341 | .remove = au1xac97c_drvremove, |
339 | }; | 342 | }; |
340 | 343 | ||
341 | static int __init au1xac97c_load(void) | 344 | module_platform_driver(&au1xac97c_driver); |
342 | { | ||
343 | ac97c_workdata = NULL; | ||
344 | return platform_driver_register(&au1xac97c_driver); | ||
345 | } | ||
346 | |||
347 | static void __exit au1xac97c_unload(void) | ||
348 | { | ||
349 | platform_driver_unregister(&au1xac97c_driver); | ||
350 | } | ||
351 | |||
352 | module_init(au1xac97c_load); | ||
353 | module_exit(au1xac97c_unload); | ||
354 | 345 | ||
355 | MODULE_LICENSE("GPL"); | 346 | MODULE_LICENSE("GPL"); |
356 | MODULE_DESCRIPTION("Au1000/1500/1100 AC97C ASoC driver"); | 347 | MODULE_DESCRIPTION("Au1000/1500/1100 AC97C ASoC driver"); |
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c index 8f1862aa7333..a822ab822bb7 100644 --- a/sound/soc/au1x/psc-ac97.c +++ b/sound/soc/au1x/psc-ac97.c | |||
@@ -201,13 +201,12 @@ static void au1xpsc_ac97_cold_reset(struct snd_ac97 *ac97) | |||
201 | } | 201 | } |
202 | 202 | ||
203 | /* AC97 controller operations */ | 203 | /* AC97 controller operations */ |
204 | struct snd_ac97_bus_ops soc_ac97_ops = { | 204 | static struct snd_ac97_bus_ops psc_ac97_ops = { |
205 | .read = au1xpsc_ac97_read, | 205 | .read = au1xpsc_ac97_read, |
206 | .write = au1xpsc_ac97_write, | 206 | .write = au1xpsc_ac97_write, |
207 | .reset = au1xpsc_ac97_cold_reset, | 207 | .reset = au1xpsc_ac97_cold_reset, |
208 | .warm_reset = au1xpsc_ac97_warm_reset, | 208 | .warm_reset = au1xpsc_ac97_warm_reset, |
209 | }; | 209 | }; |
210 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | ||
211 | 210 | ||
212 | static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream, | 211 | static int au1xpsc_ac97_hw_params(struct snd_pcm_substream *substream, |
213 | struct snd_pcm_hw_params *params, | 212 | struct snd_pcm_hw_params *params, |
@@ -383,15 +382,9 @@ static int au1xpsc_ac97_drvprobe(struct platform_device *pdev) | |||
383 | if (!iores) | 382 | if (!iores) |
384 | return -ENODEV; | 383 | return -ENODEV; |
385 | 384 | ||
386 | if (!devm_request_mem_region(&pdev->dev, iores->start, | 385 | wd->mmio = devm_ioremap_resource(&pdev->dev, iores); |
387 | resource_size(iores), | 386 | if (IS_ERR(wd->mmio)) |
388 | pdev->name)) | 387 | return PTR_ERR(wd->mmio); |
389 | return -EBUSY; | ||
390 | |||
391 | wd->mmio = devm_ioremap(&pdev->dev, iores->start, | ||
392 | resource_size(iores)); | ||
393 | if (!wd->mmio) | ||
394 | return -EBUSY; | ||
395 | 388 | ||
396 | dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 389 | dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
397 | if (!dmares) | 390 | if (!dmares) |
@@ -423,6 +416,10 @@ static int au1xpsc_ac97_drvprobe(struct platform_device *pdev) | |||
423 | 416 | ||
424 | platform_set_drvdata(pdev, wd); | 417 | platform_set_drvdata(pdev, wd); |
425 | 418 | ||
419 | ret = snd_soc_set_ac97_ops(&psc_ac97_ops); | ||
420 | if (ret) | ||
421 | return ret; | ||
422 | |||
426 | ret = snd_soc_register_component(&pdev->dev, &au1xpsc_ac97_component, | 423 | ret = snd_soc_register_component(&pdev->dev, &au1xpsc_ac97_component, |
427 | &wd->dai_drv, 1); | 424 | &wd->dai_drv, 1); |
428 | if (ret) | 425 | if (ret) |
@@ -503,19 +500,7 @@ static struct platform_driver au1xpsc_ac97_driver = { | |||
503 | .remove = au1xpsc_ac97_drvremove, | 500 | .remove = au1xpsc_ac97_drvremove, |
504 | }; | 501 | }; |
505 | 502 | ||
506 | static int __init au1xpsc_ac97_load(void) | 503 | module_platform_driver(au1xpsc_ac97_driver); |
507 | { | ||
508 | au1xpsc_ac97_workdata = NULL; | ||
509 | return platform_driver_register(&au1xpsc_ac97_driver); | ||
510 | } | ||
511 | |||
512 | static void __exit au1xpsc_ac97_unload(void) | ||
513 | { | ||
514 | platform_driver_unregister(&au1xpsc_ac97_driver); | ||
515 | } | ||
516 | |||
517 | module_init(au1xpsc_ac97_load); | ||
518 | module_exit(au1xpsc_ac97_unload); | ||
519 | 504 | ||
520 | MODULE_LICENSE("GPL"); | 505 | MODULE_LICENSE("GPL"); |
521 | MODULE_DESCRIPTION("Au12x0/Au1550 PSC AC97 ALSA ASoC audio driver"); | 506 | MODULE_DESCRIPTION("Au12x0/Au1550 PSC AC97 ALSA ASoC audio driver"); |
diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c index c66bef826ac5..efb1daecd0dd 100644 --- a/sound/soc/blackfin/bf5xx-ac97.c +++ b/sound/soc/blackfin/bf5xx-ac97.c | |||
@@ -198,13 +198,12 @@ static void bf5xx_ac97_cold_reset(struct snd_ac97 *ac97) | |||
198 | #endif | 198 | #endif |
199 | } | 199 | } |
200 | 200 | ||
201 | struct snd_ac97_bus_ops soc_ac97_ops = { | 201 | static struct snd_ac97_bus_ops bf5xx_ac97_ops = { |
202 | .read = bf5xx_ac97_read, | 202 | .read = bf5xx_ac97_read, |
203 | .write = bf5xx_ac97_write, | 203 | .write = bf5xx_ac97_write, |
204 | .warm_reset = bf5xx_ac97_warm_reset, | 204 | .warm_reset = bf5xx_ac97_warm_reset, |
205 | .reset = bf5xx_ac97_cold_reset, | 205 | .reset = bf5xx_ac97_cold_reset, |
206 | }; | 206 | }; |
207 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | ||
208 | 207 | ||
209 | #ifdef CONFIG_PM | 208 | #ifdef CONFIG_PM |
210 | static int bf5xx_ac97_suspend(struct snd_soc_dai *dai) | 209 | static int bf5xx_ac97_suspend(struct snd_soc_dai *dai) |
@@ -293,13 +292,14 @@ static int asoc_bfin_ac97_probe(struct platform_device *pdev) | |||
293 | 292 | ||
294 | #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET | 293 | #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET |
295 | /* Request PB3 as reset pin */ | 294 | /* Request PB3 as reset pin */ |
296 | if (gpio_request(CONFIG_SND_BF5XX_RESET_GPIO_NUM, "SND_AD198x RESET")) { | 295 | ret = devm_gpio_request_one(&pdev->dev, |
297 | pr_err("Failed to request GPIO_%d for reset\n", | 296 | CONFIG_SND_BF5XX_RESET_GPIO_NUM, |
298 | CONFIG_SND_BF5XX_RESET_GPIO_NUM); | 297 | GPIOF_OUT_INIT_HIGH, "SND_AD198x RESET") { |
299 | ret = -1; | 298 | dev_err(&pdev->dev, |
299 | "Failed to request GPIO_%d for reset: %d\n", | ||
300 | CONFIG_SND_BF5XX_RESET_GPIO_NUM, ret); | ||
300 | goto gpio_err; | 301 | goto gpio_err; |
301 | } | 302 | } |
302 | gpio_direction_output(CONFIG_SND_BF5XX_RESET_GPIO_NUM, 1); | ||
303 | #endif | 303 | #endif |
304 | 304 | ||
305 | sport_handle = sport_init(pdev, 2, sizeof(struct ac97_frame), | 305 | sport_handle = sport_init(pdev, 2, sizeof(struct ac97_frame), |
@@ -335,6 +335,12 @@ static int asoc_bfin_ac97_probe(struct platform_device *pdev) | |||
335 | goto sport_config_err; | 335 | goto sport_config_err; |
336 | } | 336 | } |
337 | 337 | ||
338 | ret = snd_soc_set_ac97_ops(&bf5xx_ac97_ops); | ||
339 | if (ret != 0) { | ||
340 | dev_err(&pdev->dev, "Failed to set AC'97 ops: %d\n", ret); | ||
341 | goto sport_config_err; | ||
342 | } | ||
343 | |||
338 | ret = snd_soc_register_component(&pdev->dev, &bfin_ac97_component, | 344 | ret = snd_soc_register_component(&pdev->dev, &bfin_ac97_component, |
339 | &bfin_ac97_dai, 1); | 345 | &bfin_ac97_dai, 1); |
340 | if (ret) { | 346 | if (ret) { |
@@ -349,10 +355,7 @@ static int asoc_bfin_ac97_probe(struct platform_device *pdev) | |||
349 | sport_config_err: | 355 | sport_config_err: |
350 | sport_done(sport_handle); | 356 | sport_done(sport_handle); |
351 | sport_err: | 357 | sport_err: |
352 | #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET | 358 | snd_soc_set_ac97_ops(NULL); |
353 | gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); | ||
354 | gpio_err: | ||
355 | #endif | ||
356 | 359 | ||
357 | return ret; | 360 | return ret; |
358 | } | 361 | } |
@@ -363,9 +366,7 @@ static int asoc_bfin_ac97_remove(struct platform_device *pdev) | |||
363 | 366 | ||
364 | snd_soc_unregister_component(&pdev->dev); | 367 | snd_soc_unregister_component(&pdev->dev); |
365 | sport_done(sport_handle); | 368 | sport_done(sport_handle); |
366 | #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET | 369 | snd_soc_set_ac97_ops(NULL); |
367 | gpio_free(CONFIG_SND_BF5XX_RESET_GPIO_NUM); | ||
368 | #endif | ||
369 | 370 | ||
370 | return 0; | 371 | return 0; |
371 | } | 372 | } |
diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c index 3f4f88877c84..ac73c607410a 100644 --- a/sound/soc/cirrus/ep93xx-ac97.c +++ b/sound/soc/cirrus/ep93xx-ac97.c | |||
@@ -237,13 +237,12 @@ static irqreturn_t ep93xx_ac97_interrupt(int irq, void *dev_id) | |||
237 | return IRQ_HANDLED; | 237 | return IRQ_HANDLED; |
238 | } | 238 | } |
239 | 239 | ||
240 | struct snd_ac97_bus_ops soc_ac97_ops = { | 240 | static struct snd_ac97_bus_ops ep93xx_ac97_ops = { |
241 | .read = ep93xx_ac97_read, | 241 | .read = ep93xx_ac97_read, |
242 | .write = ep93xx_ac97_write, | 242 | .write = ep93xx_ac97_write, |
243 | .reset = ep93xx_ac97_cold_reset, | 243 | .reset = ep93xx_ac97_cold_reset, |
244 | .warm_reset = ep93xx_ac97_warm_reset, | 244 | .warm_reset = ep93xx_ac97_warm_reset, |
245 | }; | 245 | }; |
246 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | ||
247 | 246 | ||
248 | static int ep93xx_ac97_trigger(struct snd_pcm_substream *substream, | 247 | static int ep93xx_ac97_trigger(struct snd_pcm_substream *substream, |
249 | int cmd, struct snd_soc_dai *dai) | 248 | int cmd, struct snd_soc_dai *dai) |
@@ -389,6 +388,10 @@ static int ep93xx_ac97_probe(struct platform_device *pdev) | |||
389 | ep93xx_ac97_info = info; | 388 | ep93xx_ac97_info = info; |
390 | platform_set_drvdata(pdev, info); | 389 | platform_set_drvdata(pdev, info); |
391 | 390 | ||
391 | ret = snd_soc_set_ac97_ops(&ep93xx_ac97_ops); | ||
392 | if (ret) | ||
393 | goto fail; | ||
394 | |||
392 | ret = snd_soc_register_component(&pdev->dev, &ep93xx_ac97_component, | 395 | ret = snd_soc_register_component(&pdev->dev, &ep93xx_ac97_component, |
393 | &ep93xx_ac97_dai, 1); | 396 | &ep93xx_ac97_dai, 1); |
394 | if (ret) | 397 | if (ret) |
@@ -398,7 +401,7 @@ static int ep93xx_ac97_probe(struct platform_device *pdev) | |||
398 | 401 | ||
399 | fail: | 402 | fail: |
400 | ep93xx_ac97_info = NULL; | 403 | ep93xx_ac97_info = NULL; |
401 | dev_set_drvdata(&pdev->dev, NULL); | 404 | snd_soc_set_ac97_ops(NULL); |
402 | return ret; | 405 | return ret; |
403 | } | 406 | } |
404 | 407 | ||
@@ -412,7 +415,8 @@ static int ep93xx_ac97_remove(struct platform_device *pdev) | |||
412 | ep93xx_ac97_write_reg(info, AC97GCR, 0); | 415 | ep93xx_ac97_write_reg(info, AC97GCR, 0); |
413 | 416 | ||
414 | ep93xx_ac97_info = NULL; | 417 | ep93xx_ac97_info = NULL; |
415 | dev_set_drvdata(&pdev->dev, NULL); | 418 | |
419 | snd_soc_set_ac97_ops(NULL); | ||
416 | 420 | ||
417 | return 0; | 421 | return 0; |
418 | } | 422 | } |
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c index 1382f3f3f4bf..8af04343cc1a 100644 --- a/sound/soc/codecs/88pm860x-codec.c +++ b/sound/soc/codecs/88pm860x-codec.c | |||
@@ -120,10 +120,8 @@ | |||
120 | * before DAC & PGA in DAPM power-off sequence. | 120 | * before DAC & PGA in DAPM power-off sequence. |
121 | */ | 121 | */ |
122 | #define PM860X_DAPM_OUTPUT(wname, wevent) \ | 122 | #define PM860X_DAPM_OUTPUT(wname, wevent) \ |
123 | { .id = snd_soc_dapm_pga, .name = wname, .reg = SND_SOC_NOPM, \ | 123 | SND_SOC_DAPM_PGA_E(wname, SND_SOC_NOPM, 0, 0, NULL, 0, wevent, \ |
124 | .shift = 0, .invert = 0, .kcontrol_news = NULL, \ | 124 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD) |
125 | .num_kcontrols = 0, .event = wevent, \ | ||
126 | .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD, } | ||
127 | 125 | ||
128 | struct pm860x_det { | 126 | struct pm860x_det { |
129 | struct snd_soc_jack *hp_jack; | 127 | struct snd_soc_jack *hp_jack; |
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c index ef2ae32ffc66..ec7351803c24 100644 --- a/sound/soc/codecs/ac97.c +++ b/sound/soc/codecs/ac97.c | |||
@@ -62,13 +62,13 @@ static struct snd_soc_dai_driver ac97_dai = { | |||
62 | static unsigned int ac97_read(struct snd_soc_codec *codec, | 62 | static unsigned int ac97_read(struct snd_soc_codec *codec, |
63 | unsigned int reg) | 63 | unsigned int reg) |
64 | { | 64 | { |
65 | return soc_ac97_ops.read(codec->ac97, reg); | 65 | return soc_ac97_ops->read(codec->ac97, reg); |
66 | } | 66 | } |
67 | 67 | ||
68 | static int ac97_write(struct snd_soc_codec *codec, unsigned int reg, | 68 | static int ac97_write(struct snd_soc_codec *codec, unsigned int reg, |
69 | unsigned int val) | 69 | unsigned int val) |
70 | { | 70 | { |
71 | soc_ac97_ops.write(codec->ac97, reg, val); | 71 | soc_ac97_ops->write(codec->ac97, reg, val); |
72 | return 0; | 72 | return 0; |
73 | } | 73 | } |
74 | 74 | ||
@@ -79,7 +79,8 @@ static int ac97_soc_probe(struct snd_soc_codec *codec) | |||
79 | int ret; | 79 | int ret; |
80 | 80 | ||
81 | /* add codec as bus device for standard ac97 */ | 81 | /* add codec as bus device for standard ac97 */ |
82 | ret = snd_ac97_bus(codec->card->snd_card, 0, &soc_ac97_ops, NULL, &ac97_bus); | 82 | ret = snd_ac97_bus(codec->card->snd_card, 0, soc_ac97_ops, NULL, |
83 | &ac97_bus); | ||
83 | if (ret < 0) | 84 | if (ret < 0) |
84 | return ret; | 85 | return ret; |
85 | 86 | ||
diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c index f385342947d3..89fcf7d6e7b8 100644 --- a/sound/soc/codecs/ad1980.c +++ b/sound/soc/codecs/ad1980.c | |||
@@ -108,7 +108,7 @@ static unsigned int ac97_read(struct snd_soc_codec *codec, | |||
108 | case AC97_EXTENDED_STATUS: | 108 | case AC97_EXTENDED_STATUS: |
109 | case AC97_VENDOR_ID1: | 109 | case AC97_VENDOR_ID1: |
110 | case AC97_VENDOR_ID2: | 110 | case AC97_VENDOR_ID2: |
111 | return soc_ac97_ops.read(codec->ac97, reg); | 111 | return soc_ac97_ops->read(codec->ac97, reg); |
112 | default: | 112 | default: |
113 | reg = reg >> 1; | 113 | reg = reg >> 1; |
114 | 114 | ||
@@ -124,7 +124,7 @@ static int ac97_write(struct snd_soc_codec *codec, unsigned int reg, | |||
124 | { | 124 | { |
125 | u16 *cache = codec->reg_cache; | 125 | u16 *cache = codec->reg_cache; |
126 | 126 | ||
127 | soc_ac97_ops.write(codec->ac97, reg, val); | 127 | soc_ac97_ops->write(codec->ac97, reg, val); |
128 | reg = reg >> 1; | 128 | reg = reg >> 1; |
129 | if (reg < ARRAY_SIZE(ad1980_reg)) | 129 | if (reg < ARRAY_SIZE(ad1980_reg)) |
130 | cache[reg] = val; | 130 | cache[reg] = val; |
@@ -154,13 +154,13 @@ static int ad1980_reset(struct snd_soc_codec *codec, int try_warm) | |||
154 | u16 retry_cnt = 0; | 154 | u16 retry_cnt = 0; |
155 | 155 | ||
156 | retry: | 156 | retry: |
157 | if (try_warm && soc_ac97_ops.warm_reset) { | 157 | if (try_warm && soc_ac97_ops->warm_reset) { |
158 | soc_ac97_ops.warm_reset(codec->ac97); | 158 | soc_ac97_ops->warm_reset(codec->ac97); |
159 | if (ac97_read(codec, AC97_RESET) == 0x0090) | 159 | if (ac97_read(codec, AC97_RESET) == 0x0090) |
160 | return 1; | 160 | return 1; |
161 | } | 161 | } |
162 | 162 | ||
163 | soc_ac97_ops.reset(codec->ac97); | 163 | soc_ac97_ops->reset(codec->ac97); |
164 | /* Set bit 16slot in register 74h, then every slot will has only 16 | 164 | /* Set bit 16slot in register 74h, then every slot will has only 16 |
165 | * bits. This command is sent out in 20bit mode, in which case the | 165 | * bits. This command is sent out in 20bit mode, in which case the |
166 | * first nibble of data is eaten by the addr. (Tag is always 16 bit)*/ | 166 | * first nibble of data is eaten by the addr. (Tag is always 16 bit)*/ |
@@ -186,7 +186,7 @@ static int ad1980_soc_probe(struct snd_soc_codec *codec) | |||
186 | 186 | ||
187 | printk(KERN_INFO "AD1980 SoC Audio Codec\n"); | 187 | printk(KERN_INFO "AD1980 SoC Audio Codec\n"); |
188 | 188 | ||
189 | ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0); | 189 | ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); |
190 | if (ret < 0) { | 190 | if (ret < 0) { |
191 | printk(KERN_ERR "ad1980: failed to register AC97 codec\n"); | 191 | printk(KERN_ERR "ad1980: failed to register AC97 codec\n"); |
192 | return ret; | 192 | return ret; |
diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c index b6b1a773bd37..0e250f118c0e 100644 --- a/sound/soc/codecs/adau1701.c +++ b/sound/soc/codecs/adau1701.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/of.h> | 16 | #include <linux/of.h> |
17 | #include <linux/of_gpio.h> | 17 | #include <linux/of_gpio.h> |
18 | #include <linux/of_device.h> | 18 | #include <linux/of_device.h> |
19 | #include <linux/regmap.h> | ||
19 | #include <sound/core.h> | 20 | #include <sound/core.h> |
20 | #include <sound/pcm.h> | 21 | #include <sound/pcm.h> |
21 | #include <sound/pcm_params.h> | 22 | #include <sound/pcm_params.h> |
@@ -24,16 +25,19 @@ | |||
24 | #include "sigmadsp.h" | 25 | #include "sigmadsp.h" |
25 | #include "adau1701.h" | 26 | #include "adau1701.h" |
26 | 27 | ||
27 | #define ADAU1701_DSPCTRL 0x1c | 28 | #define ADAU1701_DSPCTRL 0x081c |
28 | #define ADAU1701_SEROCTL 0x1e | 29 | #define ADAU1701_SEROCTL 0x081e |
29 | #define ADAU1701_SERICTL 0x1f | 30 | #define ADAU1701_SERICTL 0x081f |
30 | 31 | ||
31 | #define ADAU1701_AUXNPOW 0x22 | 32 | #define ADAU1701_AUXNPOW 0x0822 |
33 | #define ADAU1701_PINCONF_0 0x0820 | ||
34 | #define ADAU1701_PINCONF_1 0x0821 | ||
35 | #define ADAU1701_AUXNPOW 0x0822 | ||
32 | 36 | ||
33 | #define ADAU1701_OSCIPOW 0x26 | 37 | #define ADAU1701_OSCIPOW 0x0826 |
34 | #define ADAU1701_DACSET 0x27 | 38 | #define ADAU1701_DACSET 0x0827 |
35 | 39 | ||
36 | #define ADAU1701_NUM_REGS 0x28 | 40 | #define ADAU1701_MAX_REGISTER 0x0828 |
37 | 41 | ||
38 | #define ADAU1701_DSPCTRL_CR (1 << 2) | 42 | #define ADAU1701_DSPCTRL_CR (1 << 2) |
39 | #define ADAU1701_DSPCTRL_DAM (1 << 3) | 43 | #define ADAU1701_DSPCTRL_DAM (1 << 3) |
@@ -87,11 +91,18 @@ | |||
87 | #define ADAU1701_OSCIPOW_OPD 0x04 | 91 | #define ADAU1701_OSCIPOW_OPD 0x04 |
88 | #define ADAU1701_DACSET_DACINIT 1 | 92 | #define ADAU1701_DACSET_DACINIT 1 |
89 | 93 | ||
94 | #define ADAU1707_CLKDIV_UNSET (-1UL) | ||
95 | |||
90 | #define ADAU1701_FIRMWARE "adau1701.bin" | 96 | #define ADAU1701_FIRMWARE "adau1701.bin" |
91 | 97 | ||
92 | struct adau1701 { | 98 | struct adau1701 { |
93 | int gpio_nreset; | 99 | int gpio_nreset; |
100 | int gpio_pll_mode[2]; | ||
94 | unsigned int dai_fmt; | 101 | unsigned int dai_fmt; |
102 | unsigned int pll_clkdiv; | ||
103 | unsigned int sysclk; | ||
104 | struct regmap *regmap; | ||
105 | u8 pin_config[12]; | ||
95 | }; | 106 | }; |
96 | 107 | ||
97 | static const struct snd_kcontrol_new adau1701_controls[] = { | 108 | static const struct snd_kcontrol_new adau1701_controls[] = { |
@@ -123,10 +134,13 @@ static const struct snd_soc_dapm_route adau1701_dapm_routes[] = { | |||
123 | { "ADC", NULL, "IN1" }, | 134 | { "ADC", NULL, "IN1" }, |
124 | }; | 135 | }; |
125 | 136 | ||
126 | static unsigned int adau1701_register_size(struct snd_soc_codec *codec, | 137 | static unsigned int adau1701_register_size(struct device *dev, |
127 | unsigned int reg) | 138 | unsigned int reg) |
128 | { | 139 | { |
129 | switch (reg) { | 140 | switch (reg) { |
141 | case ADAU1701_PINCONF_0: | ||
142 | case ADAU1701_PINCONF_1: | ||
143 | return 3; | ||
130 | case ADAU1701_DSPCTRL: | 144 | case ADAU1701_DSPCTRL: |
131 | case ADAU1701_SEROCTL: | 145 | case ADAU1701_SEROCTL: |
132 | case ADAU1701_AUXNPOW: | 146 | case ADAU1701_AUXNPOW: |
@@ -137,33 +151,42 @@ static unsigned int adau1701_register_size(struct snd_soc_codec *codec, | |||
137 | return 1; | 151 | return 1; |
138 | } | 152 | } |
139 | 153 | ||
140 | dev_err(codec->dev, "Unsupported register address: %d\n", reg); | 154 | dev_err(dev, "Unsupported register address: %d\n", reg); |
141 | return 0; | 155 | return 0; |
142 | } | 156 | } |
143 | 157 | ||
144 | static int adau1701_write(struct snd_soc_codec *codec, unsigned int reg, | 158 | static bool adau1701_volatile_reg(struct device *dev, unsigned int reg) |
145 | unsigned int value) | ||
146 | { | 159 | { |
160 | switch (reg) { | ||
161 | case ADAU1701_DACSET: | ||
162 | return true; | ||
163 | default: | ||
164 | return false; | ||
165 | } | ||
166 | } | ||
167 | |||
168 | static int adau1701_reg_write(void *context, unsigned int reg, | ||
169 | unsigned int value) | ||
170 | { | ||
171 | struct i2c_client *client = context; | ||
147 | unsigned int i; | 172 | unsigned int i; |
148 | unsigned int size; | 173 | unsigned int size; |
149 | uint8_t buf[4]; | 174 | uint8_t buf[5]; |
150 | int ret; | 175 | int ret; |
151 | 176 | ||
152 | size = adau1701_register_size(codec, reg); | 177 | size = adau1701_register_size(&client->dev, reg); |
153 | if (size == 0) | 178 | if (size == 0) |
154 | return -EINVAL; | 179 | return -EINVAL; |
155 | 180 | ||
156 | snd_soc_cache_write(codec, reg, value); | 181 | buf[0] = reg >> 8; |
157 | 182 | buf[1] = reg & 0xff; | |
158 | buf[0] = 0x08; | ||
159 | buf[1] = reg; | ||
160 | 183 | ||
161 | for (i = size + 1; i >= 2; --i) { | 184 | for (i = size + 1; i >= 2; --i) { |
162 | buf[i] = value; | 185 | buf[i] = value; |
163 | value >>= 8; | 186 | value >>= 8; |
164 | } | 187 | } |
165 | 188 | ||
166 | ret = i2c_master_send(to_i2c_client(codec->dev), buf, size + 2); | 189 | ret = i2c_master_send(client, buf, size + 2); |
167 | if (ret == size + 2) | 190 | if (ret == size + 2) |
168 | return 0; | 191 | return 0; |
169 | else if (ret < 0) | 192 | else if (ret < 0) |
@@ -172,47 +195,105 @@ static int adau1701_write(struct snd_soc_codec *codec, unsigned int reg, | |||
172 | return -EIO; | 195 | return -EIO; |
173 | } | 196 | } |
174 | 197 | ||
175 | static unsigned int adau1701_read(struct snd_soc_codec *codec, unsigned int reg) | 198 | static int adau1701_reg_read(void *context, unsigned int reg, |
199 | unsigned int *value) | ||
176 | { | 200 | { |
177 | unsigned int value; | 201 | int ret; |
178 | unsigned int ret; | 202 | unsigned int i; |
203 | unsigned int size; | ||
204 | uint8_t send_buf[2], recv_buf[3]; | ||
205 | struct i2c_client *client = context; | ||
206 | struct i2c_msg msgs[2]; | ||
179 | 207 | ||
180 | ret = snd_soc_cache_read(codec, reg, &value); | 208 | size = adau1701_register_size(&client->dev, reg); |
181 | if (ret) | 209 | if (size == 0) |
182 | return ret; | 210 | return -EINVAL; |
183 | 211 | ||
184 | return value; | 212 | send_buf[0] = reg >> 8; |
185 | } | 213 | send_buf[1] = reg & 0xff; |
186 | 214 | ||
187 | static void adau1701_reset(struct snd_soc_codec *codec) | 215 | msgs[0].addr = client->addr; |
188 | { | 216 | msgs[0].len = sizeof(send_buf); |
189 | struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); | 217 | msgs[0].buf = send_buf; |
218 | msgs[0].flags = 0; | ||
190 | 219 | ||
191 | if (!gpio_is_valid(adau1701->gpio_nreset)) | 220 | msgs[1].addr = client->addr; |
192 | return; | 221 | msgs[1].len = size; |
222 | msgs[1].buf = recv_buf; | ||
223 | msgs[1].flags = I2C_M_RD; | ||
193 | 224 | ||
194 | gpio_set_value(adau1701->gpio_nreset, 0); | 225 | ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); |
195 | /* minimum reset time is 20ns */ | 226 | if (ret < 0) |
196 | udelay(1); | 227 | return ret; |
197 | gpio_set_value(adau1701->gpio_nreset, 1); | 228 | else if (ret != ARRAY_SIZE(msgs)) |
198 | /* power-up time may be as long as 85ms */ | 229 | return -EIO; |
199 | mdelay(85); | 230 | |
231 | *value = 0; | ||
232 | |||
233 | for (i = 0; i < size; i++) | ||
234 | *value |= recv_buf[i] << (i * 8); | ||
235 | |||
236 | return 0; | ||
200 | } | 237 | } |
201 | 238 | ||
202 | static int adau1701_init(struct snd_soc_codec *codec) | 239 | static int adau1701_reset(struct snd_soc_codec *codec, unsigned int clkdiv) |
203 | { | 240 | { |
204 | int ret; | 241 | struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); |
205 | struct i2c_client *client = to_i2c_client(codec->dev); | 242 | struct i2c_client *client = to_i2c_client(codec->dev); |
243 | int ret; | ||
206 | 244 | ||
207 | adau1701_reset(codec); | 245 | if (clkdiv != ADAU1707_CLKDIV_UNSET && |
246 | gpio_is_valid(adau1701->gpio_pll_mode[0]) && | ||
247 | gpio_is_valid(adau1701->gpio_pll_mode[1])) { | ||
248 | switch (clkdiv) { | ||
249 | case 64: | ||
250 | gpio_set_value(adau1701->gpio_pll_mode[0], 0); | ||
251 | gpio_set_value(adau1701->gpio_pll_mode[1], 0); | ||
252 | break; | ||
253 | case 256: | ||
254 | gpio_set_value(adau1701->gpio_pll_mode[0], 0); | ||
255 | gpio_set_value(adau1701->gpio_pll_mode[1], 1); | ||
256 | break; | ||
257 | case 384: | ||
258 | gpio_set_value(adau1701->gpio_pll_mode[0], 1); | ||
259 | gpio_set_value(adau1701->gpio_pll_mode[1], 0); | ||
260 | break; | ||
261 | case 0: /* fallback */ | ||
262 | case 512: | ||
263 | gpio_set_value(adau1701->gpio_pll_mode[0], 1); | ||
264 | gpio_set_value(adau1701->gpio_pll_mode[1], 1); | ||
265 | break; | ||
266 | } | ||
267 | } | ||
208 | 268 | ||
209 | ret = process_sigma_firmware(client, ADAU1701_FIRMWARE); | 269 | adau1701->pll_clkdiv = clkdiv; |
210 | if (ret) { | 270 | |
211 | dev_warn(codec->dev, "Failed to load firmware\n"); | 271 | if (gpio_is_valid(adau1701->gpio_nreset)) { |
212 | return ret; | 272 | gpio_set_value(adau1701->gpio_nreset, 0); |
273 | /* minimum reset time is 20ns */ | ||
274 | udelay(1); | ||
275 | gpio_set_value(adau1701->gpio_nreset, 1); | ||
276 | /* power-up time may be as long as 85ms */ | ||
277 | mdelay(85); | ||
213 | } | 278 | } |
214 | 279 | ||
215 | snd_soc_write(codec, ADAU1701_DACSET, ADAU1701_DACSET_DACINIT); | 280 | /* |
281 | * Postpone the firmware download to a point in time when we | ||
282 | * know the correct PLL setup | ||
283 | */ | ||
284 | if (clkdiv != ADAU1707_CLKDIV_UNSET) { | ||
285 | ret = process_sigma_firmware(client, ADAU1701_FIRMWARE); | ||
286 | if (ret) { | ||
287 | dev_warn(codec->dev, "Failed to load firmware\n"); | ||
288 | return ret; | ||
289 | } | ||
290 | } | ||
291 | |||
292 | regmap_write(adau1701->regmap, ADAU1701_DACSET, ADAU1701_DACSET_DACINIT); | ||
293 | regmap_write(adau1701->regmap, ADAU1701_DSPCTRL, ADAU1701_DSPCTRL_CR); | ||
294 | |||
295 | regcache_mark_dirty(adau1701->regmap); | ||
296 | regcache_sync(adau1701->regmap); | ||
216 | 297 | ||
217 | return 0; | 298 | return 0; |
218 | } | 299 | } |
@@ -291,8 +372,22 @@ static int adau1701_hw_params(struct snd_pcm_substream *substream, | |||
291 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) | 372 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) |
292 | { | 373 | { |
293 | struct snd_soc_codec *codec = dai->codec; | 374 | struct snd_soc_codec *codec = dai->codec; |
375 | struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); | ||
376 | unsigned int clkdiv = adau1701->sysclk / params_rate(params); | ||
294 | snd_pcm_format_t format; | 377 | snd_pcm_format_t format; |
295 | unsigned int val; | 378 | unsigned int val; |
379 | int ret; | ||
380 | |||
381 | /* | ||
382 | * If the mclk/lrclk ratio changes, the chip needs updated PLL | ||
383 | * mode GPIO settings, and a full reset cycle, including a new | ||
384 | * firmware upload. | ||
385 | */ | ||
386 | if (clkdiv != adau1701->pll_clkdiv) { | ||
387 | ret = adau1701_reset(codec, clkdiv); | ||
388 | if (ret < 0) | ||
389 | return ret; | ||
390 | } | ||
296 | 391 | ||
297 | switch (params_rate(params)) { | 392 | switch (params_rate(params)) { |
298 | case 192000: | 393 | case 192000: |
@@ -384,8 +479,8 @@ static int adau1701_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
384 | 479 | ||
385 | adau1701->dai_fmt = fmt & SND_SOC_DAIFMT_FORMAT_MASK; | 480 | adau1701->dai_fmt = fmt & SND_SOC_DAIFMT_FORMAT_MASK; |
386 | 481 | ||
387 | snd_soc_write(codec, ADAU1701_SERICTL, serictl); | 482 | regmap_write(adau1701->regmap, ADAU1701_SERICTL, serictl); |
388 | snd_soc_update_bits(codec, ADAU1701_SEROCTL, | 483 | regmap_update_bits(adau1701->regmap, ADAU1701_SEROCTL, |
389 | ~ADAU1701_SEROCTL_WORD_LEN_MASK, seroctl); | 484 | ~ADAU1701_SEROCTL_WORD_LEN_MASK, seroctl); |
390 | 485 | ||
391 | return 0; | 486 | return 0; |
@@ -435,6 +530,7 @@ static int adau1701_set_sysclk(struct snd_soc_codec *codec, int clk_id, | |||
435 | int source, unsigned int freq, int dir) | 530 | int source, unsigned int freq, int dir) |
436 | { | 531 | { |
437 | unsigned int val; | 532 | unsigned int val; |
533 | struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); | ||
438 | 534 | ||
439 | switch (clk_id) { | 535 | switch (clk_id) { |
440 | case ADAU1701_CLK_SRC_OSC: | 536 | case ADAU1701_CLK_SRC_OSC: |
@@ -448,6 +544,7 @@ static int adau1701_set_sysclk(struct snd_soc_codec *codec, int clk_id, | |||
448 | } | 544 | } |
449 | 545 | ||
450 | snd_soc_update_bits(codec, ADAU1701_OSCIPOW, ADAU1701_OSCIPOW_OPD, val); | 546 | snd_soc_update_bits(codec, ADAU1701_OSCIPOW, ADAU1701_OSCIPOW_OPD, val); |
547 | adau1701->sysclk = freq; | ||
451 | 548 | ||
452 | return 0; | 549 | return 0; |
453 | } | 550 | } |
@@ -494,15 +591,37 @@ MODULE_DEVICE_TABLE(of, adau1701_dt_ids); | |||
494 | 591 | ||
495 | static int adau1701_probe(struct snd_soc_codec *codec) | 592 | static int adau1701_probe(struct snd_soc_codec *codec) |
496 | { | 593 | { |
497 | int ret; | 594 | int i, ret; |
595 | unsigned int val; | ||
596 | struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); | ||
498 | 597 | ||
499 | codec->control_data = to_i2c_client(codec->dev); | 598 | codec->control_data = to_i2c_client(codec->dev); |
500 | 599 | ||
501 | ret = adau1701_init(codec); | 600 | /* |
502 | if (ret) | 601 | * Let the pll_clkdiv variable default to something that won't happen |
602 | * at runtime. That way, we can postpone the firmware download from | ||
603 | * adau1701_reset() to a point in time when we know the correct PLL | ||
604 | * mode parameters. | ||
605 | */ | ||
606 | adau1701->pll_clkdiv = ADAU1707_CLKDIV_UNSET; | ||
607 | |||
608 | /* initalize with pre-configured pll mode settings */ | ||
609 | ret = adau1701_reset(codec, adau1701->pll_clkdiv); | ||
610 | if (ret < 0) | ||
503 | return ret; | 611 | return ret; |
504 | 612 | ||
505 | snd_soc_write(codec, ADAU1701_DSPCTRL, ADAU1701_DSPCTRL_CR); | 613 | /* set up pin config */ |
614 | val = 0; | ||
615 | for (i = 0; i < 6; i++) | ||
616 | val |= adau1701->pin_config[i] << (i * 4); | ||
617 | |||
618 | regmap_write(adau1701->regmap, ADAU1701_PINCONF_0, val); | ||
619 | |||
620 | val = 0; | ||
621 | for (i = 0; i < 6; i++) | ||
622 | val |= adau1701->pin_config[i + 6] << (i * 4); | ||
623 | |||
624 | regmap_write(adau1701->regmap, ADAU1701_PINCONF_1, val); | ||
506 | 625 | ||
507 | return 0; | 626 | return 0; |
508 | } | 627 | } |
@@ -512,9 +631,6 @@ static struct snd_soc_codec_driver adau1701_codec_drv = { | |||
512 | .set_bias_level = adau1701_set_bias_level, | 631 | .set_bias_level = adau1701_set_bias_level, |
513 | .idle_bias_off = true, | 632 | .idle_bias_off = true, |
514 | 633 | ||
515 | .reg_cache_size = ADAU1701_NUM_REGS, | ||
516 | .reg_word_size = sizeof(u16), | ||
517 | |||
518 | .controls = adau1701_controls, | 634 | .controls = adau1701_controls, |
519 | .num_controls = ARRAY_SIZE(adau1701_controls), | 635 | .num_controls = ARRAY_SIZE(adau1701_controls), |
520 | .dapm_widgets = adau1701_dapm_widgets, | 636 | .dapm_widgets = adau1701_dapm_widgets, |
@@ -522,28 +638,58 @@ static struct snd_soc_codec_driver adau1701_codec_drv = { | |||
522 | .dapm_routes = adau1701_dapm_routes, | 638 | .dapm_routes = adau1701_dapm_routes, |
523 | .num_dapm_routes = ARRAY_SIZE(adau1701_dapm_routes), | 639 | .num_dapm_routes = ARRAY_SIZE(adau1701_dapm_routes), |
524 | 640 | ||
525 | .write = adau1701_write, | ||
526 | .read = adau1701_read, | ||
527 | |||
528 | .set_sysclk = adau1701_set_sysclk, | 641 | .set_sysclk = adau1701_set_sysclk, |
529 | }; | 642 | }; |
530 | 643 | ||
644 | static const struct regmap_config adau1701_regmap = { | ||
645 | .reg_bits = 16, | ||
646 | .val_bits = 32, | ||
647 | .max_register = ADAU1701_MAX_REGISTER, | ||
648 | .cache_type = REGCACHE_RBTREE, | ||
649 | .volatile_reg = adau1701_volatile_reg, | ||
650 | .reg_write = adau1701_reg_write, | ||
651 | .reg_read = adau1701_reg_read, | ||
652 | }; | ||
653 | |||
531 | static int adau1701_i2c_probe(struct i2c_client *client, | 654 | static int adau1701_i2c_probe(struct i2c_client *client, |
532 | const struct i2c_device_id *id) | 655 | const struct i2c_device_id *id) |
533 | { | 656 | { |
534 | struct adau1701 *adau1701; | 657 | struct adau1701 *adau1701; |
535 | struct device *dev = &client->dev; | 658 | struct device *dev = &client->dev; |
536 | int gpio_nreset = -EINVAL; | 659 | int gpio_nreset = -EINVAL; |
660 | int gpio_pll_mode[2] = { -EINVAL, -EINVAL }; | ||
537 | int ret; | 661 | int ret; |
538 | 662 | ||
539 | adau1701 = devm_kzalloc(dev, sizeof(*adau1701), GFP_KERNEL); | 663 | adau1701 = devm_kzalloc(dev, sizeof(*adau1701), GFP_KERNEL); |
540 | if (!adau1701) | 664 | if (!adau1701) |
541 | return -ENOMEM; | 665 | return -ENOMEM; |
542 | 666 | ||
667 | adau1701->regmap = devm_regmap_init(dev, NULL, client, | ||
668 | &adau1701_regmap); | ||
669 | if (IS_ERR(adau1701->regmap)) | ||
670 | return PTR_ERR(adau1701->regmap); | ||
671 | |||
543 | if (dev->of_node) { | 672 | if (dev->of_node) { |
544 | gpio_nreset = of_get_named_gpio(dev->of_node, "reset-gpio", 0); | 673 | gpio_nreset = of_get_named_gpio(dev->of_node, "reset-gpio", 0); |
545 | if (gpio_nreset < 0 && gpio_nreset != -ENOENT) | 674 | if (gpio_nreset < 0 && gpio_nreset != -ENOENT) |
546 | return gpio_nreset; | 675 | return gpio_nreset; |
676 | |||
677 | gpio_pll_mode[0] = of_get_named_gpio(dev->of_node, | ||
678 | "adi,pll-mode-gpios", 0); | ||
679 | if (gpio_pll_mode[0] < 0 && gpio_pll_mode[0] != -ENOENT) | ||
680 | return gpio_pll_mode[0]; | ||
681 | |||
682 | gpio_pll_mode[1] = of_get_named_gpio(dev->of_node, | ||
683 | "adi,pll-mode-gpios", 1); | ||
684 | if (gpio_pll_mode[1] < 0 && gpio_pll_mode[1] != -ENOENT) | ||
685 | return gpio_pll_mode[1]; | ||
686 | |||
687 | of_property_read_u32(dev->of_node, "adi,pll-clkdiv", | ||
688 | &adau1701->pll_clkdiv); | ||
689 | |||
690 | of_property_read_u8_array(dev->of_node, "adi,pin-config", | ||
691 | adau1701->pin_config, | ||
692 | ARRAY_SIZE(adau1701->pin_config)); | ||
547 | } | 693 | } |
548 | 694 | ||
549 | if (gpio_is_valid(gpio_nreset)) { | 695 | if (gpio_is_valid(gpio_nreset)) { |
@@ -553,7 +699,24 @@ static int adau1701_i2c_probe(struct i2c_client *client, | |||
553 | return ret; | 699 | return ret; |
554 | } | 700 | } |
555 | 701 | ||
702 | if (gpio_is_valid(gpio_pll_mode[0]) && | ||
703 | gpio_is_valid(gpio_pll_mode[1])) { | ||
704 | ret = devm_gpio_request_one(dev, gpio_pll_mode[0], | ||
705 | GPIOF_OUT_INIT_LOW, | ||
706 | "ADAU1701 PLL mode 0"); | ||
707 | if (ret < 0) | ||
708 | return ret; | ||
709 | |||
710 | ret = devm_gpio_request_one(dev, gpio_pll_mode[1], | ||
711 | GPIOF_OUT_INIT_LOW, | ||
712 | "ADAU1701 PLL mode 1"); | ||
713 | if (ret < 0) | ||
714 | return ret; | ||
715 | } | ||
716 | |||
556 | adau1701->gpio_nreset = gpio_nreset; | 717 | adau1701->gpio_nreset = gpio_nreset; |
718 | adau1701->gpio_pll_mode[0] = gpio_pll_mode[0]; | ||
719 | adau1701->gpio_pll_mode[1] = gpio_pll_mode[1]; | ||
557 | 720 | ||
558 | i2c_set_clientdata(client, adau1701); | 721 | i2c_set_clientdata(client, adau1701); |
559 | ret = snd_soc_register_codec(&client->dev, &adau1701_codec_drv, | 722 | ret = snd_soc_register_codec(&client->dev, &adau1701_codec_drv, |
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c index 2eda85ba79ac..a5455c1aea42 100644 --- a/sound/soc/codecs/stac9766.c +++ b/sound/soc/codecs/stac9766.c | |||
@@ -28,8 +28,6 @@ | |||
28 | 28 | ||
29 | #include "stac9766.h" | 29 | #include "stac9766.h" |
30 | 30 | ||
31 | #define STAC9766_VERSION "0.10" | ||
32 | |||
33 | /* | 31 | /* |
34 | * STAC9766 register cache | 32 | * STAC9766 register cache |
35 | */ | 33 | */ |
@@ -145,14 +143,14 @@ static int stac9766_ac97_write(struct snd_soc_codec *codec, unsigned int reg, | |||
145 | 143 | ||
146 | if (reg > AC97_STAC_PAGE0) { | 144 | if (reg > AC97_STAC_PAGE0) { |
147 | stac9766_ac97_write(codec, AC97_INT_PAGING, 0); | 145 | stac9766_ac97_write(codec, AC97_INT_PAGING, 0); |
148 | soc_ac97_ops.write(codec->ac97, reg, val); | 146 | soc_ac97_ops->write(codec->ac97, reg, val); |
149 | stac9766_ac97_write(codec, AC97_INT_PAGING, 1); | 147 | stac9766_ac97_write(codec, AC97_INT_PAGING, 1); |
150 | return 0; | 148 | return 0; |
151 | } | 149 | } |
152 | if (reg / 2 >= ARRAY_SIZE(stac9766_reg)) | 150 | if (reg / 2 >= ARRAY_SIZE(stac9766_reg)) |
153 | return -EIO; | 151 | return -EIO; |
154 | 152 | ||
155 | soc_ac97_ops.write(codec->ac97, reg, val); | 153 | soc_ac97_ops->write(codec->ac97, reg, val); |
156 | cache[reg / 2] = val; | 154 | cache[reg / 2] = val; |
157 | return 0; | 155 | return 0; |
158 | } | 156 | } |
@@ -164,7 +162,7 @@ static unsigned int stac9766_ac97_read(struct snd_soc_codec *codec, | |||
164 | 162 | ||
165 | if (reg > AC97_STAC_PAGE0) { | 163 | if (reg > AC97_STAC_PAGE0) { |
166 | stac9766_ac97_write(codec, AC97_INT_PAGING, 0); | 164 | stac9766_ac97_write(codec, AC97_INT_PAGING, 0); |
167 | val = soc_ac97_ops.read(codec->ac97, reg - AC97_STAC_PAGE0); | 165 | val = soc_ac97_ops->read(codec->ac97, reg - AC97_STAC_PAGE0); |
168 | stac9766_ac97_write(codec, AC97_INT_PAGING, 1); | 166 | stac9766_ac97_write(codec, AC97_INT_PAGING, 1); |
169 | return val; | 167 | return val; |
170 | } | 168 | } |
@@ -175,7 +173,7 @@ static unsigned int stac9766_ac97_read(struct snd_soc_codec *codec, | |||
175 | reg == AC97_INT_PAGING || reg == AC97_VENDOR_ID1 || | 173 | reg == AC97_INT_PAGING || reg == AC97_VENDOR_ID1 || |
176 | reg == AC97_VENDOR_ID2) { | 174 | reg == AC97_VENDOR_ID2) { |
177 | 175 | ||
178 | val = soc_ac97_ops.read(codec->ac97, reg); | 176 | val = soc_ac97_ops->read(codec->ac97, reg); |
179 | return val; | 177 | return val; |
180 | } | 178 | } |
181 | return cache[reg / 2]; | 179 | return cache[reg / 2]; |
@@ -242,15 +240,15 @@ static int stac9766_set_bias_level(struct snd_soc_codec *codec, | |||
242 | 240 | ||
243 | static int stac9766_reset(struct snd_soc_codec *codec, int try_warm) | 241 | static int stac9766_reset(struct snd_soc_codec *codec, int try_warm) |
244 | { | 242 | { |
245 | if (try_warm && soc_ac97_ops.warm_reset) { | 243 | if (try_warm && soc_ac97_ops->warm_reset) { |
246 | soc_ac97_ops.warm_reset(codec->ac97); | 244 | soc_ac97_ops->warm_reset(codec->ac97); |
247 | if (stac9766_ac97_read(codec, 0) == stac9766_reg[0]) | 245 | if (stac9766_ac97_read(codec, 0) == stac9766_reg[0]) |
248 | return 1; | 246 | return 1; |
249 | } | 247 | } |
250 | 248 | ||
251 | soc_ac97_ops.reset(codec->ac97); | 249 | soc_ac97_ops->reset(codec->ac97); |
252 | if (soc_ac97_ops.warm_reset) | 250 | if (soc_ac97_ops->warm_reset) |
253 | soc_ac97_ops.warm_reset(codec->ac97); | 251 | soc_ac97_ops->warm_reset(codec->ac97); |
254 | if (stac9766_ac97_read(codec, 0) != stac9766_reg[0]) | 252 | if (stac9766_ac97_read(codec, 0) != stac9766_reg[0]) |
255 | return -EIO; | 253 | return -EIO; |
256 | return 0; | 254 | return 0; |
@@ -274,7 +272,7 @@ reset: | |||
274 | return -EIO; | 272 | return -EIO; |
275 | } | 273 | } |
276 | codec->ac97->bus->ops->warm_reset(codec->ac97); | 274 | codec->ac97->bus->ops->warm_reset(codec->ac97); |
277 | id = soc_ac97_ops.read(codec->ac97, AC97_VENDOR_ID2); | 275 | id = soc_ac97_ops->read(codec->ac97, AC97_VENDOR_ID2); |
278 | if (id != 0x4c13) { | 276 | if (id != 0x4c13) { |
279 | stac9766_reset(codec, 0); | 277 | stac9766_reset(codec, 0); |
280 | reset++; | 278 | reset++; |
@@ -338,9 +336,7 @@ static int stac9766_codec_probe(struct snd_soc_codec *codec) | |||
338 | { | 336 | { |
339 | int ret = 0; | 337 | int ret = 0; |
340 | 338 | ||
341 | printk(KERN_INFO "STAC9766 SoC Audio Codec %s\n", STAC9766_VERSION); | 339 | ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); |
342 | |||
343 | ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0); | ||
344 | if (ret < 0) | 340 | if (ret < 0) |
345 | goto codec_err; | 341 | goto codec_err; |
346 | 342 | ||
diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c index d447c4aa1d5e..6d31d88f7204 100644 --- a/sound/soc/codecs/tas5086.c +++ b/sound/soc/codecs/tas5086.c | |||
@@ -83,6 +83,14 @@ | |||
83 | #define TAS5086_SPLIT_CAP_CHARGE 0x1a /* Split cap charge period register */ | 83 | #define TAS5086_SPLIT_CAP_CHARGE 0x1a /* Split cap charge period register */ |
84 | #define TAS5086_OSC_TRIM 0x1b /* Oscillator trim register */ | 84 | #define TAS5086_OSC_TRIM 0x1b /* Oscillator trim register */ |
85 | #define TAS5086_BKNDERR 0x1c | 85 | #define TAS5086_BKNDERR 0x1c |
86 | #define TAS5086_INPUT_MUX 0x20 | ||
87 | #define TAS5086_PWM_OUTPUT_MUX 0x25 | ||
88 | |||
89 | #define TAS5086_MAX_REGISTER TAS5086_PWM_OUTPUT_MUX | ||
90 | |||
91 | #define TAS5086_PWM_START_MIDZ_FOR_START_1 (1 << 7) | ||
92 | #define TAS5086_PWM_START_MIDZ_FOR_START_2 (1 << 6) | ||
93 | #define TAS5086_PWM_START_CHANNEL_MASK (0x3f) | ||
86 | 94 | ||
87 | /* | 95 | /* |
88 | * Default TAS5086 power-up configuration | 96 | * Default TAS5086 power-up configuration |
@@ -119,9 +127,30 @@ static const struct reg_default tas5086_reg_defaults[] = { | |||
119 | { 0x1c, 0x05 }, | 127 | { 0x1c, 0x05 }, |
120 | }; | 128 | }; |
121 | 129 | ||
130 | static int tas5086_register_size(struct device *dev, unsigned int reg) | ||
131 | { | ||
132 | switch (reg) { | ||
133 | case TAS5086_CLOCK_CONTROL ... TAS5086_BKNDERR: | ||
134 | return 1; | ||
135 | case TAS5086_INPUT_MUX: | ||
136 | case TAS5086_PWM_OUTPUT_MUX: | ||
137 | return 4; | ||
138 | } | ||
139 | |||
140 | dev_err(dev, "Unsupported register address: %d\n", reg); | ||
141 | return 0; | ||
142 | } | ||
143 | |||
122 | static bool tas5086_accessible_reg(struct device *dev, unsigned int reg) | 144 | static bool tas5086_accessible_reg(struct device *dev, unsigned int reg) |
123 | { | 145 | { |
124 | return !((reg == 0x0f) || (reg >= 0x11 && reg <= 0x17)); | 146 | switch (reg) { |
147 | case 0x0f: | ||
148 | case 0x11 ... 0x17: | ||
149 | case 0x1d ... 0x1f: | ||
150 | return false; | ||
151 | default: | ||
152 | return true; | ||
153 | } | ||
125 | } | 154 | } |
126 | 155 | ||
127 | static bool tas5086_volatile_reg(struct device *dev, unsigned int reg) | 156 | static bool tas5086_volatile_reg(struct device *dev, unsigned int reg) |
@@ -140,6 +169,76 @@ static bool tas5086_writeable_reg(struct device *dev, unsigned int reg) | |||
140 | return tas5086_accessible_reg(dev, reg) && (reg != TAS5086_DEV_ID); | 169 | return tas5086_accessible_reg(dev, reg) && (reg != TAS5086_DEV_ID); |
141 | } | 170 | } |
142 | 171 | ||
172 | static int tas5086_reg_write(void *context, unsigned int reg, | ||
173 | unsigned int value) | ||
174 | { | ||
175 | struct i2c_client *client = context; | ||
176 | unsigned int i, size; | ||
177 | uint8_t buf[5]; | ||
178 | int ret; | ||
179 | |||
180 | size = tas5086_register_size(&client->dev, reg); | ||
181 | if (size == 0) | ||
182 | return -EINVAL; | ||
183 | |||
184 | buf[0] = reg; | ||
185 | |||
186 | for (i = size; i >= 1; --i) { | ||
187 | buf[i] = value; | ||
188 | value >>= 8; | ||
189 | } | ||
190 | |||
191 | ret = i2c_master_send(client, buf, size + 1); | ||
192 | if (ret == size + 1) | ||
193 | return 0; | ||
194 | else if (ret < 0) | ||
195 | return ret; | ||
196 | else | ||
197 | return -EIO; | ||
198 | } | ||
199 | |||
200 | static int tas5086_reg_read(void *context, unsigned int reg, | ||
201 | unsigned int *value) | ||
202 | { | ||
203 | struct i2c_client *client = context; | ||
204 | uint8_t send_buf, recv_buf[4]; | ||
205 | struct i2c_msg msgs[2]; | ||
206 | unsigned int size; | ||
207 | unsigned int i; | ||
208 | int ret; | ||
209 | |||
210 | size = tas5086_register_size(&client->dev, reg); | ||
211 | if (size == 0) | ||
212 | return -EINVAL; | ||
213 | |||
214 | send_buf = reg; | ||
215 | |||
216 | msgs[0].addr = client->addr; | ||
217 | msgs[0].len = sizeof(send_buf); | ||
218 | msgs[0].buf = &send_buf; | ||
219 | msgs[0].flags = 0; | ||
220 | |||
221 | msgs[1].addr = client->addr; | ||
222 | msgs[1].len = size; | ||
223 | msgs[1].buf = recv_buf; | ||
224 | msgs[1].flags = I2C_M_RD; | ||
225 | |||
226 | ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); | ||
227 | if (ret < 0) | ||
228 | return ret; | ||
229 | else if (ret != ARRAY_SIZE(msgs)) | ||
230 | return -EIO; | ||
231 | |||
232 | *value = 0; | ||
233 | |||
234 | for (i = 0; i < size; i++) { | ||
235 | *value <<= 8; | ||
236 | *value |= recv_buf[i]; | ||
237 | } | ||
238 | |||
239 | return 0; | ||
240 | } | ||
241 | |||
143 | struct tas5086_private { | 242 | struct tas5086_private { |
144 | struct regmap *regmap; | 243 | struct regmap *regmap; |
145 | unsigned int mclk, sclk; | 244 | unsigned int mclk, sclk; |
@@ -376,6 +475,202 @@ static const struct snd_kcontrol_new tas5086_controls[] = { | |||
376 | tas5086_get_deemph, tas5086_put_deemph), | 475 | tas5086_get_deemph, tas5086_put_deemph), |
377 | }; | 476 | }; |
378 | 477 | ||
478 | /* Input mux controls */ | ||
479 | static const char *tas5086_dapm_sdin_texts[] = | ||
480 | { | ||
481 | "SDIN1-L", "SDIN1-R", "SDIN2-L", "SDIN2-R", | ||
482 | "SDIN3-L", "SDIN3-R", "Ground (0)", "nc" | ||
483 | }; | ||
484 | |||
485 | static const struct soc_enum tas5086_dapm_input_mux_enum[] = { | ||
486 | SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 20, 8, tas5086_dapm_sdin_texts), | ||
487 | SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 16, 8, tas5086_dapm_sdin_texts), | ||
488 | SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 12, 8, tas5086_dapm_sdin_texts), | ||
489 | SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 8, 8, tas5086_dapm_sdin_texts), | ||
490 | SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 4, 8, tas5086_dapm_sdin_texts), | ||
491 | SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 0, 8, tas5086_dapm_sdin_texts), | ||
492 | }; | ||
493 | |||
494 | static const struct snd_kcontrol_new tas5086_dapm_input_mux_controls[] = { | ||
495 | SOC_DAPM_ENUM("Channel 1 input", tas5086_dapm_input_mux_enum[0]), | ||
496 | SOC_DAPM_ENUM("Channel 2 input", tas5086_dapm_input_mux_enum[1]), | ||
497 | SOC_DAPM_ENUM("Channel 3 input", tas5086_dapm_input_mux_enum[2]), | ||
498 | SOC_DAPM_ENUM("Channel 4 input", tas5086_dapm_input_mux_enum[3]), | ||
499 | SOC_DAPM_ENUM("Channel 5 input", tas5086_dapm_input_mux_enum[4]), | ||
500 | SOC_DAPM_ENUM("Channel 6 input", tas5086_dapm_input_mux_enum[5]), | ||
501 | }; | ||
502 | |||
503 | /* Output mux controls */ | ||
504 | static const char *tas5086_dapm_channel_texts[] = | ||
505 | { "Channel 1 Mux", "Channel 2 Mux", "Channel 3 Mux", | ||
506 | "Channel 4 Mux", "Channel 5 Mux", "Channel 6 Mux" }; | ||
507 | |||
508 | static const struct soc_enum tas5086_dapm_output_mux_enum[] = { | ||
509 | SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 20, 6, tas5086_dapm_channel_texts), | ||
510 | SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 16, 6, tas5086_dapm_channel_texts), | ||
511 | SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 12, 6, tas5086_dapm_channel_texts), | ||
512 | SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 8, 6, tas5086_dapm_channel_texts), | ||
513 | SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 4, 6, tas5086_dapm_channel_texts), | ||
514 | SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 0, 6, tas5086_dapm_channel_texts), | ||
515 | }; | ||
516 | |||
517 | static const struct snd_kcontrol_new tas5086_dapm_output_mux_controls[] = { | ||
518 | SOC_DAPM_ENUM("PWM1 Output", tas5086_dapm_output_mux_enum[0]), | ||
519 | SOC_DAPM_ENUM("PWM2 Output", tas5086_dapm_output_mux_enum[1]), | ||
520 | SOC_DAPM_ENUM("PWM3 Output", tas5086_dapm_output_mux_enum[2]), | ||
521 | SOC_DAPM_ENUM("PWM4 Output", tas5086_dapm_output_mux_enum[3]), | ||
522 | SOC_DAPM_ENUM("PWM5 Output", tas5086_dapm_output_mux_enum[4]), | ||
523 | SOC_DAPM_ENUM("PWM6 Output", tas5086_dapm_output_mux_enum[5]), | ||
524 | }; | ||
525 | |||
526 | static const struct snd_soc_dapm_widget tas5086_dapm_widgets[] = { | ||
527 | SND_SOC_DAPM_INPUT("SDIN1-L"), | ||
528 | SND_SOC_DAPM_INPUT("SDIN1-R"), | ||
529 | SND_SOC_DAPM_INPUT("SDIN2-L"), | ||
530 | SND_SOC_DAPM_INPUT("SDIN2-R"), | ||
531 | SND_SOC_DAPM_INPUT("SDIN3-L"), | ||
532 | SND_SOC_DAPM_INPUT("SDIN3-R"), | ||
533 | SND_SOC_DAPM_INPUT("SDIN4-L"), | ||
534 | SND_SOC_DAPM_INPUT("SDIN4-R"), | ||
535 | |||
536 | SND_SOC_DAPM_OUTPUT("PWM1"), | ||
537 | SND_SOC_DAPM_OUTPUT("PWM2"), | ||
538 | SND_SOC_DAPM_OUTPUT("PWM3"), | ||
539 | SND_SOC_DAPM_OUTPUT("PWM4"), | ||
540 | SND_SOC_DAPM_OUTPUT("PWM5"), | ||
541 | SND_SOC_DAPM_OUTPUT("PWM6"), | ||
542 | |||
543 | SND_SOC_DAPM_MUX("Channel 1 Mux", SND_SOC_NOPM, 0, 0, | ||
544 | &tas5086_dapm_input_mux_controls[0]), | ||
545 | SND_SOC_DAPM_MUX("Channel 2 Mux", SND_SOC_NOPM, 0, 0, | ||
546 | &tas5086_dapm_input_mux_controls[1]), | ||
547 | SND_SOC_DAPM_MUX("Channel 3 Mux", SND_SOC_NOPM, 0, 0, | ||
548 | &tas5086_dapm_input_mux_controls[2]), | ||
549 | SND_SOC_DAPM_MUX("Channel 4 Mux", SND_SOC_NOPM, 0, 0, | ||
550 | &tas5086_dapm_input_mux_controls[3]), | ||
551 | SND_SOC_DAPM_MUX("Channel 5 Mux", SND_SOC_NOPM, 0, 0, | ||
552 | &tas5086_dapm_input_mux_controls[4]), | ||
553 | SND_SOC_DAPM_MUX("Channel 6 Mux", SND_SOC_NOPM, 0, 0, | ||
554 | &tas5086_dapm_input_mux_controls[5]), | ||
555 | |||
556 | SND_SOC_DAPM_MUX("PWM1 Mux", SND_SOC_NOPM, 0, 0, | ||
557 | &tas5086_dapm_output_mux_controls[0]), | ||
558 | SND_SOC_DAPM_MUX("PWM2 Mux", SND_SOC_NOPM, 0, 0, | ||
559 | &tas5086_dapm_output_mux_controls[1]), | ||
560 | SND_SOC_DAPM_MUX("PWM3 Mux", SND_SOC_NOPM, 0, 0, | ||
561 | &tas5086_dapm_output_mux_controls[2]), | ||
562 | SND_SOC_DAPM_MUX("PWM4 Mux", SND_SOC_NOPM, 0, 0, | ||
563 | &tas5086_dapm_output_mux_controls[3]), | ||
564 | SND_SOC_DAPM_MUX("PWM5 Mux", SND_SOC_NOPM, 0, 0, | ||
565 | &tas5086_dapm_output_mux_controls[4]), | ||
566 | SND_SOC_DAPM_MUX("PWM6 Mux", SND_SOC_NOPM, 0, 0, | ||
567 | &tas5086_dapm_output_mux_controls[5]), | ||
568 | }; | ||
569 | |||
570 | static const struct snd_soc_dapm_route tas5086_dapm_routes[] = { | ||
571 | /* SDIN inputs -> channel muxes */ | ||
572 | { "Channel 1 Mux", "SDIN1-L", "SDIN1-L" }, | ||
573 | { "Channel 1 Mux", "SDIN1-R", "SDIN1-R" }, | ||
574 | { "Channel 1 Mux", "SDIN2-L", "SDIN2-L" }, | ||
575 | { "Channel 1 Mux", "SDIN2-R", "SDIN2-R" }, | ||
576 | { "Channel 1 Mux", "SDIN3-L", "SDIN3-L" }, | ||
577 | { "Channel 1 Mux", "SDIN3-R", "SDIN3-R" }, | ||
578 | |||
579 | { "Channel 2 Mux", "SDIN1-L", "SDIN1-L" }, | ||
580 | { "Channel 2 Mux", "SDIN1-R", "SDIN1-R" }, | ||
581 | { "Channel 2 Mux", "SDIN2-L", "SDIN2-L" }, | ||
582 | { "Channel 2 Mux", "SDIN2-R", "SDIN2-R" }, | ||
583 | { "Channel 2 Mux", "SDIN3-L", "SDIN3-L" }, | ||
584 | { "Channel 2 Mux", "SDIN3-R", "SDIN3-R" }, | ||
585 | |||
586 | { "Channel 2 Mux", "SDIN1-L", "SDIN1-L" }, | ||
587 | { "Channel 2 Mux", "SDIN1-R", "SDIN1-R" }, | ||
588 | { "Channel 2 Mux", "SDIN2-L", "SDIN2-L" }, | ||
589 | { "Channel 2 Mux", "SDIN2-R", "SDIN2-R" }, | ||
590 | { "Channel 2 Mux", "SDIN3-L", "SDIN3-L" }, | ||
591 | { "Channel 2 Mux", "SDIN3-R", "SDIN3-R" }, | ||
592 | |||
593 | { "Channel 3 Mux", "SDIN1-L", "SDIN1-L" }, | ||
594 | { "Channel 3 Mux", "SDIN1-R", "SDIN1-R" }, | ||
595 | { "Channel 3 Mux", "SDIN2-L", "SDIN2-L" }, | ||
596 | { "Channel 3 Mux", "SDIN2-R", "SDIN2-R" }, | ||
597 | { "Channel 3 Mux", "SDIN3-L", "SDIN3-L" }, | ||
598 | { "Channel 3 Mux", "SDIN3-R", "SDIN3-R" }, | ||
599 | |||
600 | { "Channel 4 Mux", "SDIN1-L", "SDIN1-L" }, | ||
601 | { "Channel 4 Mux", "SDIN1-R", "SDIN1-R" }, | ||
602 | { "Channel 4 Mux", "SDIN2-L", "SDIN2-L" }, | ||
603 | { "Channel 4 Mux", "SDIN2-R", "SDIN2-R" }, | ||
604 | { "Channel 4 Mux", "SDIN3-L", "SDIN3-L" }, | ||
605 | { "Channel 4 Mux", "SDIN3-R", "SDIN3-R" }, | ||
606 | |||
607 | { "Channel 5 Mux", "SDIN1-L", "SDIN1-L" }, | ||
608 | { "Channel 5 Mux", "SDIN1-R", "SDIN1-R" }, | ||
609 | { "Channel 5 Mux", "SDIN2-L", "SDIN2-L" }, | ||
610 | { "Channel 5 Mux", "SDIN2-R", "SDIN2-R" }, | ||
611 | { "Channel 5 Mux", "SDIN3-L", "SDIN3-L" }, | ||
612 | { "Channel 5 Mux", "SDIN3-R", "SDIN3-R" }, | ||
613 | |||
614 | { "Channel 6 Mux", "SDIN1-L", "SDIN1-L" }, | ||
615 | { "Channel 6 Mux", "SDIN1-R", "SDIN1-R" }, | ||
616 | { "Channel 6 Mux", "SDIN2-L", "SDIN2-L" }, | ||
617 | { "Channel 6 Mux", "SDIN2-R", "SDIN2-R" }, | ||
618 | { "Channel 6 Mux", "SDIN3-L", "SDIN3-L" }, | ||
619 | { "Channel 6 Mux", "SDIN3-R", "SDIN3-R" }, | ||
620 | |||
621 | /* Channel muxes -> PWM muxes */ | ||
622 | { "PWM1 Mux", "Channel 1 Mux", "Channel 1 Mux" }, | ||
623 | { "PWM2 Mux", "Channel 1 Mux", "Channel 1 Mux" }, | ||
624 | { "PWM3 Mux", "Channel 1 Mux", "Channel 1 Mux" }, | ||
625 | { "PWM4 Mux", "Channel 1 Mux", "Channel 1 Mux" }, | ||
626 | { "PWM5 Mux", "Channel 1 Mux", "Channel 1 Mux" }, | ||
627 | { "PWM6 Mux", "Channel 1 Mux", "Channel 1 Mux" }, | ||
628 | |||
629 | { "PWM1 Mux", "Channel 2 Mux", "Channel 2 Mux" }, | ||
630 | { "PWM2 Mux", "Channel 2 Mux", "Channel 2 Mux" }, | ||
631 | { "PWM3 Mux", "Channel 2 Mux", "Channel 2 Mux" }, | ||
632 | { "PWM4 Mux", "Channel 2 Mux", "Channel 2 Mux" }, | ||
633 | { "PWM5 Mux", "Channel 2 Mux", "Channel 2 Mux" }, | ||
634 | { "PWM6 Mux", "Channel 2 Mux", "Channel 2 Mux" }, | ||
635 | |||
636 | { "PWM1 Mux", "Channel 3 Mux", "Channel 3 Mux" }, | ||
637 | { "PWM2 Mux", "Channel 3 Mux", "Channel 3 Mux" }, | ||
638 | { "PWM3 Mux", "Channel 3 Mux", "Channel 3 Mux" }, | ||
639 | { "PWM4 Mux", "Channel 3 Mux", "Channel 3 Mux" }, | ||
640 | { "PWM5 Mux", "Channel 3 Mux", "Channel 3 Mux" }, | ||
641 | { "PWM6 Mux", "Channel 3 Mux", "Channel 3 Mux" }, | ||
642 | |||
643 | { "PWM1 Mux", "Channel 4 Mux", "Channel 4 Mux" }, | ||
644 | { "PWM2 Mux", "Channel 4 Mux", "Channel 4 Mux" }, | ||
645 | { "PWM3 Mux", "Channel 4 Mux", "Channel 4 Mux" }, | ||
646 | { "PWM4 Mux", "Channel 4 Mux", "Channel 4 Mux" }, | ||
647 | { "PWM5 Mux", "Channel 4 Mux", "Channel 4 Mux" }, | ||
648 | { "PWM6 Mux", "Channel 4 Mux", "Channel 4 Mux" }, | ||
649 | |||
650 | { "PWM1 Mux", "Channel 5 Mux", "Channel 5 Mux" }, | ||
651 | { "PWM2 Mux", "Channel 5 Mux", "Channel 5 Mux" }, | ||
652 | { "PWM3 Mux", "Channel 5 Mux", "Channel 5 Mux" }, | ||
653 | { "PWM4 Mux", "Channel 5 Mux", "Channel 5 Mux" }, | ||
654 | { "PWM5 Mux", "Channel 5 Mux", "Channel 5 Mux" }, | ||
655 | { "PWM6 Mux", "Channel 5 Mux", "Channel 5 Mux" }, | ||
656 | |||
657 | { "PWM1 Mux", "Channel 6 Mux", "Channel 6 Mux" }, | ||
658 | { "PWM2 Mux", "Channel 6 Mux", "Channel 6 Mux" }, | ||
659 | { "PWM3 Mux", "Channel 6 Mux", "Channel 6 Mux" }, | ||
660 | { "PWM4 Mux", "Channel 6 Mux", "Channel 6 Mux" }, | ||
661 | { "PWM5 Mux", "Channel 6 Mux", "Channel 6 Mux" }, | ||
662 | { "PWM6 Mux", "Channel 6 Mux", "Channel 6 Mux" }, | ||
663 | |||
664 | /* The PWM muxes are directly connected to the PWM outputs */ | ||
665 | { "PWM1", NULL, "PWM1 Mux" }, | ||
666 | { "PWM2", NULL, "PWM2 Mux" }, | ||
667 | { "PWM3", NULL, "PWM3 Mux" }, | ||
668 | { "PWM4", NULL, "PWM4 Mux" }, | ||
669 | { "PWM5", NULL, "PWM5 Mux" }, | ||
670 | { "PWM6", NULL, "PWM6 Mux" }, | ||
671 | |||
672 | }; | ||
673 | |||
379 | static const struct snd_soc_dai_ops tas5086_dai_ops = { | 674 | static const struct snd_soc_dai_ops tas5086_dai_ops = { |
380 | .hw_params = tas5086_hw_params, | 675 | .hw_params = tas5086_hw_params, |
381 | .set_sysclk = tas5086_set_dai_sysclk, | 676 | .set_sysclk = tas5086_set_dai_sysclk, |
@@ -426,13 +721,34 @@ static int tas5086_probe(struct snd_soc_codec *codec) | |||
426 | { | 721 | { |
427 | struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); | 722 | struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); |
428 | int charge_period = 1300000; /* hardware default is 1300 ms */ | 723 | int charge_period = 1300000; /* hardware default is 1300 ms */ |
724 | u8 pwm_start_mid_z = 0; | ||
429 | int i, ret; | 725 | int i, ret; |
430 | 726 | ||
431 | if (of_match_device(of_match_ptr(tas5086_dt_ids), codec->dev)) { | 727 | if (of_match_device(of_match_ptr(tas5086_dt_ids), codec->dev)) { |
432 | struct device_node *of_node = codec->dev->of_node; | 728 | struct device_node *of_node = codec->dev->of_node; |
433 | of_property_read_u32(of_node, "ti,charge-period", &charge_period); | 729 | of_property_read_u32(of_node, "ti,charge-period", &charge_period); |
730 | |||
731 | for (i = 0; i < 6; i++) { | ||
732 | char name[25]; | ||
733 | |||
734 | snprintf(name, sizeof(name), | ||
735 | "ti,mid-z-channel-%d", i + 1); | ||
736 | |||
737 | if (of_get_property(of_node, name, NULL) != NULL) | ||
738 | pwm_start_mid_z |= 1 << i; | ||
739 | } | ||
434 | } | 740 | } |
435 | 741 | ||
742 | /* | ||
743 | * If any of the channels is configured to start in Mid-Z mode, | ||
744 | * configure 'part 1' of the PWM starts to use Mid-Z, and tell | ||
745 | * all configured mid-z channels to start start under 'part 1'. | ||
746 | */ | ||
747 | if (pwm_start_mid_z) | ||
748 | regmap_write(priv->regmap, TAS5086_PWM_START, | ||
749 | TAS5086_PWM_START_MIDZ_FOR_START_1 | | ||
750 | pwm_start_mid_z); | ||
751 | |||
436 | /* lookup and set split-capacitor charge period */ | 752 | /* lookup and set split-capacitor charge period */ |
437 | if (charge_period == 0) { | 753 | if (charge_period == 0) { |
438 | regmap_write(priv->regmap, TAS5086_SPLIT_CAP_CHARGE, 0); | 754 | regmap_write(priv->regmap, TAS5086_SPLIT_CAP_CHARGE, 0); |
@@ -490,6 +806,10 @@ static struct snd_soc_codec_driver soc_codec_dev_tas5086 = { | |||
490 | .resume = tas5086_soc_resume, | 806 | .resume = tas5086_soc_resume, |
491 | .controls = tas5086_controls, | 807 | .controls = tas5086_controls, |
492 | .num_controls = ARRAY_SIZE(tas5086_controls), | 808 | .num_controls = ARRAY_SIZE(tas5086_controls), |
809 | .dapm_widgets = tas5086_dapm_widgets, | ||
810 | .num_dapm_widgets = ARRAY_SIZE(tas5086_dapm_widgets), | ||
811 | .dapm_routes = tas5086_dapm_routes, | ||
812 | .num_dapm_routes = ARRAY_SIZE(tas5086_dapm_routes), | ||
493 | }; | 813 | }; |
494 | 814 | ||
495 | static const struct i2c_device_id tas5086_i2c_id[] = { | 815 | static const struct i2c_device_id tas5086_i2c_id[] = { |
@@ -500,14 +820,16 @@ MODULE_DEVICE_TABLE(i2c, tas5086_i2c_id); | |||
500 | 820 | ||
501 | static const struct regmap_config tas5086_regmap = { | 821 | static const struct regmap_config tas5086_regmap = { |
502 | .reg_bits = 8, | 822 | .reg_bits = 8, |
503 | .val_bits = 8, | 823 | .val_bits = 32, |
504 | .max_register = ARRAY_SIZE(tas5086_reg_defaults), | 824 | .max_register = TAS5086_MAX_REGISTER, |
505 | .reg_defaults = tas5086_reg_defaults, | 825 | .reg_defaults = tas5086_reg_defaults, |
506 | .num_reg_defaults = ARRAY_SIZE(tas5086_reg_defaults), | 826 | .num_reg_defaults = ARRAY_SIZE(tas5086_reg_defaults), |
507 | .cache_type = REGCACHE_RBTREE, | 827 | .cache_type = REGCACHE_RBTREE, |
508 | .volatile_reg = tas5086_volatile_reg, | 828 | .volatile_reg = tas5086_volatile_reg, |
509 | .writeable_reg = tas5086_writeable_reg, | 829 | .writeable_reg = tas5086_writeable_reg, |
510 | .readable_reg = tas5086_accessible_reg, | 830 | .readable_reg = tas5086_accessible_reg, |
831 | .reg_read = tas5086_reg_read, | ||
832 | .reg_write = tas5086_reg_write, | ||
511 | }; | 833 | }; |
512 | 834 | ||
513 | static int tas5086_i2c_probe(struct i2c_client *i2c, | 835 | static int tas5086_i2c_probe(struct i2c_client *i2c, |
@@ -522,7 +844,7 @@ static int tas5086_i2c_probe(struct i2c_client *i2c, | |||
522 | if (!priv) | 844 | if (!priv) |
523 | return -ENOMEM; | 845 | return -ENOMEM; |
524 | 846 | ||
525 | priv->regmap = devm_regmap_init_i2c(i2c, &tas5086_regmap); | 847 | priv->regmap = devm_regmap_init(dev, NULL, i2c, &tas5086_regmap); |
526 | if (IS_ERR(priv->regmap)) { | 848 | if (IS_ERR(priv->regmap)) { |
527 | ret = PTR_ERR(priv->regmap); | 849 | ret = PTR_ERR(priv->regmap); |
528 | dev_err(&i2c->dev, "Failed to create regmap: %d\n", ret); | 850 | dev_err(&i2c->dev, "Failed to create regmap: %d\n", ret); |
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 1514bf845e4b..e5b926883131 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -128,10 +128,8 @@ static const u8 aic3x_reg[AIC3X_CACHEREGNUM] = { | |||
128 | }; | 128 | }; |
129 | 129 | ||
130 | #define SOC_DAPM_SINGLE_AIC3X(xname, reg, shift, mask, invert) \ | 130 | #define SOC_DAPM_SINGLE_AIC3X(xname, reg, shift, mask, invert) \ |
131 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 131 | SOC_SINGLE_EXT(xname, reg, shift, mask, invert, \ |
132 | .info = snd_soc_info_volsw, \ | 132 | snd_soc_dapm_get_volsw, snd_soc_dapm_put_volsw_aic3x) |
133 | .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw_aic3x, \ | ||
134 | .private_value = SOC_SINGLE_VALUE(reg, shift, mask, invert) } | ||
135 | 133 | ||
136 | /* | 134 | /* |
137 | * All input lines are connected when !0xf and disconnected with 0xf bit field, | 135 | * All input lines are connected when !0xf and disconnected with 0xf bit field, |
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 9b9a6e587610..44621ddc332d 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c | |||
@@ -38,6 +38,14 @@ | |||
38 | 38 | ||
39 | #include "twl6040.h" | 39 | #include "twl6040.h" |
40 | 40 | ||
41 | enum twl6040_dai_id { | ||
42 | TWL6040_DAI_LEGACY = 0, | ||
43 | TWL6040_DAI_UL, | ||
44 | TWL6040_DAI_DL1, | ||
45 | TWL6040_DAI_DL2, | ||
46 | TWL6040_DAI_VIB, | ||
47 | }; | ||
48 | |||
41 | #define TWL6040_RATES SNDRV_PCM_RATE_8000_96000 | 49 | #define TWL6040_RATES SNDRV_PCM_RATE_8000_96000 |
42 | #define TWL6040_FORMATS (SNDRV_PCM_FMTBIT_S32_LE) | 50 | #define TWL6040_FORMATS (SNDRV_PCM_FMTBIT_S32_LE) |
43 | 51 | ||
@@ -67,6 +75,8 @@ struct twl6040_data { | |||
67 | int pll_power_mode; | 75 | int pll_power_mode; |
68 | int hs_power_mode; | 76 | int hs_power_mode; |
69 | int hs_power_mode_locked; | 77 | int hs_power_mode_locked; |
78 | bool dl1_unmuted; | ||
79 | bool dl2_unmuted; | ||
70 | unsigned int clk_in; | 80 | unsigned int clk_in; |
71 | unsigned int sysclk; | 81 | unsigned int sysclk; |
72 | struct twl6040_jack_data hs_jack; | 82 | struct twl6040_jack_data hs_jack; |
@@ -220,6 +230,25 @@ static int twl6040_read_reg_volatile(struct snd_soc_codec *codec, | |||
220 | return value; | 230 | return value; |
221 | } | 231 | } |
222 | 232 | ||
233 | static bool twl6040_is_path_unmuted(struct snd_soc_codec *codec, | ||
234 | unsigned int reg) | ||
235 | { | ||
236 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | ||
237 | |||
238 | switch (reg) { | ||
239 | case TWL6040_REG_HSLCTL: | ||
240 | case TWL6040_REG_HSRCTL: | ||
241 | case TWL6040_REG_EARCTL: | ||
242 | /* DL1 path */ | ||
243 | return priv->dl1_unmuted; | ||
244 | case TWL6040_REG_HFLCTL: | ||
245 | case TWL6040_REG_HFRCTL: | ||
246 | return priv->dl2_unmuted; | ||
247 | default: | ||
248 | return 1; | ||
249 | }; | ||
250 | } | ||
251 | |||
223 | /* | 252 | /* |
224 | * write to the twl6040 register space | 253 | * write to the twl6040 register space |
225 | */ | 254 | */ |
@@ -232,7 +261,8 @@ static int twl6040_write(struct snd_soc_codec *codec, | |||
232 | return -EIO; | 261 | return -EIO; |
233 | 262 | ||
234 | twl6040_write_reg_cache(codec, reg, value); | 263 | twl6040_write_reg_cache(codec, reg, value); |
235 | if (likely(reg < TWL6040_REG_SW_SHADOW)) | 264 | if (likely(reg < TWL6040_REG_SW_SHADOW) && |
265 | twl6040_is_path_unmuted(codec, reg)) | ||
236 | return twl6040_reg_write(twl6040, reg, value); | 266 | return twl6040_reg_write(twl6040, reg, value); |
237 | else | 267 | else |
238 | return 0; | 268 | return 0; |
@@ -1026,16 +1056,84 @@ static int twl6040_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
1026 | return 0; | 1056 | return 0; |
1027 | } | 1057 | } |
1028 | 1058 | ||
1059 | static void twl6040_mute_path(struct snd_soc_codec *codec, enum twl6040_dai_id id, | ||
1060 | int mute) | ||
1061 | { | ||
1062 | struct twl6040 *twl6040 = codec->control_data; | ||
1063 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | ||
1064 | int hslctl, hsrctl, earctl; | ||
1065 | int hflctl, hfrctl; | ||
1066 | |||
1067 | switch (id) { | ||
1068 | case TWL6040_DAI_DL1: | ||
1069 | hslctl = twl6040_read_reg_cache(codec, TWL6040_REG_HSLCTL); | ||
1070 | hsrctl = twl6040_read_reg_cache(codec, TWL6040_REG_HSRCTL); | ||
1071 | earctl = twl6040_read_reg_cache(codec, TWL6040_REG_EARCTL); | ||
1072 | |||
1073 | if (mute) { | ||
1074 | /* Power down drivers and DACs */ | ||
1075 | earctl &= ~0x01; | ||
1076 | hslctl &= ~(TWL6040_HSDRVENA | TWL6040_HSDACENA); | ||
1077 | hsrctl &= ~(TWL6040_HSDRVENA | TWL6040_HSDACENA); | ||
1078 | |||
1079 | } | ||
1080 | |||
1081 | twl6040_reg_write(twl6040, TWL6040_REG_EARCTL, earctl); | ||
1082 | twl6040_reg_write(twl6040, TWL6040_REG_HSLCTL, hslctl); | ||
1083 | twl6040_reg_write(twl6040, TWL6040_REG_HSRCTL, hsrctl); | ||
1084 | priv->dl1_unmuted = !mute; | ||
1085 | break; | ||
1086 | case TWL6040_DAI_DL2: | ||
1087 | hflctl = twl6040_read_reg_cache(codec, TWL6040_REG_HFLCTL); | ||
1088 | hfrctl = twl6040_read_reg_cache(codec, TWL6040_REG_HFRCTL); | ||
1089 | |||
1090 | if (mute) { | ||
1091 | /* Power down drivers and DACs */ | ||
1092 | hflctl &= ~(TWL6040_HFDACENA | TWL6040_HFPGAENA | | ||
1093 | TWL6040_HFDRVENA); | ||
1094 | hfrctl &= ~(TWL6040_HFDACENA | TWL6040_HFPGAENA | | ||
1095 | TWL6040_HFDRVENA); | ||
1096 | } | ||
1097 | |||
1098 | twl6040_reg_write(twl6040, TWL6040_REG_HFLCTL, hflctl); | ||
1099 | twl6040_reg_write(twl6040, TWL6040_REG_HFRCTL, hfrctl); | ||
1100 | priv->dl2_unmuted = !mute; | ||
1101 | break; | ||
1102 | default: | ||
1103 | break; | ||
1104 | }; | ||
1105 | } | ||
1106 | |||
1107 | static int twl6040_digital_mute(struct snd_soc_dai *dai, int mute) | ||
1108 | { | ||
1109 | switch (dai->id) { | ||
1110 | case TWL6040_DAI_LEGACY: | ||
1111 | twl6040_mute_path(dai->codec, TWL6040_DAI_DL1, mute); | ||
1112 | twl6040_mute_path(dai->codec, TWL6040_DAI_DL2, mute); | ||
1113 | break; | ||
1114 | case TWL6040_DAI_DL1: | ||
1115 | case TWL6040_DAI_DL2: | ||
1116 | twl6040_mute_path(dai->codec, dai->id, mute); | ||
1117 | break; | ||
1118 | default: | ||
1119 | break; | ||
1120 | } | ||
1121 | |||
1122 | return 0; | ||
1123 | } | ||
1124 | |||
1029 | static const struct snd_soc_dai_ops twl6040_dai_ops = { | 1125 | static const struct snd_soc_dai_ops twl6040_dai_ops = { |
1030 | .startup = twl6040_startup, | 1126 | .startup = twl6040_startup, |
1031 | .hw_params = twl6040_hw_params, | 1127 | .hw_params = twl6040_hw_params, |
1032 | .prepare = twl6040_prepare, | 1128 | .prepare = twl6040_prepare, |
1033 | .set_sysclk = twl6040_set_dai_sysclk, | 1129 | .set_sysclk = twl6040_set_dai_sysclk, |
1130 | .digital_mute = twl6040_digital_mute, | ||
1034 | }; | 1131 | }; |
1035 | 1132 | ||
1036 | static struct snd_soc_dai_driver twl6040_dai[] = { | 1133 | static struct snd_soc_dai_driver twl6040_dai[] = { |
1037 | { | 1134 | { |
1038 | .name = "twl6040-legacy", | 1135 | .name = "twl6040-legacy", |
1136 | .id = TWL6040_DAI_LEGACY, | ||
1039 | .playback = { | 1137 | .playback = { |
1040 | .stream_name = "Legacy Playback", | 1138 | .stream_name = "Legacy Playback", |
1041 | .channels_min = 1, | 1139 | .channels_min = 1, |
@@ -1054,6 +1152,7 @@ static struct snd_soc_dai_driver twl6040_dai[] = { | |||
1054 | }, | 1152 | }, |
1055 | { | 1153 | { |
1056 | .name = "twl6040-ul", | 1154 | .name = "twl6040-ul", |
1155 | .id = TWL6040_DAI_UL, | ||
1057 | .capture = { | 1156 | .capture = { |
1058 | .stream_name = "Capture", | 1157 | .stream_name = "Capture", |
1059 | .channels_min = 1, | 1158 | .channels_min = 1, |
@@ -1065,6 +1164,7 @@ static struct snd_soc_dai_driver twl6040_dai[] = { | |||
1065 | }, | 1164 | }, |
1066 | { | 1165 | { |
1067 | .name = "twl6040-dl1", | 1166 | .name = "twl6040-dl1", |
1167 | .id = TWL6040_DAI_DL1, | ||
1068 | .playback = { | 1168 | .playback = { |
1069 | .stream_name = "Headset Playback", | 1169 | .stream_name = "Headset Playback", |
1070 | .channels_min = 1, | 1170 | .channels_min = 1, |
@@ -1076,6 +1176,7 @@ static struct snd_soc_dai_driver twl6040_dai[] = { | |||
1076 | }, | 1176 | }, |
1077 | { | 1177 | { |
1078 | .name = "twl6040-dl2", | 1178 | .name = "twl6040-dl2", |
1179 | .id = TWL6040_DAI_DL2, | ||
1079 | .playback = { | 1180 | .playback = { |
1080 | .stream_name = "Handsfree Playback", | 1181 | .stream_name = "Handsfree Playback", |
1081 | .channels_min = 1, | 1182 | .channels_min = 1, |
@@ -1087,6 +1188,7 @@ static struct snd_soc_dai_driver twl6040_dai[] = { | |||
1087 | }, | 1188 | }, |
1088 | { | 1189 | { |
1089 | .name = "twl6040-vib", | 1190 | .name = "twl6040-vib", |
1191 | .id = TWL6040_DAI_VIB, | ||
1090 | .playback = { | 1192 | .playback = { |
1091 | .stream_name = "Vibra Playback", | 1193 | .stream_name = "Vibra Playback", |
1092 | .channels_min = 1, | 1194 | .channels_min = 1, |
@@ -1143,7 +1245,7 @@ static int twl6040_probe(struct snd_soc_codec *codec) | |||
1143 | 1245 | ||
1144 | mutex_init(&priv->mutex); | 1246 | mutex_init(&priv->mutex); |
1145 | 1247 | ||
1146 | ret = devm_request_threaded_irq(codec->dev, priv->plug_irq, NULL, | 1248 | ret = request_threaded_irq(priv->plug_irq, NULL, |
1147 | twl6040_audio_handler, IRQF_NO_SUSPEND, | 1249 | twl6040_audio_handler, IRQF_NO_SUSPEND, |
1148 | "twl6040_irq_plug", codec); | 1250 | "twl6040_irq_plug", codec); |
1149 | if (ret) { | 1251 | if (ret) { |
@@ -1159,6 +1261,9 @@ static int twl6040_probe(struct snd_soc_codec *codec) | |||
1159 | 1261 | ||
1160 | static int twl6040_remove(struct snd_soc_codec *codec) | 1262 | static int twl6040_remove(struct snd_soc_codec *codec) |
1161 | { | 1263 | { |
1264 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | ||
1265 | |||
1266 | free_irq(priv->plug_irq, codec); | ||
1162 | twl6040_set_bias_level(codec, SND_SOC_BIAS_OFF); | 1267 | twl6040_set_bias_level(codec, SND_SOC_BIAS_OFF); |
1163 | 1268 | ||
1164 | return 0; | 1269 | return 0; |
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index af6d227e67be..d2a092850283 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c | |||
@@ -143,13 +143,8 @@ static int wm8400_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, | |||
143 | } | 143 | } |
144 | 144 | ||
145 | #define WM8400_OUTPGA_SINGLE_R_TLV(xname, reg, shift, max, invert, tlv_array) \ | 145 | #define WM8400_OUTPGA_SINGLE_R_TLV(xname, reg, shift, max, invert, tlv_array) \ |
146 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | 146 | SOC_SINGLE_EXT_TLV(xname, reg, shift, max, invert, \ |
147 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | 147 | snd_soc_get_volsw, wm8400_outpga_put_volsw_vu, tlv_array) |
148 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ | ||
149 | .tlv.p = (tlv_array), \ | ||
150 | .info = snd_soc_info_volsw, \ | ||
151 | .get = snd_soc_get_volsw, .put = wm8400_outpga_put_volsw_vu, \ | ||
152 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } | ||
153 | 148 | ||
154 | 149 | ||
155 | static const char *wm8400_digital_sidetone[] = | 150 | static const char *wm8400_digital_sidetone[] = |
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 9d88437cdcd1..fa24cedee687 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
@@ -403,10 +403,8 @@ static int wm8903_class_w_put(struct snd_kcontrol *kcontrol, | |||
403 | } | 403 | } |
404 | 404 | ||
405 | #define SOC_DAPM_SINGLE_W(xname, reg, shift, max, invert) \ | 405 | #define SOC_DAPM_SINGLE_W(xname, reg, shift, max, invert) \ |
406 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 406 | SOC_SINGLE_EXT(xname, reg, shift, max, invert, \ |
407 | .info = snd_soc_info_volsw, \ | 407 | snd_soc_dapm_get_volsw, wm8903_class_w_put) |
408 | .get = snd_soc_dapm_get_volsw, .put = wm8903_class_w_put, \ | ||
409 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } | ||
410 | 408 | ||
411 | 409 | ||
412 | static int wm8903_deemph[] = { 0, 32000, 44100, 48000 }; | 410 | static int wm8903_deemph[] = { 0, 32000, 44100, 48000 }; |
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index 3ff195c541db..4c9fb142cb2d 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
@@ -603,13 +603,8 @@ SOC_DOUBLE_R("Capture Switch", WM8904_ANALOGUE_LEFT_INPUT_0, | |||
603 | 603 | ||
604 | SOC_SINGLE("High Pass Filter Switch", WM8904_ADC_DIGITAL_0, 4, 1, 0), | 604 | SOC_SINGLE("High Pass Filter Switch", WM8904_ADC_DIGITAL_0, 4, 1, 0), |
605 | SOC_ENUM("High Pass Filter Mode", hpf_mode), | 605 | SOC_ENUM("High Pass Filter Mode", hpf_mode), |
606 | 606 | SOC_SINGLE_EXT("ADC 128x OSR Switch", WM8904_ANALOGUE_ADC_0, 0, 1, 0, | |
607 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 607 | snd_soc_get_volsw, wm8904_adc_osr_put), |
608 | .name = "ADC 128x OSR Switch", | ||
609 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, | ||
610 | .put = wm8904_adc_osr_put, | ||
611 | .private_value = SOC_SINGLE_VALUE(WM8904_ANALOGUE_ADC_0, 0, 1, 0), | ||
612 | }, | ||
613 | }; | 608 | }; |
614 | 609 | ||
615 | static const char *drc_path_text[] = { | 610 | static const char *drc_path_text[] = { |
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index 837978e16e9d..253c88bb7a4c 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c | |||
@@ -151,14 +151,9 @@ static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, | |||
151 | } | 151 | } |
152 | 152 | ||
153 | #define SOC_WM899X_OUTPGA_SINGLE_R_TLV(xname, reg, shift, max, invert,\ | 153 | #define SOC_WM899X_OUTPGA_SINGLE_R_TLV(xname, reg, shift, max, invert,\ |
154 | tlv_array) {\ | 154 | tlv_array) \ |
155 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | 155 | SOC_SINGLE_EXT_TLV(xname, reg, shift, max, invert, \ |
156 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | 156 | snd_soc_get_volsw, wm899x_outpga_put_volsw_vu, tlv_array) |
157 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ | ||
158 | .tlv.p = (tlv_array), \ | ||
159 | .info = snd_soc_info_volsw, \ | ||
160 | .get = snd_soc_get_volsw, .put = wm899x_outpga_put_volsw_vu, \ | ||
161 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } | ||
162 | 157 | ||
163 | 158 | ||
164 | static const char *wm8990_digital_sidetone[] = | 159 | static const char *wm8990_digital_sidetone[] = |
diff --git a/sound/soc/codecs/wm8991.h b/sound/soc/codecs/wm8991.h index 8a942efd18a5..07707d8d7e20 100644 --- a/sound/soc/codecs/wm8991.h +++ b/sound/soc/codecs/wm8991.h | |||
@@ -822,12 +822,7 @@ | |||
822 | 822 | ||
823 | #define SOC_WM899X_OUTPGA_SINGLE_R_TLV(xname, reg, shift, max, invert,\ | 823 | #define SOC_WM899X_OUTPGA_SINGLE_R_TLV(xname, reg, shift, max, invert,\ |
824 | tlv_array) \ | 824 | tlv_array) \ |
825 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | 825 | SOC_SINGLE_EXT_TLV(xname, reg, shift, max, invert, \ |
826 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | 826 | snd_soc_get_volsw, wm899x_outpga_put_volsw_vu, tlv_array) |
827 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ | ||
828 | .tlv.p = (tlv_array), \ | ||
829 | .info = snd_soc_info_volsw, \ | ||
830 | .get = snd_soc_get_volsw, .put = wm899x_outpga_put_volsw_vu, \ | ||
831 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } | ||
832 | 827 | ||
833 | #endif /* _WM8991_H */ | 828 | #endif /* _WM8991_H */ |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 25580b5a853f..1d4b1ec66e36 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -290,10 +290,8 @@ static const DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0); | |||
290 | static const DECLARE_TLV_DB_SCALE(mixin_boost_tlv, 0, 900, 0); | 290 | static const DECLARE_TLV_DB_SCALE(mixin_boost_tlv, 0, 900, 0); |
291 | 291 | ||
292 | #define WM8994_DRC_SWITCH(xname, reg, shift) \ | 292 | #define WM8994_DRC_SWITCH(xname, reg, shift) \ |
293 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 293 | SOC_SINGLE_EXT(xname, reg, shift, 1, 0, \ |
294 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ | 294 | snd_soc_get_volsw, wm8994_put_drc_sw) |
295 | .put = wm8994_put_drc_sw, \ | ||
296 | .private_value = SOC_SINGLE_VALUE(reg, shift, 1, 0) } | ||
297 | 295 | ||
298 | static int wm8994_put_drc_sw(struct snd_kcontrol *kcontrol, | 296 | static int wm8994_put_drc_sw(struct snd_kcontrol *kcontrol, |
299 | struct snd_ctl_elem_value *ucontrol) | 297 | struct snd_ctl_elem_value *ucontrol) |
@@ -1433,10 +1431,8 @@ SOC_DAPM_SINGLE("AIF1.1 Switch", WM8994_DAC2_RIGHT_MIXER_ROUTING, | |||
1433 | }; | 1431 | }; |
1434 | 1432 | ||
1435 | #define WM8994_CLASS_W_SWITCH(xname, reg, shift, max, invert) \ | 1433 | #define WM8994_CLASS_W_SWITCH(xname, reg, shift, max, invert) \ |
1436 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 1434 | SOC_SINGLE_EXT(xname, reg, shift, max, invert, \ |
1437 | .info = snd_soc_info_volsw, \ | 1435 | snd_soc_get_volsw, wm8994_put_class_w) |
1438 | .get = snd_soc_dapm_get_volsw, .put = wm8994_put_class_w, \ | ||
1439 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } | ||
1440 | 1436 | ||
1441 | static int wm8994_put_class_w(struct snd_kcontrol *kcontrol, | 1437 | static int wm8994_put_class_w(struct snd_kcontrol *kcontrol, |
1442 | struct snd_ctl_elem_value *ucontrol) | 1438 | struct snd_ctl_elem_value *ucontrol) |
diff --git a/sound/soc/codecs/wm8995.h b/sound/soc/codecs/wm8995.h index 5642121c4977..508ad27fe2bb 100644 --- a/sound/soc/codecs/wm8995.h +++ b/sound/soc/codecs/wm8995.h | |||
@@ -4237,11 +4237,8 @@ | |||
4237 | #define WM8995_SPK2_MUTE_SEQ1_WIDTH 8 /* SPK2_MUTE_SEQ1 - [7:0] */ | 4237 | #define WM8995_SPK2_MUTE_SEQ1_WIDTH 8 /* SPK2_MUTE_SEQ1 - [7:0] */ |
4238 | 4238 | ||
4239 | #define WM8995_CLASS_W_SWITCH(xname, reg, shift, max, invert) \ | 4239 | #define WM8995_CLASS_W_SWITCH(xname, reg, shift, max, invert) \ |
4240 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 4240 | SOC_SINGLE_EXT(xname, reg, shift, max, invert, \ |
4241 | .info = snd_soc_info_volsw, \ | 4241 | snd_soc_dapm_get_volsw, wm8995_put_class_w) |
4242 | .get = snd_soc_dapm_get_volsw, .put = wm8995_put_class_w, \ | ||
4243 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) \ | ||
4244 | } | ||
4245 | 4242 | ||
4246 | struct wm8995_reg_access { | 4243 | struct wm8995_reg_access { |
4247 | u16 read; | 4244 | u16 read; |
diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c index 05b1f346695b..70ce6793c5bd 100644 --- a/sound/soc/codecs/wm9705.c +++ b/sound/soc/codecs/wm9705.c | |||
@@ -209,7 +209,7 @@ static unsigned int ac97_read(struct snd_soc_codec *codec, unsigned int reg) | |||
209 | case AC97_RESET: | 209 | case AC97_RESET: |
210 | case AC97_VENDOR_ID1: | 210 | case AC97_VENDOR_ID1: |
211 | case AC97_VENDOR_ID2: | 211 | case AC97_VENDOR_ID2: |
212 | return soc_ac97_ops.read(codec->ac97, reg); | 212 | return soc_ac97_ops->read(codec->ac97, reg); |
213 | default: | 213 | default: |
214 | reg = reg >> 1; | 214 | reg = reg >> 1; |
215 | 215 | ||
@@ -225,7 +225,7 @@ static int ac97_write(struct snd_soc_codec *codec, unsigned int reg, | |||
225 | { | 225 | { |
226 | u16 *cache = codec->reg_cache; | 226 | u16 *cache = codec->reg_cache; |
227 | 227 | ||
228 | soc_ac97_ops.write(codec->ac97, reg, val); | 228 | soc_ac97_ops->write(codec->ac97, reg, val); |
229 | reg = reg >> 1; | 229 | reg = reg >> 1; |
230 | if (reg < (ARRAY_SIZE(wm9705_reg))) | 230 | if (reg < (ARRAY_SIZE(wm9705_reg))) |
231 | cache[reg] = val; | 231 | cache[reg] = val; |
@@ -294,8 +294,8 @@ static struct snd_soc_dai_driver wm9705_dai[] = { | |||
294 | 294 | ||
295 | static int wm9705_reset(struct snd_soc_codec *codec) | 295 | static int wm9705_reset(struct snd_soc_codec *codec) |
296 | { | 296 | { |
297 | if (soc_ac97_ops.reset) { | 297 | if (soc_ac97_ops->reset) { |
298 | soc_ac97_ops.reset(codec->ac97); | 298 | soc_ac97_ops->reset(codec->ac97); |
299 | if (ac97_read(codec, 0) == wm9705_reg[0]) | 299 | if (ac97_read(codec, 0) == wm9705_reg[0]) |
300 | return 0; /* Success */ | 300 | return 0; /* Success */ |
301 | } | 301 | } |
@@ -306,7 +306,7 @@ static int wm9705_reset(struct snd_soc_codec *codec) | |||
306 | #ifdef CONFIG_PM | 306 | #ifdef CONFIG_PM |
307 | static int wm9705_soc_suspend(struct snd_soc_codec *codec) | 307 | static int wm9705_soc_suspend(struct snd_soc_codec *codec) |
308 | { | 308 | { |
309 | soc_ac97_ops.write(codec->ac97, AC97_POWERDOWN, 0xffff); | 309 | soc_ac97_ops->write(codec->ac97, AC97_POWERDOWN, 0xffff); |
310 | 310 | ||
311 | return 0; | 311 | return 0; |
312 | } | 312 | } |
@@ -323,7 +323,7 @@ static int wm9705_soc_resume(struct snd_soc_codec *codec) | |||
323 | } | 323 | } |
324 | 324 | ||
325 | for (i = 2; i < ARRAY_SIZE(wm9705_reg) << 1; i += 2) { | 325 | for (i = 2; i < ARRAY_SIZE(wm9705_reg) << 1; i += 2) { |
326 | soc_ac97_ops.write(codec->ac97, i, cache[i>>1]); | 326 | soc_ac97_ops->write(codec->ac97, i, cache[i>>1]); |
327 | } | 327 | } |
328 | 328 | ||
329 | return 0; | 329 | return 0; |
@@ -337,9 +337,7 @@ static int wm9705_soc_probe(struct snd_soc_codec *codec) | |||
337 | { | 337 | { |
338 | int ret = 0; | 338 | int ret = 0; |
339 | 339 | ||
340 | printk(KERN_INFO "WM9705 SoC Audio Codec\n"); | 340 | ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); |
341 | |||
342 | ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0); | ||
343 | if (ret < 0) { | 341 | if (ret < 0) { |
344 | printk(KERN_ERR "wm9705: failed to register AC97 codec\n"); | 342 | printk(KERN_ERR "wm9705: failed to register AC97 codec\n"); |
345 | return ret; | 343 | return ret; |
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 8e9a6a3eeb1a..c5eb746087b4 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c | |||
@@ -455,7 +455,7 @@ static unsigned int ac97_read(struct snd_soc_codec *codec, | |||
455 | if (reg == AC97_RESET || reg == AC97_GPIO_STATUS || | 455 | if (reg == AC97_RESET || reg == AC97_GPIO_STATUS || |
456 | reg == AC97_VENDOR_ID1 || reg == AC97_VENDOR_ID2 || | 456 | reg == AC97_VENDOR_ID1 || reg == AC97_VENDOR_ID2 || |
457 | reg == AC97_REC_GAIN) | 457 | reg == AC97_REC_GAIN) |
458 | return soc_ac97_ops.read(codec->ac97, reg); | 458 | return soc_ac97_ops->read(codec->ac97, reg); |
459 | else { | 459 | else { |
460 | reg = reg >> 1; | 460 | reg = reg >> 1; |
461 | 461 | ||
@@ -472,7 +472,7 @@ static int ac97_write(struct snd_soc_codec *codec, unsigned int reg, | |||
472 | u16 *cache = codec->reg_cache; | 472 | u16 *cache = codec->reg_cache; |
473 | 473 | ||
474 | if (reg < 0x7c) | 474 | if (reg < 0x7c) |
475 | soc_ac97_ops.write(codec->ac97, reg, val); | 475 | soc_ac97_ops->write(codec->ac97, reg, val); |
476 | reg = reg >> 1; | 476 | reg = reg >> 1; |
477 | if (reg < (ARRAY_SIZE(wm9712_reg))) | 477 | if (reg < (ARRAY_SIZE(wm9712_reg))) |
478 | cache[reg] = val; | 478 | cache[reg] = val; |
@@ -581,15 +581,15 @@ static int wm9712_set_bias_level(struct snd_soc_codec *codec, | |||
581 | 581 | ||
582 | static int wm9712_reset(struct snd_soc_codec *codec, int try_warm) | 582 | static int wm9712_reset(struct snd_soc_codec *codec, int try_warm) |
583 | { | 583 | { |
584 | if (try_warm && soc_ac97_ops.warm_reset) { | 584 | if (try_warm && soc_ac97_ops->warm_reset) { |
585 | soc_ac97_ops.warm_reset(codec->ac97); | 585 | soc_ac97_ops->warm_reset(codec->ac97); |
586 | if (ac97_read(codec, 0) == wm9712_reg[0]) | 586 | if (ac97_read(codec, 0) == wm9712_reg[0]) |
587 | return 1; | 587 | return 1; |
588 | } | 588 | } |
589 | 589 | ||
590 | soc_ac97_ops.reset(codec->ac97); | 590 | soc_ac97_ops->reset(codec->ac97); |
591 | if (soc_ac97_ops.warm_reset) | 591 | if (soc_ac97_ops->warm_reset) |
592 | soc_ac97_ops.warm_reset(codec->ac97); | 592 | soc_ac97_ops->warm_reset(codec->ac97); |
593 | if (ac97_read(codec, 0) != wm9712_reg[0]) | 593 | if (ac97_read(codec, 0) != wm9712_reg[0]) |
594 | goto err; | 594 | goto err; |
595 | return 0; | 595 | return 0; |
@@ -624,7 +624,7 @@ static int wm9712_soc_resume(struct snd_soc_codec *codec) | |||
624 | if (i == AC97_INT_PAGING || i == AC97_POWERDOWN || | 624 | if (i == AC97_INT_PAGING || i == AC97_POWERDOWN || |
625 | (i > 0x58 && i != 0x5c)) | 625 | (i > 0x58 && i != 0x5c)) |
626 | continue; | 626 | continue; |
627 | soc_ac97_ops.write(codec->ac97, i, cache[i>>1]); | 627 | soc_ac97_ops->write(codec->ac97, i, cache[i>>1]); |
628 | } | 628 | } |
629 | } | 629 | } |
630 | 630 | ||
@@ -635,7 +635,7 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec) | |||
635 | { | 635 | { |
636 | int ret = 0; | 636 | int ret = 0; |
637 | 637 | ||
638 | ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0); | 638 | ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); |
639 | if (ret < 0) { | 639 | if (ret < 0) { |
640 | printk(KERN_ERR "wm9712: failed to register AC97 codec\n"); | 640 | printk(KERN_ERR "wm9712: failed to register AC97 codec\n"); |
641 | return ret; | 641 | return ret; |
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index f7afa68d8c7f..a53e175c015a 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
@@ -652,7 +652,7 @@ static unsigned int ac97_read(struct snd_soc_codec *codec, | |||
652 | if (reg == AC97_RESET || reg == AC97_GPIO_STATUS || | 652 | if (reg == AC97_RESET || reg == AC97_GPIO_STATUS || |
653 | reg == AC97_VENDOR_ID1 || reg == AC97_VENDOR_ID2 || | 653 | reg == AC97_VENDOR_ID1 || reg == AC97_VENDOR_ID2 || |
654 | reg == AC97_CD) | 654 | reg == AC97_CD) |
655 | return soc_ac97_ops.read(codec->ac97, reg); | 655 | return soc_ac97_ops->read(codec->ac97, reg); |
656 | else { | 656 | else { |
657 | reg = reg >> 1; | 657 | reg = reg >> 1; |
658 | 658 | ||
@@ -668,7 +668,7 @@ static int ac97_write(struct snd_soc_codec *codec, unsigned int reg, | |||
668 | { | 668 | { |
669 | u16 *cache = codec->reg_cache; | 669 | u16 *cache = codec->reg_cache; |
670 | if (reg < 0x7c) | 670 | if (reg < 0x7c) |
671 | soc_ac97_ops.write(codec->ac97, reg, val); | 671 | soc_ac97_ops->write(codec->ac97, reg, val); |
672 | reg = reg >> 1; | 672 | reg = reg >> 1; |
673 | if (reg < (ARRAY_SIZE(wm9713_reg))) | 673 | if (reg < (ARRAY_SIZE(wm9713_reg))) |
674 | cache[reg] = val; | 674 | cache[reg] = val; |
@@ -1095,15 +1095,15 @@ static struct snd_soc_dai_driver wm9713_dai[] = { | |||
1095 | 1095 | ||
1096 | int wm9713_reset(struct snd_soc_codec *codec, int try_warm) | 1096 | int wm9713_reset(struct snd_soc_codec *codec, int try_warm) |
1097 | { | 1097 | { |
1098 | if (try_warm && soc_ac97_ops.warm_reset) { | 1098 | if (try_warm && soc_ac97_ops->warm_reset) { |
1099 | soc_ac97_ops.warm_reset(codec->ac97); | 1099 | soc_ac97_ops->warm_reset(codec->ac97); |
1100 | if (ac97_read(codec, 0) == wm9713_reg[0]) | 1100 | if (ac97_read(codec, 0) == wm9713_reg[0]) |
1101 | return 1; | 1101 | return 1; |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | soc_ac97_ops.reset(codec->ac97); | 1104 | soc_ac97_ops->reset(codec->ac97); |
1105 | if (soc_ac97_ops.warm_reset) | 1105 | if (soc_ac97_ops->warm_reset) |
1106 | soc_ac97_ops.warm_reset(codec->ac97); | 1106 | soc_ac97_ops->warm_reset(codec->ac97); |
1107 | if (ac97_read(codec, 0) != wm9713_reg[0]) | 1107 | if (ac97_read(codec, 0) != wm9713_reg[0]) |
1108 | return -EIO; | 1108 | return -EIO; |
1109 | return 0; | 1109 | return 0; |
@@ -1180,7 +1180,7 @@ static int wm9713_soc_resume(struct snd_soc_codec *codec) | |||
1180 | if (i == AC97_POWERDOWN || i == AC97_EXTENDED_MID || | 1180 | if (i == AC97_POWERDOWN || i == AC97_EXTENDED_MID || |
1181 | i == AC97_EXTENDED_MSTATUS || i > 0x66) | 1181 | i == AC97_EXTENDED_MSTATUS || i > 0x66) |
1182 | continue; | 1182 | continue; |
1183 | soc_ac97_ops.write(codec->ac97, i, cache[i>>1]); | 1183 | soc_ac97_ops->write(codec->ac97, i, cache[i>>1]); |
1184 | } | 1184 | } |
1185 | } | 1185 | } |
1186 | 1186 | ||
@@ -1197,7 +1197,7 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec) | |||
1197 | return -ENOMEM; | 1197 | return -ENOMEM; |
1198 | snd_soc_codec_set_drvdata(codec, wm9713); | 1198 | snd_soc_codec_set_drvdata(codec, wm9713); |
1199 | 1199 | ||
1200 | ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0); | 1200 | ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); |
1201 | if (ret < 0) | 1201 | if (ret < 0) |
1202 | goto codec_err; | 1202 | goto codec_err; |
1203 | 1203 | ||
diff --git a/sound/soc/codecs/wm_adsp.h b/sound/soc/codecs/wm_adsp.h index 6e890b916592..9f922c82536c 100644 --- a/sound/soc/codecs/wm_adsp.h +++ b/sound/soc/codecs/wm_adsp.h | |||
@@ -61,14 +61,12 @@ struct wm_adsp { | |||
61 | }; | 61 | }; |
62 | 62 | ||
63 | #define WM_ADSP1(wname, num) \ | 63 | #define WM_ADSP1(wname, num) \ |
64 | { .id = snd_soc_dapm_pga, .name = wname, .reg = SND_SOC_NOPM, \ | 64 | SND_SOC_DAPM_PGA_E(wname, SND_SOC_NOPM, num, 0, NULL, 0, \ |
65 | .shift = num, .event = wm_adsp1_event, \ | 65 | wm_adsp1_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD) |
66 | .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD } | ||
67 | 66 | ||
68 | #define WM_ADSP2(wname, num) \ | 67 | #define WM_ADSP2(wname, num) \ |
69 | { .id = snd_soc_dapm_pga, .name = wname, .reg = SND_SOC_NOPM, \ | 68 | SND_SOC_DAPM_PGA_E(wname, SND_SOC_NOPM, num, 0, NULL, 0, \ |
70 | .shift = num, .event = wm_adsp2_event, \ | 69 | wm_adsp2_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD) |
71 | .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD } | ||
72 | 70 | ||
73 | extern const struct snd_kcontrol_new wm_adsp1_fw_controls[]; | 71 | extern const struct snd_kcontrol_new wm_adsp1_fw_controls[]; |
74 | extern const struct snd_kcontrol_new wm_adsp2_fw_controls[]; | 72 | extern const struct snd_kcontrol_new wm_adsp2_fw_controls[]; |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index f5d81b948759..2d9e099415a5 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
@@ -693,10 +693,8 @@ void wm_hubs_update_class_w(struct snd_soc_codec *codec) | |||
693 | EXPORT_SYMBOL_GPL(wm_hubs_update_class_w); | 693 | EXPORT_SYMBOL_GPL(wm_hubs_update_class_w); |
694 | 694 | ||
695 | #define WM_HUBS_SINGLE_W(xname, reg, shift, max, invert) \ | 695 | #define WM_HUBS_SINGLE_W(xname, reg, shift, max, invert) \ |
696 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 696 | SOC_SINGLE_EXT(xname, reg, shift, max, invert, \ |
697 | .info = snd_soc_info_volsw, \ | 697 | snd_soc_dapm_get_volsw, class_w_put_volsw) |
698 | .get = snd_soc_dapm_get_volsw, .put = class_w_put_volsw, \ | ||
699 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } | ||
700 | 698 | ||
701 | static int class_w_put_volsw(struct snd_kcontrol *kcontrol, | 699 | static int class_w_put_volsw(struct snd_kcontrol *kcontrol, |
702 | struct snd_ctl_elem_value *ucontrol) | 700 | struct snd_ctl_elem_value *ucontrol) |
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c index a8362be3cd18..51be3772cba9 100644 --- a/sound/soc/fsl/imx-ssi.c +++ b/sound/soc/fsl/imx-ssi.c | |||
@@ -501,13 +501,12 @@ static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97) | |||
501 | imx_ssi_ac97_read(ac97, 0); | 501 | imx_ssi_ac97_read(ac97, 0); |
502 | } | 502 | } |
503 | 503 | ||
504 | struct snd_ac97_bus_ops soc_ac97_ops = { | 504 | static struct snd_ac97_bus_ops imx_ssi_ac97_ops = { |
505 | .read = imx_ssi_ac97_read, | 505 | .read = imx_ssi_ac97_read, |
506 | .write = imx_ssi_ac97_write, | 506 | .write = imx_ssi_ac97_write, |
507 | .reset = imx_ssi_ac97_reset, | 507 | .reset = imx_ssi_ac97_reset, |
508 | .warm_reset = imx_ssi_ac97_warm_reset | 508 | .warm_reset = imx_ssi_ac97_warm_reset |
509 | }; | 509 | }; |
510 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | ||
511 | 510 | ||
512 | static int imx_ssi_probe(struct platform_device *pdev) | 511 | static int imx_ssi_probe(struct platform_device *pdev) |
513 | { | 512 | { |
@@ -583,6 +582,12 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
583 | 582 | ||
584 | platform_set_drvdata(pdev, ssi); | 583 | platform_set_drvdata(pdev, ssi); |
585 | 584 | ||
585 | ret = snd_soc_set_ac97_ops(&imx_ssi_ac97_ops); | ||
586 | if (ret != 0) { | ||
587 | dev_err(&pdev->dev, "Failed to set AC'97 ops: %d\n", ret); | ||
588 | goto failed_register; | ||
589 | } | ||
590 | |||
586 | ret = snd_soc_register_component(&pdev->dev, &imx_component, | 591 | ret = snd_soc_register_component(&pdev->dev, &imx_component, |
587 | dai, 1); | 592 | dai, 1); |
588 | if (ret) { | 593 | if (ret) { |
@@ -608,6 +613,7 @@ failed_register: | |||
608 | release_mem_region(res->start, resource_size(res)); | 613 | release_mem_region(res->start, resource_size(res)); |
609 | clk_disable_unprepare(ssi->clk); | 614 | clk_disable_unprepare(ssi->clk); |
610 | failed_clk: | 615 | failed_clk: |
616 | snd_soc_set_ac97_ops(NULL); | ||
611 | 617 | ||
612 | return ret; | 618 | return ret; |
613 | } | 619 | } |
@@ -627,6 +633,7 @@ static int imx_ssi_remove(struct platform_device *pdev) | |||
627 | 633 | ||
628 | release_mem_region(res->start, resource_size(res)); | 634 | release_mem_region(res->start, resource_size(res)); |
629 | clk_disable_unprepare(ssi->clk); | 635 | clk_disable_unprepare(ssi->clk); |
636 | snd_soc_set_ac97_ops(NULL); | ||
630 | 637 | ||
631 | return 0; | 638 | return 0; |
632 | } | 639 | } |
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c index 4141b35ef0bb..3ef7a0c92efa 100644 --- a/sound/soc/fsl/mpc5200_psc_ac97.c +++ b/sound/soc/fsl/mpc5200_psc_ac97.c | |||
@@ -131,13 +131,12 @@ static void psc_ac97_cold_reset(struct snd_ac97 *ac97) | |||
131 | psc_ac97_warm_reset(ac97); | 131 | psc_ac97_warm_reset(ac97); |
132 | } | 132 | } |
133 | 133 | ||
134 | struct snd_ac97_bus_ops soc_ac97_ops = { | 134 | static struct snd_ac97_bus_ops psc_ac97_ops = { |
135 | .read = psc_ac97_read, | 135 | .read = psc_ac97_read, |
136 | .write = psc_ac97_write, | 136 | .write = psc_ac97_write, |
137 | .reset = psc_ac97_cold_reset, | 137 | .reset = psc_ac97_cold_reset, |
138 | .warm_reset = psc_ac97_warm_reset, | 138 | .warm_reset = psc_ac97_warm_reset, |
139 | }; | 139 | }; |
140 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | ||
141 | 140 | ||
142 | static int psc_ac97_hw_analog_params(struct snd_pcm_substream *substream, | 141 | static int psc_ac97_hw_analog_params(struct snd_pcm_substream *substream, |
143 | struct snd_pcm_hw_params *params, | 142 | struct snd_pcm_hw_params *params, |
@@ -290,6 +289,12 @@ static int psc_ac97_of_probe(struct platform_device *op) | |||
290 | if (rc != 0) | 289 | if (rc != 0) |
291 | return rc; | 290 | return rc; |
292 | 291 | ||
292 | rc = snd_soc_set_ac97_ops(&psc_ac97_ops); | ||
293 | if (rc != 0) { | ||
294 | dev_err(&op->dev, "Failed to set AC'97 ops: %d\n", ret); | ||
295 | return rc; | ||
296 | } | ||
297 | |||
293 | rc = snd_soc_register_component(&op->dev, &psc_ac97_component, | 298 | rc = snd_soc_register_component(&op->dev, &psc_ac97_component, |
294 | psc_ac97_dai, ARRAY_SIZE(psc_ac97_dai)); | 299 | psc_ac97_dai, ARRAY_SIZE(psc_ac97_dai)); |
295 | if (rc != 0) { | 300 | if (rc != 0) { |
@@ -318,6 +323,7 @@ static int psc_ac97_of_remove(struct platform_device *op) | |||
318 | { | 323 | { |
319 | mpc5200_audio_dma_destroy(op); | 324 | mpc5200_audio_dma_destroy(op); |
320 | snd_soc_unregister_component(&op->dev); | 325 | snd_soc_unregister_component(&op->dev); |
326 | snd_soc_set_ac97_ops(NULL); | ||
321 | return 0; | 327 | return 0; |
322 | } | 328 | } |
323 | 329 | ||
diff --git a/sound/soc/mid-x86/mfld_machine.c b/sound/soc/mid-x86/mfld_machine.c index 78d582519891..ee363845759e 100644 --- a/sound/soc/mid-x86/mfld_machine.c +++ b/sound/soc/mid-x86/mfld_machine.c | |||
@@ -371,7 +371,7 @@ static int snd_mfld_mc_probe(struct platform_device *pdev) | |||
371 | 371 | ||
372 | /* audio interrupt base of SRAM location where | 372 | /* audio interrupt base of SRAM location where |
373 | * interrupts are stored by System FW */ | 373 | * interrupts are stored by System FW */ |
374 | mc_drv_ctx = kzalloc(sizeof(*mc_drv_ctx), GFP_ATOMIC); | 374 | mc_drv_ctx = devm_kzalloc(&pdev->dev, sizeof(*mc_drv_ctx), GFP_ATOMIC); |
375 | if (!mc_drv_ctx) { | 375 | if (!mc_drv_ctx) { |
376 | pr_err("allocation failed\n"); | 376 | pr_err("allocation failed\n"); |
377 | return -ENOMEM; | 377 | return -ENOMEM; |
@@ -381,50 +381,39 @@ static int snd_mfld_mc_probe(struct platform_device *pdev) | |||
381 | pdev, IORESOURCE_MEM, "IRQ_BASE"); | 381 | pdev, IORESOURCE_MEM, "IRQ_BASE"); |
382 | if (!irq_mem) { | 382 | if (!irq_mem) { |
383 | pr_err("no mem resource given\n"); | 383 | pr_err("no mem resource given\n"); |
384 | ret_val = -ENODEV; | 384 | return -ENODEV; |
385 | goto unalloc; | ||
386 | } | 385 | } |
387 | mc_drv_ctx->int_base = ioremap_nocache(irq_mem->start, | 386 | mc_drv_ctx->int_base = devm_ioremap_nocache(&pdev->dev, irq_mem->start, |
388 | resource_size(irq_mem)); | 387 | resource_size(irq_mem)); |
389 | if (!mc_drv_ctx->int_base) { | 388 | if (!mc_drv_ctx->int_base) { |
390 | pr_err("Mapping of cache failed\n"); | 389 | pr_err("Mapping of cache failed\n"); |
391 | ret_val = -ENOMEM; | 390 | return -ENOMEM; |
392 | goto unalloc; | ||
393 | } | 391 | } |
394 | /* register for interrupt */ | 392 | /* register for interrupt */ |
395 | ret_val = request_threaded_irq(irq, snd_mfld_jack_intr_handler, | 393 | ret_val = devm_request_threaded_irq(&pdev->dev, irq, |
394 | snd_mfld_jack_intr_handler, | ||
396 | snd_mfld_jack_detection, | 395 | snd_mfld_jack_detection, |
397 | IRQF_SHARED, pdev->dev.driver->name, mc_drv_ctx); | 396 | IRQF_SHARED, pdev->dev.driver->name, mc_drv_ctx); |
398 | if (ret_val) { | 397 | if (ret_val) { |
399 | pr_err("cannot register IRQ\n"); | 398 | pr_err("cannot register IRQ\n"); |
400 | goto unalloc; | 399 | return ret_val; |
401 | } | 400 | } |
402 | /* register the soc card */ | 401 | /* register the soc card */ |
403 | snd_soc_card_mfld.dev = &pdev->dev; | 402 | snd_soc_card_mfld.dev = &pdev->dev; |
404 | ret_val = snd_soc_register_card(&snd_soc_card_mfld); | 403 | ret_val = snd_soc_register_card(&snd_soc_card_mfld); |
405 | if (ret_val) { | 404 | if (ret_val) { |
406 | pr_debug("snd_soc_register_card failed %d\n", ret_val); | 405 | pr_debug("snd_soc_register_card failed %d\n", ret_val); |
407 | goto freeirq; | 406 | return ret_val; |
408 | } | 407 | } |
409 | platform_set_drvdata(pdev, mc_drv_ctx); | 408 | platform_set_drvdata(pdev, mc_drv_ctx); |
410 | pr_debug("successfully exited probe\n"); | 409 | pr_debug("successfully exited probe\n"); |
411 | return ret_val; | 410 | return 0; |
412 | |||
413 | freeirq: | ||
414 | free_irq(irq, mc_drv_ctx); | ||
415 | unalloc: | ||
416 | kfree(mc_drv_ctx); | ||
417 | return ret_val; | ||
418 | } | 411 | } |
419 | 412 | ||
420 | static int snd_mfld_mc_remove(struct platform_device *pdev) | 413 | static int snd_mfld_mc_remove(struct platform_device *pdev) |
421 | { | 414 | { |
422 | struct mfld_mc_private *mc_drv_ctx = platform_get_drvdata(pdev); | ||
423 | |||
424 | pr_debug("snd_mfld_mc_remove called\n"); | 415 | pr_debug("snd_mfld_mc_remove called\n"); |
425 | free_irq(platform_get_irq(pdev, 0), mc_drv_ctx); | ||
426 | snd_soc_unregister_card(&snd_soc_card_mfld); | 416 | snd_soc_unregister_card(&snd_soc_card_mfld); |
427 | kfree(mc_drv_ctx); | ||
428 | return 0; | 417 | return 0; |
429 | } | 418 | } |
430 | 419 | ||
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c index fe3285ceaf5b..f4c2417a8730 100644 --- a/sound/soc/nuc900/nuc900-ac97.c +++ b/sound/soc/nuc900/nuc900-ac97.c | |||
@@ -197,13 +197,12 @@ static void nuc900_ac97_cold_reset(struct snd_ac97 *ac97) | |||
197 | } | 197 | } |
198 | 198 | ||
199 | /* AC97 controller operations */ | 199 | /* AC97 controller operations */ |
200 | struct snd_ac97_bus_ops soc_ac97_ops = { | 200 | static struct snd_ac97_bus_ops nuc900_ac97_ops = { |
201 | .read = nuc900_ac97_read, | 201 | .read = nuc900_ac97_read, |
202 | .write = nuc900_ac97_write, | 202 | .write = nuc900_ac97_write, |
203 | .reset = nuc900_ac97_cold_reset, | 203 | .reset = nuc900_ac97_cold_reset, |
204 | .warm_reset = nuc900_ac97_warm_reset, | 204 | .warm_reset = nuc900_ac97_warm_reset, |
205 | } | 205 | }; |
206 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | ||
207 | 206 | ||
208 | static int nuc900_ac97_trigger(struct snd_pcm_substream *substream, | 207 | static int nuc900_ac97_trigger(struct snd_pcm_substream *substream, |
209 | int cmd, struct snd_soc_dai *dai) | 208 | int cmd, struct snd_soc_dai *dai) |
@@ -326,64 +325,52 @@ static int nuc900_ac97_drvprobe(struct platform_device *pdev) | |||
326 | if (nuc900_ac97_data) | 325 | if (nuc900_ac97_data) |
327 | return -EBUSY; | 326 | return -EBUSY; |
328 | 327 | ||
329 | nuc900_audio = kzalloc(sizeof(struct nuc900_audio), GFP_KERNEL); | 328 | nuc900_audio = devm_kzalloc(&pdev->dev, sizeof(struct nuc900_audio), |
329 | GFP_KERNEL); | ||
330 | if (!nuc900_audio) | 330 | if (!nuc900_audio) |
331 | return -ENOMEM; | 331 | return -ENOMEM; |
332 | 332 | ||
333 | spin_lock_init(&nuc900_audio->lock); | 333 | spin_lock_init(&nuc900_audio->lock); |
334 | 334 | ||
335 | nuc900_audio->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 335 | nuc900_audio->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
336 | if (!nuc900_audio->res) { | 336 | if (!nuc900_audio->res) |
337 | ret = -ENODEV; | 337 | return ret; |
338 | goto out0; | ||
339 | } | ||
340 | |||
341 | if (!request_mem_region(nuc900_audio->res->start, | ||
342 | resource_size(nuc900_audio->res), pdev->name)) { | ||
343 | ret = -EBUSY; | ||
344 | goto out0; | ||
345 | } | ||
346 | 338 | ||
347 | nuc900_audio->mmio = ioremap(nuc900_audio->res->start, | 339 | nuc900_audio->mmio = devm_ioremap_resource(&pdev->dev, |
348 | resource_size(nuc900_audio->res)); | 340 | nuc900_audio->res); |
349 | if (!nuc900_audio->mmio) { | 341 | if (IS_ERR(nuc900_audio->mmio)) |
350 | ret = -ENOMEM; | 342 | return PTR_ERR(nuc900_audio->mmio); |
351 | goto out1; | ||
352 | } | ||
353 | 343 | ||
354 | nuc900_audio->clk = clk_get(&pdev->dev, NULL); | 344 | nuc900_audio->clk = devm_clk_get(&pdev->dev, NULL); |
355 | if (IS_ERR(nuc900_audio->clk)) { | 345 | if (IS_ERR(nuc900_audio->clk)) { |
356 | ret = PTR_ERR(nuc900_audio->clk); | 346 | ret = PTR_ERR(nuc900_audio->clk); |
357 | goto out2; | 347 | goto out; |
358 | } | 348 | } |
359 | 349 | ||
360 | nuc900_audio->irq_num = platform_get_irq(pdev, 0); | 350 | nuc900_audio->irq_num = platform_get_irq(pdev, 0); |
361 | if (!nuc900_audio->irq_num) { | 351 | if (!nuc900_audio->irq_num) { |
362 | ret = -EBUSY; | 352 | ret = -EBUSY; |
363 | goto out3; | 353 | goto out; |
364 | } | 354 | } |
365 | 355 | ||
366 | nuc900_ac97_data = nuc900_audio; | 356 | nuc900_ac97_data = nuc900_audio; |
367 | 357 | ||
358 | ret = snd_soc_set_ac97_ops(&nuc900_ac97_ops); | ||
359 | if (ret) | ||
360 | goto out; | ||
361 | |||
368 | ret = snd_soc_register_component(&pdev->dev, &nuc900_ac97_component, | 362 | ret = snd_soc_register_component(&pdev->dev, &nuc900_ac97_component, |
369 | &nuc900_ac97_dai, 1); | 363 | &nuc900_ac97_dai, 1); |
370 | if (ret) | 364 | if (ret) |
371 | goto out3; | 365 | goto out; |
372 | 366 | ||
373 | /* enbale ac97 multifunction pin */ | 367 | /* enbale ac97 multifunction pin */ |
374 | mfp_set_groupg(nuc900_audio->dev, NULL); | 368 | mfp_set_groupg(nuc900_audio->dev, NULL); |
375 | 369 | ||
376 | return 0; | 370 | return 0; |
377 | 371 | ||
378 | out3: | 372 | out: |
379 | clk_put(nuc900_audio->clk); | 373 | snd_soc_set_ac97_ops(NULL); |
380 | out2: | ||
381 | iounmap(nuc900_audio->mmio); | ||
382 | out1: | ||
383 | release_mem_region(nuc900_audio->res->start, | ||
384 | resource_size(nuc900_audio->res)); | ||
385 | out0: | ||
386 | kfree(nuc900_audio); | ||
387 | return ret; | 374 | return ret; |
388 | } | 375 | } |
389 | 376 | ||
@@ -391,13 +378,8 @@ static int nuc900_ac97_drvremove(struct platform_device *pdev) | |||
391 | { | 378 | { |
392 | snd_soc_unregister_component(&pdev->dev); | 379 | snd_soc_unregister_component(&pdev->dev); |
393 | 380 | ||
394 | clk_put(nuc900_ac97_data->clk); | ||
395 | iounmap(nuc900_ac97_data->mmio); | ||
396 | release_mem_region(nuc900_ac97_data->res->start, | ||
397 | resource_size(nuc900_ac97_data->res)); | ||
398 | |||
399 | kfree(nuc900_ac97_data); | ||
400 | nuc900_ac97_data = NULL; | 381 | nuc900_ac97_data = NULL; |
382 | snd_soc_set_ac97_ops(NULL); | ||
401 | 383 | ||
402 | return 0; | 384 | return 0; |
403 | } | 385 | } |
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index 57ea8e6c5488..a3c22ba25f08 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c | |||
@@ -41,13 +41,12 @@ static void pxa2xx_ac97_cold_reset(struct snd_ac97 *ac97) | |||
41 | pxa2xx_ac97_finish_reset(ac97); | 41 | pxa2xx_ac97_finish_reset(ac97); |
42 | } | 42 | } |
43 | 43 | ||
44 | struct snd_ac97_bus_ops soc_ac97_ops = { | 44 | static struct snd_ac97_bus_ops pxa2xx_ac97_ops = { |
45 | .read = pxa2xx_ac97_read, | 45 | .read = pxa2xx_ac97_read, |
46 | .write = pxa2xx_ac97_write, | 46 | .write = pxa2xx_ac97_write, |
47 | .warm_reset = pxa2xx_ac97_warm_reset, | 47 | .warm_reset = pxa2xx_ac97_warm_reset, |
48 | .reset = pxa2xx_ac97_cold_reset, | 48 | .reset = pxa2xx_ac97_cold_reset, |
49 | }; | 49 | }; |
50 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | ||
51 | 50 | ||
52 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_out = { | 51 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_out = { |
53 | .name = "AC97 PCM Stereo out", | 52 | .name = "AC97 PCM Stereo out", |
@@ -244,6 +243,10 @@ static int pxa2xx_ac97_dev_probe(struct platform_device *pdev) | |||
244 | return -ENXIO; | 243 | return -ENXIO; |
245 | } | 244 | } |
246 | 245 | ||
246 | ret = snd_soc_set_ac97_ops(&pxa2xx_ac97_ops); | ||
247 | if (ret != 0) | ||
248 | return ret; | ||
249 | |||
247 | /* Punt most of the init to the SoC probe; we may need the machine | 250 | /* Punt most of the init to the SoC probe; we may need the machine |
248 | * driver to do interesting things with the clocking to get us up | 251 | * driver to do interesting things with the clocking to get us up |
249 | * and running. | 252 | * and running. |
@@ -255,6 +258,7 @@ static int pxa2xx_ac97_dev_probe(struct platform_device *pdev) | |||
255 | static int pxa2xx_ac97_dev_remove(struct platform_device *pdev) | 258 | static int pxa2xx_ac97_dev_remove(struct platform_device *pdev) |
256 | { | 259 | { |
257 | snd_soc_unregister_component(&pdev->dev); | 260 | snd_soc_unregister_component(&pdev->dev); |
261 | snd_soc_set_ac97_ops(NULL); | ||
258 | return 0; | 262 | return 0; |
259 | } | 263 | } |
260 | 264 | ||
diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c index cb88ead98917..2dd623fa3882 100644 --- a/sound/soc/samsung/ac97.c +++ b/sound/soc/samsung/ac97.c | |||
@@ -214,13 +214,12 @@ static irqreturn_t s3c_ac97_irq(int irq, void *dev_id) | |||
214 | return IRQ_HANDLED; | 214 | return IRQ_HANDLED; |
215 | } | 215 | } |
216 | 216 | ||
217 | struct snd_ac97_bus_ops soc_ac97_ops = { | 217 | static struct snd_ac97_bus_ops s3c_ac97_ops = { |
218 | .read = s3c_ac97_read, | 218 | .read = s3c_ac97_read, |
219 | .write = s3c_ac97_write, | 219 | .write = s3c_ac97_write, |
220 | .warm_reset = s3c_ac97_warm_reset, | 220 | .warm_reset = s3c_ac97_warm_reset, |
221 | .reset = s3c_ac97_cold_reset, | 221 | .reset = s3c_ac97_cold_reset, |
222 | }; | 222 | }; |
223 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | ||
224 | 223 | ||
225 | static int s3c_ac97_hw_params(struct snd_pcm_substream *substream, | 224 | static int s3c_ac97_hw_params(struct snd_pcm_substream *substream, |
226 | struct snd_pcm_hw_params *params, | 225 | struct snd_pcm_hw_params *params, |
@@ -417,11 +416,9 @@ static int s3c_ac97_probe(struct platform_device *pdev) | |||
417 | return -ENXIO; | 416 | return -ENXIO; |
418 | } | 417 | } |
419 | 418 | ||
420 | if (!request_mem_region(mem_res->start, | 419 | s3c_ac97.regs = devm_ioremap_resource(&pdev->dev, mem_res); |
421 | resource_size(mem_res), "ac97")) { | 420 | if (IS_ERR(s3c_ac97.regs)) |
422 | dev_err(&pdev->dev, "Unable to request register region\n"); | 421 | return PTR_ERR(s3c_ac97.regs); |
423 | return -EBUSY; | ||
424 | } | ||
425 | 422 | ||
426 | s3c_ac97_pcm_out.channel = dmatx_res->start; | 423 | s3c_ac97_pcm_out.channel = dmatx_res->start; |
427 | s3c_ac97_pcm_out.dma_addr = mem_res->start + S3C_AC97_PCM_DATA; | 424 | s3c_ac97_pcm_out.dma_addr = mem_res->start + S3C_AC97_PCM_DATA; |
@@ -433,14 +430,7 @@ static int s3c_ac97_probe(struct platform_device *pdev) | |||
433 | init_completion(&s3c_ac97.done); | 430 | init_completion(&s3c_ac97.done); |
434 | mutex_init(&s3c_ac97.lock); | 431 | mutex_init(&s3c_ac97.lock); |
435 | 432 | ||
436 | s3c_ac97.regs = ioremap(mem_res->start, resource_size(mem_res)); | 433 | s3c_ac97.ac97_clk = devm_clk_get(&pdev->dev, "ac97"); |
437 | if (s3c_ac97.regs == NULL) { | ||
438 | dev_err(&pdev->dev, "Unable to ioremap register region\n"); | ||
439 | ret = -ENXIO; | ||
440 | goto err1; | ||
441 | } | ||
442 | |||
443 | s3c_ac97.ac97_clk = clk_get(&pdev->dev, "ac97"); | ||
444 | if (IS_ERR(s3c_ac97.ac97_clk)) { | 434 | if (IS_ERR(s3c_ac97.ac97_clk)) { |
445 | dev_err(&pdev->dev, "ac97 failed to get ac97_clock\n"); | 435 | dev_err(&pdev->dev, "ac97 failed to get ac97_clock\n"); |
446 | ret = -ENODEV; | 436 | ret = -ENODEV; |
@@ -461,6 +451,12 @@ static int s3c_ac97_probe(struct platform_device *pdev) | |||
461 | goto err4; | 451 | goto err4; |
462 | } | 452 | } |
463 | 453 | ||
454 | ret = snd_soc_set_ac97_ops(&s3c_ac97_ops); | ||
455 | if (ret != 0) { | ||
456 | dev_err(&pdev->dev, "Failed to set AC'97 ops: %d\n", ret); | ||
457 | goto err4; | ||
458 | } | ||
459 | |||
464 | ret = snd_soc_register_component(&pdev->dev, &s3c_ac97_component, | 460 | ret = snd_soc_register_component(&pdev->dev, &s3c_ac97_component, |
465 | s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai)); | 461 | s3c_ac97_dai, ARRAY_SIZE(s3c_ac97_dai)); |
466 | if (ret) | 462 | if (ret) |
@@ -480,18 +476,14 @@ err5: | |||
480 | err4: | 476 | err4: |
481 | err3: | 477 | err3: |
482 | clk_disable_unprepare(s3c_ac97.ac97_clk); | 478 | clk_disable_unprepare(s3c_ac97.ac97_clk); |
483 | clk_put(s3c_ac97.ac97_clk); | ||
484 | err2: | 479 | err2: |
485 | iounmap(s3c_ac97.regs); | 480 | snd_soc_set_ac97_ops(NULL); |
486 | err1: | ||
487 | release_mem_region(mem_res->start, resource_size(mem_res)); | ||
488 | |||
489 | return ret; | 481 | return ret; |
490 | } | 482 | } |
491 | 483 | ||
492 | static int s3c_ac97_remove(struct platform_device *pdev) | 484 | static int s3c_ac97_remove(struct platform_device *pdev) |
493 | { | 485 | { |
494 | struct resource *mem_res, *irq_res; | 486 | struct resource *irq_res; |
495 | 487 | ||
496 | asoc_dma_platform_unregister(&pdev->dev); | 488 | asoc_dma_platform_unregister(&pdev->dev); |
497 | snd_soc_unregister_component(&pdev->dev); | 489 | snd_soc_unregister_component(&pdev->dev); |
@@ -501,13 +493,7 @@ static int s3c_ac97_remove(struct platform_device *pdev) | |||
501 | free_irq(irq_res->start, NULL); | 493 | free_irq(irq_res->start, NULL); |
502 | 494 | ||
503 | clk_disable_unprepare(s3c_ac97.ac97_clk); | 495 | clk_disable_unprepare(s3c_ac97.ac97_clk); |
504 | clk_put(s3c_ac97.ac97_clk); | 496 | snd_soc_set_ac97_ops(NULL); |
505 | |||
506 | iounmap(s3c_ac97.regs); | ||
507 | |||
508 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
509 | if (mem_res) | ||
510 | release_mem_region(mem_res->start, resource_size(mem_res)); | ||
511 | 497 | ||
512 | return 0; | 498 | return 0; |
513 | } | 499 | } |
diff --git a/sound/soc/sh/hac.c b/sound/soc/sh/hac.c index af19f77b7bf0..0af2e4dfd139 100644 --- a/sound/soc/sh/hac.c +++ b/sound/soc/sh/hac.c | |||
@@ -227,13 +227,12 @@ static void hac_ac97_coldrst(struct snd_ac97 *ac97) | |||
227 | hac_ac97_warmrst(ac97); | 227 | hac_ac97_warmrst(ac97); |
228 | } | 228 | } |
229 | 229 | ||
230 | struct snd_ac97_bus_ops soc_ac97_ops = { | 230 | static struct snd_ac97_bus_ops hac_ac97_ops = { |
231 | .read = hac_ac97_read, | 231 | .read = hac_ac97_read, |
232 | .write = hac_ac97_write, | 232 | .write = hac_ac97_write, |
233 | .reset = hac_ac97_coldrst, | 233 | .reset = hac_ac97_coldrst, |
234 | .warm_reset = hac_ac97_warmrst, | 234 | .warm_reset = hac_ac97_warmrst, |
235 | }; | 235 | }; |
236 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | ||
237 | 236 | ||
238 | static int hac_hw_params(struct snd_pcm_substream *substream, | 237 | static int hac_hw_params(struct snd_pcm_substream *substream, |
239 | struct snd_pcm_hw_params *params, | 238 | struct snd_pcm_hw_params *params, |
@@ -316,6 +315,10 @@ static const struct snd_soc_component_driver sh4_hac_component = { | |||
316 | 315 | ||
317 | static int hac_soc_platform_probe(struct platform_device *pdev) | 316 | static int hac_soc_platform_probe(struct platform_device *pdev) |
318 | { | 317 | { |
318 | ret = snd_soc_set_ac97_ops(&hac_ac97_ops); | ||
319 | if (ret != 0) | ||
320 | return ret; | ||
321 | |||
319 | return snd_soc_register_component(&pdev->dev, &sh4_hac_component, | 322 | return snd_soc_register_component(&pdev->dev, &sh4_hac_component, |
320 | sh4_hac_dai, ARRAY_SIZE(sh4_hac_dai)); | 323 | sh4_hac_dai, ARRAY_SIZE(sh4_hac_dai)); |
321 | } | 324 | } |
@@ -323,6 +326,7 @@ static int hac_soc_platform_probe(struct platform_device *pdev) | |||
323 | static int hac_soc_platform_remove(struct platform_device *pdev) | 326 | static int hac_soc_platform_remove(struct platform_device *pdev) |
324 | { | 327 | { |
325 | snd_soc_unregister_component(&pdev->dev); | 328 | snd_soc_unregister_component(&pdev->dev); |
329 | snd_soc_set_ac97_ops(NULL); | ||
326 | return 0; | 330 | return 0; |
327 | } | 331 | } |
328 | 332 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 4489c5b7b53a..309e5c91167b 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -2080,6 +2080,22 @@ int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, | |||
2080 | } | 2080 | } |
2081 | EXPORT_SYMBOL_GPL(snd_soc_new_ac97_codec); | 2081 | EXPORT_SYMBOL_GPL(snd_soc_new_ac97_codec); |
2082 | 2082 | ||
2083 | struct snd_ac97_bus_ops *soc_ac97_ops; | ||
2084 | |||
2085 | int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops) | ||
2086 | { | ||
2087 | if (ops == soc_ac97_ops) | ||
2088 | return 0; | ||
2089 | |||
2090 | if (soc_ac97_ops && ops) | ||
2091 | return -EBUSY; | ||
2092 | |||
2093 | soc_ac97_ops = ops; | ||
2094 | |||
2095 | return 0; | ||
2096 | } | ||
2097 | EXPORT_SYMBOL_GPL(snd_soc_set_ac97_ops); | ||
2098 | |||
2083 | /** | 2099 | /** |
2084 | * snd_soc_free_ac97_codec - free AC97 codec device | 2100 | * snd_soc_free_ac97_codec - free AC97 codec device |
2085 | * @codec: audio codec | 2101 | * @codec: audio codec |
diff --git a/sound/soc/tegra/tegra20_ac97.c b/sound/soc/tegra/tegra20_ac97.c index 2f70ea7f6618..f52eab6d2231 100644 --- a/sound/soc/tegra/tegra20_ac97.c +++ b/sound/soc/tegra/tegra20_ac97.c | |||
@@ -142,13 +142,12 @@ static void tegra20_ac97_codec_write(struct snd_ac97 *ac97_snd, | |||
142 | } while (!time_after(jiffies, timeout)); | 142 | } while (!time_after(jiffies, timeout)); |
143 | } | 143 | } |
144 | 144 | ||
145 | struct snd_ac97_bus_ops soc_ac97_ops = { | 145 | static struct snd_ac97_bus_ops tegra20_ac97_ops = { |
146 | .read = tegra20_ac97_codec_read, | 146 | .read = tegra20_ac97_codec_read, |
147 | .write = tegra20_ac97_codec_write, | 147 | .write = tegra20_ac97_codec_write, |
148 | .reset = tegra20_ac97_codec_reset, | 148 | .reset = tegra20_ac97_codec_reset, |
149 | .warm_reset = tegra20_ac97_codec_warm_reset, | 149 | .warm_reset = tegra20_ac97_codec_warm_reset, |
150 | }; | 150 | }; |
151 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | ||
152 | 151 | ||
153 | static inline void tegra20_ac97_start_playback(struct tegra20_ac97 *ac97) | 152 | static inline void tegra20_ac97_start_playback(struct tegra20_ac97 *ac97) |
154 | { | 153 | { |
@@ -327,7 +326,7 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) | |||
327 | } | 326 | } |
328 | dev_set_drvdata(&pdev->dev, ac97); | 327 | dev_set_drvdata(&pdev->dev, ac97); |
329 | 328 | ||
330 | ac97->clk_ac97 = clk_get(&pdev->dev, NULL); | 329 | ac97->clk_ac97 = devm_clk_get(&pdev->dev, NULL); |
331 | if (IS_ERR(ac97->clk_ac97)) { | 330 | if (IS_ERR(ac97->clk_ac97)) { |
332 | dev_err(&pdev->dev, "Can't retrieve ac97 clock\n"); | 331 | dev_err(&pdev->dev, "Can't retrieve ac97 clock\n"); |
333 | ret = PTR_ERR(ac97->clk_ac97); | 332 | ret = PTR_ERR(ac97->clk_ac97); |
@@ -341,18 +340,10 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) | |||
341 | goto err_clk_put; | 340 | goto err_clk_put; |
342 | } | 341 | } |
343 | 342 | ||
344 | memregion = devm_request_mem_region(&pdev->dev, mem->start, | 343 | regs = devm_ioremap_resource(&pdev->dev, mem); |
345 | resource_size(mem), DRV_NAME); | 344 | if (IS_ERR(regs)) { |
346 | if (!memregion) { | 345 | ret = PTR_ERR(regs); |
347 | dev_err(&pdev->dev, "Memory region already claimed\n"); | 346 | dev_err(&pdev->dev, "ioremap failed: %d\n", ret); |
348 | ret = -EBUSY; | ||
349 | goto err_clk_put; | ||
350 | } | ||
351 | |||
352 | regs = devm_ioremap(&pdev->dev, mem->start, resource_size(mem)); | ||
353 | if (!regs) { | ||
354 | dev_err(&pdev->dev, "ioremap failed\n"); | ||
355 | ret = -ENOMEM; | ||
356 | goto err_clk_put; | 347 | goto err_clk_put; |
357 | } | 348 | } |
358 | 349 | ||
@@ -403,23 +394,9 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) | |||
403 | ac97->capture_dma_data.maxburst = 4; | 394 | ac97->capture_dma_data.maxburst = 4; |
404 | ac97->capture_dma_data.slave_id = of_dma[0]; | 395 | ac97->capture_dma_data.slave_id = of_dma[0]; |
405 | 396 | ||
406 | ret = snd_soc_register_component(&pdev->dev, &tegra20_ac97_component, | ||
407 | &tegra20_ac97_dai, 1); | ||
408 | if (ret) { | ||
409 | dev_err(&pdev->dev, "Could not register DAI: %d\n", ret); | ||
410 | ret = -ENOMEM; | ||
411 | goto err_clk_put; | ||
412 | } | ||
413 | |||
414 | ret = tegra_pcm_platform_register(&pdev->dev); | ||
415 | if (ret) { | ||
416 | dev_err(&pdev->dev, "Could not register PCM: %d\n", ret); | ||
417 | goto err_unregister_component; | ||
418 | } | ||
419 | |||
420 | ret = tegra_asoc_utils_init(&ac97->util_data, &pdev->dev); | 397 | ret = tegra_asoc_utils_init(&ac97->util_data, &pdev->dev); |
421 | if (ret) | 398 | if (ret) |
422 | goto err_unregister_pcm; | 399 | goto err_clk_put; |
423 | 400 | ||
424 | ret = tegra_asoc_utils_set_ac97_rate(&ac97->util_data); | 401 | ret = tegra_asoc_utils_set_ac97_rate(&ac97->util_data); |
425 | if (ret) | 402 | if (ret) |
@@ -431,20 +408,40 @@ static int tegra20_ac97_platform_probe(struct platform_device *pdev) | |||
431 | goto err_asoc_utils_fini; | 408 | goto err_asoc_utils_fini; |
432 | } | 409 | } |
433 | 410 | ||
411 | ret = snd_soc_set_ac97_ops(&tegra20_ac97_ops); | ||
412 | if (ret) { | ||
413 | dev_err(&pdev->dev, "Failed to set AC'97 ops: %d\n", ret); | ||
414 | goto err_asoc_utils_fini; | ||
415 | } | ||
416 | |||
417 | ret = snd_soc_register_component(&pdev->dev, &tegra20_ac97_component, | ||
418 | &tegra20_ac97_dai, 1); | ||
419 | if (ret) { | ||
420 | dev_err(&pdev->dev, "Could not register DAI: %d\n", ret); | ||
421 | ret = -ENOMEM; | ||
422 | goto err_asoc_utils_fini; | ||
423 | } | ||
424 | |||
425 | ret = tegra_pcm_platform_register(&pdev->dev); | ||
426 | if (ret) { | ||
427 | dev_err(&pdev->dev, "Could not register PCM: %d\n", ret); | ||
428 | goto err_unregister_component; | ||
429 | } | ||
430 | |||
434 | /* XXX: crufty ASoC AC97 API - only one AC97 codec allowed */ | 431 | /* XXX: crufty ASoC AC97 API - only one AC97 codec allowed */ |
435 | workdata = ac97; | 432 | workdata = ac97; |
436 | 433 | ||
437 | return 0; | 434 | return 0; |
438 | 435 | ||
439 | err_asoc_utils_fini: | ||
440 | tegra_asoc_utils_fini(&ac97->util_data); | ||
441 | err_unregister_pcm: | 436 | err_unregister_pcm: |
442 | tegra_pcm_platform_unregister(&pdev->dev); | 437 | tegra_pcm_platform_unregister(&pdev->dev); |
443 | err_unregister_component: | 438 | err_unregister_component: |
444 | snd_soc_unregister_component(&pdev->dev); | 439 | snd_soc_unregister_component(&pdev->dev); |
440 | err_asoc_utils_fini: | ||
441 | tegra_asoc_utils_fini(&ac97->util_data); | ||
445 | err_clk_put: | 442 | err_clk_put: |
446 | clk_put(ac97->clk_ac97); | ||
447 | err: | 443 | err: |
444 | snd_soc_set_ac97_ops(NULL); | ||
448 | return ret; | 445 | return ret; |
449 | } | 446 | } |
450 | 447 | ||
@@ -458,7 +455,8 @@ static int tegra20_ac97_platform_remove(struct platform_device *pdev) | |||
458 | tegra_asoc_utils_fini(&ac97->util_data); | 455 | tegra_asoc_utils_fini(&ac97->util_data); |
459 | 456 | ||
460 | clk_disable_unprepare(ac97->clk_ac97); | 457 | clk_disable_unprepare(ac97->clk_ac97); |
461 | clk_put(ac97->clk_ac97); | 458 | |
459 | snd_soc_set_ac97_ops(NULL); | ||
462 | 460 | ||
463 | return 0; | 461 | return 0; |
464 | } | 462 | } |
diff --git a/sound/soc/txx9/txx9aclc-ac97.c b/sound/soc/txx9/txx9aclc-ac97.c index 8a2840304d28..4bcce8a3cded 100644 --- a/sound/soc/txx9/txx9aclc-ac97.c +++ b/sound/soc/txx9/txx9aclc-ac97.c | |||
@@ -119,12 +119,11 @@ static void txx9aclc_ac97_cold_reset(struct snd_ac97 *ac97) | |||
119 | } | 119 | } |
120 | 120 | ||
121 | /* AC97 controller operations */ | 121 | /* AC97 controller operations */ |
122 | struct snd_ac97_bus_ops soc_ac97_ops = { | 122 | static struct snd_ac97_bus_ops txx9aclc_ac97_ops = { |
123 | .read = txx9aclc_ac97_read, | 123 | .read = txx9aclc_ac97_read, |
124 | .write = txx9aclc_ac97_write, | 124 | .write = txx9aclc_ac97_write, |
125 | .reset = txx9aclc_ac97_cold_reset, | 125 | .reset = txx9aclc_ac97_cold_reset, |
126 | }; | 126 | }; |
127 | EXPORT_SYMBOL_GPL(soc_ac97_ops); | ||
128 | 127 | ||
129 | static irqreturn_t txx9aclc_ac97_irq(int irq, void *dev_id) | 128 | static irqreturn_t txx9aclc_ac97_irq(int irq, void *dev_id) |
130 | { | 129 | { |
@@ -188,9 +187,9 @@ static int txx9aclc_ac97_dev_probe(struct platform_device *pdev) | |||
188 | if (!r) | 187 | if (!r) |
189 | return -EBUSY; | 188 | return -EBUSY; |
190 | 189 | ||
191 | if (!devm_request_mem_region(&pdev->dev, r->start, resource_size(r), | 190 | drvdata->base = devm_ioremap_resource(&pdev->dev, r); |
192 | dev_name(&pdev->dev))) | 191 | if (IS_ERR(drvdata->base)) |
193 | return -EBUSY; | 192 | return PTR_ERR(drvdata->base); |
194 | 193 | ||
195 | drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); | 194 | drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); |
196 | if (!drvdata) | 195 | if (!drvdata) |
@@ -201,14 +200,15 @@ static int txx9aclc_ac97_dev_probe(struct platform_device *pdev) | |||
201 | r->start >= TXX9_DIRECTMAP_BASE && | 200 | r->start >= TXX9_DIRECTMAP_BASE && |
202 | r->start < TXX9_DIRECTMAP_BASE + 0x400000) | 201 | r->start < TXX9_DIRECTMAP_BASE + 0x400000) |
203 | drvdata->physbase |= 0xf00000000ull; | 202 | drvdata->physbase |= 0xf00000000ull; |
204 | drvdata->base = devm_ioremap(&pdev->dev, r->start, resource_size(r)); | ||
205 | if (!drvdata->base) | ||
206 | return -EBUSY; | ||
207 | err = devm_request_irq(&pdev->dev, irq, txx9aclc_ac97_irq, | 203 | err = devm_request_irq(&pdev->dev, irq, txx9aclc_ac97_irq, |
208 | 0, dev_name(&pdev->dev), drvdata); | 204 | 0, dev_name(&pdev->dev), drvdata); |
209 | if (err < 0) | 205 | if (err < 0) |
210 | return err; | 206 | return err; |
211 | 207 | ||
208 | err = snd_soc_set_ac97_ops(&txx9aclc_ac97_ops); | ||
209 | if (err < 0) | ||
210 | return err; | ||
211 | |||
212 | return snd_soc_register_component(&pdev->dev, &txx9aclc_ac97_component, | 212 | return snd_soc_register_component(&pdev->dev, &txx9aclc_ac97_component, |
213 | &txx9aclc_ac97_dai, 1); | 213 | &txx9aclc_ac97_dai, 1); |
214 | } | 214 | } |
@@ -216,6 +216,7 @@ static int txx9aclc_ac97_dev_probe(struct platform_device *pdev) | |||
216 | static int txx9aclc_ac97_dev_remove(struct platform_device *pdev) | 216 | static int txx9aclc_ac97_dev_remove(struct platform_device *pdev) |
217 | { | 217 | { |
218 | snd_soc_unregister_component(&pdev->dev); | 218 | snd_soc_unregister_component(&pdev->dev); |
219 | snd_soc_set_ac97_ops(NULL); | ||
219 | return 0; | 220 | return 0; |
220 | } | 221 | } |
221 | 222 | ||