Skip to content

Commit e454ff8

Browse files
committed
ALSA: hda/intel: Drop superfluous AZX_DCAPS_I915_POWERWELL checks
snd_hdac_display_power() can be called even for a HDA controller without DRM binding. The same is true for other helpers, snd_hdac_i915_set_bclk() and snd_hdac_set_codec_wakeup(). So all superfluous AZX_DCAPS_I915_POWERWELL checks in hda_intel.c can be dropped, and the definition of AZX_DCAPS_I915_POWERWELL itself can be removed as well. This simplifies the code a lot. Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 029d92c commit e454ff8

2 files changed

Lines changed: 28 additions & 51 deletions

File tree

‎sound/pci/hda/hda_controller.h‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,7 @@
5050
/* 24 unused */
5151
#define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */
5252
#define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */
53-
#ifdef CONFIG_SND_HDA_I915
54-
#define AZX_DCAPS_I915_POWERWELL (1 << 27) /* HSW i915 powerwell support */
55-
#else
56-
#define AZX_DCAPS_I915_POWERWELL 0 /* NOP */
57-
#endif
53+
/* 27 unused */
5854
#define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */
5955
#define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */
6056
#define AZX_DCAPS_SEPARATE_STREAM_TAG (1 << 30) /* capture and playback use separate stream tag */

‎sound/pci/hda/hda_intel.c‎

Lines changed: 27 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -310,31 +310,28 @@ enum {
310310
#define AZX_DCAPS_INTEL_HASWELL \
311311
(/*AZX_DCAPS_ALIGN_BUFSIZE |*/ AZX_DCAPS_COUNT_LPIB_DELAY |\
312312
AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_COMPONENT |\
313-
AZX_DCAPS_I915_POWERWELL | AZX_DCAPS_SNOOP_TYPE(SCH))
313+
AZX_DCAPS_SNOOP_TYPE(SCH))
314314

315315
/* Broadwell HDMI can't use position buffer reliably, force to use LPIB */
316316
#define AZX_DCAPS_INTEL_BROADWELL \
317317
(/*AZX_DCAPS_ALIGN_BUFSIZE |*/ AZX_DCAPS_POSFIX_LPIB |\
318318
AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_COMPONENT |\
319-
AZX_DCAPS_I915_POWERWELL | AZX_DCAPS_SNOOP_TYPE(SCH))
319+
AZX_DCAPS_SNOOP_TYPE(SCH))
320320

321321
#define AZX_DCAPS_INTEL_BAYTRAIL \
322-
(AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_I915_COMPONENT |\
323-
AZX_DCAPS_I915_POWERWELL)
322+
(AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_I915_COMPONENT)
324323

325324
#define AZX_DCAPS_INTEL_BRASWELL \
326325
(AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME |\
327-
AZX_DCAPS_I915_COMPONENT | AZX_DCAPS_I915_POWERWELL)
326+
AZX_DCAPS_I915_COMPONENT)
328327

329328
#define AZX_DCAPS_INTEL_SKYLAKE \
330329
(AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME |\
331-
AZX_DCAPS_SEPARATE_STREAM_TAG | AZX_DCAPS_I915_COMPONENT |\
332-
AZX_DCAPS_I915_POWERWELL)
330+
AZX_DCAPS_SEPARATE_STREAM_TAG | AZX_DCAPS_I915_COMPONENT)
333331

334332
#define AZX_DCAPS_INTEL_BROXTON \
335333
(AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME |\
336-
AZX_DCAPS_SEPARATE_STREAM_TAG | AZX_DCAPS_I915_COMPONENT |\
337-
AZX_DCAPS_I915_POWERWELL)
334+
AZX_DCAPS_SEPARATE_STREAM_TAG | AZX_DCAPS_I915_COMPONENT)
338335

339336
/* quirks for ATI SB / AMD Hudson */
340337
#define AZX_DCAPS_PRESET_ATI_SB \
@@ -591,8 +588,7 @@ static void hda_intel_init_chip(struct azx *chip, bool full_reset)
591588
struct pci_dev *pci = chip->pci;
592589
u32 val;
593590

594-
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
595-
snd_hdac_set_codec_wakeup(bus, true);
591+
snd_hdac_set_codec_wakeup(bus, true);
596592
if (chip->driver_type == AZX_DRIVER_SKL) {
597593
pci_read_config_dword(pci, INTEL_HDA_CGCTL, &val);
598594
val = val & ~INTEL_HDA_CGCTL_MISCBDCGE;
@@ -604,8 +600,8 @@ static void hda_intel_init_chip(struct azx *chip, bool full_reset)
604600
val = val | INTEL_HDA_CGCTL_MISCBDCGE;
605601
pci_write_config_dword(pci, INTEL_HDA_CGCTL, val);
606602
}
607-
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
608-
snd_hdac_set_codec_wakeup(bus, false);
603+
604+
snd_hdac_set_codec_wakeup(bus, false);
609605

