Skip to content

Commit

Permalink
ASoC: Intel: Skylake: Move snd_hdac_i915_init to before probe_work.
Browse files Browse the repository at this point in the history
Now that we can use -EPROBE_DEFER, it's no longer required to spin off
the snd_hdac_i915_init into a workqueue. It's likely the whole workqueue
can be destroyed, but I don't have the means to test this.

Removing the workqueue would simplify init even further, but is left
as exercise for the reviewer.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20231009115437.99976-12-maarten.lankhorst@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Maarten Lankhorst authored and Takashi Iwai committed Oct 19, 2023
1 parent 65cbbfa commit e46f137
Showing 1 changed file with 9 additions and 22 deletions.
31 changes: 9 additions & 22 deletions sound/soc/intel/skylake/skl.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,35 +783,15 @@ static void skl_codec_create(struct hdac_bus *bus)
}
}

static int skl_i915_init(struct hdac_bus *bus)
{
int err;

/*
* The HDMI codec is in GPU so we need to ensure that it is powered
* up and ready for probe
*/
err = snd_hdac_i915_init(bus, true);
if (err < 0)
return err;

snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, true);

return 0;
}

static void skl_probe_work(struct work_struct *work)
{
struct skl_dev *skl = container_of(work, struct skl_dev, probe_work);
struct hdac_bus *bus = skl_to_bus(skl);
struct hdac_ext_link *hlink;
int err;

if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {
err = skl_i915_init(bus);
if (err < 0)
return;
}
if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, true);

skl_init_pci(skl);
skl_dum_set(bus);
Expand Down Expand Up @@ -1075,10 +1055,17 @@ static int skl_probe(struct pci_dev *pci,
goto out_dsp_free;
}

if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {
err = snd_hdac_i915_init(bus, false);
if (err < 0)
goto out_dmic_unregister;
}
schedule_work(&skl->probe_work);

return 0;

out_dmic_unregister:
skl_dmic_device_unregister(skl);
out_dsp_free:
skl_free_dsp(skl);
out_clk_free:
Expand Down

0 comments on commit e46f137

Please sign in to comment.