ASoC: Intel: Skylake: Request IRQ late only after all context are initialized
Subsystems (3)
PATCH 1/2 ASoC: Intel: Skylake: Request IRQ late only after all context are initialized
From: "Subhransu S. Prusty" <[email protected]>
Sometimes during boot, panic is observed at sst_dsp_shim_read_unlocked(). This happens when interrupt occurs before the context is initialized. So move the irq initialization only after the context is initialized completely.
--- sound/soc/intel/skylake/bxt-sst.c | 2 +- sound/soc/intel/skylake/cnl-sst.c | 2 +- sound/soc/intel/skylake/skl-sst-dsp.c | 14 ++++++++++---- sound/soc/intel/skylake/skl-sst-dsp.h | 1 + sound/soc/intel/skylake/skl-sst.c | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +1 -1
@@ -582,7 +582,7 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,INIT_DELAYED_WORK (&skl->d0i3.work, bxt_set_dsp_D0i3); skl->d0i3.state =SKL_DSP_D0I3_NONE ; -return 0 ; +return skl_dsp_acquire_irq (sst); }EXPORT_SYMBOL_GPL (bxt_sst_dsp_init);
sound/soc/intel/skylake/cnl-sst.c +1 -1
@@ -458,7 +458,7 @@ int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq, cnl->boot_complete = false;init_waitqueue_head (&cnl->boot_wait); -return 0 ; +return skl_dsp_acquire_irq (sst); }EXPORT_SYMBOL_GPL (cnl_sst_dsp_init);
sound/soc/intel/skylake/skl-sst-dsp.c +10 -4
@@ -435,16 +435,22 @@ struct sst_dsp *skl_dsp_ctx_init(struct device *dev,return NULL ; } +return sst; +} + +int skl_dsp_acquire_irq (struct sst_dsp *sst) +{ +struct sst_dsp_device *sst_dev = sst->sst_dev; +int ret; +/* Register the ISR */ ret =request_threaded_irq (sst->irq, sst->ops->irq_handler, sst_dev->thread,IRQF_SHARED ,"AudioDSP" , sst); -if (ret) { +if (ret)dev_err (sst->dev,"unable to grab threaded IRQ %d, disabling device\n" , sst->irq); -return NULL ; - } -return sst; +return ret; }void skl_dsp_free (struct sst_dsp *dsp)
sound/soc/intel/skylake/skl-sst-dsp.h +1 -0
@@ -206,6 +206,7 @@ int skl_cldma_wait_interruptible(struct sst_dsp *ctx);void skl_dsp_set_state_locked (struct sst_dsp *ctx,int state);struct sst_dsp *skl_dsp_ctx_init (struct device *dev,struct sst_dsp_device *sst_dev,int irq); +int skl_dsp_acquire_irq (struct sst_dsp *sst);bool is_skl_dsp_running (struct sst_dsp *ctx);unsigned int skl_dsp_get_enabled_cores (struct sst_dsp *ctx);
sound/soc/intel/skylake/skl-sst.c +1 -1
@@ -569,7 +569,7 @@ int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq, sst->fw_ops = skl_fw_ops; -return 0 ; +return skl_dsp_acquire_irq (sst); }EXPORT_SYMBOL_GPL (skl_sst_dsp_init);
Signature · 1 line
2.15.1
PATCH 2/2 ASoC: Intel: Skylake: Ensure dai and dailink registration happens in sequence.
From: Pankaj Bharadiya <[email protected]>
Platform registration happens in probe work handler whereas machine device is registered during skl_probe. This sometimes results in cpu dais not found if the work handler is sufficiently delayed due to system load, even with deferred probe of machine driver.
So move machine device registration after registering platform.
--- sound/soc/intel/skylake/skl.c | 56 +++++++++++++++++++++++++++++-------------- sound/soc/intel/skylake/skl.h | 1 + 2 files changed, 39 insertions(+), 18 deletions(-)
sound/soc/intel/skylake/skl.c +38 -18
@@ -476,19 +476,34 @@ static struct skl_ssp_clk skl_ssp_clks[] = { {.name = "ssp5_sclkfs"}, }; -static int skl_machine_device_register (struct skl *skl,void *driver_data) +static int skl_find_machine (struct skl *skl,void *driver_data) { -struct hdac_bus *bus =ebus_to_hbus (&skl->ebus); -struct platform_device *pdev;struct snd_soc_acpi_mach *mach = driver_data; -int ret; +struct hdac_bus *bus =ebus_to_hbus (&skl->ebus); +struct skl_machine_pdata *pdata; mach =snd_soc_acpi_find_machine (mach);if (mach ==NULL ) {dev_err (bus->dev,"No matching machine driver found\n" );return -ENODEV ; } + + skl->mach = mach; skl->fw_name = mach->fw_filename; + pdata = skl->mach->pdata; + +if (mach->pdata) + skl->use_tplg_pcm = pdata->use_tplg_pcm; + +return 0 ; +} + +static int skl_machine_device_register (struct skl *skl) +{ +struct hdac_bus *bus =ebus_to_hbus (&skl->ebus); +struct snd_soc_acpi_mach *mach = skl->mach; +struct platform_device *pdev; +int ret; pdev =platform_device_alloc (mach->drv_name,-1 );if (pdev ==NULL ) {
@@ -503,11 +518,8 @@ static int skl_machine_device_register(struct skl *skl, void *driver_data)return -EIO ; } -if (mach->pdata) { - skl->use_tplg_pcm = - ((struct skl_machine_pdata *)mach->pdata)->use_tplg_pcm; +if (mach->pdata)dev_set_drvdata (&pdev->dev, mach->pdata); - } skl->i2s_dev = pdev;
@@ -724,18 +736,30 @@ static void skl_probe_work(struct work_struct *work)/* create codec instances */ skl_codec_create (ebus); +/* register platform dai and controls */ + err =skl_platform_register (bus->dev); +if (err <0 ) { +dev_err (bus->dev,"platform register failed: %d\n" , err); +return ; + } + +if (bus->ppcap) { + err =skl_machine_device_register (skl); +if (err <0 ) { +dev_err (bus->dev,"machine register failed: %d\n" , err); + goto out_err; + } + } +if (IS_ENABLED (CONFIG_SND_SOC_HDAC_HDMI )) { err =snd_hdac_display_power (bus, false);if (err <0 ) {dev_err (bus->dev,"Cannot turn off display power on i915\n" ); +skl_machine_device_unregister (skl);return ; } } -/* register platform dai and controls */ - err =skl_platform_register (bus->dev); -if (err <0 ) -return ;/* * we are done probing so decrement link counts */
@@ -905,18 +929,16 @@ static int skl_probe(struct pci_dev *pci,if (err <0 ) goto out_clk_free; - err =skl_machine_device_register (skl, - (void *)pci_id->driver_data); + err =skl_find_machine (skl, (void *)pci_id->driver_data);if (err <0 ) goto out_nhlt_free; err =skl_init_dsp (skl);if (err <0 ) {dev_dbg (bus->dev,"error failed to register dsp\n" ); - goto out_mach_free; + goto out_nhlt_free; } skl->skl_sst->enable_miscbdcge = skl_enable_miscbdcge; - }if (bus->mlcap)snd_hdac_ext_bus_get_ml_capabilities (ebus);
@@ -934,8 +956,6 @@ static int skl_probe(struct pci_dev *pci, out_dsp_free:skl_free_dsp (skl); -out_mach_free: -skl_machine_device_unregister (skl); out_clk_free:skl_clock_device_unregister (skl); out_nhlt_free:
sound/soc/intel/skylake/skl.h +1 -0
@@ -94,6 +94,7 @@ struct skl {struct skl_module **modules;bool use_tplg_pcm;struct skl_fw_config cfg; +struct snd_soc_acpi_mach *mach; };#define skl_to_ebus (s) (&(s)->ebus)
Signature · 1 line
2.15.1
Mark Brown
maintainerApplied "ASoC: Intel: Skylake: Ensure dai and dailink registration happens in sequence." to the asoc tree
The patch
ASoC: Intel: Skylake: Ensure dai and dailink registration happens in sequence.
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
752c93aa72e60ba573bbcfcd508b9cc550db0b94Mon Sep 17 00:00:00 2001
From: Pankaj Bharadiya <[email protected]>
Date: Mon, 18 Dec 2017 10:46:50 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Ensure dai and dailink registration
happens in sequence.
Platform registration happens in probe work handler whereas machine device is registered during skl_probe. This sometimes results in cpu dais not found if the work handler is sufficiently delayed due to system load, even with deferred probe of machine driver.
So move machine device registration after registering platform.
--- sound/soc/intel/skylake/skl.c | 56 +++++++++++++++++++++++++++++-------------- sound/soc/intel/skylake/skl.h | 1 + 2 files changed, 39 insertions(+), 18 deletions(-)
sound/soc/intel/skylake/skl.c +38 -18
@@ -453,19 +453,34 @@ static struct skl_ssp_clk skl_ssp_clks[] = { {.name = "ssp5_sclkfs"}, }; -static int skl_machine_device_register (struct skl *skl,void *driver_data) +static int skl_find_machine (struct skl *skl,void *driver_data) { -struct hdac_bus *bus =ebus_to_hbus (&skl->ebus); -struct platform_device *pdev;struct snd_soc_acpi_mach *mach = driver_data; -int ret; +struct hdac_bus *bus =ebus_to_hbus (&skl->ebus); +struct skl_machine_pdata *pdata; mach =snd_soc_acpi_find_machine (mach);if (mach ==NULL ) {dev_err (bus->dev,"No matching machine driver found\n" );return -ENODEV ; } + + skl->mach = mach; skl->fw_name = mach->fw_filename; + pdata = skl->mach->pdata; + +if (mach->pdata) + skl->use_tplg_pcm = pdata->use_tplg_pcm; + +return 0 ; +} + +static int skl_machine_device_register (struct skl *skl) +{ +struct hdac_bus *bus =ebus_to_hbus (&skl->ebus); +struct snd_soc_acpi_mach *mach = skl->mach; +struct platform_device *pdev; +int ret; pdev =platform_device_alloc (mach->drv_name,-1 );if (pdev ==NULL ) {
@@ -480,11 +495,8 @@ static int skl_machine_device_register(struct skl *skl, void *driver_data)return -EIO ; } -if (mach->pdata) { - skl->use_tplg_pcm = - ((struct skl_machine_pdata *)mach->pdata)->use_tplg_pcm; +if (mach->pdata)dev_set_drvdata (&pdev->dev, mach->pdata); - } skl->i2s_dev = pdev;
@@ -701,18 +713,30 @@ static void skl_probe_work(struct work_struct *work)/* create codec instances */ skl_codec_create (ebus); +/* register platform dai and controls */ + err =skl_platform_register (bus->dev); +if (err <0 ) { +dev_err (bus->dev,"platform register failed: %d\n" , err); +return ; + } + +if (bus->ppcap) { + err =skl_machine_device_register (skl); +if (err <0 ) { +dev_err (bus->dev,"machine register failed: %d\n" , err); + goto out_err; + } + } +if (IS_ENABLED (CONFIG_SND_SOC_HDAC_HDMI )) { err =snd_hdac_display_power (bus, false);if (err <0 ) {dev_err (bus->dev,"Cannot turn off display power on i915\n" ); +skl_machine_device_unregister (skl);return ; } } -/* register platform dai and controls */ - err =skl_platform_register (bus->dev); -if (err <0 ) -return ;/* * we are done probing so decrement link counts */
@@ -882,18 +906,16 @@ static int skl_probe(struct pci_dev *pci,if (err <0 ) goto out_clk_free; - err =skl_machine_device_register (skl, - (void *)pci_id->driver_data); + err =skl_find_machine (skl, (void *)pci_id->driver_data);if (err <0 ) goto out_nhlt_free; err =skl_init_dsp (skl);if (err <0 ) {dev_dbg (bus->dev,"error failed to register dsp\n" ); - goto out_mach_free; + goto out_nhlt_free; } skl->skl_sst->enable_miscbdcge = skl_enable_miscbdcge; - }if (bus->mlcap)snd_hdac_ext_bus_get_ml_capabilities (ebus);
@@ -911,8 +933,6 @@ static int skl_probe(struct pci_dev *pci, out_dsp_free:skl_free_dsp (skl); -out_mach_free: -skl_machine_device_unregister (skl); out_clk_free:skl_clock_device_unregister (skl); out_nhlt_free:
sound/soc/intel/skylake/skl.h +1 -0
@@ -94,6 +94,7 @@ struct skl {struct skl_module **modules;bool use_tplg_pcm;struct skl_fw_config cfg; +struct snd_soc_acpi_mach *mach; };#define skl_to_ebus (s) (&(s)->ebus)
Signature · 1 line
2.15.1
Quoted 6 lines · Guneshwor Singh
From: "Subhransu S. Prusty" <[email protected]>
Sometimes during boot, panic is observed at
sst_dsp_shim_read_unlocked(). This happens when interrupt occurs before the context is initialized. So move the irq initialization only after the context is initialized completely.
Both:
Signature · 1 line
~Vinod
Mark Brown
maintainerApplied "ASoC: Intel: Skylake: Request IRQ late only after all context are initialized" to the asoc tree
In reply to Guneshwor SinghThe patch
ASoC: Intel: Skylake: Request IRQ late only after all context are initialized
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
8e9d8e19b3d0c36d45161233eee3f2d368efe3acMon Sep 17 00:00:00 2001
From: "Subhransu S. Prusty" <[email protected]>
Date: Mon, 18 Dec 2017 10:46:49 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Request IRQ late only after all context
are initialized
Sometimes during boot, panic is observed at sst_dsp_shim_read_unlocked(). This happens when interrupt occurs before the context is initialized. So move the irq initialization only after the context is initialized completely.
--- sound/soc/intel/skylake/bxt-sst.c | 2 +- sound/soc/intel/skylake/cnl-sst.c | 2 +- sound/soc/intel/skylake/skl-sst-dsp.c | 14 ++++++++++---- sound/soc/intel/skylake/skl-sst-dsp.h | 1 + sound/soc/intel/skylake/skl-sst.c | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +1 -1
@@ -595,7 +595,7 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,INIT_DELAYED_WORK (&skl->d0i3.work, bxt_set_dsp_D0i3); skl->d0i3.state =SKL_DSP_D0I3_NONE ; -return 0 ; +return skl_dsp_acquire_irq (sst); }EXPORT_SYMBOL_GPL (bxt_sst_dsp_init);
sound/soc/intel/skylake/cnl-sst.c +1 -1
@@ -458,7 +458,7 @@ int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq, cnl->boot_complete = false;init_waitqueue_head (&cnl->boot_wait); -return 0 ; +return skl_dsp_acquire_irq (sst); }EXPORT_SYMBOL_GPL (cnl_sst_dsp_init);
sound/soc/intel/skylake/skl-sst-dsp.c +10 -4
@@ -435,16 +435,22 @@ struct sst_dsp *skl_dsp_ctx_init(struct device *dev,return NULL ; } +return sst; +} + +int skl_dsp_acquire_irq (struct sst_dsp *sst) +{ +struct sst_dsp_device *sst_dev = sst->sst_dev; +int ret; +/* Register the ISR */ ret =request_threaded_irq (sst->irq, sst->ops->irq_handler, sst_dev->thread,IRQF_SHARED ,"AudioDSP" , sst); -if (ret) { +if (ret)dev_err (sst->dev,"unable to grab threaded IRQ %d, disabling device\n" , sst->irq); -return NULL ; - } -return sst; +return ret; }void skl_dsp_free (struct sst_dsp *dsp)
sound/soc/intel/skylake/skl-sst-dsp.h +1 -0
@@ -206,6 +206,7 @@ int skl_cldma_wait_interruptible(struct sst_dsp *ctx);void skl_dsp_set_state_locked (struct sst_dsp *ctx,int state);struct sst_dsp *skl_dsp_ctx_init (struct device *dev,struct sst_dsp_device *sst_dev,int irq); +int skl_dsp_acquire_irq (struct sst_dsp *sst);bool is_skl_dsp_running (struct sst_dsp *ctx);unsigned int skl_dsp_get_enabled_cores (struct sst_dsp *ctx);
sound/soc/intel/skylake/skl-sst.c +1 -1
@@ -569,7 +569,7 @@ int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq, sst->fw_ops = skl_fw_ops; -return 0 ; +return skl_dsp_acquire_irq (sst); }EXPORT_SYMBOL_GPL (skl_sst_dsp_init);
Signature · 1 line
2.15.1