Magellan Linux

Contents of /trunk/kernel-magellan/patches-3.4/0102-3.4.3-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1810 - (show annotations) (download)
Fri Jun 22 09:07:44 2012 UTC (11 years, 10 months ago) by niro
File size: 56335 byte(s)
-added linux-3.4.3 inc patch
1 diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c
2 index 0b6d796..2e3200c 100644
3 --- a/arch/powerpc/kernel/module_32.c
4 +++ b/arch/powerpc/kernel/module_32.c
5 @@ -176,8 +176,8 @@ int module_frob_arch_sections(Elf32_Ehdr *hdr,
6
7 static inline int entry_matches(struct ppc_plt_entry *entry, Elf32_Addr val)
8 {
9 - if (entry->jump[0] == 0x3d600000 + ((val + 0x8000) >> 16)
10 - && entry->jump[1] == 0x396b0000 + (val & 0xffff))
11 + if (entry->jump[0] == 0x3d800000 + ((val + 0x8000) >> 16)
12 + && entry->jump[1] == 0x398c0000 + (val & 0xffff))
13 return 1;
14 return 0;
15 }
16 @@ -204,10 +204,9 @@ static uint32_t do_plt_call(void *location,
17 entry++;
18 }
19
20 - /* Stolen from Paul Mackerras as well... */
21 - entry->jump[0] = 0x3d600000+((val+0x8000)>>16); /* lis r11,sym@ha */
22 - entry->jump[1] = 0x396b0000 + (val&0xffff); /* addi r11,r11,sym@l*/
23 - entry->jump[2] = 0x7d6903a6; /* mtctr r11 */
24 + entry->jump[0] = 0x3d800000+((val+0x8000)>>16); /* lis r12,sym@ha */
25 + entry->jump[1] = 0x398c0000 + (val&0xffff); /* addi r12,r12,sym@l*/
26 + entry->jump[2] = 0x7d8903a6; /* mtctr r12 */
27 entry->jump[3] = 0x4e800420; /* bctr */
28
29 DEBUGP("Initialized plt for 0x%x at %p\n", val, entry);
30 diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
31 index 2c42cd7..730e69c 100644
32 --- a/arch/powerpc/kernel/time.c
33 +++ b/arch/powerpc/kernel/time.c
34 @@ -474,6 +474,7 @@ void timer_interrupt(struct pt_regs * regs)
35 struct pt_regs *old_regs;
36 u64 *next_tb = &__get_cpu_var(decrementers_next_tb);
37 struct clock_event_device *evt = &__get_cpu_var(decrementers);
38 + u64 now;
39
40 /* Ensure a positive value is written to the decrementer, or else
41 * some CPUs will continue to take decrementer exceptions.
42 @@ -508,9 +509,16 @@ void timer_interrupt(struct pt_regs * regs)
43 irq_work_run();
44 }
45
46 - *next_tb = ~(u64)0;
47 - if (evt->event_handler)
48 - evt->event_handler(evt);
49 + now = get_tb_or_rtc();
50 + if (now >= *next_tb) {
51 + *next_tb = ~(u64)0;
52 + if (evt->event_handler)
53 + evt->event_handler(evt);
54 + } else {
55 + now = *next_tb - now;
56 + if (now <= DECREMENTER_MAX)
57 + set_dec((int)now);
58 + }
59
60 #ifdef CONFIG_PPC64
61 /* collect purr register values often, for accurate calculations */
62 diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S
63 index be6d9e3..3470624 100644
64 --- a/arch/x86/crypto/aesni-intel_asm.S
65 +++ b/arch/x86/crypto/aesni-intel_asm.S
66 @@ -2460,10 +2460,12 @@ ENTRY(aesni_cbc_dec)
67 pxor IN3, STATE4
68 movaps IN4, IV
69 #else
70 - pxor (INP), STATE2
71 - pxor 0x10(INP), STATE3
72 pxor IN1, STATE4
73 movaps IN2, IV
74 + movups (INP), IN1
75 + pxor IN1, STATE2
76 + movups 0x10(INP), IN2
77 + pxor IN2, STATE3
78 #endif
79 movups STATE1, (OUTP)
80 movups STATE2, 0x10(OUTP)
81 diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h
82 index becf47b..6149b47 100644
83 --- a/arch/x86/include/asm/uv/uv_bau.h
84 +++ b/arch/x86/include/asm/uv/uv_bau.h
85 @@ -149,7 +149,6 @@
86 /* 4 bits of software ack period */
87 #define UV2_ACK_MASK 0x7UL
88 #define UV2_ACK_UNITS_SHFT 3
89 -#define UV2_LEG_SHFT UV2H_LB_BAU_MISC_CONTROL_USE_LEGACY_DESCRIPTOR_FORMATS_SHFT
90 #define UV2_EXT_SHFT UV2H_LB_BAU_MISC_CONTROL_ENABLE_EXTENDED_SB_STATUS_SHFT
91
92 /*
93 diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
94 index 99b5717..2c1d178 100644
95 --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
96 +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
97 @@ -51,6 +51,7 @@ struct threshold_block {
98 unsigned int cpu;
99 u32 address;
100 u16 interrupt_enable;
101 + bool interrupt_capable;
102 u16 threshold_limit;
103 struct kobject kobj;
104 struct list_head miscj;
105 @@ -83,6 +84,21 @@ struct thresh_restart {
106 u16 old_limit;
107 };
108
109 +static bool lvt_interrupt_supported(unsigned int bank, u32 msr_high_bits)
110 +{
111 + /*
112 + * bank 4 supports APIC LVT interrupts implicitly since forever.
113 + */
114 + if (bank == 4)
115 + return true;
116 +
117 + /*
118 + * IntP: interrupt present; if this bit is set, the thresholding
119 + * bank can generate APIC LVT interrupts
120 + */
121 + return msr_high_bits & BIT(28);
122 +}
123 +
124 static int lvt_off_valid(struct threshold_block *b, int apic, u32 lo, u32 hi)
125 {
126 int msr = (hi & MASK_LVTOFF_HI) >> 20;
127 @@ -104,8 +120,10 @@ static int lvt_off_valid(struct threshold_block *b, int apic, u32 lo, u32 hi)
128 return 1;
129 };
130
131 -/* must be called with correct cpu affinity */
132 -/* Called via smp_call_function_single() */
133 +/*
134 + * Called via smp_call_function_single(), must be called with correct
135 + * cpu affinity.
136 + */
137 static void threshold_restart_bank(void *_tr)
138 {
139 struct thresh_restart *tr = _tr;
140 @@ -128,6 +146,12 @@ static void threshold_restart_bank(void *_tr)
141 (new_count & THRESHOLD_MAX);
142 }
143
144 + /* clear IntType */
145 + hi &= ~MASK_INT_TYPE_HI;
146 +
147 + if (!tr->b->interrupt_capable)
148 + goto done;
149 +
150 if (tr->set_lvt_off) {
151 if (lvt_off_valid(tr->b, tr->lvt_off, lo, hi)) {
152 /* set new lvt offset */
153 @@ -136,9 +160,10 @@ static void threshold_restart_bank(void *_tr)
154 }
155 }
156
157 - tr->b->interrupt_enable ?
158 - (hi = (hi & ~MASK_INT_TYPE_HI) | INT_TYPE_APIC) :
159 - (hi &= ~MASK_INT_TYPE_HI);
160 + if (tr->b->interrupt_enable)
161 + hi |= INT_TYPE_APIC;
162 +
163 + done:
164
165 hi |= MASK_COUNT_EN_HI;
166 wrmsr(tr->b->address, lo, hi);
167 @@ -202,14 +227,17 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
168 if (shared_bank[bank] && c->cpu_core_id)
169 break;
170
171 - offset = setup_APIC_mce(offset,
172 - (high & MASK_LVTOFF_HI) >> 20);
173 -
174 memset(&b, 0, sizeof(b));
175 - b.cpu = cpu;
176 - b.bank = bank;
177 - b.block = block;
178 - b.address = address;
179 + b.cpu = cpu;
180 + b.bank = bank;
181 + b.block = block;
182 + b.address = address;
183 + b.interrupt_capable = lvt_interrupt_supported(bank, high);
184 +
185 + if (b.interrupt_capable) {
186 + int new = (high & MASK_LVTOFF_HI) >> 20;
187 + offset = setup_APIC_mce(offset, new);
188 + }
189
190 mce_threshold_block_init(&b, offset);
191 mce_threshold_vector = amd_threshold_interrupt;
192 @@ -309,6 +337,9 @@ store_interrupt_enable(struct threshold_block *b, const char *buf, size_t size)
193 struct thresh_restart tr;
194 unsigned long new;
195
196 + if (!b->interrupt_capable)
197 + return -EINVAL;
198 +
199 if (strict_strtoul(buf, 0, &new) < 0)
200 return -EINVAL;
201
202 @@ -467,6 +498,7 @@ static __cpuinit int allocate_threshold_blocks(unsigned int cpu,
203 b->cpu = cpu;
204 b->address = address;
205 b->interrupt_enable = 0;
206 + b->interrupt_capable = lvt_interrupt_supported(bank, high);
207 b->threshold_limit = THRESHOLD_MAX;
208
209 INIT_LIST_HEAD(&b->miscj);
210 diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
211 index 3ae0e61..59880af 100644
212 --- a/arch/x86/platform/uv/tlb_uv.c
213 +++ b/arch/x86/platform/uv/tlb_uv.c
214 @@ -1295,7 +1295,6 @@ static void __init enable_timeouts(void)
215 */
216 mmr_image |= (1L << SOFTACK_MSHIFT);
217 if (is_uv2_hub()) {
218 - mmr_image &= ~(1L << UV2_LEG_SHFT);
219 mmr_image |= (1L << UV2_EXT_SHFT);
220 }
221 write_mmr_misc_control(pnode, mmr_image);
222 diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
223 index 9577b6f..66e8f73 100644
224 --- a/drivers/acpi/video.c
225 +++ b/drivers/acpi/video.c
226 @@ -1745,6 +1745,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
227
228 static int __init intel_opregion_present(void)
229 {
230 + int i915 = 0;
231 #if defined(CONFIG_DRM_I915) || defined(CONFIG_DRM_I915_MODULE)
232 struct pci_dev *dev = NULL;
233 u32 address;
234 @@ -1757,10 +1758,10 @@ static int __init intel_opregion_present(void)
235 pci_read_config_dword(dev, 0xfc, &address);
236 if (!address)
237 continue;
238 - return 1;
239 + i915 = 1;
240 }
241 #endif
242 - return 0;
243 + return i915;
244 }
245
246 int acpi_video_register(void)
247 diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
248 index 7857e8f..3c809bf 100644
249 --- a/drivers/ata/ata_piix.c
250 +++ b/drivers/ata/ata_piix.c
251 @@ -1554,6 +1554,39 @@ static bool piix_broken_system_poweroff(struct pci_dev *pdev)
252 return false;
253 }
254
255 +static int prefer_ms_hyperv = 1;
256 +module_param(prefer_ms_hyperv, int, 0);
257 +
258 +static void piix_ignore_devices_quirk(struct ata_host *host)
259 +{
260 +#if IS_ENABLED(CONFIG_HYPERV_STORAGE)
261 + static const struct dmi_system_id ignore_hyperv[] = {
262 + {
263 + /* On Hyper-V hypervisors the disks are exposed on
264 + * both the emulated SATA controller and on the
265 + * paravirtualised drivers. The CD/DVD devices
266 + * are only exposed on the emulated controller.
267 + * Request we ignore ATA devices on this host.
268 + */
269 + .ident = "Hyper-V Virtual Machine",
270 + .matches = {
271 + DMI_MATCH(DMI_SYS_VENDOR,
272 + "Microsoft Corporation"),
273 + DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
274 + },
275 + },
276 + { } /* terminate list */
277 + };
278 + const struct dmi_system_id *dmi = dmi_first_match(ignore_hyperv);
279 +
280 + if (dmi && prefer_ms_hyperv) {
281 + host->flags |= ATA_HOST_IGNORE_ATA;
282 + dev_info(host->dev, "%s detected, ATA device ignore set\n",
283 + dmi->ident);
284 + }
285 +#endif
286 +}
287 +
288 /**
289 * piix_init_one - Register PIIX ATA PCI device with kernel services
290 * @pdev: PCI device to register
291 @@ -1669,6 +1702,9 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
292 }
293 host->flags |= ATA_HOST_PARALLEL_SCAN;
294
295 + /* Allow hosts to specify device types to ignore when scanning. */
296 + piix_ignore_devices_quirk(host);
297 +
298 pci_set_master(pdev);
299 return ata_pci_sff_activate_host(host, ata_bmdma_interrupt, sht);
300 }
301 diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
302 index 23763a1..d31ee55 100644
303 --- a/drivers/ata/libata-core.c
304 +++ b/drivers/ata/libata-core.c
305 @@ -1973,6 +1973,12 @@ retry:
306 if (class == ATA_DEV_ATA) {
307 if (!ata_id_is_ata(id) && !ata_id_is_cfa(id))
308 goto err_out;
309 + if (ap->host->flags & ATA_HOST_IGNORE_ATA &&
310 + ata_id_is_ata(id)) {
311 + ata_dev_dbg(dev,
312 + "host indicates ignore ATA devices, ignored\n");
313 + return -ENOENT;
314 + }
315 } else {
316 if (ata_id_is_ata(id))
317 goto err_out;
318 diff --git a/drivers/bcma/driver_chipcommon_pmu.c b/drivers/bcma/driver_chipcommon_pmu.c
319 index a058842..61ce405 100644
320 --- a/drivers/bcma/driver_chipcommon_pmu.c
321 +++ b/drivers/bcma/driver_chipcommon_pmu.c
322 @@ -139,7 +139,9 @@ void bcma_pmu_workarounds(struct bcma_drv_cc *cc)
323 bcma_chipco_chipctl_maskset(cc, 0, ~0, 0x7);
324 break;
325 case 0x4331:
326 - /* BCM4331 workaround is SPROM-related, we put it in sprom.c */
327 + case 43431:
328 + /* Ext PA lines must be enabled for tx on BCM4331 */
329 + bcma_chipco_bcm4331_ext_pa_lines_ctl(cc, true);
330 break;
331 case 43224:
332 if (bus->chipinfo.rev == 0) {
333 diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c
334 index 3e2a600..4588da2 100644
335 --- a/drivers/bcma/sprom.c
336 +++ b/drivers/bcma/sprom.c
337 @@ -432,13 +432,13 @@ int bcma_sprom_get(struct bcma_bus *bus)
338 if (!sprom)
339 return -ENOMEM;
340
341 - if (bus->chipinfo.id == 0x4331)
342 + if (bus->chipinfo.id == 0x4331 || bus->chipinfo.id == 43431)
343 bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, false);
344
345 pr_debug("SPROM offset 0x%x\n", offset);
346 bcma_sprom_read(bus, offset, sprom);
347
348 - if (bus->chipinfo.id == 0x4331)
349 + if (bus->chipinfo.id == 0x4331 || bus->chipinfo.id == 43431)
350 bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, true);
351
352 err = bcma_sprom_valid(sprom);
353 diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
354 index 962e75d..4293c48 100644
355 --- a/drivers/char/agp/intel-agp.c
356 +++ b/drivers/char/agp/intel-agp.c
357 @@ -898,6 +898,7 @@ static struct pci_device_id agp_intel_pci_table[] = {
358 ID(PCI_DEVICE_ID_INTEL_B43_HB),
359 ID(PCI_DEVICE_ID_INTEL_B43_1_HB),
360 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB),
361 + ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D2_HB),
362 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB),
363 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB),
364 ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB),
365 diff --git a/drivers/char/agp/intel-agp.h b/drivers/char/agp/intel-agp.h
366 index 7ea18a5..439d7e7 100644
367 --- a/drivers/char/agp/intel-agp.h
368 +++ b/drivers/char/agp/intel-agp.h
369 @@ -211,6 +211,7 @@
370 #define PCI_DEVICE_ID_INTEL_G41_HB 0x2E30
371 #define PCI_DEVICE_ID_INTEL_G41_IG 0x2E32
372 #define PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB 0x0040
373 +#define PCI_DEVICE_ID_INTEL_IRONLAKE_D2_HB 0x0069
374 #define PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG 0x0042
375 #define PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB 0x0044
376 #define PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB 0x0062
377 diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
378 index f518b99..6289f0e 100644
379 --- a/drivers/char/hw_random/atmel-rng.c
380 +++ b/drivers/char/hw_random/atmel-rng.c
381 @@ -36,6 +36,13 @@ static int atmel_trng_read(struct hwrng *rng, void *buf, size_t max,
382 /* data ready? */
383 if (readl(trng->base + TRNG_ODATA) & 1) {
384 *data = readl(trng->base + TRNG_ODATA);
385 + /*
386 + ensure data ready is only set again AFTER the next data
387 + word is ready in case it got set between checking ISR
388 + and reading ODATA, so we don't risk re-reading the
389 + same word
390 + */
391 + readl(trng->base + TRNG_ISR);
392 return 4;
393 } else
394 return 0;
395 diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
396 index c34adf9..09af2ff 100644
397 --- a/drivers/gpu/drm/gma500/psb_drv.c
398 +++ b/drivers/gpu/drm/gma500/psb_drv.c
399 @@ -349,7 +349,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
400 PSB_WSGX32(0x30000000, PSB_CR_BIF_3D_REQ_BASE);
401
402 /* igd_opregion_init(&dev_priv->opregion_dev); */
403 - acpi_video_register();
404 +/* acpi_video_register(); */
405 if (dev_priv->lid_state)
406 psb_lid_timer_init(dev_priv);
407
408 diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
409 index 62892a8..302d3d5 100644
410 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
411 +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
412 @@ -309,6 +309,7 @@ static int init_ring_common(struct intel_ring_buffer *ring)
413 ring->head = I915_READ_HEAD(ring);
414 ring->tail = I915_READ_TAIL(ring) & TAIL_ADDR;
415 ring->space = ring_space(ring);
416 + ring->last_retired_head = -1;
417 }
418
419 return 0;
420 @@ -1026,6 +1027,10 @@ int intel_init_ring_buffer(struct drm_device *dev,
421 if (ret)
422 goto err_unref;
423
424 + ret = i915_gem_object_set_to_gtt_domain(obj, true);
425 + if (ret)
426 + goto err_unpin;
427 +
428 ring->map.size = ring->size;
429 ring->map.offset = dev->agp->base + obj->gtt_offset;
430 ring->map.type = 0;
431 diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
432 index fa86035..7b11edb 100644
433 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c
434 +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
435 @@ -654,7 +654,13 @@ nouveau_connector_detect_depth(struct drm_connector *connector)
436 if (nv_connector->edid && connector->display_info.bpc)
437 return;
438
439 - /* if not, we're out of options unless we're LVDS, default to 8bpc */
440 + /* EDID 1.4 is *supposed* to be supported on eDP, but, Apple... */
441 + if (nv_connector->type == DCB_CONNECTOR_eDP) {
442 + connector->display_info.bpc = 6;
443 + return;
444 + }
445 +
446 + /* we're out of options unless we're LVDS, default to 8bpc */
447 if (nv_encoder->dcb->type != OUTPUT_LVDS) {
448 connector->display_info.bpc = 8;
449 return;
450 diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
451 index 70089d3..ea69dae 100644
452 --- a/drivers/gpu/drm/radeon/evergreen_cs.c
453 +++ b/drivers/gpu/drm/radeon/evergreen_cs.c
454 @@ -52,6 +52,7 @@ struct evergreen_cs_track {
455 u32 cb_color_view[12];
456 u32 cb_color_pitch[12];
457 u32 cb_color_slice[12];
458 + u32 cb_color_slice_idx[12];
459 u32 cb_color_attrib[12];
460 u32 cb_color_cmask_slice[8];/* unused */
461 u32 cb_color_fmask_slice[8];/* unused */
462 @@ -127,12 +128,14 @@ static void evergreen_cs_track_init(struct evergreen_cs_track *track)
463 track->cb_color_info[i] = 0;
464 track->cb_color_view[i] = 0xFFFFFFFF;
465 track->cb_color_pitch[i] = 0;
466 - track->cb_color_slice[i] = 0;
467 + track->cb_color_slice[i] = 0xfffffff;
468 + track->cb_color_slice_idx[i] = 0;
469 }
470 track->cb_target_mask = 0xFFFFFFFF;
471 track->cb_shader_mask = 0xFFFFFFFF;
472 track->cb_dirty = true;
473
474 + track->db_depth_slice = 0xffffffff;
475 track->db_depth_view = 0xFFFFC000;
476 track->db_depth_size = 0xFFFFFFFF;
477 track->db_depth_control = 0xFFFFFFFF;
478 @@ -250,10 +253,9 @@ static int evergreen_surface_check_2d(struct radeon_cs_parser *p,
479 {
480 struct evergreen_cs_track *track = p->track;
481 unsigned palign, halign, tileb, slice_pt;
482 + unsigned mtile_pr, mtile_ps, mtileb;
483
484 tileb = 64 * surf->bpe * surf->nsamples;
485 - palign = track->group_size / (8 * surf->bpe * surf->nsamples);
486 - palign = MAX(8, palign);
487 slice_pt = 1;
488 if (tileb > surf->tsplit) {
489 slice_pt = tileb / surf->tsplit;
490 @@ -262,7 +264,10 @@ static int evergreen_surface_check_2d(struct radeon_cs_parser *p,
491 /* macro tile width & height */
492 palign = (8 * surf->bankw * track->npipes) * surf->mtilea;
493 halign = (8 * surf->bankh * surf->nbanks) / surf->mtilea;
494 - surf->layer_size = surf->nbx * surf->nby * surf->bpe * slice_pt;
495 + mtileb = (palign / 8) * (halign / 8) * tileb;;
496 + mtile_pr = surf->nbx / palign;
497 + mtile_ps = (mtile_pr * surf->nby) / halign;
498 + surf->layer_size = mtile_ps * mtileb * slice_pt;
499 surf->base_align = (palign / 8) * (halign / 8) * tileb;
500 surf->palign = palign;
501 surf->halign = halign;
502 @@ -434,6 +439,39 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned i
503
504 offset += surf.layer_size * mslice;
505 if (offset > radeon_bo_size(track->cb_color_bo[id])) {
506 + /* old ddx are broken they allocate bo with w*h*bpp but
507 + * program slice with ALIGN(h, 8), catch this and patch
508 + * command stream.
509 + */
510 + if (!surf.mode) {
511 + volatile u32 *ib = p->ib->ptr;
512 + unsigned long tmp, nby, bsize, size, min = 0;
513 +
514 + /* find the height the ddx wants */
515 + if (surf.nby > 8) {
516 + min = surf.nby - 8;
517 + }
518 + bsize = radeon_bo_size(track->cb_color_bo[id]);
519 + tmp = track->cb_color_bo_offset[id] << 8;
520 + for (nby = surf.nby; nby > min; nby--) {
521 + size = nby * surf.nbx * surf.bpe * surf.nsamples;
522 + if ((tmp + size * mslice) <= bsize) {
523 + break;
524 + }
525 + }
526 + if (nby > min) {
527 + surf.nby = nby;
528 + slice = ((nby * surf.nbx) / 64) - 1;
529 + if (!evergreen_surface_check(p, &surf, "cb")) {
530 + /* check if this one works */
531 + tmp += surf.layer_size * mslice;
532 + if (tmp <= bsize) {
533 + ib[track->cb_color_slice_idx[id]] = slice;
534 + goto old_ddx_ok;
535 + }
536 + }
537 + }
538 + }
539 dev_warn(p->dev, "%s:%d cb[%d] bo too small (layer size %d, "
540 "offset %d, max layer %d, bo size %ld, slice %d)\n",
541 __func__, __LINE__, id, surf.layer_size,
542 @@ -446,6 +484,7 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned i
543 surf.tsplit, surf.mtilea);
544 return -EINVAL;
545 }
546 +old_ddx_ok:
547
548 return 0;
549 }
550 @@ -1532,6 +1571,7 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx)
551 case CB_COLOR7_SLICE:
552 tmp = (reg - CB_COLOR0_SLICE) / 0x3c;
553 track->cb_color_slice[tmp] = radeon_get_ib_value(p, idx);
554 + track->cb_color_slice_idx[tmp] = idx;
555 track->cb_dirty = true;
556 break;
557 case CB_COLOR8_SLICE:
558 @@ -1540,6 +1580,7 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx)
559 case CB_COLOR11_SLICE:
560 tmp = ((reg - CB_COLOR8_SLICE) / 0x1c) + 8;
561 track->cb_color_slice[tmp] = radeon_get_ib_value(p, idx);
562 + track->cb_color_slice_idx[tmp] = idx;
563 track->cb_dirty = true;
564 break;
565 case CB_COLOR0_ATTRIB:
566 diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
567 index ef7bb3f..15250fb 100644
568 --- a/drivers/gpu/drm/radeon/radeon_drv.c
569 +++ b/drivers/gpu/drm/radeon/radeon_drv.c
570 @@ -57,9 +57,10 @@
571 * 2.13.0 - virtual memory support, streamout
572 * 2.14.0 - add evergreen tiling informations
573 * 2.15.0 - add max_pipes query
574 + * 2.16.0 - fix evergreen 2D tiled surface calculation
575 */
576 #define KMS_DRIVER_MAJOR 2
577 -#define KMS_DRIVER_MINOR 15
578 +#define KMS_DRIVER_MINOR 16
579 #define KMS_DRIVER_PATCHLEVEL 0
580 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
581 int radeon_driver_unload_kms(struct drm_device *dev);
582 diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
583 index 1843418..8b73ae8 100644
584 --- a/drivers/gpu/drm/ttm/ttm_bo.c
585 +++ b/drivers/gpu/drm/ttm/ttm_bo.c
586 @@ -1193,6 +1193,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
587 (*destroy)(bo);
588 else
589 kfree(bo);
590 + ttm_mem_global_free(mem_glob, acc_size);
591 return -EINVAL;
592 }
593 bo->destroy = destroy;
594 @@ -1294,22 +1295,14 @@ int ttm_bo_create(struct ttm_bo_device *bdev,
595 struct ttm_buffer_object **p_bo)
596 {
597 struct ttm_buffer_object *bo;
598 - struct ttm_mem_global *mem_glob = bdev->glob->mem_glob;
599 size_t acc_size;
600 int ret;
601
602 - acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct ttm_buffer_object));
603 - ret = ttm_mem_global_alloc(mem_glob, acc_size, false, false);
604 - if (unlikely(ret != 0))
605 - return ret;
606 -
607 bo = kzalloc(sizeof(*bo), GFP_KERNEL);
608 -
609 - if (unlikely(bo == NULL)) {
610 - ttm_mem_global_free(mem_glob, acc_size);
611 + if (unlikely(bo == NULL))
612 return -ENOMEM;
613 - }
614
615 + acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct ttm_buffer_object));
616 ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment,
617 buffer_start, interruptible,
618 persistent_swap_storage, acc_size, NULL);
619 diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
620 index 536bda0..8dc84d6 100644
621 --- a/drivers/net/can/c_can/c_can.c
622 +++ b/drivers/net/can/c_can/c_can.c
623 @@ -686,7 +686,7 @@ static int c_can_get_berr_counter(const struct net_device *dev,
624 *
625 * We iterate from priv->tx_echo to priv->tx_next and check if the
626 * packet has been transmitted, echo it back to the CAN framework.
627 - * If we discover a not yet transmitted package, stop looking for more.
628 + * If we discover a not yet transmitted packet, stop looking for more.
629 */
630 static void c_can_do_tx(struct net_device *dev)
631 {
632 @@ -698,7 +698,7 @@ static void c_can_do_tx(struct net_device *dev)
633 for (/* nix */; (priv->tx_next - priv->tx_echo) > 0; priv->tx_echo++) {
634 msg_obj_no = get_tx_echo_msg_obj(priv);
635 val = c_can_read_reg32(priv, &priv->regs->txrqst1);
636 - if (!(val & (1 << msg_obj_no))) {
637 + if (!(val & (1 << (msg_obj_no - 1)))) {
638 can_get_echo_skb(dev,
639 msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
640 stats->tx_bytes += priv->read_reg(priv,
641 @@ -706,6 +706,8 @@ static void c_can_do_tx(struct net_device *dev)
642 & IF_MCONT_DLC_MASK;
643 stats->tx_packets++;
644 c_can_inval_msg_object(dev, 0, msg_obj_no);
645 + } else {
646 + break;
647 }
648 }
649
650 @@ -950,7 +952,7 @@ static int c_can_poll(struct napi_struct *napi, int quota)
651 struct net_device *dev = napi->dev;
652 struct c_can_priv *priv = netdev_priv(dev);
653
654 - irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
655 + irqstatus = priv->irqstatus;
656 if (!irqstatus)
657 goto end;
658
659 @@ -1028,12 +1030,11 @@ end:
660
661 static irqreturn_t c_can_isr(int irq, void *dev_id)
662 {
663 - u16 irqstatus;
664 struct net_device *dev = (struct net_device *)dev_id;
665 struct c_can_priv *priv = netdev_priv(dev);
666
667 - irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
668 - if (!irqstatus)
669 + priv->irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
670 + if (!priv->irqstatus)
671 return IRQ_NONE;
672
673 /* disable all interrupts and schedule the NAPI */
674 @@ -1063,10 +1064,11 @@ static int c_can_open(struct net_device *dev)
675 goto exit_irq_fail;
676 }
677
678 + napi_enable(&priv->napi);
679 +
680 /* start the c_can controller */
681 c_can_start(dev);
682
683 - napi_enable(&priv->napi);
684 netif_start_queue(dev);
685
686 return 0;
687 diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h
688 index 9b7fbef..5f32d34 100644
689 --- a/drivers/net/can/c_can/c_can.h
690 +++ b/drivers/net/can/c_can/c_can.h
691 @@ -76,6 +76,7 @@ struct c_can_priv {
692 unsigned int tx_next;
693 unsigned int tx_echo;
694 void *priv; /* for board-specific data */
695 + u16 irqstatus;
696 };
697
698 struct net_device *alloc_c_can_dev(void);
699 diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c
700 index b59cf20..cc9776c 100644
701 --- a/drivers/net/usb/sierra_net.c
702 +++ b/drivers/net/usb/sierra_net.c
703 @@ -946,7 +946,7 @@ struct sk_buff *sierra_net_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
704 }
705
706 static const u8 sierra_net_ifnum_list[] = { 7, 10, 11 };
707 -static const struct sierra_net_info_data sierra_net_info_data_68A3 = {
708 +static const struct sierra_net_info_data sierra_net_info_data_direct_ip = {
709 .rx_urb_size = 8 * 1024,
710 .whitelist = {
711 .infolen = ARRAY_SIZE(sierra_net_ifnum_list),
712 @@ -954,7 +954,7 @@ static const struct sierra_net_info_data sierra_net_info_data_68A3 = {
713 }
714 };
715
716 -static const struct driver_info sierra_net_info_68A3 = {
717 +static const struct driver_info sierra_net_info_direct_ip = {
718 .description = "Sierra Wireless USB-to-WWAN Modem",
719 .flags = FLAG_WWAN | FLAG_SEND_ZLP,
720 .bind = sierra_net_bind,
721 @@ -962,12 +962,18 @@ static const struct driver_info sierra_net_info_68A3 = {
722 .status = sierra_net_status,
723 .rx_fixup = sierra_net_rx_fixup,
724 .tx_fixup = sierra_net_tx_fixup,
725 - .data = (unsigned long)&sierra_net_info_data_68A3,
726 + .data = (unsigned long)&sierra_net_info_data_direct_ip,
727 };
728
729 static const struct usb_device_id products[] = {
730 {USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless USB-to-WWAN modem */
731 - .driver_info = (unsigned long) &sierra_net_info_68A3},
732 + .driver_info = (unsigned long) &sierra_net_info_direct_ip},
733 + {USB_DEVICE(0x0F3D, 0x68A3), /* AT&T Direct IP modem */
734 + .driver_info = (unsigned long) &sierra_net_info_direct_ip},
735 + {USB_DEVICE(0x1199, 0x68AA), /* Sierra Wireless Direct IP LTE modem */
736 + .driver_info = (unsigned long) &sierra_net_info_direct_ip},
737 + {USB_DEVICE(0x0F3D, 0x68AA), /* AT&T Direct IP LTE modem */
738 + .driver_info = (unsigned long) &sierra_net_info_direct_ip},
739
740 {}, /* last item */
741 };
742 diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
743 index c417560..bef3f24 100644
744 --- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
745 +++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
746 @@ -1222,7 +1222,7 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv,
747 key_flags |= STA_KEY_MULTICAST_MSK;
748
749 sta_cmd.key.key_flags = key_flags;
750 - sta_cmd.key.key_offset = WEP_INVALID_OFFSET;
751 + sta_cmd.key.key_offset = keyconf->hw_key_idx;
752 sta_cmd.sta.modify_mask = STA_MODIFY_KEY_MASK;
753 sta_cmd.mode = STA_CONTROL_MODIFY_MSK;
754
755 diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
756 index c24a713..1018f9b 100644
757 --- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c
758 +++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c
759 @@ -196,6 +196,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
760 WIPHY_FLAG_DISABLE_BEACON_HINTS |
761 WIPHY_FLAG_IBSS_RSN;
762
763 +#ifdef CONFIG_PM_SLEEP
764 if (priv->fw->img[IWL_UCODE_WOWLAN].sec[0].len &&
765 trans(priv)->ops->wowlan_suspend &&
766 device_can_wakeup(trans(priv)->dev)) {
767 @@ -214,6 +215,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
768 hw->wiphy->wowlan.pattern_max_len =
769 IWLAGN_WOWLAN_MAX_PATTERN_LEN;
770 }
771 +#endif
772
773 if (iwlagn_mod_params.power_save)
774 hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
775 @@ -243,6 +245,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
776 ret = ieee80211_register_hw(priv->hw);
777 if (ret) {
778 IWL_ERR(priv, "Failed to register hw (error %d)\n", ret);
779 + iwl_leds_exit(priv);
780 return ret;
781 }
782 priv->mac80211_registered = 1;
783 diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h
784 index 3b10692..dfd5466 100644
785 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h
786 +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h
787 @@ -224,6 +224,7 @@
788 #define SCD_TXFACT (SCD_BASE + 0x10)
789 #define SCD_ACTIVE (SCD_BASE + 0x14)
790 #define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8)
791 +#define SCD_CHAINEXT_EN (SCD_BASE + 0x244)
792 #define SCD_AGGR_SEL (SCD_BASE + 0x248)
793 #define SCD_INTERRUPT_MASK (SCD_BASE + 0x108)
794
795 diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
796 index 4d7b30d..66df016 100644
797 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
798 +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
799 @@ -1128,6 +1128,11 @@ static void iwl_tx_start(struct iwl_trans *trans)
800 iwl_write_prph(trans, SCD_DRAM_BASE_ADDR,
801 trans_pcie->scd_bc_tbls.dma >> 10);
802
803 + /* The chain extension of the SCD doesn't work well. This feature is
804 + * enabled by default by the HW, so we need to disable it manually.
805 + */
806 + iwl_write_prph(trans, SCD_CHAINEXT_EN, 0);
807 +
808 /* Enable DMA channel */
809 for (chan = 0; chan < FH_TCSR_CHNL_NUM ; chan++)
810 iwl_write_direct32(trans, FH_TCSR_CHNL_TX_CONFIG_REG(chan),
811 diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
812 index 001735f..5601302 100644
813 --- a/drivers/net/wireless/rt2x00/rt2800usb.c
814 +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
815 @@ -922,6 +922,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
816 { USB_DEVICE(0x1482, 0x3c09) },
817 /* AirTies */
818 { USB_DEVICE(0x1eda, 0x2012) },
819 + { USB_DEVICE(0x1eda, 0x2210) },
820 { USB_DEVICE(0x1eda, 0x2310) },
821 /* Allwin */
822 { USB_DEVICE(0x8516, 0x2070) },
823 @@ -991,6 +992,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
824 /* DVICO */
825 { USB_DEVICE(0x0fe9, 0xb307) },
826 /* Edimax */
827 + { USB_DEVICE(0x7392, 0x4085) },
828 { USB_DEVICE(0x7392, 0x7711) },
829 { USB_DEVICE(0x7392, 0x7717) },
830 { USB_DEVICE(0x7392, 0x7718) },
831 @@ -1066,6 +1068,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
832 /* Philips */
833 { USB_DEVICE(0x0471, 0x200f) },
834 /* Planex */
835 + { USB_DEVICE(0x2019, 0x5201) },
836 { USB_DEVICE(0x2019, 0xab25) },
837 { USB_DEVICE(0x2019, 0xed06) },
838 /* Quanta */
839 @@ -1134,6 +1137,10 @@ static struct usb_device_id rt2800usb_device_table[] = {
840 #ifdef CONFIG_RT2800USB_RT33XX
841 /* Belkin */
842 { USB_DEVICE(0x050d, 0x945b) },
843 + /* Panasonic */
844 + { USB_DEVICE(0x083a, 0xb511) },
845 + /* Philips */
846 + { USB_DEVICE(0x0471, 0x20dd) },
847 /* Ralink */
848 { USB_DEVICE(0x148f, 0x3370) },
849 { USB_DEVICE(0x148f, 0x8070) },
850 @@ -1145,6 +1152,8 @@ static struct usb_device_id rt2800usb_device_table[] = {
851 { USB_DEVICE(0x8516, 0x3572) },
852 /* Askey */
853 { USB_DEVICE(0x1690, 0x0744) },
854 + { USB_DEVICE(0x1690, 0x0761) },
855 + { USB_DEVICE(0x1690, 0x0764) },
856 /* Cisco */
857 { USB_DEVICE(0x167b, 0x4001) },
858 /* EnGenius */
859 @@ -1159,20 +1168,25 @@ static struct usb_device_id rt2800usb_device_table[] = {
860 /* Sitecom */
861 { USB_DEVICE(0x0df6, 0x0041) },
862 { USB_DEVICE(0x0df6, 0x0062) },
863 + { USB_DEVICE(0x0df6, 0x0065) },
864 + { USB_DEVICE(0x0df6, 0x0066) },
865 + { USB_DEVICE(0x0df6, 0x0068) },
866 /* Toshiba */
867 { USB_DEVICE(0x0930, 0x0a07) },
868 /* Zinwell */
869 { USB_DEVICE(0x5a57, 0x0284) },
870 #endif
871 #ifdef CONFIG_RT2800USB_RT53XX
872 - /* Alpha */
873 - { USB_DEVICE(0x2001, 0x3c15) },
874 - { USB_DEVICE(0x2001, 0x3c19) },
875 /* Arcadyan */
876 { USB_DEVICE(0x043e, 0x7a12) },
877 /* Azurewave */
878 { USB_DEVICE(0x13d3, 0x3329) },
879 { USB_DEVICE(0x13d3, 0x3365) },
880 + /* D-Link */
881 + { USB_DEVICE(0x2001, 0x3c15) },
882 + { USB_DEVICE(0x2001, 0x3c19) },
883 + { USB_DEVICE(0x2001, 0x3c1c) },
884 + { USB_DEVICE(0x2001, 0x3c1d) },
885 /* LG innotek */
886 { USB_DEVICE(0x043e, 0x7a22) },
887 /* Panasonic */
888 @@ -1224,12 +1238,8 @@ static struct usb_device_id rt2800usb_device_table[] = {
889 { USB_DEVICE(0x07d1, 0x3c0b) },
890 { USB_DEVICE(0x07d1, 0x3c17) },
891 { USB_DEVICE(0x2001, 0x3c17) },
892 - /* Edimax */
893 - { USB_DEVICE(0x7392, 0x4085) },
894 /* Encore */
895 { USB_DEVICE(0x203d, 0x14a1) },
896 - /* Fujitsu Stylistic 550 */
897 - { USB_DEVICE(0x1690, 0x0761) },
898 /* Gemtek */
899 { USB_DEVICE(0x15a9, 0x0010) },
900 /* Gigabyte */
901 @@ -1250,7 +1260,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
902 { USB_DEVICE(0x05a6, 0x0101) },
903 { USB_DEVICE(0x1d4d, 0x0010) },
904 /* Planex */
905 - { USB_DEVICE(0x2019, 0x5201) },
906 { USB_DEVICE(0x2019, 0xab24) },
907 /* Qcom */
908 { USB_DEVICE(0x18e8, 0x6259) },
909 diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
910 index 471f87c..c264dfa 100644
911 --- a/drivers/net/wireless/rt2x00/rt2x00.h
912 +++ b/drivers/net/wireless/rt2x00/rt2x00.h
913 @@ -396,8 +396,7 @@ struct rt2x00_intf {
914 * for hardware which doesn't support hardware
915 * sequence counting.
916 */
917 - spinlock_t seqlock;
918 - u16 seqno;
919 + atomic_t seqno;
920 };
921
922 static inline struct rt2x00_intf* vif_to_intf(struct ieee80211_vif *vif)
923 diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
924 index 2df2eb6..a8885f0 100644
925 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c
926 +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
927 @@ -277,7 +277,6 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
928 else
929 rt2x00dev->intf_sta_count++;
930
931 - spin_lock_init(&intf->seqlock);
932 mutex_init(&intf->beacon_skb_mutex);
933 intf->beacon = entry;
934
935 diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
936 index 9b1b2b7..50f92d5 100644
937 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c
938 +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
939 @@ -207,6 +207,7 @@ static void rt2x00queue_create_tx_descriptor_seq(struct rt2x00_dev *rt2x00dev,
940 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
941 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
942 struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
943 + u16 seqno;
944
945 if (!(tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ))
946 return;
947 @@ -227,15 +228,13 @@ static void rt2x00queue_create_tx_descriptor_seq(struct rt2x00_dev *rt2x00dev,
948 * sequence counting per-frame, since those will override the
949 * sequence counter given by mac80211.
950 */
951 - spin_lock(&intf->seqlock);
952 -
953 if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags))
954 - intf->seqno += 0x10;
955 - hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
956 - hdr->seq_ctrl |= cpu_to_le16(intf->seqno);
957 -
958 - spin_unlock(&intf->seqlock);
959 + seqno = atomic_add_return(0x10, &intf->seqno);
960 + else
961 + seqno = atomic_read(&intf->seqno);
962
963 + hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
964 + hdr->seq_ctrl |= cpu_to_le16(seqno);
965 }
966
967 static void rt2x00queue_create_tx_descriptor_plcp(struct rt2x00_dev *rt2x00dev,
968 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
969 index 61b16c6..0df0d1f 100644
970 --- a/fs/btrfs/inode.c
971 +++ b/fs/btrfs/inode.c
972 @@ -257,10 +257,13 @@ static noinline int cow_file_range_inline(struct btrfs_trans_handle *trans,
973 ret = insert_inline_extent(trans, root, inode, start,
974 inline_len, compressed_size,
975 compress_type, compressed_pages);
976 - if (ret) {
977 + if (ret && ret != -ENOSPC) {
978 btrfs_abort_transaction(trans, root, ret);
979 return ret;
980 + } else if (ret == -ENOSPC) {
981 + return 1;
982 }
983 +
984 btrfs_delalloc_release_metadata(inode, end + 1 - start);
985 btrfs_drop_extent_cache(inode, start, aligned_end - 1, 0);
986 return 0;
987 diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
988 index 4bbd07a..8da837b 100644
989 --- a/fs/ext4/balloc.c
990 +++ b/fs/ext4/balloc.c
991 @@ -90,8 +90,8 @@ unsigned ext4_num_overhead_clusters(struct super_block *sb,
992 * unusual file system layouts.
993 */
994 if (ext4_block_in_group(sb, ext4_block_bitmap(sb, gdp), block_group)) {
995 - block_cluster = EXT4_B2C(sbi, (start -
996 - ext4_block_bitmap(sb, gdp)));
997 + block_cluster = EXT4_B2C(sbi,
998 + ext4_block_bitmap(sb, gdp) - start);
999 if (block_cluster < num_clusters)
1000 block_cluster = -1;
1001 else if (block_cluster == num_clusters) {
1002 @@ -102,7 +102,7 @@ unsigned ext4_num_overhead_clusters(struct super_block *sb,
1003
1004 if (ext4_block_in_group(sb, ext4_inode_bitmap(sb, gdp), block_group)) {
1005 inode_cluster = EXT4_B2C(sbi,
1006 - start - ext4_inode_bitmap(sb, gdp));
1007 + ext4_inode_bitmap(sb, gdp) - start);
1008 if (inode_cluster < num_clusters)
1009 inode_cluster = -1;
1010 else if (inode_cluster == num_clusters) {
1011 @@ -114,7 +114,7 @@ unsigned ext4_num_overhead_clusters(struct super_block *sb,
1012 itbl_blk = ext4_inode_table(sb, gdp);
1013 for (i = 0; i < sbi->s_itb_per_group; i++) {
1014 if (ext4_block_in_group(sb, itbl_blk + i, block_group)) {
1015 - c = EXT4_B2C(sbi, start - itbl_blk + i);
1016 + c = EXT4_B2C(sbi, itbl_blk + i - start);
1017 if ((c < num_clusters) || (c == inode_cluster) ||
1018 (c == block_cluster) || (c == itbl_cluster))
1019 continue;
1020 diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
1021 index df5ac04..bc43832 100644
1022 --- a/fs/fuse/dir.c
1023 +++ b/fs/fuse/dir.c
1024 @@ -863,6 +863,7 @@ int fuse_update_attributes(struct inode *inode, struct kstat *stat,
1025 if (stat) {
1026 generic_fillattr(inode, stat);
1027 stat->mode = fi->orig_i_mode;
1028 + stat->ino = fi->orig_ino;
1029 }
1030 }
1031
1032 diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
1033 index 572cefc..d181926 100644
1034 --- a/fs/fuse/fuse_i.h
1035 +++ b/fs/fuse/fuse_i.h
1036 @@ -82,6 +82,9 @@ struct fuse_inode {
1037 preserve the original mode */
1038 umode_t orig_i_mode;
1039
1040 + /** 64 bit inode number */
1041 + u64 orig_ino;
1042 +
1043 /** Version of last attribute change */
1044 u64 attr_version;
1045
1046 diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
1047 index 26783eb..a59cf5e 100644
1048 --- a/fs/fuse/inode.c
1049 +++ b/fs/fuse/inode.c
1050 @@ -91,6 +91,7 @@ static struct inode *fuse_alloc_inode(struct super_block *sb)
1051 fi->nlookup = 0;
1052 fi->attr_version = 0;
1053 fi->writectr = 0;
1054 + fi->orig_ino = 0;
1055 INIT_LIST_HEAD(&fi->write_files);
1056 INIT_LIST_HEAD(&fi->queued_writes);
1057 INIT_LIST_HEAD(&fi->writepages);
1058 @@ -139,6 +140,18 @@ static int fuse_remount_fs(struct super_block *sb, int *flags, char *data)
1059 return 0;
1060 }
1061
1062 +/*
1063 + * ino_t is 32-bits on 32-bit arch. We have to squash the 64-bit value down
1064 + * so that it will fit.
1065 + */
1066 +static ino_t fuse_squash_ino(u64 ino64)
1067 +{
1068 + ino_t ino = (ino_t) ino64;
1069 + if (sizeof(ino_t) < sizeof(u64))
1070 + ino ^= ino64 >> (sizeof(u64) - sizeof(ino_t)) * 8;
1071 + return ino;
1072 +}
1073 +
1074 void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
1075 u64 attr_valid)
1076 {
1077 @@ -148,7 +161,7 @@ void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
1078 fi->attr_version = ++fc->attr_version;
1079 fi->i_time = attr_valid;
1080
1081 - inode->i_ino = attr->ino;
1082 + inode->i_ino = fuse_squash_ino(attr->ino);
1083 inode->i_mode = (inode->i_mode & S_IFMT) | (attr->mode & 07777);
1084 set_nlink(inode, attr->nlink);
1085 inode->i_uid = attr->uid;
1086 @@ -174,6 +187,8 @@ void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr,
1087 fi->orig_i_mode = inode->i_mode;
1088 if (!(fc->flags & FUSE_DEFAULT_PERMISSIONS))
1089 inode->i_mode &= ~S_ISVTX;
1090 +
1091 + fi->orig_ino = attr->ino;
1092 }
1093
1094 void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
1095 diff --git a/include/linux/libata.h b/include/linux/libata.h
1096 index e926df7..6e887c7 100644
1097 --- a/include/linux/libata.h
1098 +++ b/include/linux/libata.h
1099 @@ -247,6 +247,7 @@ enum {
1100 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */
1101 ATA_HOST_STARTED = (1 << 1), /* Host started */
1102 ATA_HOST_PARALLEL_SCAN = (1 << 2), /* Ports on this host can be scanned in parallel */
1103 + ATA_HOST_IGNORE_ATA = (1 << 3), /* Ignore ATA devices on this host. */
1104
1105 /* bits 24:31 of host->flags are reserved for LLD specific flags */
1106
1107 diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
1108 index ea36486..944bc18 100644
1109 --- a/include/linux/moduleparam.h
1110 +++ b/include/linux/moduleparam.h
1111 @@ -128,7 +128,7 @@ struct kparam_array
1112 * The ops can have NULL set or get functions.
1113 */
1114 #define module_param_cb(name, ops, arg, perm) \
1115 - __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, 0)
1116 + __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1)
1117
1118 /**
1119 * <level>_param_cb - general callback for a module/cmdline parameter
1120 @@ -192,7 +192,7 @@ struct kparam_array
1121 { (void *)set, (void *)get }; \
1122 __module_param_call(MODULE_PARAM_PREFIX, \
1123 name, &__param_ops_##name, arg, \
1124 - (perm) + sizeof(__check_old_set_param(set))*0, 0)
1125 + (perm) + sizeof(__check_old_set_param(set))*0, -1)
1126
1127 /* We don't get oldget: it's often a new-style param_get_uint, etc. */
1128 static inline int
1129 @@ -272,7 +272,7 @@ static inline void __kernel_param_unlock(void)
1130 */
1131 #define core_param(name, var, type, perm) \
1132 param_check_##type(name, &(var)); \
1133 - __module_param_call("", name, &param_ops_##type, &var, perm, 0)
1134 + __module_param_call("", name, &param_ops_##type, &var, perm, -1)
1135 #endif /* !MODULE */
1136
1137 /**
1138 @@ -290,7 +290,7 @@ static inline void __kernel_param_unlock(void)
1139 = { len, string }; \
1140 __module_param_call(MODULE_PARAM_PREFIX, name, \
1141 &param_ops_string, \
1142 - .str = &__param_string_##name, perm, 0); \
1143 + .str = &__param_string_##name, perm, -1); \
1144 __MODULE_PARM_TYPE(name, "string")
1145
1146 /**
1147 @@ -431,7 +431,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp);
1148 __module_param_call(MODULE_PARAM_PREFIX, name, \
1149 &param_array_ops, \
1150 .arr = &__param_arr_##name, \
1151 - perm, 0); \
1152 + perm, -1); \
1153 __MODULE_PARM_TYPE(name, "array of " #type)
1154
1155 extern struct kernel_param_ops param_array_ops;
1156 diff --git a/init/main.c b/init/main.c
1157 index cb54cd3..b08c5f7 100644
1158 --- a/init/main.c
1159 +++ b/init/main.c
1160 @@ -508,7 +508,7 @@ asmlinkage void __init start_kernel(void)
1161 parse_early_param();
1162 parse_args("Booting kernel", static_command_line, __start___param,
1163 __stop___param - __start___param,
1164 - 0, 0, &unknown_bootoption);
1165 + -1, -1, &unknown_bootoption);
1166
1167 jump_label_init();
1168
1169 diff --git a/kernel/sched/core.c b/kernel/sched/core.c
1170 index e5212ae..2000e06 100644
1171 --- a/kernel/sched/core.c
1172 +++ b/kernel/sched/core.c
1173 @@ -6230,11 +6230,8 @@ int sched_domain_level_max;
1174
1175 static int __init setup_relax_domain_level(char *str)
1176 {
1177 - unsigned long val;
1178 -
1179 - val = simple_strtoul(str, NULL, 0);
1180 - if (val < sched_domain_level_max)
1181 - default_relax_domain_level = val;
1182 + if (kstrtoint(str, 0, &default_relax_domain_level))
1183 + pr_warn("Unable to set relax_domain_level\n");
1184
1185 return 1;
1186 }
1187 @@ -6439,7 +6436,6 @@ struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl,
1188 if (!sd)
1189 return child;
1190
1191 - set_domain_attribute(sd, attr);
1192 cpumask_and(sched_domain_span(sd), cpu_map, tl->mask(cpu));
1193 if (child) {
1194 sd->level = child->level + 1;
1195 @@ -6447,6 +6443,7 @@ struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl,
1196 child->parent = sd;
1197 }
1198 sd->child = child;
1199 + set_domain_attribute(sd, attr);
1200
1201 return sd;
1202 }
1203 diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
1204 index d66b213..d42574df 100644
1205 --- a/kernel/time/timekeeping.c
1206 +++ b/kernel/time/timekeeping.c
1207 @@ -964,6 +964,7 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
1208 timekeeper.xtime.tv_sec++;
1209 leap = second_overflow(timekeeper.xtime.tv_sec);
1210 timekeeper.xtime.tv_sec += leap;
1211 + timekeeper.wall_to_monotonic.tv_sec -= leap;
1212 }
1213
1214 /* Accumulate raw time */
1215 @@ -1079,6 +1080,7 @@ static void update_wall_time(void)
1216 timekeeper.xtime.tv_sec++;
1217 leap = second_overflow(timekeeper.xtime.tv_sec);
1218 timekeeper.xtime.tv_sec += leap;
1219 + timekeeper.wall_to_monotonic.tv_sec -= leap;
1220 }
1221
1222 timekeeping_update(false);
1223 diff --git a/lib/btree.c b/lib/btree.c
1224 index e5ec1e9..5cf9e74 100644
1225 --- a/lib/btree.c
1226 +++ b/lib/btree.c
1227 @@ -319,8 +319,8 @@ void *btree_get_prev(struct btree_head *head, struct btree_geo *geo,
1228
1229 if (head->height == 0)
1230 return NULL;
1231 -retry:
1232 longcpy(key, __key, geo->keylen);
1233 +retry:
1234 dec_key(geo, key);
1235
1236 node = head->node;
1237 @@ -351,7 +351,7 @@ retry:
1238 }
1239 miss:
1240 if (retry_key) {
1241 - __key = retry_key;
1242 + longcpy(key, retry_key, geo->keylen);
1243 retry_key = NULL;
1244 goto retry;
1245 }
1246 diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
1247 index c20051b..48f937e 100644
1248 --- a/net/mac80211/iface.c
1249 +++ b/net/mac80211/iface.c
1250 @@ -514,6 +514,18 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
1251 ieee80211_configure_filter(local);
1252 break;
1253 default:
1254 + mutex_lock(&local->mtx);
1255 + if (local->hw_roc_dev == sdata->dev &&
1256 + local->hw_roc_channel) {
1257 + /* ignore return value since this is racy */
1258 + drv_cancel_remain_on_channel(local);
1259 + ieee80211_queue_work(&local->hw, &local->hw_roc_done);
1260 + }
1261 + mutex_unlock(&local->mtx);
1262 +
1263 + flush_work(&local->hw_roc_start);
1264 + flush_work(&local->hw_roc_done);
1265 +
1266 flush_work(&sdata->work);
1267 /*
1268 * When we get here, the interface is marked down.
1269 diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
1270 index f054e94..935aa4b 100644
1271 --- a/net/mac80211/offchannel.c
1272 +++ b/net/mac80211/offchannel.c
1273 @@ -234,6 +234,22 @@ static void ieee80211_hw_roc_done(struct work_struct *work)
1274 return;
1275 }
1276
1277 + /* was never transmitted */
1278 + if (local->hw_roc_skb) {
1279 + u64 cookie;
1280 +
1281 + cookie = local->hw_roc_cookie ^ 2;
1282 +
1283 + cfg80211_mgmt_tx_status(local->hw_roc_dev, cookie,
1284 + local->hw_roc_skb->data,
1285 + local->hw_roc_skb->len, false,
1286 + GFP_KERNEL);
1287 +
1288 + kfree_skb(local->hw_roc_skb);
1289 + local->hw_roc_skb = NULL;
1290 + local->hw_roc_skb_for_status = NULL;
1291 + }
1292 +
1293 if (!local->hw_roc_for_tx)
1294 cfg80211_remain_on_channel_expired(local->hw_roc_dev,
1295 local->hw_roc_cookie,
1296 diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
1297 index 38137cb..d93d39b 100644
1298 --- a/net/mac80211/sta_info.c
1299 +++ b/net/mac80211/sta_info.c
1300 @@ -378,7 +378,7 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
1301 /* make the station visible */
1302 sta_info_hash_add(local, sta);
1303
1304 - list_add(&sta->list, &local->sta_list);
1305 + list_add_rcu(&sta->list, &local->sta_list);
1306
1307 set_sta_flag(sta, WLAN_STA_INSERTED);
1308
1309 @@ -688,7 +688,7 @@ int __must_check __sta_info_destroy(struct sta_info *sta)
1310 if (ret)
1311 return ret;
1312
1313 - list_del(&sta->list);
1314 + list_del_rcu(&sta->list);
1315
1316 mutex_lock(&local->key_mtx);
1317 for (i = 0; i < NUM_DEFAULT_KEYS; i++)
1318 diff --git a/net/mac80211/util.c b/net/mac80211/util.c
1319 index 3862c96..eb9d7c0 100644
1320 --- a/net/mac80211/util.c
1321 +++ b/net/mac80211/util.c
1322 @@ -1224,7 +1224,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1323 enum ieee80211_sta_state state;
1324
1325 for (state = IEEE80211_STA_NOTEXIST;
1326 - state < sta->sta_state - 1; state++)
1327 + state < sta->sta_state; state++)
1328 WARN_ON(drv_sta_state(local, sta->sdata, sta,
1329 state, state + 1));
1330 }
1331 diff --git a/net/wireless/util.c b/net/wireless/util.c
1332 index 957f2562..b5b6890 100644
1333 --- a/net/wireless/util.c
1334 +++ b/net/wireless/util.c
1335 @@ -936,6 +936,7 @@ int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev,
1336 enum nl80211_iftype iftype)
1337 {
1338 struct wireless_dev *wdev_iter;
1339 + u32 used_iftypes = BIT(iftype);
1340 int num[NUM_NL80211_IFTYPES];
1341 int total = 1;
1342 int i, j;
1343 @@ -969,12 +970,14 @@ int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev,
1344
1345 num[wdev_iter->iftype]++;
1346 total++;
1347 + used_iftypes |= BIT(wdev_iter->iftype);
1348 }
1349 mutex_unlock(&rdev->devlist_mtx);
1350
1351 for (i = 0; i < rdev->wiphy.n_iface_combinations; i++) {
1352 const struct ieee80211_iface_combination *c;
1353 struct ieee80211_iface_limit *limits;
1354 + u32 all_iftypes = 0;
1355
1356 c = &rdev->wiphy.iface_combinations[i];
1357
1358 @@ -989,6 +992,7 @@ int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev,
1359 if (rdev->wiphy.software_iftypes & BIT(iftype))
1360 continue;
1361 for (j = 0; j < c->n_limits; j++) {
1362 + all_iftypes |= limits[j].types;
1363 if (!(limits[j].types & BIT(iftype)))
1364 continue;
1365 if (limits[j].max < num[iftype])
1366 @@ -996,7 +1000,20 @@ int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev,
1367 limits[j].max -= num[iftype];
1368 }
1369 }
1370 - /* yay, it fits */
1371 +
1372 + /*
1373 + * Finally check that all iftypes that we're currently
1374 + * using are actually part of this combination. If they
1375 + * aren't then we can't use this combination and have
1376 + * to continue to the next.
1377 + */
1378 + if ((all_iftypes & used_iftypes) != used_iftypes)
1379 + goto cont;
1380 +
1381 + /*
1382 + * This combination covered all interface types and
1383 + * supported the requested numbers, so we're good.
1384 + */
1385 kfree(limits);
1386 return 0;
1387 cont:
1388 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
1389 index 7810913..e56c2c8 100644
1390 --- a/sound/pci/hda/patch_realtek.c
1391 +++ b/sound/pci/hda/patch_realtek.c
1392 @@ -6606,6 +6606,7 @@ enum {
1393 ALC662_FIXUP_ASUS_MODE7,
1394 ALC662_FIXUP_ASUS_MODE8,
1395 ALC662_FIXUP_NO_JACK_DETECT,
1396 + ALC662_FIXUP_ZOTAC_Z68,
1397 };
1398
1399 static const struct alc_fixup alc662_fixups[] = {
1400 @@ -6755,6 +6756,13 @@ static const struct alc_fixup alc662_fixups[] = {
1401 .type = ALC_FIXUP_FUNC,
1402 .v.func = alc_fixup_no_jack_detect,
1403 },
1404 + [ALC662_FIXUP_ZOTAC_Z68] = {
1405 + .type = ALC_FIXUP_PINS,
1406 + .v.pins = (const struct alc_pincfg[]) {
1407 + { 0x1b, 0x02214020 }, /* Front HP */
1408 + { }
1409 + }
1410 + },
1411 };
1412
1413 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
1414 @@ -6768,6 +6776,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
1415 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
1416 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
1417 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
1418 + SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
1419 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
1420
1421 #if 0
1422 diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
1423 index 2de12eb..f351b93 100644
1424 --- a/sound/soc/codecs/wm8994.c
1425 +++ b/sound/soc/codecs/wm8994.c
1426 @@ -46,6 +46,39 @@
1427 #define WM8994_NUM_DRC 3
1428 #define WM8994_NUM_EQ 3
1429
1430 +static struct {
1431 + unsigned int reg;
1432 + unsigned int mask;
1433 +} wm8994_vu_bits[] = {
1434 + { WM8994_LEFT_LINE_INPUT_1_2_VOLUME, WM8994_IN1_VU },
1435 + { WM8994_RIGHT_LINE_INPUT_1_2_VOLUME, WM8994_IN1_VU },
1436 + { WM8994_LEFT_LINE_INPUT_3_4_VOLUME, WM8994_IN2_VU },
1437 + { WM8994_RIGHT_LINE_INPUT_3_4_VOLUME, WM8994_IN2_VU },
1438 + { WM8994_SPEAKER_VOLUME_LEFT, WM8994_SPKOUT_VU },
1439 + { WM8994_SPEAKER_VOLUME_RIGHT, WM8994_SPKOUT_VU },
1440 + { WM8994_LEFT_OUTPUT_VOLUME, WM8994_HPOUT1_VU },
1441 + { WM8994_RIGHT_OUTPUT_VOLUME, WM8994_HPOUT1_VU },
1442 + { WM8994_LEFT_OPGA_VOLUME, WM8994_MIXOUT_VU },
1443 + { WM8994_RIGHT_OPGA_VOLUME, WM8994_MIXOUT_VU },
1444 +
1445 + { WM8994_AIF1_DAC1_LEFT_VOLUME, WM8994_AIF1DAC1_VU },
1446 + { WM8994_AIF1_DAC1_RIGHT_VOLUME, WM8994_AIF1DAC1_VU },
1447 + { WM8994_AIF1_DAC2_LEFT_VOLUME, WM8994_AIF1DAC2_VU },
1448 + { WM8994_AIF1_DAC2_RIGHT_VOLUME, WM8994_AIF1DAC2_VU },
1449 + { WM8994_AIF2_DAC_LEFT_VOLUME, WM8994_AIF2DAC_VU },
1450 + { WM8994_AIF2_DAC_RIGHT_VOLUME, WM8994_AIF2DAC_VU },
1451 + { WM8994_AIF1_ADC1_LEFT_VOLUME, WM8994_AIF1ADC1_VU },
1452 + { WM8994_AIF1_ADC1_RIGHT_VOLUME, WM8994_AIF1ADC1_VU },
1453 + { WM8994_AIF1_ADC2_LEFT_VOLUME, WM8994_AIF1ADC2_VU },
1454 + { WM8994_AIF1_ADC2_RIGHT_VOLUME, WM8994_AIF1ADC2_VU },
1455 + { WM8994_AIF2_ADC_LEFT_VOLUME, WM8994_AIF2ADC_VU },
1456 + { WM8994_AIF2_ADC_RIGHT_VOLUME, WM8994_AIF1ADC2_VU },
1457 + { WM8994_DAC1_LEFT_VOLUME, WM8994_DAC1_VU },
1458 + { WM8994_DAC1_RIGHT_VOLUME, WM8994_DAC1_VU },
1459 + { WM8994_DAC2_LEFT_VOLUME, WM8994_DAC2_VU },
1460 + { WM8994_DAC2_RIGHT_VOLUME, WM8994_DAC2_VU },
1461 +};
1462 +
1463 static int wm8994_drc_base[] = {
1464 WM8994_AIF1_DRC1_1,
1465 WM8994_AIF1_DRC2_1,
1466 @@ -1006,6 +1039,7 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
1467 struct snd_soc_codec *codec = w->codec;
1468 struct wm8994 *control = codec->control_data;
1469 int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA;
1470 + int i;
1471 int dac;
1472 int adc;
1473 int val;
1474 @@ -1064,6 +1098,13 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
1475 WM8994_AIF1DAC2L_ENA);
1476 break;
1477
1478 + case SND_SOC_DAPM_POST_PMU:
1479 + for (i = 0; i < ARRAY_SIZE(wm8994_vu_bits); i++)
1480 + snd_soc_write(codec, wm8994_vu_bits[i].reg,
1481 + snd_soc_read(codec,
1482 + wm8994_vu_bits[i].reg));
1483 + break;
1484 +
1485 case SND_SOC_DAPM_PRE_PMD:
1486 case SND_SOC_DAPM_POST_PMD:
1487 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
1488 @@ -1089,6 +1130,7 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
1489 struct snd_kcontrol *kcontrol, int event)
1490 {
1491 struct snd_soc_codec *codec = w->codec;
1492 + int i;
1493 int dac;
1494 int adc;
1495 int val;
1496 @@ -1139,6 +1181,13 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
1497 WM8994_AIF2DACR_ENA);
1498 break;
1499
1500 + case SND_SOC_DAPM_POST_PMU:
1501 + for (i = 0; i < ARRAY_SIZE(wm8994_vu_bits); i++)
1502 + snd_soc_write(codec, wm8994_vu_bits[i].reg,
1503 + snd_soc_read(codec,
1504 + wm8994_vu_bits[i].reg));
1505 + break;
1506 +
1507 case SND_SOC_DAPM_PRE_PMD:
1508 case SND_SOC_DAPM_POST_PMD:
1509 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
1510 @@ -1207,17 +1256,19 @@ static int late_enable_ev(struct snd_soc_dapm_widget *w,
1511 switch (event) {
1512 case SND_SOC_DAPM_PRE_PMU:
1513 if (wm8994->aif1clk_enable) {
1514 - aif1clk_ev(w, kcontrol, event);
1515 + aif1clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMU);
1516 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
1517 WM8994_AIF1CLK_ENA_MASK,
1518 WM8994_AIF1CLK_ENA);
1519 + aif1clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMU);
1520 wm8994->aif1clk_enable = 0;
1521 }
1522 if (wm8994->aif2clk_enable) {
1523 - aif2clk_ev(w, kcontrol, event);
1524 + aif2clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMU);
1525 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
1526 WM8994_AIF2CLK_ENA_MASK,
1527 WM8994_AIF2CLK_ENA);
1528 + aif2clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMU);
1529 wm8994->aif2clk_enable = 0;
1530 }
1531 break;
1532 @@ -1238,15 +1289,17 @@ static int late_disable_ev(struct snd_soc_dapm_widget *w,
1533 switch (event) {
1534 case SND_SOC_DAPM_POST_PMD:
1535 if (wm8994->aif1clk_disable) {
1536 + aif1clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMD);
1537 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
1538 WM8994_AIF1CLK_ENA_MASK, 0);
1539 - aif1clk_ev(w, kcontrol, event);
1540 + aif1clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMD);
1541 wm8994->aif1clk_disable = 0;
1542 }
1543 if (wm8994->aif2clk_disable) {
1544 + aif2clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMD);
1545 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
1546 WM8994_AIF2CLK_ENA_MASK, 0);
1547 - aif2clk_ev(w, kcontrol, event);
1548 + aif2clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMD);
1549 wm8994->aif2clk_disable = 0;
1550 }
1551 break;
1552 @@ -1583,9 +1636,11 @@ SND_SOC_DAPM_POST("Late Disable PGA", late_disable_ev)
1553
1554 static const struct snd_soc_dapm_widget wm8994_lateclk_widgets[] = {
1555 SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, aif1clk_ev,
1556 - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
1557 + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1558 + SND_SOC_DAPM_PRE_PMD),
1559 SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, aif2clk_ev,
1560 - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
1561 + SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1562 + SND_SOC_DAPM_PRE_PMD),
1563 SND_SOC_DAPM_PGA("Direct Voice", SND_SOC_NOPM, 0, 0, NULL, 0),
1564 SND_SOC_DAPM_MIXER("SPKL", WM8994_POWER_MANAGEMENT_3, 8, 0,
1565 left_speaker_mixer, ARRAY_SIZE(left_speaker_mixer)),
1566 @@ -3939,39 +3994,11 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
1567
1568 pm_runtime_put(codec->dev);
1569
1570 - /* Latch volume updates (right only; we always do left then right). */
1571 - snd_soc_update_bits(codec, WM8994_AIF1_DAC1_LEFT_VOLUME,
1572 - WM8994_AIF1DAC1_VU, WM8994_AIF1DAC1_VU);
1573 - snd_soc_update_bits(codec, WM8994_AIF1_DAC1_RIGHT_VOLUME,
1574 - WM8994_AIF1DAC1_VU, WM8994_AIF1DAC1_VU);
1575 - snd_soc_update_bits(codec, WM8994_AIF1_DAC2_LEFT_VOLUME,
1576 - WM8994_AIF1DAC2_VU, WM8994_AIF1DAC2_VU);
1577 - snd_soc_update_bits(codec, WM8994_AIF1_DAC2_RIGHT_VOLUME,
1578 - WM8994_AIF1DAC2_VU, WM8994_AIF1DAC2_VU);
1579 - snd_soc_update_bits(codec, WM8994_AIF2_DAC_LEFT_VOLUME,
1580 - WM8994_AIF2DAC_VU, WM8994_AIF2DAC_VU);
1581 - snd_soc_update_bits(codec, WM8994_AIF2_DAC_RIGHT_VOLUME,
1582 - WM8994_AIF2DAC_VU, WM8994_AIF2DAC_VU);
1583 - snd_soc_update_bits(codec, WM8994_AIF1_ADC1_LEFT_VOLUME,
1584 - WM8994_AIF1ADC1_VU, WM8994_AIF1ADC1_VU);
1585 - snd_soc_update_bits(codec, WM8994_AIF1_ADC1_RIGHT_VOLUME,
1586 - WM8994_AIF1ADC1_VU, WM8994_AIF1ADC1_VU);
1587 - snd_soc_update_bits(codec, WM8994_AIF1_ADC2_LEFT_VOLUME,
1588 - WM8994_AIF1ADC2_VU, WM8994_AIF1ADC2_VU);
1589 - snd_soc_update_bits(codec, WM8994_AIF1_ADC2_RIGHT_VOLUME,
1590 - WM8994_AIF1ADC2_VU, WM8994_AIF1ADC2_VU);
1591 - snd_soc_update_bits(codec, WM8994_AIF2_ADC_LEFT_VOLUME,
1592 - WM8994_AIF2ADC_VU, WM8994_AIF1ADC2_VU);
1593 - snd_soc_update_bits(codec, WM8994_AIF2_ADC_RIGHT_VOLUME,
1594 - WM8994_AIF2ADC_VU, WM8994_AIF1ADC2_VU);
1595 - snd_soc_update_bits(codec, WM8994_DAC1_LEFT_VOLUME,
1596 - WM8994_DAC1_VU, WM8994_DAC1_VU);
1597 - snd_soc_update_bits(codec, WM8994_DAC1_RIGHT_VOLUME,
1598 - WM8994_DAC1_VU, WM8994_DAC1_VU);
1599 - snd_soc_update_bits(codec, WM8994_DAC2_LEFT_VOLUME,
1600 - WM8994_DAC2_VU, WM8994_DAC2_VU);
1601 - snd_soc_update_bits(codec, WM8994_DAC2_RIGHT_VOLUME,
1602 - WM8994_DAC2_VU, WM8994_DAC2_VU);
1603 + /* Latch volume update bits */
1604 + for (i = 0; i < ARRAY_SIZE(wm8994_vu_bits); i++)
1605 + snd_soc_update_bits(codec, wm8994_vu_bits[i].reg,
1606 + wm8994_vu_bits[i].mask,
1607 + wm8994_vu_bits[i].mask);
1608
1609 /* Set the low bit of the 3D stereo depth so TLV matches */
1610 snd_soc_update_bits(codec, WM8994_AIF1_DAC1_FILTERS_2,