610606
/* reduce dma latency to avoid noise */
611607
if (IS_BXT(pci))
@@ -945,14 +941,10 @@ static bool azx_is_pm_ready(struct snd_card *card)
945941

946942
static void __azx_runtime_suspend(struct azx *chip)
947943
{
948-
struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
949-
950944
azx_stop_chip(chip);
951945
azx_enter_link_reset(chip);
952946
azx_clear_irq_pending(chip);
953-
if ((chip->driver_caps & AZX_DCAPS_I915_POWERWELL) &&
954-
hda->need_i915_power)
955-
display_power(chip, false);
947+
display_power(chip, false);
956948
}
957949

958950
static void __azx_runtime_resume(struct azx *chip)
@@ -962,11 +954,9 @@ static void __azx_runtime_resume(struct azx *chip)
962954
struct hda_codec *codec;
963955
int status;
964956

965-
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
966-
display_power(chip, true);
967-
if (hda->need_i915_power)
968-
snd_hdac_i915_set_bclk(bus);
969-
}
957+
display_power(chip, true);
958+
if (hda->need_i915_power)
959+
snd_hdac_i915_set_bclk(bus);
970960

971961
/* Read STATESTS before controller reset */
972962
status = azx_readw(chip, STATESTS);
@@ -982,8 +972,7 @@ static void __azx_runtime_resume(struct azx *chip)
982972
}
983973

984974
/* power down again for link-controlled chips */
985-
if ((chip->driver_caps & AZX_DCAPS_I915_POWERWELL) &&
986-
!hda->need_i915_power)
975+
if (!hda->need_i915_power)
987976
display_power(chip, false);
988977
}
989978

@@ -1347,11 +1336,8 @@ static int azx_free(struct azx *chip)
13471336
#ifdef CONFIG_SND_HDA_PATCH_LOADER
13481337
release_firmware(chip->fw);
13491338
#endif
1339+
display_power(chip, false);
13501340

1351-
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
1352-
if (hda->need_i915_power)
1353-
display_power(chip, false);
1354-
}
13551341
if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT)
13561342
snd_hdac_i915_exit(bus);
13571343
kfree(hda);
@@ -1908,8 +1894,7 @@ static int azx_first_init(struct azx *chip)
19081894
/* initialize chip */
19091895
azx_init_pci(chip);
19101896

1911-
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
1912-
snd_hdac_i915_set_bclk(bus);
1897+
snd_hdac_i915_set_bclk(bus);
19131898

19141899
hda_intel_init_chip(chip, (probe_only[dev] & 2) == 0);
19151900

@@ -2217,28 +2202,25 @@ static int azx_probe_continue(struct azx *chip)
22172202
goto out_free;
22182203
} else {
22192204
/* don't bother any longer */
2220-
chip->driver_caps &=
2221-
~(AZX_DCAPS_I915_COMPONENT | AZX_DCAPS_I915_POWERWELL);
2205+
chip->driver_caps &= ~AZX_DCAPS_I915_COMPONENT;
22222206
}
22232207
}
2208+
2209+
/* HSW/BDW controllers need this power */
2210+
if (CONTROLLER_IN_GPU(pci))
2211+
hda->need_i915_power = 1;
22242212
}
22252213

22262214
/* Request display power well for the HDA controller or codec. For
22272215
* Haswell/Broadwell, both the display HDA controller and codec need
22282216
* this power. For other platforms, like Baytrail/Braswell, only the
22292217
* display codec needs the power and it can be released after probe.
22302218
*/
2231-
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
2232-
/* HSW/BDW controllers need this power */
2233-
if (CONTROLLER_IN_GPU(pci))
2234-
hda->need_i915_power = 1;
2235-
2236-
err = display_power(chip, true);
2237-
if (err < 0) {
2238-
dev_err(chip->card->dev,
2239-
"Cannot turn on display power on i915\n");
2240-
goto i915_power_fail;
2241-
}
2219+
err = display_power(chip, true);
2220+
if (err < 0) {
2221+
dev_err(chip->card->dev,
2222+
"Cannot turn on display power on i915\n");
2223+
goto i915_power_fail;
22422224
}
22432225

22442226
err = azx_first_init(chip);
@@ -2287,8 +2269,7 @@ static int azx_probe_continue(struct azx *chip)
22872269
pm_runtime_put_autosuspend(&pci->dev);
22882270

22892271
out_free:
2290-
if ((chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
2291-
&& !hda->need_i915_power)
2272+
if (!hda->need_i915_power)
22922273
display_power(chip, false);
22932274

22942275
i915_power_fail:

0 commit comments

Comments
 (0)