History

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.

Pankaj Bharadiya committed 8 years ago

Commit 752c93a1 parent 8e9d8e12 files · +39 −18Browse files

Unified · Split

2 files
  1. sound/soc/intel/skylake/skl.c +38 −18
  2. sound/soc/intel/skylake/skl.h +1 −0
sound/soc/intel/skylake/skl.c+38−18
@@ -453,19 +453,34 @@ static struct skl_ssp_clk skl_ssp_clks[] = { · 452 unmodified lines
453453 {.name = "ssp5_sclkfs"},
454454 };
455455
456−static int skl_machine_device_register(struct skl *skl, void *driver_data)
456+static int skl_find_machine(struct skl *skl, void *driver_data)
457457 {
458− struct hdac_bus *bus = ebus_to_hbus(&skl->ebus);
459− struct platform_device *pdev;
460458 struct snd_soc_acpi_mach *mach = driver_data;
461− int ret;
459+ struct hdac_bus *bus = ebus_to_hbus(&skl->ebus);
460+ struct skl_machine_pdata *pdata;
462461
463462 mach = snd_soc_acpi_find_machine(mach);
464463 if (mach == NULL) {
465464 dev_err(bus->dev, "No matching machine driver found\n");
466465 return -ENODEV;
467466 }
467+
468+ skl->mach = mach;
468469 skl->fw_name = mach->fw_filename;
470+ pdata = skl->mach->pdata;
471+
472+ if (mach->pdata)
473+ skl->use_tplg_pcm = pdata->use_tplg_pcm;
474+
475+ return 0;
476+}
477+
478+static int skl_machine_device_register(struct skl *skl)
479+{
480+ struct hdac_bus *bus = ebus_to_hbus(&skl->ebus);
481+ struct snd_soc_acpi_mach *mach = skl->mach;
482+ struct platform_device *pdev;
483+ int ret;
469484
470485 pdev = platform_device_alloc(mach->drv_name, -1);
471486 if (pdev == NULL) {
@@ -480,11 +495,8 @@ static int skl_machine_device_register(struct skl *skl, void *driver_data) · 8 unmodified lines
480495 return -EIO;
481496 }
482497
483− if (mach->pdata) {
484− skl->use_tplg_pcm =
485− ((struct skl_machine_pdata *)mach->pdata)->use_tplg_pcm;
498+ if (mach->pdata)
486499 dev_set_drvdata(&pdev->dev, mach->pdata);
487− }
488500
489501 skl->i2s_dev = pdev;
490502
@@ -701,18 +713,30 @@ static void skl_probe_work(struct work_struct *work) · 210 unmodified lines
701713 /* create codec instances */
702714 skl_codec_create(ebus);
703715
716+ /* register platform dai and controls */
717+ err = skl_platform_register(bus->dev);
718+ if (err < 0) {
719+ dev_err(bus->dev, "platform register failed: %d\n", err);
720+ return;
721+ }
722+
723+ if (bus->ppcap) {
724+ err = skl_machine_device_register(skl);
725+ if (err < 0) {
726+ dev_err(bus->dev, "machine register failed: %d\n", err);
727+ goto out_err;
728+ }
729+ }
730+
704731 if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {
705732 err = snd_hdac_display_power(bus, false);
706733 if (err < 0) {
707734 dev_err(bus->dev, "Cannot turn off display power on i915\n");
735+ skl_machine_device_unregister(skl);
708736 return;
709737 }
710738 }
711739
712− /* register platform dai and controls */
713− err = skl_platform_register(bus->dev);
714− if (err < 0)
715− return;
716740 /*
717741 * we are done probing so decrement link counts
718742 */
@@ -882,18 +906,16 @@ static int skl_probe(struct pci_dev *pci, · 163 unmodified lines
882906 if (err < 0)
883907 goto out_clk_free;
884908
885− err = skl_machine_device_register(skl,
886− (void *)pci_id->driver_data);
909+ err = skl_find_machine(skl, (void *)pci_id->driver_data);
887910 if (err < 0)
888911 goto out_nhlt_free;
889912
890913 err = skl_init_dsp(skl);
891914 if (err < 0) {
892915 dev_dbg(bus->dev, "error failed to register dsp\n");
893− goto out_mach_free;
916+ goto out_nhlt_free;
894917 }
895918 skl->skl_sst->enable_miscbdcge = skl_enable_miscbdcge;
896−
897919 }
898920 if (bus->mlcap)
899921 snd_hdac_ext_bus_get_ml_capabilities(ebus);
@@ -911,8 +933,6 @@ static int skl_probe(struct pci_dev *pci, · 11 unmodified lines
911933
912934 out_dsp_free:
913935 skl_free_dsp(skl);
914−out_mach_free:
915− skl_machine_device_unregister(skl);
916936 out_clk_free:
917937 skl_clock_device_unregister(skl);
918938 out_nhlt_free:
sound/soc/intel/skylake/skl.h+1−0
@@ -94,6 +94,7 @@ struct skl { · 93 unmodified lines
9494 struct skl_module **modules;
9595 bool use_tplg_pcm;
9696 struct skl_fw_config cfg;
97+ struct snd_soc_acpi_mach *mach;
9798 };
9899
99100 #define skl_to_ebus(s) (&(s)->ebus)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t