sound/for-next: Cherry pick patches from sound/for-next
Subsystems (4)
cover sound/for-next: Cherry pick patches from sound/for-next
Sound patches have been merged to the sound tree, rebase Xe on top of the new patches.
Maarten Lankhorst (13):
Revert "sound/soc/sof: Remove deferred probe for SOF" Revert "sound/hda: Allow XE as i915 replacement for sound"
ASoC: SOF: core: Ensure sof_ops_free() is still called when probe
never ran.
ASoC: SOF: Intel: Fix error handling in hda_init()
ALSA: hda: Intel: Fix error handling in azx_probe()
ALSA: hda: i915: Allow override of gpu binding.
ALSA: hda: i915: Add an allow_modprobe argument to snd_hdac_i915_init
ALSA: hda: i915: Allow xe as match for i915_component_master_match
ASoC: Intel: avs: Move snd_hdac_i915_init to before probe_work.
ALSA: hda: Intel: Move snd_hdac_i915_init to before probe_work.
ASoC: Intel: Skylake: Move snd_hdac_i915_init to before probe_work.
ASoC: SOF: Intel: Move binding to display driver outside of deferred
probe
ALSA: hda: i915: Remove extra argument from snd_hdac_i915_init
Pierre-Louis Bossart (2):
ASoC: SOF: core: Add probe_early and remove_late callbacks
ASoC: SOF: Intel: hda: start splitting the probe
sound/hda/hdac_i915.c | 19 ++++++-- sound/pci/hda/hda_intel.c | 64 ++++++++++++------------- sound/soc/intel/avs/core.c | 4 +- sound/soc/intel/skylake/skl.c | 31 ++++-------- sound/soc/sof/Kconfig | 19 ++++++++ sound/soc/sof/core.c | 53 ++++++++++++++++++++- sound/soc/sof/intel/hda-common-ops.c | 2 + sound/soc/sof/intel/hda.c | 70 +++++++++++++++------------- sound/soc/sof/intel/hda.h | 2 + sound/soc/sof/ops.h | 16 +++++++ sound/soc/sof/sof-pci-dev.c | 3 +- sound/soc/sof/sof-priv.h | 7 +++ 12 files changed, 193 insertions(+), 97 deletions(-)
Signature · 1 line
2.39.2
PATCH 1/15 Revert "sound/soc/sof: Remove deferred probe for SOF"
This reverts commit 53bccb72d202d8fa8575e81d1c78adc4e6a6ea1f.
--- sound/hda/hdac_i915.c | 2 +- sound/soc/sof/Kconfig | 19 +++++++++++++++++++ sound/soc/sof/core.c | 38 +++++++++++++++++++++++++++++++++++-- sound/soc/sof/intel/hda.c | 25 +++++++++++------------- sound/soc/sof/sof-pci-dev.c | 3 ++- sound/soc/sof/sof-priv.h | 5 +++++ 6 files changed, 74 insertions(+), 18 deletions(-)
sound/hda/hdac_i915.c +1 -1
@@ -185,7 +185,7 @@ int snd_hdac_i915_init(struct hdac_bus *bus)return err; acomp = bus->audio_component;if (!acomp || !acomp->ops) { -dev_dbg (bus->dev,"couldn't bind with audio component\n" ); +dev_info (bus->dev,"couldn't bind with audio component\n" );snd_hdac_acomp_exit (bus);return -EPROBE_DEFER ; }
sound/soc/sof/Kconfig +19 -0
@@ -82,6 +82,17 @@ config SND_SOC_SOF_DEVELOPER_SUPPORT if SND_SOC_SOF_DEVELOPER_SUPPORT +config SND_SOC_SOF_FORCE_PROBE_WORKQUEUE + bool "SOF force probe workqueue" + select SND_SOC_SOF_PROBE_WORK_QUEUE + help + This option forces the use of a probe workqueue, which is only used + when HDaudio is enabled due to module dependencies. Forcing this + option is intended for debug only, but this should not add any + functional issues in nominal cases. + Say Y if you are involved in SOF development and need this option. + If not, select N. + config SND_SOC_SOF_NOCODEC tristate
@@ -260,6 +271,14 @@ config SND_SOC_SOF module dependencies but since the module or built-in type is decided at the top level it doesn't matter. +config SND_SOC_SOF_PROBE_WORK_QUEUE + bool + help + This option is not user-selectable but automagically handled by + 'select' statements at a higher level. + When selected, the probe is handled in two steps, for example to + avoid lockdeps if request_module is used in the probe. + # Supported IPC versions config SND_SOC_SOF_IPC3 bool
sound/soc/sof/core.c +36 -2
@@ -191,8 +191,7 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)/* probe the DSP hardware */ ret =snd_sof_probe (sdev);if (ret <0 ) { -if (ret != -EPROBE_DEFER ) -dev_err (sdev->dev,"error: failed to probe DSP %d\n" , ret); +dev_err (sdev->dev,"error: failed to probe DSP %d\n" , ret); goto probe_err; }
@@ -310,6 +309,8 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)if (plat_data->sof_probe_complete) plat_data->sof_probe_complete (sdev->dev); + sdev->probe_completed = true; +return 0 ; sof_machine_err:
@@ -335,6 +336,19 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)return ret; } +static void sof_probe_work (struct work_struct *work) +{ +struct snd_sof_dev *sdev = + container_of(work, struct snd_sof_dev, probe_work); +int ret; + + ret =sof_probe_continue (sdev); +if (ret <0 ) { +/* errors cannot be propagated, log */ +dev_err (sdev->dev,"error: %s failed err: %d\n" , __func__, ret); + } +} +int snd_sof_device_probe (struct device *dev,struct snd_sof_pdata *plat_data) {struct snd_sof_dev *sdev;
@@ -422,16 +436,33 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data)sof_set_fw_state (sdev,SOF_FW_BOOT_NOT_STARTED ); +if (IS_ENABLED (CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE )) { +INIT_WORK (&sdev->probe_work, sof_probe_work); +schedule_work (&sdev->probe_work); +return 0 ; + } +return sof_probe_continue (sdev); }EXPORT_SYMBOL (snd_sof_device_probe); +bool snd_sof_device_probe_completed (struct device *dev) +{ +struct snd_sof_dev *sdev =dev_get_drvdata (dev); + +return sdev->probe_completed; +} +EXPORT_SYMBOL (snd_sof_device_probe_completed); +int snd_sof_device_remove (struct device *dev) {struct snd_sof_dev *sdev =dev_get_drvdata (dev);struct snd_sof_pdata *pdata = sdev->pdata;int ret; +if (IS_ENABLED (CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE )) +cancel_work_sync (&sdev->probe_work); +/* * Unregister any registered client device first before IPC and debugfs * to allow client drivers to be removed cleanly
@@ -469,6 +500,9 @@ int snd_sof_device_shutdown(struct device *dev) {struct snd_sof_dev *sdev =dev_get_drvdata (dev); +if (IS_ENABLED (CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE )) +cancel_work_sync (&sdev->probe_work); +if (sdev->fw_state ==SOF_FW_BOOT_COMPLETE ) {sof_fw_trace_free (sdev);return snd_sof_shutdown (sdev);
sound/soc/sof/intel/hda.c +11 -14
@@ -1165,6 +1165,14 @@ int hda_dsp_probe(struct snd_sof_dev *sdev) sdev->pdata->hw_pdata = hdev; hdev->desc = chip; + hdev->dmic_dev =platform_device_register_data (sdev->dev,"dmic-codec" , +PLATFORM_DEVID_NONE , +NULL ,0 ); +if (IS_ERR (hdev->dmic_dev)) { +dev_err (sdev->dev,"error: failed to create DMIC device\n" ); +return PTR_ERR (hdev->dmic_dev); + } +/* * use position update IPC if either it is forced * or we don't have other choice
@@ -1184,15 +1192,6 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)if (ret <0 ) goto hdac_bus_unmap; - hdev->dmic_dev =platform_device_register_data (sdev->dev,"dmic-codec" , -PLATFORM_DEVID_NONE , -NULL ,0 ); -if (IS_ERR (hdev->dmic_dev)) { -dev_err (sdev->dev,"error: failed to create DMIC device\n" ); - ret =PTR_ERR (hdev->dmic_dev); - goto hdac_exit; - } -if (sdev->dspless_mode_selected) goto skip_dsp_setup;
@@ -1201,7 +1200,7 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)if (!sdev->bar[HDA_DSP_BAR ]) {dev_err (sdev->dev,"error: ioremap error\n" ); ret = -ENXIO ; - goto platform_unreg; + goto hdac_bus_unmap; } sdev->mmio_bar =HDA_DSP_BAR ;
@@ -1299,12 +1298,10 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)/* dsp_unmap: not currently used */ if (!sdev->dspless_mode_selected)iounmap (sdev->bar[HDA_DSP_BAR ]); -platform_unreg: -platform_device_unregister (hdev->dmic_dev); -hdac_exit: -hda_codec_i915_exit (sdev); hdac_bus_unmap: +platform_device_unregister (hdev->dmic_dev);iounmap (bus->remap_addr); +hda_codec_i915_exit (sdev); err:return ret; }
sound/soc/sof/sof-pci-dev.c +2 -1
@@ -339,7 +339,8 @@ void sof_pci_remove(struct pci_dev *pci)snd_sof_device_remove (&pci->dev);/* follow recommendation in pci-driver.c to increment usage counter */ -if (!(sof_pci_debug &SOF_PCI_DISABLE_PM_RUNTIME )) +if (snd_sof_device_probe_completed (&pci->dev) && + !(sof_pci_debug &SOF_PCI_DISABLE_PM_RUNTIME ))pm_runtime_get_noresume (&pci->dev);/* release pci regions and disable device */
sound/soc/sof/sof-priv.h +5 -0
@@ -564,6 +564,10 @@ struct snd_sof_dev {enum sof_fw_state fw_state;bool first_boot; +/* work queue in case the probe is implemented in two steps */ +struct work_struct probe_work; +bool probe_completed; +/* DSP HW differentiation */ struct snd_sof_pdata *pdata;
@@ -671,6 +675,7 @@ struct snd_sof_dev {int snd_sof_device_probe (struct device *dev,struct snd_sof_pdata *plat_data);int snd_sof_device_remove (struct device *dev);int snd_sof_device_shutdown (struct device *dev); +bool snd_sof_device_probe_completed (struct device *dev);int snd_sof_runtime_suspend (struct device *dev);int snd_sof_runtime_resume (struct device *dev);
Signature · 1 line
2.39.2
PATCH 2/15 Revert "sound/hda: Allow XE as i915 replacement for sound"
In reply to Maarten LankhorstThis reverts commit 3cfcbd459fdcb8387b29869f96540654acc833ab.
--- sound/hda/hdac_i915.c | 17 +++++++++--- sound/pci/hda/hda_intel.c | 53 +++++++++++++++++--------------------- sound/soc/intel/avs/core.c | 13 +++------- sound/soc/sof/intel/hda.c | 7 ++--- 4 files changed, 43 insertions(+), 47 deletions(-)
sound/hda/hdac_i915.c +13 -4
@@ -109,8 +109,7 @@ static int i915_component_master_match(struct device *dev, int subcomponent, hdac_pci =to_pci_dev (bus->dev); i915_pci =to_pci_dev (dev); -if ((!strcmp (dev->driver->name,"i915" ) || - !strcmp (dev->driver->name,"xe" )) && +if (!strcmp (dev->driver->name,"i915" ) && subcomponent ==I915_COMPONENT_AUDIO &&connectivity_check (i915_pci, hdac_pci))return 1 ;
@@ -184,10 +183,20 @@ int snd_hdac_i915_init(struct hdac_bus *bus)if (err <0 )return err; acomp = bus->audio_component; -if (!acomp || !acomp->ops) { +if (!acomp) +return -ENODEV ; +if (!acomp->ops) { +if (!IS_ENABLED (CONFIG_MODULES ) || + !request_module ("i915" )) { +/* 60s timeout */ +wait_for_completion_killable_timeout (&acomp->master_bind_complete, +msecs_to_jiffies (60 *1000 )); + } + } +if (!acomp->ops) {dev_info (bus->dev,"couldn't bind with audio component\n" );snd_hdac_acomp_exit (bus); -return -EPROBE_DEFER ; +return -ENODEV ; }return 0 ; }
sound/pci/hda/hda_intel.c +24 -29
77 lines not on this page · raw message
sound/soc/intel/avs/core.c +4 -9
@@ -191,6 +191,10 @@ static void avs_hda_probe_work(struct work_struct *work)pm_runtime_set_active (bus->dev);/* clear runtime_error flag */ + ret =snd_hdac_i915_init (bus); +if (ret <0 ) +dev_info (bus->dev,"i915 init unsuccessful: %d\n" , ret); +snd_hdac_display_power (bus,HDA_CODEC_IDX_CONTROLLER , true);avs_hdac_bus_init_chip (bus, true);avs_hdac_bus_probe_codecs (bus);
@@ -461,19 +465,10 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)pci_set_drvdata (pci, bus);device_disable_async_suspend (dev); - ret =snd_hdac_i915_init (bus); -if (ret == -EPROBE_DEFER ) - goto err_unmaster; -else if (ret <0 ) -dev_info (bus->dev,"i915 init unsuccessful: %d\n" , ret); -schedule_work (&adev->probe_work);return 0 ; -err_unmaster: -pci_clear_master (pci); -pci_set_drvdata (pci,NULL ); err_acquire_irq:snd_hdac_bus_free_stream_pages (bus);snd_hdac_ext_stream_free_all (bus);
sound/soc/sof/intel/hda.c +2 -5
@@ -848,11 +848,8 @@ static int hda_init(struct snd_sof_dev *sdev)/* init i915 and HDMI codecs */ ret =hda_codec_i915_init (sdev); -if (ret <0 ) { -if (ret != -EPROBE_DEFER ) -dev_warn (sdev->dev,"init of i915 and HDMI codec failed: %i\n" , ret); -return ret; - } +if (ret <0 ) +dev_warn (sdev->dev,"init of i915 and HDMI codec failed\n" );/* get controller capabilities */ ret =hda_dsp_ctrl_get_caps (sdev);
Signature · 1 line
2.39.2
PATCH 3/15 ASoC: SOF: core: Ensure sof_ops_free() is still called when probe never ran.
In reply to Maarten LankhorstIn an effort to not call sof_ops_free twice, we stopped running it when probe was aborted.
Check the result of cancel_work_sync to see if this was the case.
--- sound/soc/sof/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/sof/core.c +5 -1
@@ -459,9 +459,10 @@ int snd_sof_device_remove(struct device *dev)struct snd_sof_dev *sdev =dev_get_drvdata (dev);struct snd_sof_pdata *pdata = sdev->pdata;int ret; +bool aborted = false;if (IS_ENABLED (CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE )) -cancel_work_sync (&sdev->probe_work); + aborted =cancel_work_sync (&sdev->probe_work);/* * Unregister any registered client device first before IPC and debugfs
@@ -487,6 +488,9 @@ int snd_sof_device_remove(struct device *dev)snd_sof_free_debug (sdev);snd_sof_remove (sdev);sof_ops_free (sdev); + }else if (aborted) { +/* probe_work never ran */ +sof_ops_free (sdev); }/* release firmware */
Signature · 1 line
2.39.2
PATCH 4/15 ASoC: SOF: core: Add probe_early and remove_late callbacks
In reply to Maarten LankhorstFrom: Pierre-Louis Bossart <[email protected]>
The existing DSP probe may be handled in a workqueue to allow for extra time, typically for the i915 request_module and HDAudio codec handling.
With the upcoming changes for i915/Xe driver relying on the -EPROBE_DEFER mechanism, we need to have a first pass of the probe which cannot be pushed to a workqueue. Introduce 2 new optional callbacks.
probe_early is called before the workqueue runs. remove_late may be called from the workqueue if load is unsuccesful, but will otherwise be called on module unload.
--- sound/soc/sof/core.c | 11 +++++++++++ sound/soc/sof/ops.h | 16 ++++++++++++++++ sound/soc/sof/sof-priv.h | 2 ++ 3 files changed, 29 insertions(+)
sound/soc/sof/core.c +11 -0
@@ -327,6 +327,7 @@ static int sof_probe_continue(struct snd_sof_dev *sdev) dsp_err:snd_sof_remove (sdev); probe_err: +snd_sof_remove_late (sdev);sof_ops_free (sdev);/* all resources freed, update state to match */
@@ -436,6 +437,14 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data)sof_set_fw_state (sdev,SOF_FW_BOOT_NOT_STARTED ); +/* +* first pass of probe which isn't allowed to run in a work-queue, +* typically to rely on -EPROBE_DEFER dependencies +*/ + ret =snd_sof_probe_early (sdev); +if (ret <0 ) +return ret; +if (IS_ENABLED (CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE )) {INIT_WORK (&sdev->probe_work, sof_probe_work);schedule_work (&sdev->probe_work);
@@ -487,9 +496,11 @@ int snd_sof_device_remove(struct device *dev)snd_sof_ipc_free (sdev);snd_sof_free_debug (sdev);snd_sof_remove (sdev); +snd_sof_remove_late (sdev);sof_ops_free (sdev); }else if (aborted) {/* probe_work never ran */ +snd_sof_remove_late (sdev);sof_ops_free (sdev); }
sound/soc/sof/ops.h +16 -0
@@ -38,6 +38,14 @@ static inline void sof_ops_free(struct snd_sof_dev *sdev)/* Mandatory operations are verified during probing */ /* init */ +static inline int snd_sof_probe_early (struct snd_sof_dev *sdev) +{ +if (sof_ops (sdev)->probe_early) +return sof_ops (sdev)->probe_early (sdev); + +return 0 ; +} +static inline int snd_sof_probe (struct snd_sof_dev *sdev) {return sof_ops (sdev)->probe (sdev);
@@ -51,6 +59,14 @@ static inline int snd_sof_remove(struct snd_sof_dev *sdev)return 0 ; } +static inline int snd_sof_remove_late (struct snd_sof_dev *sdev) +{ +if (sof_ops (sdev)->remove_late) +return sof_ops (sdev)->remove_late (sdev); + +return 0 ; +} +static inline int snd_sof_shutdown (struct snd_sof_dev *sdev) {if (sof_ops (sdev)->shutdown)
sound/soc/sof/sof-priv.h +2 -0
@@ -165,8 +165,10 @@ struct sof_firmware {struct snd_sof_dsp_ops {/* probe/remove/shutdown */ +int (*probe_early)(struct snd_sof_dev *sof_dev);/* optional */ int (*probe)(struct snd_sof_dev *sof_dev);/* mandatory */ int (*remove)(struct snd_sof_dev *sof_dev);/* optional */ +int (*remove_late)(struct snd_sof_dev *sof_dev);/* optional */ int (*shutdown)(struct snd_sof_dev *sof_dev);/* optional */ /* DSP core boot / reset */
Signature · 1 line
2.39.2
PATCH 5/15 ASoC: SOF: Intel: hda: start splitting the probe
In reply to Maarten LankhorstFrom: Pierre-Louis Bossart <[email protected]>
This patch moves the initial parts of the probe to the probe_early() callback, which provides a much faster decision on whether the SOF driver shall deal with a specific platform or yield to other Intel drivers.
This is a limited functionality change, the bigger change is to move the i915/Xe initialization to the probe_early().
--- sound/soc/sof/intel/hda-common-ops.c | 1 + sound/soc/sof/intel/hda.c | 16 +++++++++++++--- sound/soc/sof/intel/hda.h | 1 + 3 files changed, 15 insertions(+), 3 deletions(-)
sound/soc/sof/intel/hda-common-ops.c +1 -0
@@ -16,6 +16,7 @@struct snd_sof_dsp_ops sof_hda_common_ops = {/* probe/remove/shutdown */ + .probe_early = hda_dsp_probe_early, .probe = hda_dsp_probe, .remove = hda_dsp_remove,
sound/soc/sof/intel/hda.c +13 -3
@@ -1118,11 +1118,10 @@ static irqreturn_t hda_dsp_interrupt_thread(int irq, void *context)return IRQ_HANDLED ; } -int hda_dsp_probe (struct snd_sof_dev *sdev) +int hda_dsp_probe_early (struct snd_sof_dev *sdev) {struct pci_dev *pci =to_pci_dev (sdev->dev);struct sof_intel_hda_dev *hdev; -struct hdac_bus *bus;const struct sof_intel_dsp_desc *chip;int ret =0 ;
@@ -1162,6 +1161,17 @@ int hda_dsp_probe(struct snd_sof_dev *sdev) sdev->pdata->hw_pdata = hdev; hdev->desc = chip; +err: +return ret; +} + +int hda_dsp_probe (struct snd_sof_dev *sdev) +{ +struct pci_dev *pci =to_pci_dev (sdev->dev); +struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; +struct hdac_bus *bus; +int ret =0 ; + hdev->dmic_dev =platform_device_register_data (sdev->dev,"dmic-codec" ,PLATFORM_DEVID_NONE ,NULL ,0 );
@@ -1299,7 +1309,7 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)platform_device_unregister (hdev->dmic_dev);iounmap (bus->remap_addr);hda_codec_i915_exit (sdev); -err: +return ret; }
sound/soc/sof/intel/hda.h +1 -0
@@ -573,6 +573,7 @@ struct sof_intel_hda_stream {/* * DSP Core services. */ +int hda_dsp_probe_early (struct snd_sof_dev *sdev);int hda_dsp_probe (struct snd_sof_dev *sdev);int hda_dsp_remove (struct snd_sof_dev *sdev);int hda_dsp_core_power_up (struct snd_sof_dev *sdev,unsigned int core_mask);
Signature · 1 line
2.39.2
PATCH 6/15 ASoC: SOF: Intel: Fix error handling in hda_init()
In reply to Maarten LankhorstThe hda_codec_i915_init() errors are ignored inhda_init() so it can never return -EPROBE_DEFER.
Fix this before we move the call to hda_init() from the deferred probe to early probe.
While at it, also fix error handling when hda_dsp_ctrl_get_caps fails.
--- sound/soc/sof/intel/hda.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
sound/soc/sof/intel/hda.c +11 -3
@@ -848,13 +848,21 @@ static int hda_init(struct snd_sof_dev *sdev)/* init i915 and HDMI codecs */ ret =hda_codec_i915_init (sdev); -if (ret <0 ) -dev_warn (sdev->dev,"init of i915 and HDMI codec failed\n" ); +if (ret <0 && ret != -ENODEV ) { +dev_err_probe (sdev->dev, ret,"init of i915 and HDMI codec failed\n" ); + goto out; + }/* get controller capabilities */ ret =hda_dsp_ctrl_get_caps (sdev); -if (ret <0 ) +if (ret <0 ) {dev_err (sdev->dev,"error: get caps error\n" ); +hda_codec_i915_exit (sdev); + } + +out: +if (ret <0 ) +iounmap (sof_to_bus (sdev)->remap_addr);return ret; }
Signature · 1 line
2.39.2
PATCH 7/15 ALSA: hda: Intel: Fix error handling in azx_probe()
In reply to Maarten LankhorstAdd missing pci_set_drv to NULL call on error.
--- sound/pci/hda/hda_intel.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/hda_intel.c +1 -0
@@ -2176,6 +2176,7 @@ static int azx_probe(struct pci_dev *pci,return 0 ; out_free: +pci_set_drvdata (pci,NULL );snd_card_free (card);return err; }
Signature · 1 line
2.39.2
PATCH 8/15 ALSA: hda: i915: Allow override of gpu binding.
In reply to Maarten LankhorstSelecting CONFIG_DRM selects CONFIG_VIDEO_NOMODESET, which exports video_firmware_drivers_only(). This can be used as a first approximation on whether i915 will be available. It's safe to use as this is only built when CONFIG_SND_HDA_I915 is selected by CONFIG_I915.
It's not completely fool proof, as you can boot with "nomodeset i915.modeset=1" to make i915 load regardless, or use "i915.force_probe=!*" to never load i915, but the common case of booting with nomodeset to disable all GPU drivers this will work as intended.
Because of this, we add an extra module parameter, snd_hda_core.gpu_bind that can be used to signal users intent. -1 follows nomodeset, 0 disables binding, 1 forces wait/-EPROBE_DEFER on binding.
--- sound/hda/hdac_i915.c | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/hda/hdac_i915.c +9 -0
@@ -10,6 +10,12 @@#include <sound/hdaudio.h> #include <sound/hda_i915.h> #include <sound/hda_register.h> +#include <video/nomodeset.h> + +static int gpu_bind =-1 ; +module_param (gpu_bind, int,0644 ); +MODULE_PARM_DESC (gpu_bind,"Whether to bind sound component to GPU " +"(1=always, 0=never, -1=on nomodeset(default))" );/** * snd_hdac_i915_set_bclk - Reprogram BCLK for HSW/BDW
@@ -122,6 +128,9 @@ static int i915_gfx_present(struct pci_dev *hdac_pci) {struct pci_dev *display_dev =NULL ; +if (!gpu_bind || (gpu_bind <0 &&video_firmware_drivers_only ())) +return false; +for_each_pci_dev (display_dev) { if (display_dev->vendor == PCI_VENDOR_ID_INTEL && (display_dev->class >> 16) == PCI_BASE_CLASS_DISPLAY &&
Signature · 1 line
2.39.2
PATCH 9/15 ALSA: hda: i915: Add an allow_modprobe argument to snd_hdac_i915_init
In reply to Maarten LankhorstXe is a new GPU driver that re-uses the display (and sound) code from i915. It's no longer possible to load i915, as the GPU can be driven by the xe driver instead.
The new behavior will return -EPROBE_DEFER, and wait for a compatible driver to be loaded instead of modprobing i915.
Converting all drivers at the same time is a lot of work, instead we will convert each user one by one.
--- include/sound/hda_i915.h | 4 ++-- sound/hda/hdac_i915.c | 8 ++++---- sound/pci/hda/hda_intel.c | 2 +- sound/soc/intel/avs/core.c | 2 +- sound/soc/intel/skylake/skl.c | 2 +- sound/soc/sof/intel/hda-codec.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-)
include/sound/hda_i915.h +2 -2
@@ -9,12 +9,12 @@#ifdef CONFIG_SND_HDA_I915 void snd_hdac_i915_set_bclk (struct hdac_bus *bus); -int snd_hdac_i915_init (struct hdac_bus *bus); +int snd_hdac_i915_init (struct hdac_bus *bus,bool allow_modprobe);#else static inline void snd_hdac_i915_set_bclk (struct hdac_bus *bus) { } -static inline int snd_hdac_i915_init (struct hdac_bus *bus) +static inline int snd_hdac_i915_init (struct hdac_bus *bus,bool allow_modprobe) {return -ENODEV ; }
sound/hda/hdac_i915.c +4 -4
@@ -175,7 +175,7 @@ static bool dg1_gfx_present(void)* * Returns zero for success or a negative error code. */ -int snd_hdac_i915_init (struct hdac_bus *bus) +int snd_hdac_i915_init (struct hdac_bus *bus,bool allow_modprobe) {struct drm_audio_component *acomp;int err;
@@ -194,7 +194,7 @@ int snd_hdac_i915_init(struct hdac_bus *bus) acomp = bus->audio_component;if (!acomp)return -ENODEV ; -if (!acomp->ops) { +if (allow_modprobe && !acomp->ops) {if (!IS_ENABLED (CONFIG_MODULES ) || !request_module ("i915" )) {/* 60s timeout */
@@ -203,9 +203,9 @@ int snd_hdac_i915_init(struct hdac_bus *bus) } }if (!acomp->ops) { -dev_info (bus->dev,"couldn't bind with audio component\n" ); +int err = allow_modprobe ? -ENODEV : -EPROBE_DEFER ;snd_hdac_acomp_exit (bus); -return -ENODEV ; +return dev_err_probe (bus->dev, err,"couldn't bind with audio component\n" ); }return 0 ; }
sound/pci/hda/hda_intel.c +1 -1
@@ -2266,7 +2266,7 @@ static int azx_probe_continue(struct azx *chip)/* bind with i915 if needed */ if (chip->driver_caps &AZX_DCAPS_I915_COMPONENT ) { - err =snd_hdac_i915_init (bus); + err =snd_hdac_i915_init (bus, true);if (err <0 ) {/* if the controller is bound only with HDMI/DP * (for HSW and BDW), we need to abort the probe;
sound/soc/intel/avs/core.c +1 -1
@@ -191,7 +191,7 @@ static void avs_hda_probe_work(struct work_struct *work)pm_runtime_set_active (bus->dev);/* clear runtime_error flag */ - ret =snd_hdac_i915_init (bus); + ret =snd_hdac_i915_init (bus, true);if (ret <0 )dev_info (bus->dev,"i915 init unsuccessful: %d\n" , ret);
sound/soc/intel/skylake/skl.c +1 -1
@@ -791,7 +791,7 @@ static int skl_i915_init(struct hdac_bus *bus)* 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); + err =snd_hdac_i915_init (bus, true);if (err <0 )return err;
sound/soc/sof/intel/hda-codec.c +1 -1
@@ -415,7 +415,7 @@ int hda_codec_i915_init(struct snd_sof_dev *sdev)return 0 ;/* i915 exposes a HDA codec for HDMI audio */ - ret =snd_hdac_i915_init (bus); + ret =snd_hdac_i915_init (bus, true);if (ret <0 )return ret;
Signature · 1 line
2.39.2
PATCH 10/15 ALSA: hda: i915: Allow xe as match for i915_component_master_match
In reply to Maarten LankhorstXe is a new driver for intel GPU's that shares the sound related code with i915.
The modprobe mechanism is being replaced by the -EPROBE_DEFER mechanism, so we don't need to add a modprobe xe call. Adding this would have required a telepathy module to correctly guess whether to load i915 or xe.
--- sound/hda/hdac_i915.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/hda/hdac_i915.c +2 -1
@@ -115,7 +115,8 @@ static int i915_component_master_match(struct device *dev, int subcomponent, hdac_pci =to_pci_dev (bus->dev); i915_pci =to_pci_dev (dev); -if (!strcmp (dev->driver->name,"i915" ) && +if ((!strcmp (dev->driver->name,"i915" ) || + !strcmp (dev->driver->name,"xe" )) && subcomponent ==I915_COMPONENT_AUDIO &&connectivity_check (i915_pci, hdac_pci))return 1 ;
Signature · 1 line
2.39.2
PATCH 11/15 ASoC: Intel: avs: Move snd_hdac_i915_init to before probe_work.
In reply to Maarten LankhorstNow 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.
--- sound/soc/intel/avs/core.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
sound/soc/intel/avs/core.c +9 -4
@@ -191,10 +191,6 @@ static void avs_hda_probe_work(struct work_struct *work)pm_runtime_set_active (bus->dev);/* clear runtime_error flag */ - ret =snd_hdac_i915_init (bus, true); -if (ret <0 ) -dev_info (bus->dev,"i915 init unsuccessful: %d\n" , ret); -snd_hdac_display_power (bus,HDA_CODEC_IDX_CONTROLLER , true);avs_hdac_bus_init_chip (bus, true);avs_hdac_bus_probe_codecs (bus);
@@ -465,10 +461,19 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)pci_set_drvdata (pci, bus);device_disable_async_suspend (dev); + ret =snd_hdac_i915_init (bus, false); +if (ret == -EPROBE_DEFER ) + goto err_i915_init; +else if (ret <0 ) +dev_info (bus->dev,"i915 init unsuccessful: %d\n" , ret); +schedule_work (&adev->probe_work);return 0 ; +err_i915_init: +pci_clear_master (pci); +pci_set_drvdata (pci,NULL ); err_acquire_irq:snd_hdac_bus_free_stream_pages (bus);snd_hdac_ext_stream_free_all (bus);
Signature · 1 line
2.39.2
PATCH 12/15 ALSA: hda: Intel: Move snd_hdac_i915_init to before probe_work.
In reply to Maarten LankhorstNow that we can use -EPROBE_DEFER, it's no longer required to spin off the snd_hdac_i915_init into a workqueue.
Use the -EPROBE_DEFER mechanism instead, which must be returned in the probe function.
--- sound/pci/hda/hda_intel.c | 54 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-)
sound/pci/hda/hda_intel.c +27 -27
@@ -2135,6 +2135,33 @@ static int azx_probe(struct pci_dev *pci,pci_set_drvdata (pci, card); +#ifdef CONFIG_SND_HDA_I915 +/* bind with i915 if needed */ +if (chip->driver_caps &AZX_DCAPS_I915_COMPONENT ) { + err =snd_hdac_i915_init (azx_bus (chip), false); +if (err <0 ) { +/* if the controller is bound only with HDMI/DP +* (for HSW and BDW), we need to abort the probe; +* for other chips, still continue probing as other +* codecs can be on the same link. +*/ +if (HDA_CONTROLLER_IN_GPU (pci)) { + goto out_free; + }else { +/* don't bother any longer */ + chip->driver_caps &= ~AZX_DCAPS_I915_COMPONENT ; + } + } + +/* HSW/BDW controllers need this power */ +if (HDA_CONTROLLER_IN_GPU (pci)) + hda->need_i915_power = true; + } +#else +if (HDA_CONTROLLER_IN_GPU (pci)) +dev_err (card->dev,"Haswell/Broadwell HDMI/DP must build in CONFIG_SND_HDA_I915\n" ); +#endif + err =register_vga_switcheroo (chip);if (err <0 ) {dev_err (card->dev,"Error registering vga_switcheroo client\n" );
@@ -2162,11 +2189,6 @@ static int azx_probe(struct pci_dev *pci, }#endif /* CONFIG_SND_HDA_PATCH_LOADER */ -#ifndef CONFIG_SND_HDA_I915 -if (HDA_CONTROLLER_IN_GPU (pci)) -dev_err (card->dev,"Haswell/Broadwell HDMI/DP must build in CONFIG_SND_HDA_I915\n" ); -#endif -if (schedule_probe)schedule_delayed_work (&hda->probe_work,0 );
@@ -2264,28 +2286,6 @@ static int azx_probe_continue(struct azx *chip)to_hda_bus (bus)->bus_probing =1 ; hda->probe_continued =1 ; -/* bind with i915 if needed */ -if (chip->driver_caps &AZX_DCAPS_I915_COMPONENT ) { - err =snd_hdac_i915_init (bus, true); -if (err <0 ) { -/* if the controller is bound only with HDMI/DP -* (for HSW and BDW), we need to abort the probe; -* for other chips, still continue probing as other -* codecs can be on the same link. -*/ -if (HDA_CONTROLLER_IN_GPU (pci)) { - goto out_free; - }else { -/* don't bother any longer */ - chip->driver_caps &= ~AZX_DCAPS_I915_COMPONENT ; - } - } - -/* HSW/BDW controllers need this power */ -if (HDA_CONTROLLER_IN_GPU (pci)) - hda->need_i915_power = true; - } -/* Request display power well for the HDA controller or codec. For * Haswell/Broadwell, both the display HDA controller and codec need * this power. For other platforms, like Baytrail/Braswell, only the
Signature · 1 line
2.39.2
PATCH 13/15 ASoC: Intel: Skylake: Move snd_hdac_i915_init to before probe_work.
In reply to Maarten LankhorstNow 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.
--- sound/soc/intel/skylake/skl.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-)
sound/soc/intel/skylake/skl.c +9 -22
@@ -783,23 +783,6 @@ 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);
@@ -807,11 +790,8 @@ static void skl_probe_work(struct work_struct *work)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);
@@ -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:
Signature · 1 line
2.39.2
PATCH 14/15 ASoC: SOF: Intel: Move binding to display driver outside of deferred probe
In reply to Maarten LankhorstNow that we can use -EPROBE_DEFER, it's no longer required to spin off the snd_hdac_i915_init into a workqueue.
Use the -EPROBE_DEFER mechanism instead, which must be returned in the probe function.
The previously added probe_early can be used for this,
and we also use the newly added remove_late for unbinding afterwards.
--- sound/soc/sof/intel/hda-common-ops.c | 1 + sound/soc/sof/intel/hda.c | 18 ++++++------------ sound/soc/sof/intel/hda.h | 1 + 3 files changed, 8 insertions(+), 12 deletions(-)
sound/soc/sof/intel/hda-common-ops.c +1 -0
@@ -19,6 +19,7 @@ struct snd_sof_dsp_ops sof_hda_common_ops = { .probe_early = hda_dsp_probe_early, .probe = hda_dsp_probe, .remove = hda_dsp_remove, + .remove_late = hda_dsp_remove_late,/* Register IO uses direct mmio */
sound/soc/sof/intel/hda.c +6 -12
@@ -1168,6 +1168,7 @@ int hda_dsp_probe_early(struct snd_sof_dev *sdev)return -ENOMEM ; sdev->pdata->hw_pdata = hdev; hdev->desc = chip; + ret =hda_init (sdev); err:return ret;
@@ -1177,7 +1178,6 @@ int hda_dsp_probe(struct snd_sof_dev *sdev) {struct pci_dev *pci =to_pci_dev (sdev->dev);struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; -struct hdac_bus *bus;int ret =0 ; hdev->dmic_dev = platform_device_register_data(sdev->dev, "dmic-codec",
@@ -1201,12 +1201,6 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)if (sdev->dspless_mode_selected) hdev->no_ipc_position =1 ; -/* set up HDA base */ - bus =sof_to_bus (sdev); - ret =hda_init (sdev); -if (ret <0 ) - goto hdac_bus_unmap; -if (sdev->dspless_mode_selected) goto skip_dsp_setup;
@@ -1315,8 +1309,6 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)iounmap (sdev->bar[HDA_DSP_BAR ]); hdac_bus_unmap:platform_device_unregister (hdev->dmic_dev); -iounmap (bus->remap_addr); -hda_codec_i915_exit (sdev);return ret; }
@@ -1325,7 +1317,6 @@ int hda_dsp_remove(struct snd_sof_dev *sdev) {struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;const struct sof_intel_dsp_desc *chip = hda->desc; -struct hdac_bus *bus =sof_to_bus (sdev);struct pci_dev *pci =to_pci_dev (sdev->dev);struct nhlt_acpi_table *nhlt = hda->nhlt;
@@ -1376,10 +1367,13 @@ int hda_dsp_remove(struct snd_sof_dev *sdev)if (!sdev->dspless_mode_selected)iounmap (sdev->bar[HDA_DSP_BAR ]); -iounmap (bus->remap_addr); +return 0 ; +} +int hda_dsp_remove_late (struct snd_sof_dev *sdev) +{ +iounmap (sof_to_bus (sdev)->remap_addr);sof_hda_bus_exit (sdev); -hda_codec_i915_exit (sdev);return 0 ;
sound/soc/sof/intel/hda.h +1 -0
@@ -576,6 +576,7 @@ struct sof_intel_hda_stream {int hda_dsp_probe_early (struct snd_sof_dev *sdev);int hda_dsp_probe (struct snd_sof_dev *sdev);int hda_dsp_remove (struct snd_sof_dev *sdev); +int hda_dsp_remove_late (struct snd_sof_dev *sdev);int hda_dsp_core_power_up (struct snd_sof_dev *sdev,unsigned int core_mask);int hda_dsp_core_run (struct snd_sof_dev *sdev,unsigned int core_mask);int hda_dsp_enable_core (struct snd_sof_dev *sdev,unsigned int core_mask);
Signature · 1 line
2.39.2
PATCH 15/15 ALSA: hda: i915: Remove extra argument from snd_hdac_i915_init
In reply to Maarten LankhorstNow that all drivers have moved from modprobe loading to handling -EPROBE_DEFER, we can remove the argument again.
--- include/sound/hda_i915.h | 4 ++-- sound/hda/hdac_i915.c | 14 +++----------- sound/pci/hda/hda_intel.c | 2 +- sound/soc/intel/avs/core.c | 2 +- sound/soc/intel/skylake/skl.c | 2 +- sound/soc/sof/intel/hda-codec.c | 2 +- 6 files changed, 9 insertions(+), 17 deletions(-)
include/sound/hda_i915.h +2 -2
@@ -9,12 +9,12 @@#ifdef CONFIG_SND_HDA_I915 void snd_hdac_i915_set_bclk (struct hdac_bus *bus); -int snd_hdac_i915_init (struct hdac_bus *bus,bool allow_modprobe); +int snd_hdac_i915_init (struct hdac_bus *bus);#else static inline void snd_hdac_i915_set_bclk (struct hdac_bus *bus) { } -static inline int snd_hdac_i915_init (struct hdac_bus *bus,bool allow_modprobe) +static inline int snd_hdac_i915_init (struct hdac_bus *bus) {return -ENODEV ; }
sound/hda/hdac_i915.c +3 -11
@@ -176,7 +176,7 @@ static bool dg1_gfx_present(void)* * Returns zero for success or a negative error code. */ -int snd_hdac_i915_init (struct hdac_bus *bus,bool allow_modprobe) +int snd_hdac_i915_init (struct hdac_bus *bus) {struct drm_audio_component *acomp;int err;
@@ -195,18 +195,10 @@ int snd_hdac_i915_init(struct hdac_bus *bus, bool allow_modprobe) acomp = bus->audio_component;if (!acomp)return -ENODEV ; -if (allow_modprobe && !acomp->ops) { -if (!IS_ENABLED (CONFIG_MODULES ) || - !request_module ("i915" )) { -/* 60s timeout */ -wait_for_completion_killable_timeout (&acomp->master_bind_complete, -msecs_to_jiffies (60 *1000 )); - } - }if (!acomp->ops) { -int err = allow_modprobe ? -ENODEV : -EPROBE_DEFER ;snd_hdac_acomp_exit (bus); -return dev_err_probe (bus->dev, err,"couldn't bind with audio component\n" ); +return dev_err_probe (bus->dev, -EPROBE_DEFER , +"couldn't bind with audio component\n" ); }return 0 ; }
sound/pci/hda/hda_intel.c +1 -1
@@ -2138,7 +2138,7 @@ static int azx_probe(struct pci_dev *pci,#ifdef CONFIG_SND_HDA_I915 /* bind with i915 if needed */ if (chip->driver_caps &AZX_DCAPS_I915_COMPONENT ) { - err =snd_hdac_i915_init (azx_bus (chip), false); + err =snd_hdac_i915_init (azx_bus (chip));if (err <0 ) {/* if the controller is bound only with HDMI/DP * (for HSW and BDW), we need to abort the probe;
sound/soc/intel/avs/core.c +1 -1
@@ -461,7 +461,7 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)pci_set_drvdata (pci, bus);device_disable_async_suspend (dev); - ret =snd_hdac_i915_init (bus, false); + ret =snd_hdac_i915_init (bus);if (ret == -EPROBE_DEFER ) goto err_i915_init;else if (ret <0 )
sound/soc/intel/skylake/skl.c +1 -1
@@ -1056,7 +1056,7 @@ static int skl_probe(struct pci_dev *pci, }if (IS_ENABLED (CONFIG_SND_SOC_HDAC_HDMI )) { - err =snd_hdac_i915_init (bus, false); + err =snd_hdac_i915_init (bus);if (err <0 ) goto out_dmic_unregister; }
sound/soc/sof/intel/hda-codec.c +1 -1
@@ -415,7 +415,7 @@ int hda_codec_i915_init(struct snd_sof_dev *sdev)return 0 ;/* i915 exposes a HDA codec for HDMI audio */ - ret =snd_hdac_i915_init (bus, true); + ret =snd_hdac_i915_init (bus);if (ret <0 )return ret;
Signature · 1 line
2.39.2
Patchwork
CI[Intel-xe] ✗ CI.Patch_applied: failure for sound/for-next: Cherry pick patches from sound/for-next
In reply to Maarten Lankhorst== Series Details ==
== Series Details ==
Series: sound/for-next: Cherry pick patches from sound/for-next
URL : https://patchwork.freedesktop.org/series/125449/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-xe-next' with base: ===
Base commit: 4354e27ef drm/xe: Simplify xe_res_get_buddy()
=== git am output follows ===
Applying: Revert "sound/soc/sof: Remove deferred probe for SOF"
Applying: Revert "sound/hda: Allow XE as i915 replacement for sound"
Applying: ASoC: SOF: core: Ensure sof_ops_free() is still called when probe never ran.
Applying: ASoC: SOF: core: Add probe_early and remove_late callbacks
Applying: ASoC: SOF: Intel: hda: start splitting the probe
Applying: ASoC: SOF: Intel: Fix error handling in hda_init()
Applying: ALSA: hda: Intel: Fix error handling in azx_probe()
Applying: ALSA: hda: i915: Allow override of gpu binding.
Applying: ALSA: hda: i915: Add an allow_modprobe argument to snd_hdac_i915_init
Applying: ALSA: hda: i915: Allow xe as match for i915_component_master_match
Applying: ASoC: Intel: avs: Move snd_hdac_i915_init to before probe_work.
Applying: ALSA: hda: Intel: Move snd_hdac_i915_init to before probe_work.
Applying: ASoC: Intel: Skylake: Move snd_hdac_i915_init to before probe_work.
Applying: ASoC: SOF: Intel: Move binding to display driver outside of deferred probe
Applying: ALSA: hda: i915: Remove extra argument from snd_hdac_i915_init