aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-06-29 10:18:12 -0400
committerTakashi Iwai <tiwai@suse.de>2017-06-30 02:58:53 -0400
commitdba9b7b6ca1af60fd21137c18795a81a5652c5ae (patch)
treedd4af47c1cbfd604d031efaaea30a7117c9b0b05
parenta5a041b6b50bcaf96f96e5db4850d11006d61d26 (diff)
ALSA: hda - Fix doubly initialization of i915 component
In the commit fcc88d91cd36 ("ALSA: hda - Bind with i915 component before codec binding"), the binding with i915 audio component is moved to be performed always at probing the controller. This fixed the potential problems on IVB, but now it brought another issue on HSW and BDW. These two platforms give two individual HD-audio controllers, one for the analog codec on PCH and another for HDMI over gfx. Since I decided to take a lazy path to check only AZX_DRIVER_PCH type in the commit above, now both controllers try to bind with i915, and you see a kernel WARNING. This patch tries to address it again properly. Now a new DCAPS bit, AZX_DCAPS_I915_COMPONENT, is introduced for indicating the binding with i915 component in addition to the existing I915_POWERWELL bit flag. Each PCI entry has to give this new flag if it requires the binding with i915 component. For HSW/BDW PCH (i.e. the ones defined by AZX_DCAPS_INTEL_PCH) doesn't contain AZX_DCAPS_I915_COMPONENT bit while others have it. While we're at it, add parentheses around the bit flag check for avoiding possible compiler warnings, too. The bug was spotted by Intel CI tests. Fixes: fcc88d91cd36 ("ALSA: hda - Bind with i915 component before codec binding") Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196219 Reported-by: Martin Peres <martin.peres@free.fr> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_controller.h6
-rw-r--r--sound/pci/hda/hda_intel.c40
2 files changed, 27 insertions, 19 deletions
diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h
index 35a9ab2cac46..a68e75b00ea3 100644
--- a/sound/pci/hda/hda_controller.h
+++ b/sound/pci/hda/hda_controller.h
@@ -32,7 +32,11 @@
32#define AZX_DCAPS_NO_MSI (1 << 9) /* No MSI support */ 32#define AZX_DCAPS_NO_MSI (1 << 9) /* No MSI support */
33#define AZX_DCAPS_SNOOP_MASK (3 << 10) /* snoop type mask */ 33#define AZX_DCAPS_SNOOP_MASK (3 << 10) /* snoop type mask */
34#define AZX_DCAPS_SNOOP_OFF (1 << 12) /* snoop default off */ 34#define AZX_DCAPS_SNOOP_OFF (1 << 12) /* snoop default off */
35/* 13 unused */ 35#ifdef CONFIG_SND_HDA_I915
36#define AZX_DCAPS_I915_COMPONENT (1 << 13) /* bind with i915 gfx */
37#else
38#define AZX_DCAPS_I915_COMPONENT 0 /* NOP */
39#endif
36/* 14 unused */ 40/* 14 unused */
37#define AZX_DCAPS_CTX_WORKAROUND (1 << 15) /* X-Fi workaround */ 41#define AZX_DCAPS_CTX_WORKAROUND (1 << 15) /* X-Fi workaround */
38#define AZX_DCAPS_POSFIX_LPIB (1 << 16) /* Use LPIB as default */ 42#define AZX_DCAPS_POSFIX_LPIB (1 << 16) /* Use LPIB as default */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index a157582b8f2c..03e34edc8f24 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -293,38 +293,43 @@ enum {
293 (AZX_DCAPS_NO_ALIGN_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY |\ 293 (AZX_DCAPS_NO_ALIGN_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY |\
294 AZX_DCAPS_SNOOP_TYPE(SCH)) 294 AZX_DCAPS_SNOOP_TYPE(SCH))
295 295
296/* PCH up to IVB; no runtime PM */ 296/* PCH up to IVB; no runtime PM; bind with i915 gfx */
297#define AZX_DCAPS_INTEL_PCH_NOPM \ 297#define AZX_DCAPS_INTEL_PCH_NOPM \
298 (AZX_DCAPS_INTEL_PCH_BASE) 298 (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_I915_COMPONENT)
299 299
300/* PCH for HSW/BDW; with runtime PM */ 300/* PCH for HSW/BDW; with runtime PM */
301/* no i915 binding for this as HSW/BDW has another controller for HDMI */
301#define AZX_DCAPS_INTEL_PCH \ 302#define AZX_DCAPS_INTEL_PCH \
302 (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME) 303 (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME)
303 304
304/* HSW HDMI */ 305/* HSW HDMI */
305#define AZX_DCAPS_INTEL_HASWELL \ 306#define AZX_DCAPS_INTEL_HASWELL \
306 (/*AZX_DCAPS_ALIGN_BUFSIZE |*/ AZX_DCAPS_COUNT_LPIB_DELAY |\ 307 (/*AZX_DCAPS_ALIGN_BUFSIZE |*/ AZX_DCAPS_COUNT_LPIB_DELAY |\
307 AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_POWERWELL |\ 308 AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_COMPONENT |\
308 AZX_DCAPS_SNOOP_TYPE(SCH)) 309 AZX_DCAPS_I915_POWERWELL | AZX_DCAPS_SNOOP_TYPE(SCH))
309 310
310/* Broadwell HDMI can't use position buffer reliably, force to use LPIB */ 311/* Broadwell HDMI can't use position buffer reliably, force to use LPIB */
311#define AZX_DCAPS_INTEL_BROADWELL \ 312#define AZX_DCAPS_INTEL_BROADWELL \
312 (/*AZX_DCAPS_ALIGN_BUFSIZE |*/ AZX_DCAPS_POSFIX_LPIB |\ 313 (/*AZX_DCAPS_ALIGN_BUFSIZE |*/ AZX_DCAPS_POSFIX_LPIB |\
313 AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_POWERWELL |\ 314 AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_COMPONENT |\
314 AZX_DCAPS_SNOOP_TYPE(SCH)) 315 AZX_DCAPS_I915_POWERWELL | AZX_DCAPS_SNOOP_TYPE(SCH))
315 316
316#define AZX_DCAPS_INTEL_BAYTRAIL \ 317#define AZX_DCAPS_INTEL_BAYTRAIL \
317 (AZX_DCAPS_INTEL_PCH_NOPM | AZX_DCAPS_I915_POWERWELL) 318 (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_I915_COMPONENT |\
319 AZX_DCAPS_I915_POWERWELL)
318 320
319#define AZX_DCAPS_INTEL_BRASWELL \ 321#define AZX_DCAPS_INTEL_BRASWELL \
320 (AZX_DCAPS_INTEL_PCH | AZX_DCAPS_I915_POWERWELL) 322 (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME |\
323 AZX_DCAPS_I915_COMPONENT | AZX_DCAPS_I915_POWERWELL)
321 324
322#define AZX_DCAPS_INTEL_SKYLAKE \ 325#define AZX_DCAPS_INTEL_SKYLAKE \
323 (AZX_DCAPS_INTEL_PCH | AZX_DCAPS_SEPARATE_STREAM_TAG |\ 326 (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME |\
327 AZX_DCAPS_SEPARATE_STREAM_TAG | AZX_DCAPS_I915_COMPONENT |\
324 AZX_DCAPS_I915_POWERWELL) 328 AZX_DCAPS_I915_POWERWELL)
325 329
326#define AZX_DCAPS_INTEL_BROXTON \ 330#define AZX_DCAPS_INTEL_BROXTON \
327 (AZX_DCAPS_INTEL_PCH | AZX_DCAPS_SEPARATE_STREAM_TAG |\ 331 (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME |\
332 AZX_DCAPS_SEPARATE_STREAM_TAG | AZX_DCAPS_I915_COMPONENT |\
328 AZX_DCAPS_I915_POWERWELL) 333 AZX_DCAPS_I915_POWERWELL)
329 334
330/* quirks for ATI SB / AMD Hudson */ 335/* quirks for ATI SB / AMD Hudson */
@@ -1008,7 +1013,7 @@ static int azx_suspend(struct device *dev)
1008 1013
1009 if (chip->msi) 1014 if (chip->msi)
1010 pci_disable_msi(chip->pci); 1015 pci_disable_msi(chip->pci);
1011 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL 1016 if ((chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
1012 && hda->need_i915_power) 1017 && hda->need_i915_power)
1013 snd_hdac_display_power(bus, false); 1018 snd_hdac_display_power(bus, false);
1014 1019
@@ -1114,7 +1119,7 @@ static int azx_runtime_suspend(struct device *dev)
1114 azx_stop_chip(chip); 1119 azx_stop_chip(chip);
1115 azx_enter_link_reset(chip); 1120 azx_enter_link_reset(chip);
1116 azx_clear_irq_pending(chip); 1121 azx_clear_irq_pending(chip);
1117 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL 1122 if ((chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
1118 && hda->need_i915_power) 1123 && hda->need_i915_power)
1119 snd_hdac_display_power(azx_bus(chip), false); 1124 snd_hdac_display_power(azx_bus(chip), false);
1120 1125
@@ -1380,8 +1385,7 @@ static int azx_free(struct azx *chip)
1380 if (hda->need_i915_power) 1385 if (hda->need_i915_power)
1381 snd_hdac_display_power(bus, false); 1386 snd_hdac_display_power(bus, false);
1382 } 1387 }
1383 if (chip->driver_type == AZX_DRIVER_PCH || 1388 if (chip->driver_type & AZX_DCAPS_I915_COMPONENT)
1384 (chip->driver_caps & AZX_DCAPS_I915_POWERWELL))
1385 snd_hdac_i915_exit(bus); 1389 snd_hdac_i915_exit(bus);
1386 kfree(hda); 1390 kfree(hda);
1387 1391
@@ -2199,8 +2203,7 @@ static int azx_probe_continue(struct azx *chip)
2199 hda->probe_continued = 1; 2203 hda->probe_continued = 1;
2200 2204
2201 /* bind with i915 if needed */ 2205 /* bind with i915 if needed */
2202 if (chip->driver_type == AZX_DRIVER_PCH || 2206 if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT) {
2203 (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)) {
2204 err = snd_hdac_i915_init(bus); 2207 err = snd_hdac_i915_init(bus);
2205 if (err < 0) { 2208 if (err < 0) {
2206 /* if the controller is bound only with HDMI/DP 2209 /* if the controller is bound only with HDMI/DP
@@ -2214,7 +2217,8 @@ static int azx_probe_continue(struct azx *chip)
2214 goto out_free; 2217 goto out_free;
2215 } else { 2218 } else {
2216 /* don't bother any longer */ 2219 /* don't bother any longer */
2217 chip->driver_caps &= ~AZX_DCAPS_I915_POWERWELL; 2220 chip->driver_caps &=
2221 ~(AZX_DCAPS_I915_COMPONENT | AZX_DCAPS_I915_POWERWELL);
2218 } 2222 }
2219 } 2223 }
2220 } 2224 }
@@ -2279,7 +2283,7 @@ static int azx_probe_continue(struct azx *chip)
2279 pm_runtime_put_autosuspend(&pci->dev); 2283 pm_runtime_put_autosuspend(&pci->dev);
2280 2284
2281out_free: 2285out_free:
2282 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL 2286 if ((chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
2283 && !hda->need_i915_power) 2287 && !hda->need_i915_power)
2284 snd_hdac_display_power(bus, false); 2288 snd_hdac_display_power(bus, false);
2285 2289