Contents of /trunk/kernel-magellan/patches-3.9/0105-3.9.6-all-fixes.patch
Parent Directory | Revision Log
Revision 2210 -
(show annotations)
(download)
Fri Jun 14 10:30:22 2013 UTC (11 years, 3 months ago) by niro
File size: 96270 byte(s)
Fri Jun 14 10:30:22 2013 UTC (11 years, 3 months ago) by niro
File size: 96270 byte(s)
-linux-3.9.6
1 | diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile |
2 | index afed28e..27f3604 100644 |
3 | --- a/arch/arm/boot/compressed/Makefile |
4 | +++ b/arch/arm/boot/compressed/Makefile |
5 | @@ -121,7 +121,7 @@ KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) |
6 | endif |
7 | |
8 | ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj) |
9 | -asflags-y := -Wa,-march=all -DZIMAGE |
10 | +asflags-y := -DZIMAGE |
11 | |
12 | # Supply kernel BSS size to the decompressor via a linker symbol. |
13 | KBSS_SZ = $(shell $(CROSS_COMPILE)size $(obj)/../../../../vmlinux | \ |
14 | diff --git a/arch/arm/boot/compressed/head-sa1100.S b/arch/arm/boot/compressed/head-sa1100.S |
15 | index 6179d94..3115e31 100644 |
16 | --- a/arch/arm/boot/compressed/head-sa1100.S |
17 | +++ b/arch/arm/boot/compressed/head-sa1100.S |
18 | @@ -11,6 +11,7 @@ |
19 | #include <asm/mach-types.h> |
20 | |
21 | .section ".start", "ax" |
22 | + .arch armv4 |
23 | |
24 | __SA1100_start: |
25 | |
26 | diff --git a/arch/arm/boot/compressed/head-shark.S b/arch/arm/boot/compressed/head-shark.S |
27 | index 089c560..92b5689 100644 |
28 | --- a/arch/arm/boot/compressed/head-shark.S |
29 | +++ b/arch/arm/boot/compressed/head-shark.S |
30 | @@ -18,6 +18,7 @@ |
31 | |
32 | .section ".start", "ax" |
33 | |
34 | + .arch armv4 |
35 | b __beginning |
36 | |
37 | __ofw_data: .long 0 @ the number of memory blocks |
38 | diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S |
39 | index fe4d9c3..6938559 100644 |
40 | --- a/arch/arm/boot/compressed/head.S |
41 | +++ b/arch/arm/boot/compressed/head.S |
42 | @@ -11,6 +11,7 @@ |
43 | #include <linux/linkage.h> |
44 | #include <asm/assembler.h> |
45 | |
46 | + .arch armv7-a |
47 | /* |
48 | * Debugging stuff |
49 | * |
50 | diff --git a/arch/arm/include/asm/percpu.h b/arch/arm/include/asm/percpu.h |
51 | index 968c0a1..209e650 100644 |
52 | --- a/arch/arm/include/asm/percpu.h |
53 | +++ b/arch/arm/include/asm/percpu.h |
54 | @@ -30,8 +30,15 @@ static inline void set_my_cpu_offset(unsigned long off) |
55 | static inline unsigned long __my_cpu_offset(void) |
56 | { |
57 | unsigned long off; |
58 | - /* Read TPIDRPRW */ |
59 | - asm("mrc p15, 0, %0, c13, c0, 4" : "=r" (off) : : "memory"); |
60 | + register unsigned long *sp asm ("sp"); |
61 | + |
62 | + /* |
63 | + * Read TPIDRPRW. |
64 | + * We want to allow caching the value, so avoid using volatile and |
65 | + * instead use a fake stack read to hazard against barrier(). |
66 | + */ |
67 | + asm("mrc p15, 0, %0, c13, c0, 4" : "=r" (off) : "Q" (*sp)); |
68 | + |
69 | return off; |
70 | } |
71 | #define __my_cpu_offset __my_cpu_offset() |
72 | diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c |
73 | index 79282eb..606b9538 100644 |
74 | --- a/arch/arm/kernel/topology.c |
75 | +++ b/arch/arm/kernel/topology.c |
76 | @@ -13,6 +13,7 @@ |
77 | |
78 | #include <linux/cpu.h> |
79 | #include <linux/cpumask.h> |
80 | +#include <linux/export.h> |
81 | #include <linux/init.h> |
82 | #include <linux/percpu.h> |
83 | #include <linux/node.h> |
84 | @@ -200,6 +201,7 @@ static inline void update_cpu_power(unsigned int cpuid, unsigned int mpidr) {} |
85 | * cpu topology table |
86 | */ |
87 | struct cputopo_arm cpu_topology[NR_CPUS]; |
88 | +EXPORT_SYMBOL_GPL(cpu_topology); |
89 | |
90 | const struct cpumask *cpu_coregroup_mask(int cpu) |
91 | { |
92 | diff --git a/arch/arm/mach-kirkwood/board-ts219.c b/arch/arm/mach-kirkwood/board-ts219.c |
93 | index acb0187..4695d5f 100644 |
94 | --- a/arch/arm/mach-kirkwood/board-ts219.c |
95 | +++ b/arch/arm/mach-kirkwood/board-ts219.c |
96 | @@ -41,13 +41,3 @@ void __init qnap_dt_ts219_init(void) |
97 | |
98 | pm_power_off = qnap_tsx1x_power_off; |
99 | } |
100 | - |
101 | -/* FIXME: Will not work with DT. Maybe use MPP40_GPIO? */ |
102 | -static int __init ts219_pci_init(void) |
103 | -{ |
104 | - if (machine_is_ts219()) |
105 | - kirkwood_pcie_init(KW_PCIE0); |
106 | - |
107 | - return 0; |
108 | -} |
109 | -subsys_initcall(ts219_pci_init); |
110 | diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h |
111 | index fb3245e..6e11f78 100644 |
112 | --- a/arch/powerpc/include/asm/cputable.h |
113 | +++ b/arch/powerpc/include/asm/cputable.h |
114 | @@ -175,6 +175,7 @@ extern const char *powerpc_base_platform; |
115 | #define CPU_FTR_BCTAR LONG_ASM_CONST(0x0100000000000000) |
116 | #define CPU_FTR_HAS_PPR LONG_ASM_CONST(0x0200000000000000) |
117 | #define CPU_FTR_DAWR LONG_ASM_CONST(0x0400000000000000) |
118 | +#define CPU_FTR_DABRX LONG_ASM_CONST(0x0800000000000000) |
119 | |
120 | #ifndef __ASSEMBLY__ |
121 | |
122 | @@ -391,19 +392,20 @@ extern const char *powerpc_base_platform; |
123 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_201 | \ |
124 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA | \ |
125 | CPU_FTR_CP_USE_DCBTZ | CPU_FTR_STCX_CHECKS_ADDRESS | \ |
126 | - CPU_FTR_HVMODE) |
127 | + CPU_FTR_HVMODE | CPU_FTR_DABRX) |
128 | #define CPU_FTRS_POWER5 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ |
129 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
130 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
131 | CPU_FTR_COHERENT_ICACHE | CPU_FTR_PURR | \ |
132 | - CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB) |
133 | + CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_DABRX) |
134 | #define CPU_FTRS_POWER6 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ |
135 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
136 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
137 | CPU_FTR_COHERENT_ICACHE | \ |
138 | CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ |
139 | CPU_FTR_DSCR | CPU_FTR_UNALIGNED_LD_STD | \ |
140 | - CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_CFAR) |
141 | + CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_CFAR | \ |
142 | + CPU_FTR_DABRX) |
143 | #define CPU_FTRS_POWER7 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ |
144 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_206 |\ |
145 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
146 | @@ -412,7 +414,7 @@ extern const char *powerpc_base_platform; |
147 | CPU_FTR_DSCR | CPU_FTR_SAO | CPU_FTR_ASYM_SMT | \ |
148 | CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ |
149 | CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | \ |
150 | - CPU_FTR_VMX_COPY | CPU_FTR_HAS_PPR) |
151 | + CPU_FTR_VMX_COPY | CPU_FTR_HAS_PPR | CPU_FTR_DABRX) |
152 | #define CPU_FTRS_POWER8 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ |
153 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_206 |\ |
154 | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
155 | @@ -427,14 +429,15 @@ extern const char *powerpc_base_platform; |
156 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
157 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
158 | CPU_FTR_PAUSE_ZERO | CPU_FTR_CELL_TB_BUG | CPU_FTR_CP_USE_DCBTZ | \ |
159 | - CPU_FTR_UNALIGNED_LD_STD) |
160 | + CPU_FTR_UNALIGNED_LD_STD | CPU_FTR_DABRX) |
161 | #define CPU_FTRS_PA6T (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ |
162 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP | \ |
163 | - CPU_FTR_PURR | CPU_FTR_REAL_LE) |
164 | + CPU_FTR_PURR | CPU_FTR_REAL_LE | CPU_FTR_DABRX) |
165 | #define CPU_FTRS_COMPATIBLE (CPU_FTR_USE_TB | CPU_FTR_PPCAS_ARCH_V2) |
166 | |
167 | #define CPU_FTRS_A2 (CPU_FTR_USE_TB | CPU_FTR_SMT | CPU_FTR_DBELL | \ |
168 | - CPU_FTR_NOEXECUTE | CPU_FTR_NODSISRALIGN | CPU_FTR_ICSWX) |
169 | + CPU_FTR_NOEXECUTE | CPU_FTR_NODSISRALIGN | \ |
170 | + CPU_FTR_ICSWX | CPU_FTR_DABRX ) |
171 | |
172 | #ifdef __powerpc64__ |
173 | #ifdef CONFIG_PPC_BOOK3E |
174 | diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h |
175 | index 3d6b410..ccfe2c8 100644 |
176 | --- a/arch/powerpc/include/asm/machdep.h |
177 | +++ b/arch/powerpc/include/asm/machdep.h |
178 | @@ -29,6 +29,7 @@ struct rtc_time; |
179 | struct file; |
180 | struct pci_controller; |
181 | struct kimage; |
182 | +struct pci_host_bridge; |
183 | |
184 | struct machdep_calls { |
185 | char *name; |
186 | @@ -107,6 +108,8 @@ struct machdep_calls { |
187 | void (*pcibios_fixup)(void); |
188 | int (*pci_probe_mode)(struct pci_bus *); |
189 | void (*pci_irq_fixup)(struct pci_dev *dev); |
190 | + int (*pcibios_root_bridge_prepare)(struct pci_host_bridge |
191 | + *bridge); |
192 | |
193 | /* To setup PHBs when using automatic OF platform driver for PCI */ |
194 | int (*pci_setup_phb)(struct pci_controller *host); |
195 | diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h |
196 | index 025a130..bb21f5a 100644 |
197 | --- a/arch/powerpc/include/asm/pci-bridge.h |
198 | +++ b/arch/powerpc/include/asm/pci-bridge.h |
199 | @@ -154,6 +154,8 @@ struct pci_dn { |
200 | |
201 | int pci_ext_config_space; /* for pci devices */ |
202 | |
203 | + int force_32bit_msi:1; |
204 | + |
205 | struct pci_dev *pcidev; /* back-pointer to the pci device */ |
206 | #ifdef CONFIG_EEH |
207 | struct eeh_dev *edev; /* eeh device */ |
208 | diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c |
209 | index fa12ae4..9b315e5 100644 |
210 | --- a/arch/powerpc/kernel/pci-common.c |
211 | +++ b/arch/powerpc/kernel/pci-common.c |
212 | @@ -30,6 +30,7 @@ |
213 | #include <linux/irq.h> |
214 | #include <linux/vmalloc.h> |
215 | #include <linux/slab.h> |
216 | +#include <linux/vgaarb.h> |
217 | |
218 | #include <asm/processor.h> |
219 | #include <asm/io.h> |
220 | @@ -844,6 +845,14 @@ int pci_proc_domain(struct pci_bus *bus) |
221 | return 1; |
222 | } |
223 | |
224 | +int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) |
225 | +{ |
226 | + if (ppc_md.pcibios_root_bridge_prepare) |
227 | + return ppc_md.pcibios_root_bridge_prepare(bridge); |
228 | + |
229 | + return 0; |
230 | +} |
231 | + |
232 | /* This header fixup will do the resource fixup for all devices as they are |
233 | * probed, but not for bridge ranges |
234 | */ |
235 | @@ -1725,3 +1734,15 @@ static void fixup_hide_host_resource_fsl(struct pci_dev *dev) |
236 | } |
237 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MOTOROLA, PCI_ANY_ID, fixup_hide_host_resource_fsl); |
238 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, fixup_hide_host_resource_fsl); |
239 | + |
240 | +static void fixup_vga(struct pci_dev *pdev) |
241 | +{ |
242 | + u16 cmd; |
243 | + |
244 | + pci_read_config_word(pdev, PCI_COMMAND, &cmd); |
245 | + if ((cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) || !vga_default_device()) |
246 | + vga_set_default_device(pdev); |
247 | + |
248 | +} |
249 | +DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, |
250 | + PCI_CLASS_DISPLAY_VGA, 8, fixup_vga); |
251 | diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c |
252 | index 16e77a8..9600c36 100644 |
253 | --- a/arch/powerpc/kernel/process.c |
254 | +++ b/arch/powerpc/kernel/process.c |
255 | @@ -392,7 +392,8 @@ static inline int __set_dabr(unsigned long dabr, unsigned long dabrx) |
256 | static inline int __set_dabr(unsigned long dabr, unsigned long dabrx) |
257 | { |
258 | mtspr(SPRN_DABR, dabr); |
259 | - mtspr(SPRN_DABRX, dabrx); |
260 | + if (cpu_has_feature(CPU_FTR_DABRX)) |
261 | + mtspr(SPRN_DABRX, dabrx); |
262 | return 0; |
263 | } |
264 | #else |
265 | diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c |
266 | index 1c22b2d..29857c6 100644 |
267 | --- a/arch/powerpc/kernel/traps.c |
268 | +++ b/arch/powerpc/kernel/traps.c |
269 | @@ -1151,7 +1151,7 @@ void alignment_exception(struct pt_regs *regs) |
270 | local_irq_enable(); |
271 | |
272 | if (tm_abort_check(regs, TM_CAUSE_ALIGNMENT | TM_CAUSE_PERSISTENT)) |
273 | - goto bail; |
274 | + return; |
275 | |
276 | /* we don't implement logging of alignment exceptions */ |
277 | if (!(current->thread.align_ctl & PR_UNALIGN_SIGBUS)) |
278 | diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c |
279 | index 65362e9..9d858b0 100644 |
280 | --- a/arch/powerpc/perf/core-book3s.c |
281 | +++ b/arch/powerpc/perf/core-book3s.c |
282 | @@ -1528,7 +1528,7 @@ static void perf_event_interrupt(struct pt_regs *regs) |
283 | } |
284 | } |
285 | } |
286 | - if ((!found) && printk_ratelimit()) |
287 | + if (!found && !nmi && printk_ratelimit()) |
288 | printk(KERN_WARNING "Can't find PMC that caused IRQ\n"); |
289 | |
290 | /* |
291 | diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c |
292 | index 19506f9..b456b15 100644 |
293 | --- a/arch/powerpc/platforms/pseries/eeh_pseries.c |
294 | +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c |
295 | @@ -83,7 +83,11 @@ static int pseries_eeh_init(void) |
296 | ibm_configure_pe = rtas_token("ibm,configure-pe"); |
297 | ibm_configure_bridge = rtas_token("ibm,configure-bridge"); |
298 | |
299 | - /* necessary sanity check */ |
300 | + /* |
301 | + * Necessary sanity check. We needn't check "get-config-addr-info" |
302 | + * and its variant since the old firmware probably support address |
303 | + * of domain/bus/slot/function for EEH RTAS operations. |
304 | + */ |
305 | if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) { |
306 | pr_warning("%s: RTAS service <ibm,set-eeh-option> invalid\n", |
307 | __func__); |
308 | @@ -102,12 +106,6 @@ static int pseries_eeh_init(void) |
309 | pr_warning("%s: RTAS service <ibm,slot-error-detail> invalid\n", |
310 | __func__); |
311 | return -EINVAL; |
312 | - } else if (ibm_get_config_addr_info2 == RTAS_UNKNOWN_SERVICE && |
313 | - ibm_get_config_addr_info == RTAS_UNKNOWN_SERVICE) { |
314 | - pr_warning("%s: RTAS service <ibm,get-config-addr-info2> and " |
315 | - "<ibm,get-config-addr-info> invalid\n", |
316 | - __func__); |
317 | - return -EINVAL; |
318 | } else if (ibm_configure_pe == RTAS_UNKNOWN_SERVICE && |
319 | ibm_configure_bridge == RTAS_UNKNOWN_SERVICE) { |
320 | pr_warning("%s: RTAS service <ibm,configure-pe> and " |
321 | diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c |
322 | index e5b0847..77b18a2 100644 |
323 | --- a/arch/powerpc/platforms/pseries/msi.c |
324 | +++ b/arch/powerpc/platforms/pseries/msi.c |
325 | @@ -24,6 +24,7 @@ static int query_token, change_token; |
326 | #define RTAS_RESET_FN 2 |
327 | #define RTAS_CHANGE_MSI_FN 3 |
328 | #define RTAS_CHANGE_MSIX_FN 4 |
329 | +#define RTAS_CHANGE_32MSI_FN 5 |
330 | |
331 | static struct pci_dn *get_pdn(struct pci_dev *pdev) |
332 | { |
333 | @@ -58,7 +59,8 @@ static int rtas_change_msi(struct pci_dn *pdn, u32 func, u32 num_irqs) |
334 | |
335 | seq_num = 1; |
336 | do { |
337 | - if (func == RTAS_CHANGE_MSI_FN || func == RTAS_CHANGE_MSIX_FN) |
338 | + if (func == RTAS_CHANGE_MSI_FN || func == RTAS_CHANGE_MSIX_FN || |
339 | + func == RTAS_CHANGE_32MSI_FN) |
340 | rc = rtas_call(change_token, 6, 4, rtas_ret, addr, |
341 | BUID_HI(buid), BUID_LO(buid), |
342 | func, num_irqs, seq_num); |
343 | @@ -392,6 +394,25 @@ static int check_msix_entries(struct pci_dev *pdev) |
344 | return 0; |
345 | } |
346 | |
347 | +static void rtas_hack_32bit_msi_gen2(struct pci_dev *pdev) |
348 | +{ |
349 | + u32 addr_hi, addr_lo; |
350 | + int pos; |
351 | + |
352 | + /* |
353 | + * We should only get in here for IODA1 configs. This is based on the |
354 | + * fact that we using RTAS for MSIs, we don't have the 32 bit MSI RTAS |
355 | + * support, and we are in a PCIe Gen2 slot. |
356 | + */ |
357 | + dev_info(&pdev->dev, |
358 | + "rtas_msi: No 32 bit MSI firmware support, forcing 32 bit MSI\n"); |
359 | + pos = pci_find_capability(pdev, PCI_CAP_ID_MSI); |
360 | + pci_read_config_dword(pdev, pos + PCI_MSI_ADDRESS_HI, &addr_hi); |
361 | + addr_lo = 0xffff0000 | ((addr_hi >> (48 - 32)) << 4); |
362 | + pci_write_config_dword(pdev, pos + PCI_MSI_ADDRESS_LO, addr_lo); |
363 | + pci_write_config_dword(pdev, pos + PCI_MSI_ADDRESS_HI, 0); |
364 | +} |
365 | + |
366 | static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type) |
367 | { |
368 | struct pci_dn *pdn; |
369 | @@ -399,6 +420,7 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type) |
370 | struct msi_desc *entry; |
371 | struct msi_msg msg; |
372 | int nvec = nvec_in; |
373 | + int use_32bit_msi_hack = 0; |
374 | |
375 | pdn = get_pdn(pdev); |
376 | if (!pdn) |
377 | @@ -426,12 +448,31 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type) |
378 | */ |
379 | again: |
380 | if (type == PCI_CAP_ID_MSI) { |
381 | - rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec); |
382 | + if (pdn->force_32bit_msi) { |
383 | + rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec); |
384 | + if (rc < 0) { |
385 | + /* |
386 | + * We only want to run the 32 bit MSI hack below if |
387 | + * the max bus speed is Gen2 speed |
388 | + */ |
389 | + if (pdev->bus->max_bus_speed != PCIE_SPEED_5_0GT) |
390 | + return rc; |
391 | + |
392 | + use_32bit_msi_hack = 1; |
393 | + } |
394 | + } else |
395 | + rc = -1; |
396 | + |
397 | + if (rc < 0) |
398 | + rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec); |
399 | |
400 | if (rc < 0) { |
401 | pr_debug("rtas_msi: trying the old firmware call.\n"); |
402 | rc = rtas_change_msi(pdn, RTAS_CHANGE_FN, nvec); |
403 | } |
404 | + |
405 | + if (use_32bit_msi_hack && rc > 0) |
406 | + rtas_hack_32bit_msi_gen2(pdev); |
407 | } else |
408 | rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec); |
409 | |
410 | @@ -512,3 +553,13 @@ static int rtas_msi_init(void) |
411 | return 0; |
412 | } |
413 | arch_initcall(rtas_msi_init); |
414 | + |
415 | +static void quirk_radeon(struct pci_dev *dev) |
416 | +{ |
417 | + struct pci_dn *pdn = get_pdn(dev); |
418 | + |
419 | + if (pdn) |
420 | + pdn->force_32bit_msi = 1; |
421 | +} |
422 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x68f2, quirk_radeon); |
423 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0xaa68, quirk_radeon); |
424 | diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c |
425 | index 0b580f4..5f93856 100644 |
426 | --- a/arch/powerpc/platforms/pseries/pci.c |
427 | +++ b/arch/powerpc/platforms/pseries/pci.c |
428 | @@ -108,3 +108,56 @@ static void fixup_winbond_82c105(struct pci_dev* dev) |
429 | } |
430 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, |
431 | fixup_winbond_82c105); |
432 | + |
433 | +int pseries_root_bridge_prepare(struct pci_host_bridge *bridge) |
434 | +{ |
435 | + struct device_node *dn, *pdn; |
436 | + struct pci_bus *bus; |
437 | + const uint32_t *pcie_link_speed_stats; |
438 | + |
439 | + bus = bridge->bus; |
440 | + |
441 | + dn = pcibios_get_phb_of_node(bus); |
442 | + if (!dn) |
443 | + return 0; |
444 | + |
445 | + for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) { |
446 | + pcie_link_speed_stats = (const uint32_t *) of_get_property(pdn, |
447 | + "ibm,pcie-link-speed-stats", NULL); |
448 | + if (pcie_link_speed_stats) |
449 | + break; |
450 | + } |
451 | + |
452 | + of_node_put(pdn); |
453 | + |
454 | + if (!pcie_link_speed_stats) { |
455 | + pr_err("no ibm,pcie-link-speed-stats property\n"); |
456 | + return 0; |
457 | + } |
458 | + |
459 | + switch (pcie_link_speed_stats[0]) { |
460 | + case 0x01: |
461 | + bus->max_bus_speed = PCIE_SPEED_2_5GT; |
462 | + break; |
463 | + case 0x02: |
464 | + bus->max_bus_speed = PCIE_SPEED_5_0GT; |
465 | + break; |
466 | + default: |
467 | + bus->max_bus_speed = PCI_SPEED_UNKNOWN; |
468 | + break; |
469 | + } |
470 | + |
471 | + switch (pcie_link_speed_stats[1]) { |
472 | + case 0x01: |
473 | + bus->cur_bus_speed = PCIE_SPEED_2_5GT; |
474 | + break; |
475 | + case 0x02: |
476 | + bus->cur_bus_speed = PCIE_SPEED_5_0GT; |
477 | + break; |
478 | + default: |
479 | + bus->cur_bus_speed = PCI_SPEED_UNKNOWN; |
480 | + break; |
481 | + } |
482 | + |
483 | + return 0; |
484 | +} |
485 | diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h |
486 | index 9a3dda0..b79393d 100644 |
487 | --- a/arch/powerpc/platforms/pseries/pseries.h |
488 | +++ b/arch/powerpc/platforms/pseries/pseries.h |
489 | @@ -60,4 +60,8 @@ extern int dlpar_detach_node(struct device_node *); |
490 | /* Snooze Delay, pseries_idle */ |
491 | DECLARE_PER_CPU(long, smt_snooze_delay); |
492 | |
493 | +/* PCI root bridge prepare function override for pseries */ |
494 | +struct pci_host_bridge; |
495 | +int pseries_root_bridge_prepare(struct pci_host_bridge *bridge); |
496 | + |
497 | #endif /* _PSERIES_PSERIES_H */ |
498 | diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c |
499 | index 8bcc9ca..bf34cc9 100644 |
500 | --- a/arch/powerpc/platforms/pseries/setup.c |
501 | +++ b/arch/powerpc/platforms/pseries/setup.c |
502 | @@ -466,6 +466,8 @@ static void __init pSeries_setup_arch(void) |
503 | else |
504 | ppc_md.enable_pmcs = power4_enable_pmcs; |
505 | |
506 | + ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare; |
507 | + |
508 | if (firmware_has_feature(FW_FEATURE_SET_MODE)) { |
509 | long rc; |
510 | if ((rc = pSeries_enable_reloc_on_exc()) != H_SUCCESS) { |
511 | diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h |
512 | index fd80015..39a1c71 100644 |
513 | --- a/arch/s390/include/asm/pgtable.h |
514 | +++ b/arch/s390/include/asm/pgtable.h |
515 | @@ -1063,11 +1063,12 @@ static inline pte_t ptep_modify_prot_start(struct mm_struct *mm, |
516 | unsigned long address, |
517 | pte_t *ptep) |
518 | { |
519 | + pgste_t pgste; |
520 | pte_t pte; |
521 | |
522 | mm->context.flush_mm = 1; |
523 | if (mm_has_pgste(mm)) |
524 | - pgste_get_lock(ptep); |
525 | + pgste = pgste_get_lock(ptep); |
526 | |
527 | pte = *ptep; |
528 | if (!mm_exclusive(mm)) |
529 | diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c |
530 | index 901177d..1dc3d7c 100644 |
531 | --- a/arch/x86/pci/common.c |
532 | +++ b/arch/x86/pci/common.c |
533 | @@ -617,7 +617,9 @@ int pcibios_add_device(struct pci_dev *dev) |
534 | |
535 | pa_data = boot_params.hdr.setup_data; |
536 | while (pa_data) { |
537 | - data = phys_to_virt(pa_data); |
538 | + data = ioremap(pa_data, sizeof(*rom)); |
539 | + if (!data) |
540 | + return -ENOMEM; |
541 | |
542 | if (data->type == SETUP_PCI) { |
543 | rom = (struct pci_setup_rom *)data; |
544 | @@ -634,6 +636,7 @@ int pcibios_add_device(struct pci_dev *dev) |
545 | } |
546 | } |
547 | pa_data = data->next; |
548 | + iounmap(data); |
549 | } |
550 | return 0; |
551 | } |
552 | diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c |
553 | index 22c800a..96c4e85 100644 |
554 | --- a/arch/x86/xen/smp.c |
555 | +++ b/arch/x86/xen/smp.c |
556 | @@ -17,6 +17,7 @@ |
557 | #include <linux/slab.h> |
558 | #include <linux/smp.h> |
559 | #include <linux/irq_work.h> |
560 | +#include <linux/tick.h> |
561 | |
562 | #include <asm/paravirt.h> |
563 | #include <asm/desc.h> |
564 | @@ -436,6 +437,13 @@ static void __cpuinit xen_play_dead(void) /* used only with HOTPLUG_CPU */ |
565 | play_dead_common(); |
566 | HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL); |
567 | cpu_bringup(); |
568 | + /* |
569 | + * commit 4b0c0f294 (tick: Cleanup NOHZ per cpu data on cpu down) |
570 | + * clears certain data that the cpu_idle loop (which called us |
571 | + * and that we return from) expects. The only way to get that |
572 | + * data back is to call: |
573 | + */ |
574 | + tick_nohz_idle_enter(); |
575 | } |
576 | |
577 | #else /* !CONFIG_HOTPLUG_CPU */ |
578 | diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c |
579 | index 557e58d..391010a 100644 |
580 | --- a/drivers/acpi/device_pm.c |
581 | +++ b/drivers/acpi/device_pm.c |
582 | @@ -269,11 +269,13 @@ int acpi_bus_init_power(struct acpi_device *device) |
583 | if (result) |
584 | return result; |
585 | } else if (state == ACPI_STATE_UNKNOWN) { |
586 | - /* No power resources and missing _PSC? Try to force D0. */ |
587 | + /* |
588 | + * No power resources and missing _PSC? Cross fingers and make |
589 | + * it D0 in hope that this is what the BIOS put the device into. |
590 | + * [We tried to force D0 here by executing _PS0, but that broke |
591 | + * Toshiba P870-303 in a nasty way.] |
592 | + */ |
593 | state = ACPI_STATE_D0; |
594 | - result = acpi_dev_pm_explicit_set(device, state); |
595 | - if (result) |
596 | - return result; |
597 | } |
598 | device->power.state = state; |
599 | return 0; |
600 | diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c |
601 | index 313f959..81a9335 100644 |
602 | --- a/drivers/acpi/video.c |
603 | +++ b/drivers/acpi/video.c |
604 | @@ -447,6 +447,22 @@ static struct dmi_system_id video_dmi_table[] __initdata = { |
605 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Folio 13 - 2000 Notebook PC"), |
606 | }, |
607 | }, |
608 | + { |
609 | + .callback = video_ignore_initial_backlight, |
610 | + .ident = "HP Pavilion g6 Notebook PC", |
611 | + .matches = { |
612 | + DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), |
613 | + DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion g6 Notebook PC"), |
614 | + }, |
615 | + }, |
616 | + { |
617 | + .callback = video_ignore_initial_backlight, |
618 | + .ident = "HP Pavilion m4", |
619 | + .matches = { |
620 | + DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), |
621 | + DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion m4 Notebook PC"), |
622 | + }, |
623 | + }, |
624 | {} |
625 | }; |
626 | |
627 | diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c |
628 | index 57a8774..bb5939b 100644 |
629 | --- a/drivers/cpufreq/acpi-cpufreq.c |
630 | +++ b/drivers/cpufreq/acpi-cpufreq.c |
631 | @@ -347,11 +347,11 @@ static u32 get_cur_val(const struct cpumask *mask) |
632 | switch (per_cpu(acfreq_data, cpumask_first(mask))->cpu_feature) { |
633 | case SYSTEM_INTEL_MSR_CAPABLE: |
634 | cmd.type = SYSTEM_INTEL_MSR_CAPABLE; |
635 | - cmd.addr.msr.reg = MSR_IA32_PERF_STATUS; |
636 | + cmd.addr.msr.reg = MSR_IA32_PERF_CTL; |
637 | break; |
638 | case SYSTEM_AMD_MSR_CAPABLE: |
639 | cmd.type = SYSTEM_AMD_MSR_CAPABLE; |
640 | - cmd.addr.msr.reg = MSR_AMD_PERF_STATUS; |
641 | + cmd.addr.msr.reg = MSR_AMD_PERF_CTL; |
642 | break; |
643 | case SYSTEM_IO_CAPABLE: |
644 | cmd.type = SYSTEM_IO_CAPABLE; |
645 | diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c |
646 | index 1734fee..71bf4ec 100644 |
647 | --- a/drivers/dma/ste_dma40.c |
648 | +++ b/drivers/dma/ste_dma40.c |
649 | @@ -1566,10 +1566,12 @@ static void dma_tc_handle(struct d40_chan *d40c) |
650 | return; |
651 | } |
652 | |
653 | - if (d40_queue_start(d40c) == NULL) |
654 | + if (d40_queue_start(d40c) == NULL) { |
655 | d40c->busy = false; |
656 | - pm_runtime_mark_last_busy(d40c->base->dev); |
657 | - pm_runtime_put_autosuspend(d40c->base->dev); |
658 | + |
659 | + pm_runtime_mark_last_busy(d40c->base->dev); |
660 | + pm_runtime_put_autosuspend(d40c->base->dev); |
661 | + } |
662 | |
663 | d40_desc_remove(d40d); |
664 | d40_desc_done(d40c, d40d); |
665 | diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c |
666 | index a6a8643..8bcce78 100644 |
667 | --- a/drivers/gpu/drm/drm_irq.c |
668 | +++ b/drivers/gpu/drm/drm_irq.c |
669 | @@ -1054,7 +1054,7 @@ EXPORT_SYMBOL(drm_vblank_off); |
670 | */ |
671 | void drm_vblank_pre_modeset(struct drm_device *dev, int crtc) |
672 | { |
673 | - /* vblank is not initialized (IRQ not installed ?) */ |
674 | + /* vblank is not initialized (IRQ not installed ?), or has been freed */ |
675 | if (!dev->num_crtcs) |
676 | return; |
677 | /* |
678 | @@ -1076,6 +1076,10 @@ void drm_vblank_post_modeset(struct drm_device *dev, int crtc) |
679 | { |
680 | unsigned long irqflags; |
681 | |
682 | + /* vblank is not initialized (IRQ not installed ?), or has been freed */ |
683 | + if (!dev->num_crtcs) |
684 | + return; |
685 | + |
686 | if (dev->vblank_inmodeset[crtc]) { |
687 | spin_lock_irqsave(&dev->vbl_lock, irqflags); |
688 | dev->vblank_disable_allowed = 1; |
689 | diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c |
690 | index 2590cac..8d07078 100644 |
691 | --- a/drivers/gpu/drm/gma500/framebuffer.c |
692 | +++ b/drivers/gpu/drm/gma500/framebuffer.c |
693 | @@ -772,8 +772,8 @@ void psb_modeset_init(struct drm_device *dev) |
694 | for (i = 0; i < dev_priv->num_pipe; i++) |
695 | psb_intel_crtc_init(dev, i, mode_dev); |
696 | |
697 | - dev->mode_config.max_width = 2048; |
698 | - dev->mode_config.max_height = 2048; |
699 | + dev->mode_config.max_width = 4096; |
700 | + dev->mode_config.max_height = 4096; |
701 | |
702 | psb_setup_outputs(dev); |
703 | |
704 | diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c |
705 | index 73cb479..db2cff3 100644 |
706 | --- a/drivers/gpu/drm/i915/i915_gem.c |
707 | +++ b/drivers/gpu/drm/i915/i915_gem.c |
708 | @@ -91,14 +91,11 @@ i915_gem_wait_for_error(struct i915_gpu_error *error) |
709 | { |
710 | int ret; |
711 | |
712 | -#define EXIT_COND (!i915_reset_in_progress(error)) |
713 | +#define EXIT_COND (!i915_reset_in_progress(error) || \ |
714 | + i915_terminally_wedged(error)) |
715 | if (EXIT_COND) |
716 | return 0; |
717 | |
718 | - /* GPU is already declared terminally dead, give up. */ |
719 | - if (i915_terminally_wedged(error)) |
720 | - return -EIO; |
721 | - |
722 | /* |
723 | * Only wait 10 seconds for the gpu reset to complete to avoid hanging |
724 | * userspace. If it takes that long something really bad is going on and |
725 | diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
726 | index c2d173a..2ab65b4 100644 |
727 | --- a/drivers/gpu/drm/i915/intel_display.c |
728 | +++ b/drivers/gpu/drm/i915/intel_display.c |
729 | @@ -7960,6 +7960,21 @@ static void intel_set_config_restore_state(struct drm_device *dev, |
730 | } |
731 | } |
732 | |
733 | +static bool |
734 | +is_crtc_connector_off(struct drm_crtc *crtc, struct drm_connector *connectors, |
735 | + int num_connectors) |
736 | +{ |
737 | + int i; |
738 | + |
739 | + for (i = 0; i < num_connectors; i++) |
740 | + if (connectors[i].encoder && |
741 | + connectors[i].encoder->crtc == crtc && |
742 | + connectors[i].dpms != DRM_MODE_DPMS_ON) |
743 | + return true; |
744 | + |
745 | + return false; |
746 | +} |
747 | + |
748 | static void |
749 | intel_set_config_compute_mode_changes(struct drm_mode_set *set, |
750 | struct intel_set_config *config) |
751 | @@ -7967,7 +7982,11 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set, |
752 | |
753 | /* We should be able to check here if the fb has the same properties |
754 | * and then just flip_or_move it */ |
755 | - if (set->crtc->fb != set->fb) { |
756 | + if (set->connectors != NULL && |
757 | + is_crtc_connector_off(set->crtc, *set->connectors, |
758 | + set->num_connectors)) { |
759 | + config->mode_changed = true; |
760 | + } else if (set->crtc->fb != set->fb) { |
761 | /* If we have no fb then treat it as a full mode set */ |
762 | if (set->crtc->fb == NULL) { |
763 | DRM_DEBUG_KMS("crtc has no fb, full mode set\n"); |
764 | @@ -7979,8 +7998,9 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set, |
765 | } else if (set->fb->bits_per_pixel != |
766 | set->crtc->fb->bits_per_pixel) { |
767 | config->mode_changed = true; |
768 | - } else |
769 | + } else { |
770 | config->fb_changed = true; |
771 | + } |
772 | } |
773 | |
774 | if (set->fb && (set->x != set->crtc->x || set->y != set->crtc->y)) |
775 | diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c |
776 | index e0d6985..e2ca9c1 100644 |
777 | --- a/drivers/gpu/drm/i915/intel_lvds.c |
778 | +++ b/drivers/gpu/drm/i915/intel_lvds.c |
779 | @@ -803,10 +803,10 @@ static const struct dmi_system_id intel_no_lvds[] = { |
780 | }, |
781 | { |
782 | .callback = intel_no_lvds_dmi_callback, |
783 | - .ident = "Hewlett-Packard HP t5740e Thin Client", |
784 | + .ident = "Hewlett-Packard HP t5740", |
785 | .matches = { |
786 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), |
787 | - DMI_MATCH(DMI_PRODUCT_NAME, "HP t5740e Thin Client"), |
788 | + DMI_MATCH(DMI_PRODUCT_NAME, " t5740"), |
789 | }, |
790 | }, |
791 | { |
792 | diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c |
793 | index d6df786..cdd78ca 100644 |
794 | --- a/drivers/gpu/drm/i915/intel_sdvo.c |
795 | +++ b/drivers/gpu/drm/i915/intel_sdvo.c |
796 | @@ -1770,7 +1770,7 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) |
797 | * Assume that the preferred modes are |
798 | * arranged in priority order. |
799 | */ |
800 | - intel_ddc_get_modes(connector, intel_sdvo->i2c); |
801 | + intel_ddc_get_modes(connector, &intel_sdvo->ddc); |
802 | if (list_empty(&connector->probed_modes) == false) |
803 | goto end; |
804 | |
805 | diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c |
806 | index 713dd70..407e257 100644 |
807 | --- a/drivers/gpu/drm/mgag200/mgag200_mode.c |
808 | +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c |
809 | @@ -1041,13 +1041,14 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, |
810 | else |
811 | hi_pri_lvl = 5; |
812 | |
813 | - WREG8(0x1fde, 0x06); |
814 | - WREG8(0x1fdf, hi_pri_lvl); |
815 | + WREG8(MGAREG_CRTCEXT_INDEX, 0x06); |
816 | + WREG8(MGAREG_CRTCEXT_DATA, hi_pri_lvl); |
817 | } else { |
818 | + WREG8(MGAREG_CRTCEXT_INDEX, 0x06); |
819 | if (mdev->reg_1e24 >= 0x01) |
820 | - WREG8(0x1fdf, 0x03); |
821 | + WREG8(MGAREG_CRTCEXT_DATA, 0x03); |
822 | else |
823 | - WREG8(0x1fdf, 0x04); |
824 | + WREG8(MGAREG_CRTCEXT_DATA, 0x04); |
825 | } |
826 | } |
827 | return 0; |
828 | diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c |
829 | index 4552d4a..6cf2b52 100644 |
830 | --- a/drivers/gpu/drm/radeon/atombios_encoders.c |
831 | +++ b/drivers/gpu/drm/radeon/atombios_encoders.c |
832 | @@ -667,6 +667,8 @@ atombios_digital_setup(struct drm_encoder *encoder, int action) |
833 | int |
834 | atombios_get_encoder_mode(struct drm_encoder *encoder) |
835 | { |
836 | + struct drm_device *dev = encoder->dev; |
837 | + struct radeon_device *rdev = dev->dev_private; |
838 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
839 | struct drm_connector *connector; |
840 | struct radeon_connector *radeon_connector; |
841 | @@ -693,7 +695,8 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) |
842 | case DRM_MODE_CONNECTOR_DVII: |
843 | case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog works fine */ |
844 | if (drm_detect_hdmi_monitor(radeon_connector->edid) && |
845 | - radeon_audio) |
846 | + radeon_audio && |
847 | + !ASIC_IS_DCE6(rdev)) /* remove once we support DCE6 */ |
848 | return ATOM_ENCODER_MODE_HDMI; |
849 | else if (radeon_connector->use_digital) |
850 | return ATOM_ENCODER_MODE_DVI; |
851 | @@ -704,7 +707,8 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) |
852 | case DRM_MODE_CONNECTOR_HDMIA: |
853 | default: |
854 | if (drm_detect_hdmi_monitor(radeon_connector->edid) && |
855 | - radeon_audio) |
856 | + radeon_audio && |
857 | + !ASIC_IS_DCE6(rdev)) /* remove once we support DCE6 */ |
858 | return ATOM_ENCODER_MODE_HDMI; |
859 | else |
860 | return ATOM_ENCODER_MODE_DVI; |
861 | @@ -718,7 +722,8 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) |
862 | (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) |
863 | return ATOM_ENCODER_MODE_DP; |
864 | else if (drm_detect_hdmi_monitor(radeon_connector->edid) && |
865 | - radeon_audio) |
866 | + radeon_audio && |
867 | + !ASIC_IS_DCE6(rdev)) /* remove once we support DCE6 */ |
868 | return ATOM_ENCODER_MODE_HDMI; |
869 | else |
870 | return ATOM_ENCODER_MODE_DVI; |
871 | diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c |
872 | index 0ea6bdf..f8e36ac 100644 |
873 | --- a/drivers/gpu/drm/radeon/evergreen.c |
874 | +++ b/drivers/gpu/drm/radeon/evergreen.c |
875 | @@ -3728,6 +3728,12 @@ static int evergreen_startup(struct radeon_device *rdev) |
876 | } |
877 | |
878 | /* Enable IRQ */ |
879 | + if (!rdev->irq.installed) { |
880 | + r = radeon_irq_kms_init(rdev); |
881 | + if (r) |
882 | + return r; |
883 | + } |
884 | + |
885 | r = r600_irq_init(rdev); |
886 | if (r) { |
887 | DRM_ERROR("radeon: IH init failed (%d).\n", r); |
888 | @@ -3876,10 +3882,6 @@ int evergreen_init(struct radeon_device *rdev) |
889 | if (r) |
890 | return r; |
891 | |
892 | - r = radeon_irq_kms_init(rdev); |
893 | - if (r) |
894 | - return r; |
895 | - |
896 | rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ring_obj = NULL; |
897 | r600_ring_init(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX], 1024 * 1024); |
898 | |
899 | @@ -3944,8 +3946,7 @@ void evergreen_fini(struct radeon_device *rdev) |
900 | |
901 | void evergreen_pcie_gen2_enable(struct radeon_device *rdev) |
902 | { |
903 | - u32 link_width_cntl, speed_cntl, mask; |
904 | - int ret; |
905 | + u32 link_width_cntl, speed_cntl; |
906 | |
907 | if (radeon_pcie_gen2 == 0) |
908 | return; |
909 | @@ -3960,11 +3961,8 @@ void evergreen_pcie_gen2_enable(struct radeon_device *rdev) |
910 | if (ASIC_IS_X2(rdev)) |
911 | return; |
912 | |
913 | - ret = drm_pcie_get_speed_cap_mask(rdev->ddev, &mask); |
914 | - if (ret != 0) |
915 | - return; |
916 | - |
917 | - if (!(mask & DRM_PCIE_SPEED_50)) |
918 | + if ((rdev->pdev->bus->max_bus_speed != PCIE_SPEED_5_0GT) && |
919 | + (rdev->pdev->bus->max_bus_speed != PCIE_SPEED_8_0GT)) |
920 | return; |
921 | |
922 | speed_cntl = RREG32_PCIE_P(PCIE_LC_SPEED_CNTL); |
923 | diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c |
924 | index 0a32d89..d7968b8 100644 |
925 | --- a/drivers/gpu/drm/radeon/ni.c |
926 | +++ b/drivers/gpu/drm/radeon/ni.c |
927 | @@ -1711,6 +1711,12 @@ static int cayman_startup(struct radeon_device *rdev) |
928 | } |
929 | |
930 | /* Enable IRQ */ |
931 | + if (!rdev->irq.installed) { |
932 | + r = radeon_irq_kms_init(rdev); |
933 | + if (r) |
934 | + return r; |
935 | + } |
936 | + |
937 | r = r600_irq_init(rdev); |
938 | if (r) { |
939 | DRM_ERROR("radeon: IH init failed (%d).\n", r); |
940 | @@ -1857,10 +1863,6 @@ int cayman_init(struct radeon_device *rdev) |
941 | if (r) |
942 | return r; |
943 | |
944 | - r = radeon_irq_kms_init(rdev); |
945 | - if (r) |
946 | - return r; |
947 | - |
948 | ring->ring_obj = NULL; |
949 | r600_ring_init(rdev, ring, 1024 * 1024); |
950 | |
951 | diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c |
952 | index 4973bff..d0314ec 100644 |
953 | --- a/drivers/gpu/drm/radeon/r100.c |
954 | +++ b/drivers/gpu/drm/radeon/r100.c |
955 | @@ -3869,6 +3869,12 @@ static int r100_startup(struct radeon_device *rdev) |
956 | } |
957 | |
958 | /* Enable IRQ */ |
959 | + if (!rdev->irq.installed) { |
960 | + r = radeon_irq_kms_init(rdev); |
961 | + if (r) |
962 | + return r; |
963 | + } |
964 | + |
965 | r100_irq_set(rdev); |
966 | rdev->config.r100.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
967 | /* 1M ring buffer */ |
968 | @@ -4024,9 +4030,6 @@ int r100_init(struct radeon_device *rdev) |
969 | r = radeon_fence_driver_init(rdev); |
970 | if (r) |
971 | return r; |
972 | - r = radeon_irq_kms_init(rdev); |
973 | - if (r) |
974 | - return r; |
975 | /* Memory manager */ |
976 | r = radeon_bo_init(rdev); |
977 | if (r) |
978 | diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c |
979 | index c60350e..b9b776f 100644 |
980 | --- a/drivers/gpu/drm/radeon/r300.c |
981 | +++ b/drivers/gpu/drm/radeon/r300.c |
982 | @@ -1382,6 +1382,12 @@ static int r300_startup(struct radeon_device *rdev) |
983 | } |
984 | |
985 | /* Enable IRQ */ |
986 | + if (!rdev->irq.installed) { |
987 | + r = radeon_irq_kms_init(rdev); |
988 | + if (r) |
989 | + return r; |
990 | + } |
991 | + |
992 | r100_irq_set(rdev); |
993 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
994 | /* 1M ring buffer */ |
995 | @@ -1516,9 +1522,6 @@ int r300_init(struct radeon_device *rdev) |
996 | r = radeon_fence_driver_init(rdev); |
997 | if (r) |
998 | return r; |
999 | - r = radeon_irq_kms_init(rdev); |
1000 | - if (r) |
1001 | - return r; |
1002 | /* Memory manager */ |
1003 | r = radeon_bo_init(rdev); |
1004 | if (r) |
1005 | diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c |
1006 | index 6fce2eb..4e796ec 100644 |
1007 | --- a/drivers/gpu/drm/radeon/r420.c |
1008 | +++ b/drivers/gpu/drm/radeon/r420.c |
1009 | @@ -265,6 +265,12 @@ static int r420_startup(struct radeon_device *rdev) |
1010 | } |
1011 | |
1012 | /* Enable IRQ */ |
1013 | + if (!rdev->irq.installed) { |
1014 | + r = radeon_irq_kms_init(rdev); |
1015 | + if (r) |
1016 | + return r; |
1017 | + } |
1018 | + |
1019 | r100_irq_set(rdev); |
1020 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
1021 | /* 1M ring buffer */ |
1022 | @@ -411,10 +417,6 @@ int r420_init(struct radeon_device *rdev) |
1023 | if (r) { |
1024 | return r; |
1025 | } |
1026 | - r = radeon_irq_kms_init(rdev); |
1027 | - if (r) { |
1028 | - return r; |
1029 | - } |
1030 | /* Memory manager */ |
1031 | r = radeon_bo_init(rdev); |
1032 | if (r) { |
1033 | diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c |
1034 | index f795a4e..e1aece7 100644 |
1035 | --- a/drivers/gpu/drm/radeon/r520.c |
1036 | +++ b/drivers/gpu/drm/radeon/r520.c |
1037 | @@ -194,6 +194,12 @@ static int r520_startup(struct radeon_device *rdev) |
1038 | } |
1039 | |
1040 | /* Enable IRQ */ |
1041 | + if (!rdev->irq.installed) { |
1042 | + r = radeon_irq_kms_init(rdev); |
1043 | + if (r) |
1044 | + return r; |
1045 | + } |
1046 | + |
1047 | rs600_irq_set(rdev); |
1048 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
1049 | /* 1M ring buffer */ |
1050 | @@ -297,9 +303,6 @@ int r520_init(struct radeon_device *rdev) |
1051 | r = radeon_fence_driver_init(rdev); |
1052 | if (r) |
1053 | return r; |
1054 | - r = radeon_irq_kms_init(rdev); |
1055 | - if (r) |
1056 | - return r; |
1057 | /* Memory manager */ |
1058 | r = radeon_bo_init(rdev); |
1059 | if (r) |
1060 | diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c |
1061 | index 0740db3..bac1e2ac 100644 |
1062 | --- a/drivers/gpu/drm/radeon/r600.c |
1063 | +++ b/drivers/gpu/drm/radeon/r600.c |
1064 | @@ -2940,6 +2940,12 @@ static int r600_startup(struct radeon_device *rdev) |
1065 | } |
1066 | |
1067 | /* Enable IRQ */ |
1068 | + if (!rdev->irq.installed) { |
1069 | + r = radeon_irq_kms_init(rdev); |
1070 | + if (r) |
1071 | + return r; |
1072 | + } |
1073 | + |
1074 | r = r600_irq_init(rdev); |
1075 | if (r) { |
1076 | DRM_ERROR("radeon: IH init failed (%d).\n", r); |
1077 | @@ -3094,10 +3100,6 @@ int r600_init(struct radeon_device *rdev) |
1078 | if (r) |
1079 | return r; |
1080 | |
1081 | - r = radeon_irq_kms_init(rdev); |
1082 | - if (r) |
1083 | - return r; |
1084 | - |
1085 | rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ring_obj = NULL; |
1086 | r600_ring_init(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX], 1024 * 1024); |
1087 | |
1088 | @@ -4351,8 +4353,6 @@ static void r600_pcie_gen2_enable(struct radeon_device *rdev) |
1089 | { |
1090 | u32 link_width_cntl, lanes, speed_cntl, training_cntl, tmp; |
1091 | u16 link_cntl2; |
1092 | - u32 mask; |
1093 | - int ret; |
1094 | |
1095 | if (radeon_pcie_gen2 == 0) |
1096 | return; |
1097 | @@ -4371,11 +4371,8 @@ static void r600_pcie_gen2_enable(struct radeon_device *rdev) |
1098 | if (rdev->family <= CHIP_R600) |
1099 | return; |
1100 | |
1101 | - ret = drm_pcie_get_speed_cap_mask(rdev->ddev, &mask); |
1102 | - if (ret != 0) |
1103 | - return; |
1104 | - |
1105 | - if (!(mask & DRM_PCIE_SPEED_50)) |
1106 | + if ((rdev->pdev->bus->max_bus_speed != PCIE_SPEED_5_0GT) && |
1107 | + (rdev->pdev->bus->max_bus_speed != PCIE_SPEED_8_0GT)) |
1108 | return; |
1109 | |
1110 | speed_cntl = RREG32_PCIE_P(PCIE_LC_SPEED_CNTL); |
1111 | diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c |
1112 | index 73051ce..233a9b9 100644 |
1113 | --- a/drivers/gpu/drm/radeon/rs400.c |
1114 | +++ b/drivers/gpu/drm/radeon/rs400.c |
1115 | @@ -417,6 +417,12 @@ static int rs400_startup(struct radeon_device *rdev) |
1116 | } |
1117 | |
1118 | /* Enable IRQ */ |
1119 | + if (!rdev->irq.installed) { |
1120 | + r = radeon_irq_kms_init(rdev); |
1121 | + if (r) |
1122 | + return r; |
1123 | + } |
1124 | + |
1125 | r100_irq_set(rdev); |
1126 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
1127 | /* 1M ring buffer */ |
1128 | @@ -535,9 +541,6 @@ int rs400_init(struct radeon_device *rdev) |
1129 | r = radeon_fence_driver_init(rdev); |
1130 | if (r) |
1131 | return r; |
1132 | - r = radeon_irq_kms_init(rdev); |
1133 | - if (r) |
1134 | - return r; |
1135 | /* Memory manager */ |
1136 | r = radeon_bo_init(rdev); |
1137 | if (r) |
1138 | diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c |
1139 | index 46fa1b0..670b555 100644 |
1140 | --- a/drivers/gpu/drm/radeon/rs600.c |
1141 | +++ b/drivers/gpu/drm/radeon/rs600.c |
1142 | @@ -923,6 +923,12 @@ static int rs600_startup(struct radeon_device *rdev) |
1143 | } |
1144 | |
1145 | /* Enable IRQ */ |
1146 | + if (!rdev->irq.installed) { |
1147 | + r = radeon_irq_kms_init(rdev); |
1148 | + if (r) |
1149 | + return r; |
1150 | + } |
1151 | + |
1152 | rs600_irq_set(rdev); |
1153 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
1154 | /* 1M ring buffer */ |
1155 | @@ -1047,9 +1053,6 @@ int rs600_init(struct radeon_device *rdev) |
1156 | r = radeon_fence_driver_init(rdev); |
1157 | if (r) |
1158 | return r; |
1159 | - r = radeon_irq_kms_init(rdev); |
1160 | - if (r) |
1161 | - return r; |
1162 | /* Memory manager */ |
1163 | r = radeon_bo_init(rdev); |
1164 | if (r) |
1165 | diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c |
1166 | index 5706d2a..fad6633 100644 |
1167 | --- a/drivers/gpu/drm/radeon/rs690.c |
1168 | +++ b/drivers/gpu/drm/radeon/rs690.c |
1169 | @@ -628,6 +628,12 @@ static int rs690_startup(struct radeon_device *rdev) |
1170 | } |
1171 | |
1172 | /* Enable IRQ */ |
1173 | + if (!rdev->irq.installed) { |
1174 | + r = radeon_irq_kms_init(rdev); |
1175 | + if (r) |
1176 | + return r; |
1177 | + } |
1178 | + |
1179 | rs600_irq_set(rdev); |
1180 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
1181 | /* 1M ring buffer */ |
1182 | @@ -753,9 +759,6 @@ int rs690_init(struct radeon_device *rdev) |
1183 | r = radeon_fence_driver_init(rdev); |
1184 | if (r) |
1185 | return r; |
1186 | - r = radeon_irq_kms_init(rdev); |
1187 | - if (r) |
1188 | - return r; |
1189 | /* Memory manager */ |
1190 | r = radeon_bo_init(rdev); |
1191 | if (r) |
1192 | diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c |
1193 | index ffcba73..21c7d7b 100644 |
1194 | --- a/drivers/gpu/drm/radeon/rv515.c |
1195 | +++ b/drivers/gpu/drm/radeon/rv515.c |
1196 | @@ -532,6 +532,12 @@ static int rv515_startup(struct radeon_device *rdev) |
1197 | } |
1198 | |
1199 | /* Enable IRQ */ |
1200 | + if (!rdev->irq.installed) { |
1201 | + r = radeon_irq_kms_init(rdev); |
1202 | + if (r) |
1203 | + return r; |
1204 | + } |
1205 | + |
1206 | rs600_irq_set(rdev); |
1207 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); |
1208 | /* 1M ring buffer */ |
1209 | @@ -662,9 +668,6 @@ int rv515_init(struct radeon_device *rdev) |
1210 | r = radeon_fence_driver_init(rdev); |
1211 | if (r) |
1212 | return r; |
1213 | - r = radeon_irq_kms_init(rdev); |
1214 | - if (r) |
1215 | - return r; |
1216 | /* Memory manager */ |
1217 | r = radeon_bo_init(rdev); |
1218 | if (r) |
1219 | diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c |
1220 | index d63fe1d..c872d2b 100644 |
1221 | --- a/drivers/gpu/drm/radeon/rv770.c |
1222 | +++ b/drivers/gpu/drm/radeon/rv770.c |
1223 | @@ -1041,6 +1041,12 @@ static int rv770_startup(struct radeon_device *rdev) |
1224 | } |
1225 | |
1226 | /* Enable IRQ */ |
1227 | + if (!rdev->irq.installed) { |
1228 | + r = radeon_irq_kms_init(rdev); |
1229 | + if (r) |
1230 | + return r; |
1231 | + } |
1232 | + |
1233 | r = r600_irq_init(rdev); |
1234 | if (r) { |
1235 | DRM_ERROR("radeon: IH init failed (%d).\n", r); |
1236 | @@ -1180,10 +1186,6 @@ int rv770_init(struct radeon_device *rdev) |
1237 | if (r) |
1238 | return r; |
1239 | |
1240 | - r = radeon_irq_kms_init(rdev); |
1241 | - if (r) |
1242 | - return r; |
1243 | - |
1244 | rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ring_obj = NULL; |
1245 | r600_ring_init(rdev, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX], 1024 * 1024); |
1246 | |
1247 | @@ -1238,8 +1240,6 @@ static void rv770_pcie_gen2_enable(struct radeon_device *rdev) |
1248 | { |
1249 | u32 link_width_cntl, lanes, speed_cntl, tmp; |
1250 | u16 link_cntl2; |
1251 | - u32 mask; |
1252 | - int ret; |
1253 | |
1254 | if (radeon_pcie_gen2 == 0) |
1255 | return; |
1256 | @@ -1254,11 +1254,8 @@ static void rv770_pcie_gen2_enable(struct radeon_device *rdev) |
1257 | if (ASIC_IS_X2(rdev)) |
1258 | return; |
1259 | |
1260 | - ret = drm_pcie_get_speed_cap_mask(rdev->ddev, &mask); |
1261 | - if (ret != 0) |
1262 | - return; |
1263 | - |
1264 | - if (!(mask & DRM_PCIE_SPEED_50)) |
1265 | + if ((rdev->pdev->bus->max_bus_speed != PCIE_SPEED_5_0GT) && |
1266 | + (rdev->pdev->bus->max_bus_speed != PCIE_SPEED_8_0GT)) |
1267 | return; |
1268 | |
1269 | DRM_INFO("enabling PCIE gen 2 link speeds, disable with radeon.pcie_gen2=0\n"); |
1270 | diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c |
1271 | index aefefd5..a964a96 100644 |
1272 | --- a/drivers/gpu/drm/radeon/si.c |
1273 | +++ b/drivers/gpu/drm/radeon/si.c |
1274 | @@ -4374,6 +4374,12 @@ static int si_startup(struct radeon_device *rdev) |
1275 | } |
1276 | |
1277 | /* Enable IRQ */ |
1278 | + if (!rdev->irq.installed) { |
1279 | + r = radeon_irq_kms_init(rdev); |
1280 | + if (r) |
1281 | + return r; |
1282 | + } |
1283 | + |
1284 | r = si_irq_init(rdev); |
1285 | if (r) { |
1286 | DRM_ERROR("radeon: IH init failed (%d).\n", r); |
1287 | @@ -4534,10 +4540,6 @@ int si_init(struct radeon_device *rdev) |
1288 | if (r) |
1289 | return r; |
1290 | |
1291 | - r = radeon_irq_kms_init(rdev); |
1292 | - if (r) |
1293 | - return r; |
1294 | - |
1295 | ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; |
1296 | ring->ring_obj = NULL; |
1297 | r600_ring_init(rdev, ring, 1024 * 1024); |
1298 | diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c |
1299 | index 71bcba8a..1468be8 100644 |
1300 | --- a/drivers/hwmon/adm1021.c |
1301 | +++ b/drivers/hwmon/adm1021.c |
1302 | @@ -332,26 +332,68 @@ static int adm1021_detect(struct i2c_client *client, |
1303 | man_id = i2c_smbus_read_byte_data(client, ADM1021_REG_MAN_ID); |
1304 | dev_id = i2c_smbus_read_byte_data(client, ADM1021_REG_DEV_ID); |
1305 | |
1306 | + if (man_id < 0 || dev_id < 0) |
1307 | + return -ENODEV; |
1308 | + |
1309 | if (man_id == 0x4d && dev_id == 0x01) |
1310 | type_name = "max1617a"; |
1311 | else if (man_id == 0x41) { |
1312 | if ((dev_id & 0xF0) == 0x30) |
1313 | type_name = "adm1023"; |
1314 | - else |
1315 | + else if ((dev_id & 0xF0) == 0x00) |
1316 | type_name = "adm1021"; |
1317 | + else |
1318 | + return -ENODEV; |
1319 | } else if (man_id == 0x49) |
1320 | type_name = "thmc10"; |
1321 | else if (man_id == 0x23) |
1322 | type_name = "gl523sm"; |
1323 | else if (man_id == 0x54) |
1324 | type_name = "mc1066"; |
1325 | - /* LM84 Mfr ID in a different place, and it has more unused bits */ |
1326 | - else if (conv_rate == 0x00 |
1327 | - && (config & 0x7F) == 0x00 |
1328 | - && (status & 0xAB) == 0x00) |
1329 | - type_name = "lm84"; |
1330 | - else |
1331 | - type_name = "max1617"; |
1332 | + else { |
1333 | + int lte, rte, lhi, rhi, llo, rlo; |
1334 | + |
1335 | + /* extra checks for LM84 and MAX1617 to avoid misdetections */ |
1336 | + |
1337 | + llo = i2c_smbus_read_byte_data(client, ADM1021_REG_THYST_R(0)); |
1338 | + rlo = i2c_smbus_read_byte_data(client, ADM1021_REG_THYST_R(1)); |
1339 | + |
1340 | + /* fail if any of the additional register reads failed */ |
1341 | + if (llo < 0 || rlo < 0) |
1342 | + return -ENODEV; |
1343 | + |
1344 | + lte = i2c_smbus_read_byte_data(client, ADM1021_REG_TEMP(0)); |
1345 | + rte = i2c_smbus_read_byte_data(client, ADM1021_REG_TEMP(1)); |
1346 | + lhi = i2c_smbus_read_byte_data(client, ADM1021_REG_TOS_R(0)); |
1347 | + rhi = i2c_smbus_read_byte_data(client, ADM1021_REG_TOS_R(1)); |
1348 | + |
1349 | + /* |
1350 | + * Fail for negative temperatures and negative high limits. |
1351 | + * This check also catches read errors on the tested registers. |
1352 | + */ |
1353 | + if ((s8)lte < 0 || (s8)rte < 0 || (s8)lhi < 0 || (s8)rhi < 0) |
1354 | + return -ENODEV; |
1355 | + |
1356 | + /* fail if all registers hold the same value */ |
1357 | + if (lte == rte && lte == lhi && lte == rhi && lte == llo |
1358 | + && lte == rlo) |
1359 | + return -ENODEV; |
1360 | + |
1361 | + /* |
1362 | + * LM84 Mfr ID is in a different place, |
1363 | + * and it has more unused bits. |
1364 | + */ |
1365 | + if (conv_rate == 0x00 |
1366 | + && (config & 0x7F) == 0x00 |
1367 | + && (status & 0xAB) == 0x00) { |
1368 | + type_name = "lm84"; |
1369 | + } else { |
1370 | + /* fail if low limits are larger than high limits */ |
1371 | + if ((s8)llo > lhi || (s8)rlo > rhi) |
1372 | + return -ENODEV; |
1373 | + type_name = "max1617"; |
1374 | + } |
1375 | + } |
1376 | |
1377 | pr_debug("adm1021: Detected chip %s at adapter %d, address 0x%02x.\n", |
1378 | type_name, i2c_adapter_id(adapter), client->addr); |
1379 | diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c |
1380 | index a884252..e76d4ac 100644 |
1381 | --- a/drivers/iio/frequency/adf4350.c |
1382 | +++ b/drivers/iio/frequency/adf4350.c |
1383 | @@ -212,7 +212,7 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq) |
1384 | (pdata->r2_user_settings & (ADF4350_REG2_PD_POLARITY_POS | |
1385 | ADF4350_REG2_LDP_6ns | ADF4350_REG2_LDF_INT_N | |
1386 | ADF4350_REG2_CHARGE_PUMP_CURR_uA(5000) | |
1387 | - ADF4350_REG2_MUXOUT(0x7) | ADF4350_REG2_NOISE_MODE(0x9))); |
1388 | + ADF4350_REG2_MUXOUT(0x7) | ADF4350_REG2_NOISE_MODE(0x3))); |
1389 | |
1390 | st->regs[ADF4350_REG3] = pdata->r3_user_settings & |
1391 | (ADF4350_REG3_12BIT_CLKDIV(0xFFF) | |
1392 | diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c |
1393 | index b289915..8ff1a2d 100644 |
1394 | --- a/drivers/iio/inkern.c |
1395 | +++ b/drivers/iio/inkern.c |
1396 | @@ -279,7 +279,7 @@ static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan, |
1397 | s64 raw64 = raw; |
1398 | int ret; |
1399 | |
1400 | - ret = iio_channel_read(chan, &offset, NULL, IIO_CHAN_INFO_SCALE); |
1401 | + ret = iio_channel_read(chan, &offset, NULL, IIO_CHAN_INFO_OFFSET); |
1402 | if (ret == 0) |
1403 | raw64 += offset; |
1404 | |
1405 | diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c |
1406 | index 5427787..563771f 100644 |
1407 | --- a/drivers/pci/probe.c |
1408 | +++ b/drivers/pci/probe.c |
1409 | @@ -988,7 +988,6 @@ int pci_setup_device(struct pci_dev *dev) |
1410 | dev->sysdata = dev->bus->sysdata; |
1411 | dev->dev.parent = dev->bus->bridge; |
1412 | dev->dev.bus = &pci_bus_type; |
1413 | - dev->dev.type = &pci_dev_type; |
1414 | dev->hdr_type = hdr_type & 0x7f; |
1415 | dev->multifunction = !!(hdr_type & 0x80); |
1416 | dev->error_state = pci_channel_io_normal; |
1417 | @@ -1208,6 +1207,7 @@ struct pci_dev *alloc_pci_dev(void) |
1418 | return NULL; |
1419 | |
1420 | INIT_LIST_HEAD(&dev->bus_list); |
1421 | + dev->dev.type = &pci_dev_type; |
1422 | |
1423 | return dev; |
1424 | } |
1425 | diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c |
1426 | index 1a779bb..72184cc 100644 |
1427 | --- a/drivers/platform/x86/hp-wmi.c |
1428 | +++ b/drivers/platform/x86/hp-wmi.c |
1429 | @@ -679,7 +679,7 @@ static int hp_wmi_rfkill_setup(struct platform_device *device) |
1430 | } |
1431 | rfkill_init_sw_state(gps_rfkill, |
1432 | hp_wmi_get_sw_state(HPWMI_GPS)); |
1433 | - rfkill_set_hw_state(bluetooth_rfkill, |
1434 | + rfkill_set_hw_state(gps_rfkill, |
1435 | hp_wmi_get_hw_state(HPWMI_GPS)); |
1436 | err = rfkill_register(gps_rfkill); |
1437 | if (err) |
1438 | diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c |
1439 | index e8d7768..1e04b79 100644 |
1440 | --- a/drivers/usb/dwc3/dwc3-pci.c |
1441 | +++ b/drivers/usb/dwc3/dwc3-pci.c |
1442 | @@ -196,9 +196,9 @@ static void dwc3_pci_remove(struct pci_dev *pci) |
1443 | { |
1444 | struct dwc3_pci *glue = pci_get_drvdata(pci); |
1445 | |
1446 | + platform_device_unregister(glue->dwc3); |
1447 | platform_device_unregister(glue->usb2_phy); |
1448 | platform_device_unregister(glue->usb3_phy); |
1449 | - platform_device_unregister(glue->dwc3); |
1450 | pci_set_drvdata(pci, NULL); |
1451 | pci_disable_device(pci); |
1452 | } |
1453 | diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
1454 | index 82e160e..bab9630 100644 |
1455 | --- a/drivers/usb/dwc3/gadget.c |
1456 | +++ b/drivers/usb/dwc3/gadget.c |
1457 | @@ -1637,10 +1637,20 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc) |
1458 | |
1459 | for (epnum = 0; epnum < DWC3_ENDPOINTS_NUM; epnum++) { |
1460 | dep = dwc->eps[epnum]; |
1461 | - dwc3_free_trb_pool(dep); |
1462 | |
1463 | - if (epnum != 0 && epnum != 1) |
1464 | + /* |
1465 | + * Physical endpoints 0 and 1 are special; they form the |
1466 | + * bi-directional USB endpoint 0. |
1467 | + * |
1468 | + * For those two physical endpoints, we don't allocate a TRB |
1469 | + * pool nor do we add them the endpoints list. Due to that, we |
1470 | + * shouldn't do these two operations otherwise we would end up |
1471 | + * with all sorts of bugs when removing dwc3.ko. |
1472 | + */ |
1473 | + if (epnum != 0 && epnum != 1) { |
1474 | + dwc3_free_trb_pool(dep); |
1475 | list_del(&dep->endpoint.ep_list); |
1476 | + } |
1477 | |
1478 | kfree(dep); |
1479 | } |
1480 | diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c |
1481 | index 010f686..5a00ef3 100644 |
1482 | --- a/drivers/usb/host/ehci-sched.c |
1483 | +++ b/drivers/usb/host/ehci-sched.c |
1484 | @@ -213,7 +213,7 @@ static inline unsigned char tt_start_uframe(struct ehci_hcd *ehci, __hc32 mask) |
1485 | } |
1486 | |
1487 | static const unsigned char |
1488 | -max_tt_usecs[] = { 125, 125, 125, 125, 125, 125, 125, 25 }; |
1489 | +max_tt_usecs[] = { 125, 125, 125, 125, 125, 125, 30, 0 }; |
1490 | |
1491 | /* carryover low/fullspeed bandwidth that crosses uframe boundries */ |
1492 | static inline void carryover_tt_bandwidth(unsigned short tt_usecs[8]) |
1493 | diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c |
1494 | index fd26470e428..905f38c 100644 |
1495 | --- a/drivers/usb/host/xhci-mem.c |
1496 | +++ b/drivers/usb/host/xhci-mem.c |
1497 | @@ -1827,6 +1827,9 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) |
1498 | } |
1499 | spin_unlock_irqrestore(&xhci->lock, flags); |
1500 | |
1501 | + if (!xhci->rh_bw) |
1502 | + goto no_bw; |
1503 | + |
1504 | num_ports = HCS_MAX_PORTS(xhci->hcs_params1); |
1505 | for (i = 0; i < num_ports; i++) { |
1506 | struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table; |
1507 | @@ -1845,6 +1848,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) |
1508 | } |
1509 | } |
1510 | |
1511 | +no_bw: |
1512 | xhci->num_usb2_ports = 0; |
1513 | xhci->num_usb3_ports = 0; |
1514 | xhci->num_active_eps = 0; |
1515 | @@ -2256,6 +2260,9 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) |
1516 | u32 page_size, temp; |
1517 | int i; |
1518 | |
1519 | + INIT_LIST_HEAD(&xhci->lpm_failed_devs); |
1520 | + INIT_LIST_HEAD(&xhci->cancel_cmd_list); |
1521 | + |
1522 | page_size = xhci_readl(xhci, &xhci->op_regs->page_size); |
1523 | xhci_dbg(xhci, "Supported page size register = 0x%x\n", page_size); |
1524 | for (i = 0; i < 16; i++) { |
1525 | @@ -2334,7 +2341,6 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) |
1526 | xhci->cmd_ring = xhci_ring_alloc(xhci, 1, 1, TYPE_COMMAND, flags); |
1527 | if (!xhci->cmd_ring) |
1528 | goto fail; |
1529 | - INIT_LIST_HEAD(&xhci->cancel_cmd_list); |
1530 | xhci_dbg(xhci, "Allocated command ring at %p\n", xhci->cmd_ring); |
1531 | xhci_dbg(xhci, "First segment DMA is 0x%llx\n", |
1532 | (unsigned long long)xhci->cmd_ring->first_seg->dma); |
1533 | @@ -2445,8 +2451,6 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) |
1534 | if (xhci_setup_port_arrays(xhci, flags)) |
1535 | goto fail; |
1536 | |
1537 | - INIT_LIST_HEAD(&xhci->lpm_failed_devs); |
1538 | - |
1539 | /* Enable USB 3.0 device notifications for function remote wake, which |
1540 | * is necessary for allowing USB 3.0 devices to do remote wakeup from |
1541 | * U3 (device suspend). |
1542 | diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c |
1543 | index 1a30c38..cc24e39 100644 |
1544 | --- a/drivers/usb/host/xhci-pci.c |
1545 | +++ b/drivers/usb/host/xhci-pci.c |
1546 | @@ -221,6 +221,14 @@ static void xhci_pci_remove(struct pci_dev *dev) |
1547 | static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) |
1548 | { |
1549 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
1550 | + struct pci_dev *pdev = to_pci_dev(hcd->self.controller); |
1551 | + |
1552 | + /* |
1553 | + * Systems with the TI redriver that loses port status change events |
1554 | + * need to have the registers polled during D3, so avoid D3cold. |
1555 | + */ |
1556 | + if (xhci_compliance_mode_recovery_timer_quirk_check()) |
1557 | + pdev->no_d3cold = true; |
1558 | |
1559 | return xhci_suspend(xhci); |
1560 | } |
1561 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
1562 | index 53b8f89..82b0809 100644 |
1563 | --- a/drivers/usb/host/xhci.c |
1564 | +++ b/drivers/usb/host/xhci.c |
1565 | @@ -466,7 +466,7 @@ static void compliance_mode_recovery_timer_init(struct xhci_hcd *xhci) |
1566 | * Systems: |
1567 | * Vendor: Hewlett-Packard -> System Models: Z420, Z620 and Z820 |
1568 | */ |
1569 | -static bool compliance_mode_recovery_timer_quirk_check(void) |
1570 | +bool xhci_compliance_mode_recovery_timer_quirk_check(void) |
1571 | { |
1572 | const char *dmi_product_name, *dmi_sys_vendor; |
1573 | |
1574 | @@ -517,7 +517,7 @@ int xhci_init(struct usb_hcd *hcd) |
1575 | xhci_dbg(xhci, "Finished xhci_init\n"); |
1576 | |
1577 | /* Initializing Compliance Mode Recovery Data If Needed */ |
1578 | - if (compliance_mode_recovery_timer_quirk_check()) { |
1579 | + if (xhci_compliance_mode_recovery_timer_quirk_check()) { |
1580 | xhci->quirks |= XHCI_COMP_MODE_QUIRK; |
1581 | compliance_mode_recovery_timer_init(xhci); |
1582 | } |
1583 | @@ -952,6 +952,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
1584 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
1585 | struct usb_hcd *secondary_hcd; |
1586 | int retval = 0; |
1587 | + bool comp_timer_running = false; |
1588 | |
1589 | /* Wait a bit if either of the roothubs need to settle from the |
1590 | * transition into bus suspend. |
1591 | @@ -989,6 +990,13 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
1592 | |
1593 | /* If restore operation fails, re-initialize the HC during resume */ |
1594 | if ((temp & STS_SRE) || hibernated) { |
1595 | + |
1596 | + if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && |
1597 | + !(xhci_all_ports_seen_u0(xhci))) { |
1598 | + del_timer_sync(&xhci->comp_mode_recovery_timer); |
1599 | + xhci_dbg(xhci, "Compliance Mode Recovery Timer deleted!\n"); |
1600 | + } |
1601 | + |
1602 | /* Let the USB core know _both_ roothubs lost power. */ |
1603 | usb_root_hub_lost_power(xhci->main_hcd->self.root_hub); |
1604 | usb_root_hub_lost_power(xhci->shared_hcd->self.root_hub); |
1605 | @@ -1031,6 +1039,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
1606 | retval = xhci_init(hcd->primary_hcd); |
1607 | if (retval) |
1608 | return retval; |
1609 | + comp_timer_running = true; |
1610 | + |
1611 | xhci_dbg(xhci, "Start the primary HCD\n"); |
1612 | retval = xhci_run(hcd->primary_hcd); |
1613 | if (!retval) { |
1614 | @@ -1072,7 +1082,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
1615 | * to suffer the Compliance Mode issue again. It doesn't matter if |
1616 | * ports have entered previously to U0 before system's suspension. |
1617 | */ |
1618 | - if (xhci->quirks & XHCI_COMP_MODE_QUIRK) |
1619 | + if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && !comp_timer_running) |
1620 | compliance_mode_recovery_timer_init(xhci); |
1621 | |
1622 | /* Re-enable port polling. */ |
1623 | diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
1624 | index 6358271..bde9f22 100644 |
1625 | --- a/drivers/usb/host/xhci.h |
1626 | +++ b/drivers/usb/host/xhci.h |
1627 | @@ -1853,4 +1853,7 @@ struct xhci_input_control_ctx *xhci_get_input_control_ctx(struct xhci_hcd *xhci, |
1628 | struct xhci_slot_ctx *xhci_get_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx); |
1629 | struct xhci_ep_ctx *xhci_get_ep_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, unsigned int ep_index); |
1630 | |
1631 | +/* xHCI quirks */ |
1632 | +bool xhci_compliance_mode_recovery_timer_quirk_check(void); |
1633 | + |
1634 | #endif /* __LINUX_XHCI_HCD_H */ |
1635 | diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c |
1636 | index 1ce1fcf..6f26fd8 100644 |
1637 | --- a/drivers/usb/musb/musb_host.c |
1638 | +++ b/drivers/usb/musb/musb_host.c |
1639 | @@ -1232,7 +1232,6 @@ void musb_host_tx(struct musb *musb, u8 epnum) |
1640 | void __iomem *mbase = musb->mregs; |
1641 | struct dma_channel *dma; |
1642 | bool transfer_pending = false; |
1643 | - static bool use_sg; |
1644 | |
1645 | musb_ep_select(mbase, epnum); |
1646 | tx_csr = musb_readw(epio, MUSB_TXCSR); |
1647 | @@ -1463,9 +1462,9 @@ done: |
1648 | * NULL. |
1649 | */ |
1650 | if (!urb->transfer_buffer) |
1651 | - use_sg = true; |
1652 | + qh->use_sg = true; |
1653 | |
1654 | - if (use_sg) { |
1655 | + if (qh->use_sg) { |
1656 | /* sg_miter_start is already done in musb_ep_program */ |
1657 | if (!sg_miter_next(&qh->sg_miter)) { |
1658 | dev_err(musb->controller, "error: sg list empty\n"); |
1659 | @@ -1484,9 +1483,9 @@ done: |
1660 | |
1661 | qh->segsize = length; |
1662 | |
1663 | - if (use_sg) { |
1664 | + if (qh->use_sg) { |
1665 | if (offset + length >= urb->transfer_buffer_length) |
1666 | - use_sg = false; |
1667 | + qh->use_sg = false; |
1668 | } |
1669 | |
1670 | musb_ep_select(mbase, epnum); |
1671 | @@ -1552,7 +1551,6 @@ void musb_host_rx(struct musb *musb, u8 epnum) |
1672 | bool done = false; |
1673 | u32 status; |
1674 | struct dma_channel *dma; |
1675 | - static bool use_sg; |
1676 | unsigned int sg_flags = SG_MITER_ATOMIC | SG_MITER_TO_SG; |
1677 | |
1678 | musb_ep_select(mbase, epnum); |
1679 | @@ -1878,12 +1876,12 @@ void musb_host_rx(struct musb *musb, u8 epnum) |
1680 | * NULL. |
1681 | */ |
1682 | if (!urb->transfer_buffer) { |
1683 | - use_sg = true; |
1684 | + qh->use_sg = true; |
1685 | sg_miter_start(&qh->sg_miter, urb->sg, 1, |
1686 | sg_flags); |
1687 | } |
1688 | |
1689 | - if (use_sg) { |
1690 | + if (qh->use_sg) { |
1691 | if (!sg_miter_next(&qh->sg_miter)) { |
1692 | dev_err(musb->controller, "error: sg list empty\n"); |
1693 | sg_miter_stop(&qh->sg_miter); |
1694 | @@ -1913,8 +1911,8 @@ finish: |
1695 | urb->actual_length += xfer_len; |
1696 | qh->offset += xfer_len; |
1697 | if (done) { |
1698 | - if (use_sg) |
1699 | - use_sg = false; |
1700 | + if (qh->use_sg) |
1701 | + qh->use_sg = false; |
1702 | |
1703 | if (urb->status == -EINPROGRESS) |
1704 | urb->status = status; |
1705 | diff --git a/drivers/usb/musb/musb_host.h b/drivers/usb/musb/musb_host.h |
1706 | index 5a9c8fe..738f7eb 100644 |
1707 | --- a/drivers/usb/musb/musb_host.h |
1708 | +++ b/drivers/usb/musb/musb_host.h |
1709 | @@ -74,6 +74,7 @@ struct musb_qh { |
1710 | u16 frame; /* for periodic schedule */ |
1711 | unsigned iso_idx; /* in urb->iso_frame_desc[] */ |
1712 | struct sg_mapping_iter sg_miter; /* for highmem in PIO mode */ |
1713 | + bool use_sg; /* to track urb using sglist */ |
1714 | }; |
1715 | |
1716 | /* map from control or bulk queue head to the first qh on that ring */ |
1717 | diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c |
1718 | index 4775f82..513d45f 100644 |
1719 | --- a/drivers/usb/serial/ark3116.c |
1720 | +++ b/drivers/usb/serial/ark3116.c |
1721 | @@ -43,7 +43,7 @@ |
1722 | #define DRIVER_NAME "ark3116" |
1723 | |
1724 | /* usb timeout of 1 second */ |
1725 | -#define ARK_TIMEOUT (1*HZ) |
1726 | +#define ARK_TIMEOUT 1000 |
1727 | |
1728 | static const struct usb_device_id id_table[] = { |
1729 | { USB_DEVICE(0x6547, 0x0232) }, |
1730 | diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c |
1731 | index ba7352e..9b145d3 100644 |
1732 | --- a/drivers/usb/serial/cypress_m8.c |
1733 | +++ b/drivers/usb/serial/cypress_m8.c |
1734 | @@ -65,6 +65,7 @@ static const struct usb_device_id id_table_earthmate[] = { |
1735 | static const struct usb_device_id id_table_cyphidcomrs232[] = { |
1736 | { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, |
1737 | { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, |
1738 | + { USB_DEVICE(VENDOR_ID_FRWD, PRODUCT_ID_CYPHIDCOM_FRWD) }, |
1739 | { } /* Terminating entry */ |
1740 | }; |
1741 | |
1742 | @@ -78,6 +79,7 @@ static const struct usb_device_id id_table_combined[] = { |
1743 | { USB_DEVICE(VENDOR_ID_DELORME, PRODUCT_ID_EARTHMATEUSB_LT20) }, |
1744 | { USB_DEVICE(VENDOR_ID_CYPRESS, PRODUCT_ID_CYPHIDCOM) }, |
1745 | { USB_DEVICE(VENDOR_ID_POWERCOM, PRODUCT_ID_UPS) }, |
1746 | + { USB_DEVICE(VENDOR_ID_FRWD, PRODUCT_ID_CYPHIDCOM_FRWD) }, |
1747 | { USB_DEVICE(VENDOR_ID_DAZZLE, PRODUCT_ID_CA42) }, |
1748 | { } /* Terminating entry */ |
1749 | }; |
1750 | @@ -230,6 +232,12 @@ static struct usb_serial_driver * const serial_drivers[] = { |
1751 | * Cypress serial helper functions |
1752 | *****************************************************************************/ |
1753 | |
1754 | +/* FRWD Dongle hidcom needs to skip reset and speed checks */ |
1755 | +static inline bool is_frwd(struct usb_device *dev) |
1756 | +{ |
1757 | + return ((le16_to_cpu(dev->descriptor.idVendor) == VENDOR_ID_FRWD) && |
1758 | + (le16_to_cpu(dev->descriptor.idProduct) == PRODUCT_ID_CYPHIDCOM_FRWD)); |
1759 | +} |
1760 | |
1761 | static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate) |
1762 | { |
1763 | @@ -239,6 +247,10 @@ static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate) |
1764 | if (unstable_bauds) |
1765 | return new_rate; |
1766 | |
1767 | + /* FRWD Dongle uses 115200 bps */ |
1768 | + if (is_frwd(port->serial->dev)) |
1769 | + return new_rate; |
1770 | + |
1771 | /* |
1772 | * The general purpose firmware for the Cypress M8 allows for |
1773 | * a maximum speed of 57600bps (I have no idea whether DeLorme |
1774 | @@ -449,7 +461,11 @@ static int cypress_generic_port_probe(struct usb_serial_port *port) |
1775 | return -ENOMEM; |
1776 | } |
1777 | |
1778 | - usb_reset_configuration(serial->dev); |
1779 | + /* Skip reset for FRWD device. It is a workaound: |
1780 | + device hangs if it receives SET_CONFIGURE in Configured |
1781 | + state. */ |
1782 | + if (!is_frwd(serial->dev)) |
1783 | + usb_reset_configuration(serial->dev); |
1784 | |
1785 | priv->cmd_ctrl = 0; |
1786 | priv->line_control = 0; |
1787 | diff --git a/drivers/usb/serial/cypress_m8.h b/drivers/usb/serial/cypress_m8.h |
1788 | index 67cf608..b461311 100644 |
1789 | --- a/drivers/usb/serial/cypress_m8.h |
1790 | +++ b/drivers/usb/serial/cypress_m8.h |
1791 | @@ -24,6 +24,10 @@ |
1792 | #define VENDOR_ID_CYPRESS 0x04b4 |
1793 | #define PRODUCT_ID_CYPHIDCOM 0x5500 |
1794 | |
1795 | +/* FRWD Dongle - a GPS sports watch */ |
1796 | +#define VENDOR_ID_FRWD 0x6737 |
1797 | +#define PRODUCT_ID_CYPHIDCOM_FRWD 0x0001 |
1798 | + |
1799 | /* Powercom UPS, chip CY7C63723 */ |
1800 | #define VENDOR_ID_POWERCOM 0x0d9f |
1801 | #define PRODUCT_ID_UPS 0x0002 |
1802 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
1803 | index 266ece7..e8e2837 100644 |
1804 | --- a/drivers/usb/serial/ftdi_sio.c |
1805 | +++ b/drivers/usb/serial/ftdi_sio.c |
1806 | @@ -931,8 +931,8 @@ static int ftdi_get_icount(struct tty_struct *tty, |
1807 | static int ftdi_ioctl(struct tty_struct *tty, |
1808 | unsigned int cmd, unsigned long arg); |
1809 | static void ftdi_break_ctl(struct tty_struct *tty, int break_state); |
1810 | -static int ftdi_chars_in_buffer(struct tty_struct *tty); |
1811 | -static int ftdi_get_modem_status(struct tty_struct *tty, |
1812 | +static bool ftdi_tx_empty(struct usb_serial_port *port); |
1813 | +static int ftdi_get_modem_status(struct usb_serial_port *port, |
1814 | unsigned char status[2]); |
1815 | |
1816 | static unsigned short int ftdi_232am_baud_base_to_divisor(int baud, int base); |
1817 | @@ -968,7 +968,7 @@ static struct usb_serial_driver ftdi_sio_device = { |
1818 | .ioctl = ftdi_ioctl, |
1819 | .set_termios = ftdi_set_termios, |
1820 | .break_ctl = ftdi_break_ctl, |
1821 | - .chars_in_buffer = ftdi_chars_in_buffer, |
1822 | + .tx_empty = ftdi_tx_empty, |
1823 | }; |
1824 | |
1825 | static struct usb_serial_driver * const serial_drivers[] = { |
1826 | @@ -2092,27 +2092,18 @@ static void ftdi_break_ctl(struct tty_struct *tty, int break_state) |
1827 | |
1828 | } |
1829 | |
1830 | -static int ftdi_chars_in_buffer(struct tty_struct *tty) |
1831 | +static bool ftdi_tx_empty(struct usb_serial_port *port) |
1832 | { |
1833 | - struct usb_serial_port *port = tty->driver_data; |
1834 | - int chars; |
1835 | unsigned char buf[2]; |
1836 | int ret; |
1837 | |
1838 | - chars = usb_serial_generic_chars_in_buffer(tty); |
1839 | - if (chars) |
1840 | - goto out; |
1841 | - |
1842 | - /* Check if hardware buffer is empty. */ |
1843 | - ret = ftdi_get_modem_status(tty, buf); |
1844 | + ret = ftdi_get_modem_status(port, buf); |
1845 | if (ret == 2) { |
1846 | if (!(buf[1] & FTDI_RS_TEMT)) |
1847 | - chars = 1; |
1848 | + return false; |
1849 | } |
1850 | -out: |
1851 | - dev_dbg(&port->dev, "%s - %d\n", __func__, chars); |
1852 | |
1853 | - return chars; |
1854 | + return true; |
1855 | } |
1856 | |
1857 | /* old_termios contains the original termios settings and tty->termios contains |
1858 | @@ -2304,10 +2295,9 @@ no_c_cflag_changes: |
1859 | * Returns the number of status bytes retrieved (device dependant), or |
1860 | * negative error code. |
1861 | */ |
1862 | -static int ftdi_get_modem_status(struct tty_struct *tty, |
1863 | +static int ftdi_get_modem_status(struct usb_serial_port *port, |
1864 | unsigned char status[2]) |
1865 | { |
1866 | - struct usb_serial_port *port = tty->driver_data; |
1867 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1868 | unsigned char *buf; |
1869 | int len; |
1870 | @@ -2372,7 +2362,7 @@ static int ftdi_tiocmget(struct tty_struct *tty) |
1871 | unsigned char buf[2]; |
1872 | int ret; |
1873 | |
1874 | - ret = ftdi_get_modem_status(tty, buf); |
1875 | + ret = ftdi_get_modem_status(port, buf); |
1876 | if (ret < 0) |
1877 | return ret; |
1878 | |
1879 | diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c |
1880 | index 4c5c23f..7f4342b 100644 |
1881 | --- a/drivers/usb/serial/generic.c |
1882 | +++ b/drivers/usb/serial/generic.c |
1883 | @@ -264,6 +264,37 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty) |
1884 | } |
1885 | EXPORT_SYMBOL_GPL(usb_serial_generic_chars_in_buffer); |
1886 | |
1887 | +void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout) |
1888 | +{ |
1889 | + struct usb_serial_port *port = tty->driver_data; |
1890 | + unsigned int bps; |
1891 | + unsigned long period; |
1892 | + unsigned long expire; |
1893 | + |
1894 | + bps = tty_get_baud_rate(tty); |
1895 | + if (!bps) |
1896 | + bps = 9600; /* B0 */ |
1897 | + /* |
1898 | + * Use a poll-period of roughly the time it takes to send one |
1899 | + * character or at least one jiffy. |
1900 | + */ |
1901 | + period = max_t(unsigned long, (10 * HZ / bps), 1); |
1902 | + period = min_t(unsigned long, period, timeout); |
1903 | + |
1904 | + dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n", |
1905 | + __func__, jiffies_to_msecs(timeout), |
1906 | + jiffies_to_msecs(period)); |
1907 | + expire = jiffies + timeout; |
1908 | + while (!port->serial->type->tx_empty(port)) { |
1909 | + schedule_timeout_interruptible(period); |
1910 | + if (signal_pending(current)) |
1911 | + break; |
1912 | + if (time_after(jiffies, expire)) |
1913 | + break; |
1914 | + } |
1915 | +} |
1916 | +EXPORT_SYMBOL_GPL(usb_serial_generic_wait_until_sent); |
1917 | + |
1918 | static int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, |
1919 | int index, gfp_t mem_flags) |
1920 | { |
1921 | diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c |
1922 | index 38f2489..f26decd 100644 |
1923 | --- a/drivers/usb/serial/io_ti.c |
1924 | +++ b/drivers/usb/serial/io_ti.c |
1925 | @@ -2033,8 +2033,6 @@ static int edge_chars_in_buffer(struct tty_struct *tty) |
1926 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
1927 | int chars = 0; |
1928 | unsigned long flags; |
1929 | - int ret; |
1930 | - |
1931 | if (edge_port == NULL) |
1932 | return 0; |
1933 | |
1934 | @@ -2042,16 +2040,22 @@ static int edge_chars_in_buffer(struct tty_struct *tty) |
1935 | chars = kfifo_len(&edge_port->write_fifo); |
1936 | spin_unlock_irqrestore(&edge_port->ep_lock, flags); |
1937 | |
1938 | - if (!chars) { |
1939 | - ret = tx_active(edge_port); |
1940 | - if (ret > 0) |
1941 | - chars = ret; |
1942 | - } |
1943 | - |
1944 | dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); |
1945 | return chars; |
1946 | } |
1947 | |
1948 | +static bool edge_tx_empty(struct usb_serial_port *port) |
1949 | +{ |
1950 | + struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
1951 | + int ret; |
1952 | + |
1953 | + ret = tx_active(edge_port); |
1954 | + if (ret > 0) |
1955 | + return false; |
1956 | + |
1957 | + return true; |
1958 | +} |
1959 | + |
1960 | static void edge_throttle(struct tty_struct *tty) |
1961 | { |
1962 | struct usb_serial_port *port = tty->driver_data; |
1963 | @@ -2622,6 +2626,7 @@ static struct usb_serial_driver edgeport_1port_device = { |
1964 | .write = edge_write, |
1965 | .write_room = edge_write_room, |
1966 | .chars_in_buffer = edge_chars_in_buffer, |
1967 | + .tx_empty = edge_tx_empty, |
1968 | .break_ctl = edge_break, |
1969 | .read_int_callback = edge_interrupt_callback, |
1970 | .read_bulk_callback = edge_bulk_in_callback, |
1971 | @@ -2653,6 +2658,7 @@ static struct usb_serial_driver edgeport_2port_device = { |
1972 | .write = edge_write, |
1973 | .write_room = edge_write_room, |
1974 | .chars_in_buffer = edge_chars_in_buffer, |
1975 | + .tx_empty = edge_tx_empty, |
1976 | .break_ctl = edge_break, |
1977 | .read_int_callback = edge_interrupt_callback, |
1978 | .read_bulk_callback = edge_bulk_in_callback, |
1979 | diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c |
1980 | index ff77027..5687e26 100644 |
1981 | --- a/drivers/usb/serial/iuu_phoenix.c |
1982 | +++ b/drivers/usb/serial/iuu_phoenix.c |
1983 | @@ -289,7 +289,7 @@ static int bulk_immediate(struct usb_serial_port *port, u8 *buf, u8 count) |
1984 | usb_bulk_msg(serial->dev, |
1985 | usb_sndbulkpipe(serial->dev, |
1986 | port->bulk_out_endpointAddress), buf, |
1987 | - count, &actual, HZ * 1); |
1988 | + count, &actual, 1000); |
1989 | |
1990 | if (status != IUU_OPERATION_OK) |
1991 | dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status); |
1992 | @@ -309,7 +309,7 @@ static int read_immediate(struct usb_serial_port *port, u8 *buf, u8 count) |
1993 | usb_bulk_msg(serial->dev, |
1994 | usb_rcvbulkpipe(serial->dev, |
1995 | port->bulk_in_endpointAddress), buf, |
1996 | - count, &actual, HZ * 1); |
1997 | + count, &actual, 1000); |
1998 | |
1999 | if (status != IUU_OPERATION_OK) |
2000 | dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status); |
2001 | diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c |
2002 | index 1fd1935..34ed26e 100644 |
2003 | --- a/drivers/usb/serial/keyspan.c |
2004 | +++ b/drivers/usb/serial/keyspan.c |
2005 | @@ -1594,7 +1594,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, |
2006 | d_details = s_priv->device_details; |
2007 | device_port = port->number - port->serial->minor; |
2008 | |
2009 | - outcont_urb = d_details->outcont_endpoints[port->number]; |
2010 | + outcont_urb = d_details->outcont_endpoints[device_port]; |
2011 | this_urb = p_priv->outcont_urb; |
2012 | |
2013 | dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe)); |
2014 | diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c |
2015 | index e0ebec3..0923689 100644 |
2016 | --- a/drivers/usb/serial/mos7720.c |
2017 | +++ b/drivers/usb/serial/mos7720.c |
2018 | @@ -40,7 +40,7 @@ |
2019 | #define DRIVER_DESC "Moschip USB Serial Driver" |
2020 | |
2021 | /* default urb timeout */ |
2022 | -#define MOS_WDR_TIMEOUT (HZ * 5) |
2023 | +#define MOS_WDR_TIMEOUT 5000 |
2024 | |
2025 | #define MOS_MAX_PORT 0x02 |
2026 | #define MOS_WRITE 0x0E |
2027 | @@ -228,11 +228,22 @@ static int read_mos_reg(struct usb_serial *serial, unsigned int serial_portnum, |
2028 | __u8 requesttype = (__u8)0xc0; |
2029 | __u16 index = get_reg_index(reg); |
2030 | __u16 value = get_reg_value(reg, serial_portnum); |
2031 | - int status = usb_control_msg(usbdev, pipe, request, requesttype, value, |
2032 | - index, data, 1, MOS_WDR_TIMEOUT); |
2033 | - if (status < 0) |
2034 | + u8 *buf; |
2035 | + int status; |
2036 | + |
2037 | + buf = kmalloc(1, GFP_KERNEL); |
2038 | + if (!buf) |
2039 | + return -ENOMEM; |
2040 | + |
2041 | + status = usb_control_msg(usbdev, pipe, request, requesttype, value, |
2042 | + index, buf, 1, MOS_WDR_TIMEOUT); |
2043 | + if (status == 1) |
2044 | + *data = *buf; |
2045 | + else if (status < 0) |
2046 | dev_err(&usbdev->dev, |
2047 | "mos7720: usb_control_msg() failed: %d", status); |
2048 | + kfree(buf); |
2049 | + |
2050 | return status; |
2051 | } |
2052 | |
2053 | @@ -1633,7 +1644,7 @@ static void change_port_settings(struct tty_struct *tty, |
2054 | mos7720_port->shadowMCR |= (UART_MCR_XONANY); |
2055 | /* To set hardware flow control to the specified * |
2056 | * serial port, in SP1/2_CONTROL_REG */ |
2057 | - if (port->number) |
2058 | + if (port_number) |
2059 | write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x01); |
2060 | else |
2061 | write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x02); |
2062 | @@ -1992,7 +2003,7 @@ static int mos7720_startup(struct usb_serial *serial) |
2063 | |
2064 | /* setting configuration feature to one */ |
2065 | usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
2066 | - (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5*HZ); |
2067 | + (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5000); |
2068 | |
2069 | /* start the interrupt urb */ |
2070 | ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL); |
2071 | @@ -2035,7 +2046,7 @@ static void mos7720_release(struct usb_serial *serial) |
2072 | /* wait for synchronous usb calls to return */ |
2073 | if (mos_parport->msg_pending) |
2074 | wait_for_completion_timeout(&mos_parport->syncmsg_compl, |
2075 | - MOS_WDR_TIMEOUT); |
2076 | + msecs_to_jiffies(MOS_WDR_TIMEOUT)); |
2077 | |
2078 | parport_remove_port(mos_parport->pp); |
2079 | usb_set_serial_data(serial, NULL); |
2080 | diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c |
2081 | index b8051fa..2c14a31 100644 |
2082 | --- a/drivers/usb/serial/mos7840.c |
2083 | +++ b/drivers/usb/serial/mos7840.c |
2084 | @@ -2255,13 +2255,21 @@ static int mos7840_ioctl(struct tty_struct *tty, |
2085 | static int mos7810_check(struct usb_serial *serial) |
2086 | { |
2087 | int i, pass_count = 0; |
2088 | + u8 *buf; |
2089 | __u16 data = 0, mcr_data = 0; |
2090 | __u16 test_pattern = 0x55AA; |
2091 | + int res; |
2092 | + |
2093 | + buf = kmalloc(VENDOR_READ_LENGTH, GFP_KERNEL); |
2094 | + if (!buf) |
2095 | + return 0; /* failed to identify 7810 */ |
2096 | |
2097 | /* Store MCR setting */ |
2098 | - usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
2099 | + res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
2100 | MCS_RDREQ, MCS_RD_RTYPE, 0x0300, MODEM_CONTROL_REGISTER, |
2101 | - &mcr_data, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); |
2102 | + buf, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); |
2103 | + if (res == VENDOR_READ_LENGTH) |
2104 | + mcr_data = *buf; |
2105 | |
2106 | for (i = 0; i < 16; i++) { |
2107 | /* Send the 1-bit test pattern out to MCS7810 test pin */ |
2108 | @@ -2271,9 +2279,12 @@ static int mos7810_check(struct usb_serial *serial) |
2109 | MODEM_CONTROL_REGISTER, NULL, 0, MOS_WDR_TIMEOUT); |
2110 | |
2111 | /* Read the test pattern back */ |
2112 | - usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
2113 | - MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, &data, |
2114 | - VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); |
2115 | + res = usb_control_msg(serial->dev, |
2116 | + usb_rcvctrlpipe(serial->dev, 0), MCS_RDREQ, |
2117 | + MCS_RD_RTYPE, 0, GPIO_REGISTER, buf, |
2118 | + VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); |
2119 | + if (res == VENDOR_READ_LENGTH) |
2120 | + data = *buf; |
2121 | |
2122 | /* If this is a MCS7810 device, both test patterns must match */ |
2123 | if (((test_pattern >> i) ^ (~data >> 1)) & 0x0001) |
2124 | @@ -2287,6 +2298,8 @@ static int mos7810_check(struct usb_serial *serial) |
2125 | MCS_WR_RTYPE, 0x0300 | mcr_data, MODEM_CONTROL_REGISTER, NULL, |
2126 | 0, MOS_WDR_TIMEOUT); |
2127 | |
2128 | + kfree(buf); |
2129 | + |
2130 | if (pass_count == 16) |
2131 | return 1; |
2132 | |
2133 | @@ -2296,11 +2309,17 @@ static int mos7810_check(struct usb_serial *serial) |
2134 | static int mos7840_calc_num_ports(struct usb_serial *serial) |
2135 | { |
2136 | __u16 data = 0x00; |
2137 | + u8 *buf; |
2138 | int mos7840_num_ports; |
2139 | |
2140 | - usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
2141 | - MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, &data, |
2142 | - VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); |
2143 | + buf = kzalloc(VENDOR_READ_LENGTH, GFP_KERNEL); |
2144 | + if (buf) { |
2145 | + usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
2146 | + MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, buf, |
2147 | + VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); |
2148 | + data = *buf; |
2149 | + kfree(buf); |
2150 | + } |
2151 | |
2152 | if (serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7810 || |
2153 | serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7820) { |
2154 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
2155 | index 87181be..9162db2 100644 |
2156 | --- a/drivers/usb/serial/option.c |
2157 | +++ b/drivers/usb/serial/option.c |
2158 | @@ -250,13 +250,7 @@ static void option_instat_callback(struct urb *urb); |
2159 | #define ZTE_PRODUCT_MF622 0x0001 |
2160 | #define ZTE_PRODUCT_MF628 0x0015 |
2161 | #define ZTE_PRODUCT_MF626 0x0031 |
2162 | -#define ZTE_PRODUCT_CDMA_TECH 0xfffe |
2163 | -#define ZTE_PRODUCT_AC8710 0xfff1 |
2164 | -#define ZTE_PRODUCT_AC2726 0xfff5 |
2165 | -#define ZTE_PRODUCT_AC8710T 0xffff |
2166 | #define ZTE_PRODUCT_MC2718 0xffe8 |
2167 | -#define ZTE_PRODUCT_AD3812 0xffeb |
2168 | -#define ZTE_PRODUCT_MC2716 0xffed |
2169 | |
2170 | #define BENQ_VENDOR_ID 0x04a5 |
2171 | #define BENQ_PRODUCT_H10 0x4068 |
2172 | @@ -495,18 +489,10 @@ static const struct option_blacklist_info zte_k3765_z_blacklist = { |
2173 | .reserved = BIT(4), |
2174 | }; |
2175 | |
2176 | -static const struct option_blacklist_info zte_ad3812_z_blacklist = { |
2177 | - .sendsetup = BIT(0) | BIT(1) | BIT(2), |
2178 | -}; |
2179 | - |
2180 | static const struct option_blacklist_info zte_mc2718_z_blacklist = { |
2181 | .sendsetup = BIT(1) | BIT(2) | BIT(3) | BIT(4), |
2182 | }; |
2183 | |
2184 | -static const struct option_blacklist_info zte_mc2716_z_blacklist = { |
2185 | - .sendsetup = BIT(1) | BIT(2) | BIT(3), |
2186 | -}; |
2187 | - |
2188 | static const struct option_blacklist_info huawei_cdc12_blacklist = { |
2189 | .reserved = BIT(1) | BIT(2), |
2190 | }; |
2191 | @@ -593,6 +579,8 @@ static const struct usb_device_id option_ids[] = { |
2192 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, |
2193 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff), |
2194 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, |
2195 | + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x14ac, 0xff, 0xff, 0xff), /* Huawei E1820 */ |
2196 | + .driver_info = (kernel_ulong_t) &net_intf1_blacklist }, |
2197 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff), |
2198 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, |
2199 | { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0xff, 0xff) }, |
2200 | @@ -797,7 +785,6 @@ static const struct usb_device_id option_ids[] = { |
2201 | { USB_DEVICE_INTERFACE_CLASS(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_1012, 0xff) }, |
2202 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, |
2203 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, |
2204 | - { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ |
2205 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ |
2206 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ |
2207 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */ |
2208 | @@ -1199,16 +1186,9 @@ static const struct usb_device_id option_ids[] = { |
2209 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff), |
2210 | .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, |
2211 | |
2212 | - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) }, |
2213 | - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) }, |
2214 | - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) }, |
2215 | - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710T, 0xff, 0xff, 0xff) }, |
2216 | + /* NOTE: most ZTE CDMA devices should be driven by zte_ev, not option */ |
2217 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff), |
2218 | .driver_info = (kernel_ulong_t)&zte_mc2718_z_blacklist }, |
2219 | - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AD3812, 0xff, 0xff, 0xff), |
2220 | - .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist }, |
2221 | - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff), |
2222 | - .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist }, |
2223 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) }, |
2224 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) }, |
2225 | { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) }, |
2226 | diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c |
2227 | index 59b32b7..bd794b4 100644 |
2228 | --- a/drivers/usb/serial/qcserial.c |
2229 | +++ b/drivers/usb/serial/qcserial.c |
2230 | @@ -118,6 +118,7 @@ static const struct usb_device_id id_table[] = { |
2231 | {USB_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */ |
2232 | {USB_DEVICE(0x12D1, 0x14F0)}, /* Sony Gobi 3000 QDL */ |
2233 | {USB_DEVICE(0x12D1, 0x14F1)}, /* Sony Gobi 3000 Composite */ |
2234 | + {USB_DEVICE(0x0AF0, 0x8120)}, /* Option GTM681W */ |
2235 | |
2236 | /* non Gobi Qualcomm serial devices */ |
2237 | {USB_DEVICE_INTERFACE_NUMBER(0x0f3d, 0x68a2, 0)}, /* Sierra Wireless MC7700 Device Management */ |
2238 | diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c |
2239 | index 5d9b178..42de53c 100644 |
2240 | --- a/drivers/usb/serial/usb-serial.c |
2241 | +++ b/drivers/usb/serial/usb-serial.c |
2242 | @@ -379,6 +379,22 @@ static int serial_chars_in_buffer(struct tty_struct *tty) |
2243 | return count; |
2244 | } |
2245 | |
2246 | +static void serial_wait_until_sent(struct tty_struct *tty, int timeout) |
2247 | +{ |
2248 | + struct usb_serial_port *port = tty->driver_data; |
2249 | + struct usb_serial *serial = port->serial; |
2250 | + |
2251 | + dev_dbg(tty->dev, "%s\n", __func__); |
2252 | + |
2253 | + if (!port->serial->type->wait_until_sent) |
2254 | + return; |
2255 | + |
2256 | + mutex_lock(&serial->disc_mutex); |
2257 | + if (!serial->disconnected) |
2258 | + port->serial->type->wait_until_sent(tty, timeout); |
2259 | + mutex_unlock(&serial->disc_mutex); |
2260 | +} |
2261 | + |
2262 | static void serial_throttle(struct tty_struct *tty) |
2263 | { |
2264 | struct usb_serial_port *port = tty->driver_data; |
2265 | @@ -1204,6 +1220,7 @@ static const struct tty_operations serial_ops = { |
2266 | .unthrottle = serial_unthrottle, |
2267 | .break_ctl = serial_break, |
2268 | .chars_in_buffer = serial_chars_in_buffer, |
2269 | + .wait_until_sent = serial_wait_until_sent, |
2270 | .tiocmget = serial_tiocmget, |
2271 | .tiocmset = serial_tiocmset, |
2272 | .get_icount = serial_get_icount, |
2273 | @@ -1329,6 +1346,8 @@ static void fixup_generic(struct usb_serial_driver *device) |
2274 | set_to_generic_if_null(device, close); |
2275 | set_to_generic_if_null(device, write_room); |
2276 | set_to_generic_if_null(device, chars_in_buffer); |
2277 | + if (device->tx_empty) |
2278 | + set_to_generic_if_null(device, wait_until_sent); |
2279 | set_to_generic_if_null(device, read_bulk_callback); |
2280 | set_to_generic_if_null(device, write_bulk_callback); |
2281 | set_to_generic_if_null(device, disconnect); |
2282 | diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c |
2283 | index 1129aa7..c24ee17 100644 |
2284 | --- a/drivers/usb/serial/visor.c |
2285 | +++ b/drivers/usb/serial/visor.c |
2286 | @@ -566,10 +566,19 @@ static int treo_attach(struct usb_serial *serial) |
2287 | */ |
2288 | #define COPY_PORT(dest, src) \ |
2289 | do { \ |
2290 | + int i; \ |
2291 | + \ |
2292 | + for (i = 0; i < ARRAY_SIZE(src->read_urbs); ++i) { \ |
2293 | + dest->read_urbs[i] = src->read_urbs[i]; \ |
2294 | + dest->read_urbs[i]->context = dest; \ |
2295 | + dest->bulk_in_buffers[i] = src->bulk_in_buffers[i]; \ |
2296 | + } \ |
2297 | dest->read_urb = src->read_urb; \ |
2298 | dest->bulk_in_endpointAddress = src->bulk_in_endpointAddress;\ |
2299 | dest->bulk_in_buffer = src->bulk_in_buffer; \ |
2300 | + dest->bulk_in_size = src->bulk_in_size; \ |
2301 | dest->interrupt_in_urb = src->interrupt_in_urb; \ |
2302 | + dest->interrupt_in_urb->context = dest; \ |
2303 | dest->interrupt_in_endpointAddress = \ |
2304 | src->interrupt_in_endpointAddress;\ |
2305 | dest->interrupt_in_buffer = src->interrupt_in_buffer; \ |
2306 | diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c |
2307 | index b9fca35..347caad 100644 |
2308 | --- a/drivers/usb/serial/whiteheat.c |
2309 | +++ b/drivers/usb/serial/whiteheat.c |
2310 | @@ -649,7 +649,7 @@ static void firm_setup_port(struct tty_struct *tty) |
2311 | struct whiteheat_port_settings port_settings; |
2312 | unsigned int cflag = tty->termios.c_cflag; |
2313 | |
2314 | - port_settings.port = port->number + 1; |
2315 | + port_settings.port = port->number - port->serial->minor + 1; |
2316 | |
2317 | /* get the byte size */ |
2318 | switch (cflag & CSIZE) { |
2319 | diff --git a/drivers/usb/serial/zte_ev.c b/drivers/usb/serial/zte_ev.c |
2320 | index 39ee737..fca4c75 100644 |
2321 | --- a/drivers/usb/serial/zte_ev.c |
2322 | +++ b/drivers/usb/serial/zte_ev.c |
2323 | @@ -41,9 +41,6 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, |
2324 | int len; |
2325 | unsigned char *buf; |
2326 | |
2327 | - if (port->number != 0) |
2328 | - return -ENODEV; |
2329 | - |
2330 | buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL); |
2331 | if (!buf) |
2332 | return -ENOMEM; |
2333 | @@ -53,7 +50,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, |
2334 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
2335 | 0x22, 0x21, |
2336 | 0x0001, 0x0000, NULL, len, |
2337 | - HZ * USB_CTRL_GET_TIMEOUT); |
2338 | + USB_CTRL_GET_TIMEOUT); |
2339 | dev_dbg(dev, "result = %d\n", result); |
2340 | |
2341 | /* send 2st cmd and recieve data */ |
2342 | @@ -65,7 +62,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, |
2343 | result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
2344 | 0x21, 0xa1, |
2345 | 0x0000, 0x0000, buf, len, |
2346 | - HZ * USB_CTRL_GET_TIMEOUT); |
2347 | + USB_CTRL_GET_TIMEOUT); |
2348 | debug_data(dev, __func__, len, buf, result); |
2349 | |
2350 | /* send 3 cmd */ |
2351 | @@ -84,7 +81,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, |
2352 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
2353 | 0x20, 0x21, |
2354 | 0x0000, 0x0000, buf, len, |
2355 | - HZ * USB_CTRL_GET_TIMEOUT); |
2356 | + USB_CTRL_GET_TIMEOUT); |
2357 | debug_data(dev, __func__, len, buf, result); |
2358 | |
2359 | /* send 4 cmd */ |
2360 | @@ -95,7 +92,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, |
2361 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
2362 | 0x22, 0x21, |
2363 | 0x0003, 0x0000, NULL, len, |
2364 | - HZ * USB_CTRL_GET_TIMEOUT); |
2365 | + USB_CTRL_GET_TIMEOUT); |
2366 | dev_dbg(dev, "result = %d\n", result); |
2367 | |
2368 | /* send 5 cmd */ |
2369 | @@ -107,7 +104,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, |
2370 | result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
2371 | 0x21, 0xa1, |
2372 | 0x0000, 0x0000, buf, len, |
2373 | - HZ * USB_CTRL_GET_TIMEOUT); |
2374 | + USB_CTRL_GET_TIMEOUT); |
2375 | debug_data(dev, __func__, len, buf, result); |
2376 | |
2377 | /* send 6 cmd */ |
2378 | @@ -126,7 +123,7 @@ static int zte_ev_usb_serial_open(struct tty_struct *tty, |
2379 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
2380 | 0x20, 0x21, |
2381 | 0x0000, 0x0000, buf, len, |
2382 | - HZ * USB_CTRL_GET_TIMEOUT); |
2383 | + USB_CTRL_GET_TIMEOUT); |
2384 | debug_data(dev, __func__, len, buf, result); |
2385 | kfree(buf); |
2386 | |
2387 | @@ -166,9 +163,6 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) |
2388 | int len; |
2389 | unsigned char *buf; |
2390 | |
2391 | - if (port->number != 0) |
2392 | - return; |
2393 | - |
2394 | buf = kmalloc(MAX_SETUP_DATA_SIZE, GFP_KERNEL); |
2395 | if (!buf) |
2396 | return; |
2397 | @@ -178,7 +172,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) |
2398 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
2399 | 0x22, 0x21, |
2400 | 0x0002, 0x0000, NULL, len, |
2401 | - HZ * USB_CTRL_GET_TIMEOUT); |
2402 | + USB_CTRL_GET_TIMEOUT); |
2403 | dev_dbg(dev, "result = %d\n", result); |
2404 | |
2405 | /* send 2st ctl cmd(CTL 21 22 03 00 00 00 00 00 ) */ |
2406 | @@ -186,7 +180,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) |
2407 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
2408 | 0x22, 0x21, |
2409 | 0x0003, 0x0000, NULL, len, |
2410 | - HZ * USB_CTRL_GET_TIMEOUT); |
2411 | + USB_CTRL_GET_TIMEOUT); |
2412 | dev_dbg(dev, "result = %d\n", result); |
2413 | |
2414 | /* send 3st cmd and recieve data */ |
2415 | @@ -198,7 +192,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) |
2416 | result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
2417 | 0x21, 0xa1, |
2418 | 0x0000, 0x0000, buf, len, |
2419 | - HZ * USB_CTRL_GET_TIMEOUT); |
2420 | + USB_CTRL_GET_TIMEOUT); |
2421 | debug_data(dev, __func__, len, buf, result); |
2422 | |
2423 | /* send 4 cmd */ |
2424 | @@ -217,7 +211,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) |
2425 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
2426 | 0x20, 0x21, |
2427 | 0x0000, 0x0000, buf, len, |
2428 | - HZ * USB_CTRL_GET_TIMEOUT); |
2429 | + USB_CTRL_GET_TIMEOUT); |
2430 | debug_data(dev, __func__, len, buf, result); |
2431 | |
2432 | /* send 5 cmd */ |
2433 | @@ -228,7 +222,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) |
2434 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
2435 | 0x22, 0x21, |
2436 | 0x0003, 0x0000, NULL, len, |
2437 | - HZ * USB_CTRL_GET_TIMEOUT); |
2438 | + USB_CTRL_GET_TIMEOUT); |
2439 | dev_dbg(dev, "result = %d\n", result); |
2440 | |
2441 | /* send 6 cmd */ |
2442 | @@ -240,7 +234,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) |
2443 | result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
2444 | 0x21, 0xa1, |
2445 | 0x0000, 0x0000, buf, len, |
2446 | - HZ * USB_CTRL_GET_TIMEOUT); |
2447 | + USB_CTRL_GET_TIMEOUT); |
2448 | debug_data(dev, __func__, len, buf, result); |
2449 | |
2450 | /* send 7 cmd */ |
2451 | @@ -259,7 +253,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) |
2452 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
2453 | 0x20, 0x21, |
2454 | 0x0000, 0x0000, buf, len, |
2455 | - HZ * USB_CTRL_GET_TIMEOUT); |
2456 | + USB_CTRL_GET_TIMEOUT); |
2457 | debug_data(dev, __func__, len, buf, result); |
2458 | |
2459 | /* send 8 cmd */ |
2460 | @@ -270,7 +264,7 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) |
2461 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
2462 | 0x22, 0x21, |
2463 | 0x0003, 0x0000, NULL, len, |
2464 | - HZ * USB_CTRL_GET_TIMEOUT); |
2465 | + USB_CTRL_GET_TIMEOUT); |
2466 | dev_dbg(dev, "result = %d\n", result); |
2467 | |
2468 | kfree(buf); |
2469 | @@ -279,11 +273,29 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) |
2470 | } |
2471 | |
2472 | static const struct usb_device_id id_table[] = { |
2473 | - { USB_DEVICE(0x19d2, 0xffff) }, /* AC8700 */ |
2474 | - { USB_DEVICE(0x19d2, 0xfffe) }, |
2475 | - { USB_DEVICE(0x19d2, 0xfffd) }, /* MG880 */ |
2476 | + /* AC8710, AC8710T */ |
2477 | + { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffff, 0xff, 0xff, 0xff) }, |
2478 | + /* AC8700 */ |
2479 | + { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfffe, 0xff, 0xff, 0xff) }, |
2480 | + /* MG880 */ |
2481 | + { USB_DEVICE(0x19d2, 0xfffd) }, |
2482 | + { USB_DEVICE(0x19d2, 0xfffc) }, |
2483 | + { USB_DEVICE(0x19d2, 0xfffb) }, |
2484 | + /* AC2726, AC8710_V3 */ |
2485 | + { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xfff1, 0xff, 0xff, 0xff) }, |
2486 | + { USB_DEVICE(0x19d2, 0xfff6) }, |
2487 | + { USB_DEVICE(0x19d2, 0xfff7) }, |
2488 | + { USB_DEVICE(0x19d2, 0xfff8) }, |
2489 | + { USB_DEVICE(0x19d2, 0xfff9) }, |
2490 | + { USB_DEVICE(0x19d2, 0xffee) }, |
2491 | + /* AC2716, MC2716 */ |
2492 | + { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffed, 0xff, 0xff, 0xff) }, |
2493 | + /* AD3812 */ |
2494 | + { USB_DEVICE_AND_INTERFACE_INFO(0x19d2, 0xffeb, 0xff, 0xff, 0xff) }, |
2495 | + { USB_DEVICE(0x19d2, 0xffec) }, |
2496 | { USB_DEVICE(0x05C6, 0x3197) }, |
2497 | { USB_DEVICE(0x05C6, 0x6000) }, |
2498 | + { USB_DEVICE(0x05C6, 0x9008) }, |
2499 | { }, |
2500 | }; |
2501 | MODULE_DEVICE_TABLE(usb, id_table); |
2502 | diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c |
2503 | index 21b3a29..6c4b480 100644 |
2504 | --- a/fs/cifs/connect.c |
2505 | +++ b/fs/cifs/connect.c |
2506 | @@ -3332,8 +3332,8 @@ build_unc_path_to_root(const struct smb_vol *vol, |
2507 | pos = full_path + unc_len; |
2508 | |
2509 | if (pplen) { |
2510 | - *pos++ = CIFS_DIR_SEP(cifs_sb); |
2511 | - strncpy(pos, vol->prepath, pplen); |
2512 | + *pos = CIFS_DIR_SEP(cifs_sb); |
2513 | + strncpy(pos + 1, vol->prepath, pplen); |
2514 | pos += pplen; |
2515 | } |
2516 | |
2517 | diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c |
2518 | index 63b1f54..3d7fb59 100644 |
2519 | --- a/fs/ecryptfs/file.c |
2520 | +++ b/fs/ecryptfs/file.c |
2521 | @@ -294,6 +294,12 @@ static int ecryptfs_release(struct inode *inode, struct file *file) |
2522 | static int |
2523 | ecryptfs_fsync(struct file *file, loff_t start, loff_t end, int datasync) |
2524 | { |
2525 | + int rc; |
2526 | + |
2527 | + rc = filemap_write_and_wait(file->f_mapping); |
2528 | + if (rc) |
2529 | + return rc; |
2530 | + |
2531 | return vfs_fsync(ecryptfs_file_to_lower(file), datasync); |
2532 | } |
2533 | |
2534 | diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c |
2535 | index 9f9dbec..5d325c5 100644 |
2536 | --- a/fs/hpfs/file.c |
2537 | +++ b/fs/hpfs/file.c |
2538 | @@ -109,10 +109,14 @@ static void hpfs_write_failed(struct address_space *mapping, loff_t to) |
2539 | { |
2540 | struct inode *inode = mapping->host; |
2541 | |
2542 | + hpfs_lock(inode->i_sb); |
2543 | + |
2544 | if (to > inode->i_size) { |
2545 | truncate_pagecache(inode, to, inode->i_size); |
2546 | hpfs_truncate(inode); |
2547 | } |
2548 | + |
2549 | + hpfs_unlock(inode->i_sb); |
2550 | } |
2551 | |
2552 | static int hpfs_write_begin(struct file *file, struct address_space *mapping, |
2553 | diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h |
2554 | index 1819b59..73afb19 100644 |
2555 | --- a/include/linux/usb/serial.h |
2556 | +++ b/include/linux/usb/serial.h |
2557 | @@ -267,6 +267,8 @@ struct usb_serial_driver { |
2558 | struct usb_serial_port *port, struct ktermios *old); |
2559 | void (*break_ctl)(struct tty_struct *tty, int break_state); |
2560 | int (*chars_in_buffer)(struct tty_struct *tty); |
2561 | + void (*wait_until_sent)(struct tty_struct *tty, long timeout); |
2562 | + bool (*tx_empty)(struct usb_serial_port *port); |
2563 | void (*throttle)(struct tty_struct *tty); |
2564 | void (*unthrottle)(struct tty_struct *tty); |
2565 | int (*tiocmget)(struct tty_struct *tty); |
2566 | @@ -325,6 +327,8 @@ extern void usb_serial_generic_close(struct usb_serial_port *port); |
2567 | extern int usb_serial_generic_resume(struct usb_serial *serial); |
2568 | extern int usb_serial_generic_write_room(struct tty_struct *tty); |
2569 | extern int usb_serial_generic_chars_in_buffer(struct tty_struct *tty); |
2570 | +extern void usb_serial_generic_wait_until_sent(struct tty_struct *tty, |
2571 | + long timeout); |
2572 | extern void usb_serial_generic_read_bulk_callback(struct urb *urb); |
2573 | extern void usb_serial_generic_write_bulk_callback(struct urb *urb); |
2574 | extern void usb_serial_generic_throttle(struct tty_struct *tty); |
2575 | diff --git a/kernel/softirq.c b/kernel/softirq.c |
2576 | index 14d7758..d93dcb1 100644 |
2577 | --- a/kernel/softirq.c |
2578 | +++ b/kernel/softirq.c |
2579 | @@ -195,8 +195,12 @@ void local_bh_enable_ip(unsigned long ip) |
2580 | EXPORT_SYMBOL(local_bh_enable_ip); |
2581 | |
2582 | /* |
2583 | - * We restart softirq processing for at most 2 ms, |
2584 | - * and if need_resched() is not set. |
2585 | + * We restart softirq processing for at most MAX_SOFTIRQ_RESTART times, |
2586 | + * but break the loop if need_resched() is set or after 2 ms. |
2587 | + * The MAX_SOFTIRQ_TIME provides a nice upper bound in most cases, but in |
2588 | + * certain cases, such as stop_machine(), jiffies may cease to |
2589 | + * increment and so we need the MAX_SOFTIRQ_RESTART limit as |
2590 | + * well to make sure we eventually return from this method. |
2591 | * |
2592 | * These limits have been established via experimentation. |
2593 | * The two things to balance is latency against fairness - |
2594 | @@ -204,6 +208,7 @@ EXPORT_SYMBOL(local_bh_enable_ip); |
2595 | * should not be able to lock up the box. |
2596 | */ |
2597 | #define MAX_SOFTIRQ_TIME msecs_to_jiffies(2) |
2598 | +#define MAX_SOFTIRQ_RESTART 10 |
2599 | |
2600 | asmlinkage void __do_softirq(void) |
2601 | { |
2602 | @@ -212,6 +217,7 @@ asmlinkage void __do_softirq(void) |
2603 | unsigned long end = jiffies + MAX_SOFTIRQ_TIME; |
2604 | int cpu; |
2605 | unsigned long old_flags = current->flags; |
2606 | + int max_restart = MAX_SOFTIRQ_RESTART; |
2607 | |
2608 | /* |
2609 | * Mask out PF_MEMALLOC s current task context is borrowed for the |
2610 | @@ -265,7 +271,8 @@ restart: |
2611 | |
2612 | pending = local_softirq_pending(); |
2613 | if (pending) { |
2614 | - if (time_before(jiffies, end) && !need_resched()) |
2615 | + if (time_before(jiffies, end) && !need_resched() && |
2616 | + --max_restart) |
2617 | goto restart; |
2618 | |
2619 | wakeup_softirqd(); |
2620 | diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c |
2621 | index 9a0bc98..183df62 100644 |
2622 | --- a/kernel/time/timekeeping.c |
2623 | +++ b/kernel/time/timekeeping.c |
2624 | @@ -826,6 +826,14 @@ static int timekeeping_suspend(void) |
2625 | |
2626 | read_persistent_clock(&timekeeping_suspend_time); |
2627 | |
2628 | + /* |
2629 | + * On some systems the persistent_clock can not be detected at |
2630 | + * timekeeping_init by its return value, so if we see a valid |
2631 | + * value returned, update the persistent_clock_exists flag. |
2632 | + */ |
2633 | + if (timekeeping_suspend_time.tv_sec || timekeeping_suspend_time.tv_nsec) |
2634 | + persistent_clock_exist = true; |
2635 | + |
2636 | write_seqlock_irqsave(&tk->lock, flags); |
2637 | timekeeping_forward_now(tk); |
2638 | timekeeping_suspended = 1; |
2639 | diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c |
2640 | index d74500b..222b6de 100644 |
2641 | --- a/sound/pci/hda/hda_generic.c |
2642 | +++ b/sound/pci/hda/hda_generic.c |
2643 | @@ -772,6 +772,8 @@ static void set_pin_eapd(struct hda_codec *codec, hda_nid_t pin, bool enable) |
2644 | return; |
2645 | if (codec->inv_eapd) |
2646 | enable = !enable; |
2647 | + if (spec->keep_eapd_on && !enable) |
2648 | + return; |
2649 | snd_hda_codec_update_cache(codec, pin, 0, |
2650 | AC_VERB_SET_EAPD_BTLENABLE, |
2651 | enable ? 0x02 : 0x00); |
2652 | @@ -3671,6 +3673,36 @@ static void update_automute_all(struct hda_codec *codec) |
2653 | snd_hda_gen_mic_autoswitch(codec, NULL); |
2654 | } |
2655 | |
2656 | +/* call appropriate hooks */ |
2657 | +static void call_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack) |
2658 | +{ |
2659 | + struct hda_gen_spec *spec = codec->spec; |
2660 | + if (spec->hp_automute_hook) |
2661 | + spec->hp_automute_hook(codec, jack); |
2662 | + else |
2663 | + snd_hda_gen_hp_automute(codec, jack); |
2664 | +} |
2665 | + |
2666 | +static void call_line_automute(struct hda_codec *codec, |
2667 | + struct hda_jack_tbl *jack) |
2668 | +{ |
2669 | + struct hda_gen_spec *spec = codec->spec; |
2670 | + if (spec->line_automute_hook) |
2671 | + spec->line_automute_hook(codec, jack); |
2672 | + else |
2673 | + snd_hda_gen_line_automute(codec, jack); |
2674 | +} |
2675 | + |
2676 | +static void call_mic_autoswitch(struct hda_codec *codec, |
2677 | + struct hda_jack_tbl *jack) |
2678 | +{ |
2679 | + struct hda_gen_spec *spec = codec->spec; |
2680 | + if (spec->mic_autoswitch_hook) |
2681 | + spec->mic_autoswitch_hook(codec, jack); |
2682 | + else |
2683 | + snd_hda_gen_mic_autoswitch(codec, jack); |
2684 | +} |
2685 | + |
2686 | /* |
2687 | * Auto-Mute mode mixer enum support |
2688 | */ |
2689 | @@ -3805,9 +3837,7 @@ static int check_auto_mute_availability(struct hda_codec *codec) |
2690 | snd_printdd("hda-codec: Enable HP auto-muting on NID 0x%x\n", |
2691 | nid); |
2692 | snd_hda_jack_detect_enable_callback(codec, nid, HDA_GEN_HP_EVENT, |
2693 | - spec->hp_automute_hook ? |
2694 | - spec->hp_automute_hook : |
2695 | - snd_hda_gen_hp_automute); |
2696 | + call_hp_automute); |
2697 | spec->detect_hp = 1; |
2698 | } |
2699 | |
2700 | @@ -3820,9 +3850,7 @@ static int check_auto_mute_availability(struct hda_codec *codec) |
2701 | snd_printdd("hda-codec: Enable Line-Out auto-muting on NID 0x%x\n", nid); |
2702 | snd_hda_jack_detect_enable_callback(codec, nid, |
2703 | HDA_GEN_FRONT_EVENT, |
2704 | - spec->line_automute_hook ? |
2705 | - spec->line_automute_hook : |
2706 | - snd_hda_gen_line_automute); |
2707 | + call_line_automute); |
2708 | spec->detect_lo = 1; |
2709 | } |
2710 | spec->automute_lo_possible = spec->detect_hp; |
2711 | @@ -3864,9 +3892,7 @@ static bool auto_mic_check_imux(struct hda_codec *codec) |
2712 | snd_hda_jack_detect_enable_callback(codec, |
2713 | spec->am_entry[i].pin, |
2714 | HDA_GEN_MIC_EVENT, |
2715 | - spec->mic_autoswitch_hook ? |
2716 | - spec->mic_autoswitch_hook : |
2717 | - snd_hda_gen_mic_autoswitch); |
2718 | + call_mic_autoswitch); |
2719 | return true; |
2720 | } |
2721 | |
2722 | diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h |
2723 | index 009b57b..aee3238 100644 |
2724 | --- a/sound/pci/hda/hda_generic.h |
2725 | +++ b/sound/pci/hda/hda_generic.h |
2726 | @@ -205,6 +205,7 @@ struct hda_gen_spec { |
2727 | unsigned int multi_cap_vol:1; /* allow multiple capture xxx volumes */ |
2728 | unsigned int inv_dmic_split:1; /* inverted dmic w/a for conexant */ |
2729 | unsigned int own_eapd_ctl:1; /* set EAPD by own function */ |
2730 | + unsigned int keep_eapd_on:1; /* don't turn off EAPD automatically */ |
2731 | unsigned int vmaster_mute_enum:1; /* add vmaster mute mode enum */ |
2732 | unsigned int indep_hp:1; /* independent HP supported */ |
2733 | unsigned int prefer_hp_amp:1; /* enable HP amp for speaker if any */ |
2734 | diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c |
2735 | index c35338a..9a9a032 100644 |
2736 | --- a/sound/pci/hda/patch_via.c |
2737 | +++ b/sound/pci/hda/patch_via.c |
2738 | @@ -136,6 +136,7 @@ static struct via_spec *via_new_spec(struct hda_codec *codec) |
2739 | spec->codec_type = VT1708S; |
2740 | spec->no_pin_power_ctl = 1; |
2741 | spec->gen.indep_hp = 1; |
2742 | + spec->gen.keep_eapd_on = 1; |
2743 | spec->gen.pcm_playback_hook = via_playback_pcm_hook; |
2744 | return spec; |
2745 | } |
2746 | @@ -231,9 +232,14 @@ static void vt1708_update_hp_work(struct hda_codec *codec) |
2747 | |
2748 | static void set_widgets_power_state(struct hda_codec *codec) |
2749 | { |
2750 | +#if 0 /* FIXME: the assumed connections don't match always with the |
2751 | + * actual routes by the generic parser, so better to disable |
2752 | + * the control for safety. |
2753 | + */ |
2754 | struct via_spec *spec = codec->spec; |
2755 | if (spec->set_widgets_power_state) |
2756 | spec->set_widgets_power_state(codec); |
2757 | +#endif |
2758 | } |
2759 | |
2760 | static void update_power_state(struct hda_codec *codec, hda_nid_t nid, |
2761 | @@ -478,7 +484,9 @@ static int via_suspend(struct hda_codec *codec) |
2762 | /* Fix pop noise on headphones */ |
2763 | int i; |
2764 | for (i = 0; i < spec->gen.autocfg.hp_outs; i++) |
2765 | - snd_hda_set_pin_ctl(codec, spec->gen.autocfg.hp_pins[i], 0); |
2766 | + snd_hda_codec_write(codec, spec->gen.autocfg.hp_pins[i], |
2767 | + 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
2768 | + 0x00); |
2769 | } |
2770 | |
2771 | return 0; |
2772 | diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c |
2773 | index ca4739c..e5c7f9f 100644 |
2774 | --- a/sound/usb/mixer.c |
2775 | +++ b/sound/usb/mixer.c |
2776 | @@ -886,6 +886,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, |
2777 | case USB_ID(0x046d, 0x0808): |
2778 | case USB_ID(0x046d, 0x0809): |
2779 | case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */ |
2780 | + case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */ |
2781 | case USB_ID(0x046d, 0x0991): |
2782 | /* Most audio usb devices lie about volume resolution. |
2783 | * Most Logitech webcams have res = 384. |
2784 | diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h |
2785 | index c39f898..1c719d8 100644 |
2786 | --- a/sound/usb/quirks-table.h |
2787 | +++ b/sound/usb/quirks-table.h |
2788 | @@ -215,7 +215,13 @@ |
2789 | .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL |
2790 | }, |
2791 | { |
2792 | - USB_DEVICE(0x046d, 0x0990), |
2793 | + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | |
2794 | + USB_DEVICE_ID_MATCH_INT_CLASS | |
2795 | + USB_DEVICE_ID_MATCH_INT_SUBCLASS, |
2796 | + .idVendor = 0x046d, |
2797 | + .idProduct = 0x0990, |
2798 | + .bInterfaceClass = USB_CLASS_AUDIO, |
2799 | + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, |
2800 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |
2801 | .vendor_name = "Logitech, Inc.", |
2802 | .product_name = "QuickCam Pro 9000", |
2803 | @@ -1714,7 +1720,11 @@ YAMAHA_DEVICE(0x7010, "UB99"), |
2804 | USB_DEVICE_VENDOR_SPEC(0x0582, 0x0108), |
2805 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |
2806 | .ifnum = 0, |
2807 | - .type = QUIRK_MIDI_STANDARD_INTERFACE |
2808 | + .type = QUIRK_MIDI_FIXED_ENDPOINT, |
2809 | + .data = & (const struct snd_usb_midi_endpoint_info) { |
2810 | + .out_cables = 0x0007, |
2811 | + .in_cables = 0x0007 |
2812 | + } |
2813 | } |
2814 | }, |
2815 | { |