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
453 {.name = "ssp5_sclkfs"},453 {.name = "ssp5_sclkfs"},
454};454};
455 455
456static int skl_machine_device_register(struct skl *skl, void *driver_data)456static int skl_find_machine(struct skl *skl, void *driver_data)
457{457{
458 struct hdac_bus *bus = ebus_to_hbus(&skl->ebus);
459 struct platform_device *pdev;
460 struct snd_soc_acpi_mach *mach = driver_data;458 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;
462 461
463 mach = snd_soc_acpi_find_machine(mach);462 mach = snd_soc_acpi_find_machine(mach);
464 if (mach == NULL) {463 if (mach == NULL) {
465 dev_err(bus->dev, "No matching machine driver found\n");464 dev_err(bus->dev, "No matching machine driver found\n");
466 return -ENODEV;465 return -ENODEV;
467 }466 }
467
468 skl->mach = mach;
468 skl->fw_name = mach->fw_filename;469 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
478static 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;
469 484
470 pdev = platform_device_alloc(mach->drv_name, -1);485 pdev = platform_device_alloc(mach->drv_name, -1);
471 if (pdev == NULL) {486 if (pdev == NULL) {
@@ -480,11 +495,8 @@ static int skl_machine_device_register(struct skl *skl, void *driver_data) · 8 unmodified lines
480 return -EIO;495 return -EIO;
481 }496 }
482 497
483 if (mach->pdata) {498 if (mach->pdata)
484 skl->use_tplg_pcm =
485 ((struct skl_machine_pdata *)mach->pdata)->use_tplg_pcm;
486 dev_set_drvdata(&pdev->dev, mach->pdata);499 dev_set_drvdata(&pdev->dev, mach->pdata);
487 }
488 500
489 skl->i2s_dev = pdev;501 skl->i2s_dev = pdev;
490 502
@@ -701,18 +713,30 @@ static void skl_probe_work(struct work_struct *work) · 210 unmodified lines
701 /* create codec instances */713 /* create codec instances */
702 skl_codec_create(ebus);714 skl_codec_create(ebus);
703 715
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
704 if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {731 if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {
705 err = snd_hdac_display_power(bus, false);732 err = snd_hdac_display_power(bus, false);
706 if (err < 0) {733 if (err < 0) {
707 dev_err(bus->dev, "Cannot turn off display power on i915\n");734 dev_err(bus->dev, "Cannot turn off display power on i915\n");
735 skl_machine_device_unregister(skl);
708 return;736 return;
709 }737 }
710 }738 }
711 739
712 /* register platform dai and controls */
713 err = skl_platform_register(bus->dev);
714 if (err < 0)
715 return;
716 /*740 /*
717 * we are done probing so decrement link counts741 * we are done probing so decrement link counts
718 */742 */
@@ -882,18 +906,16 @@ static int skl_probe(struct pci_dev *pci, · 163 unmodified lines
882 if (err < 0)906 if (err < 0)
883 goto out_clk_free;907 goto out_clk_free;
884 908
885 err = skl_machine_device_register(skl,909 err = skl_find_machine(skl, (void *)pci_id->driver_data);
886 (void *)pci_id->driver_data);
887 if (err < 0)910 if (err < 0)
888 goto out_nhlt_free;911 goto out_nhlt_free;
889 912
890 err = skl_init_dsp(skl);913 err = skl_init_dsp(skl);
891 if (err < 0) {914 if (err < 0) {
892 dev_dbg(bus->dev, "error failed to register dsp\n");915 dev_dbg(bus->dev, "error failed to register dsp\n");
893 goto out_mach_free;916 goto out_nhlt_free;
894 }917 }
895 skl->skl_sst->enable_miscbdcge = skl_enable_miscbdcge;918 skl->skl_sst->enable_miscbdcge = skl_enable_miscbdcge;
896
897 }919 }
898 if (bus->mlcap)920 if (bus->mlcap)
899 snd_hdac_ext_bus_get_ml_capabilities(ebus);921 snd_hdac_ext_bus_get_ml_capabilities(ebus);
@@ -911,8 +933,6 @@ static int skl_probe(struct pci_dev *pci, · 11 unmodified lines
911 933
912out_dsp_free:934out_dsp_free:
913 skl_free_dsp(skl);935 skl_free_dsp(skl);
914out_mach_free:
915 skl_machine_device_unregister(skl);
916out_clk_free:936out_clk_free:
917 skl_clock_device_unregister(skl);937 skl_clock_device_unregister(skl);
918out_nhlt_free:938out_nhlt_free:
sound/soc/intel/skylake/skl.h+1−0
@@ -94,6 +94,7 @@ struct skl { · 93 unmodified lines
94 struct skl_module **modules;94 struct skl_module **modules;
95 bool use_tplg_pcm;95 bool use_tplg_pcm;
96 struct skl_fw_config cfg;96 struct skl_fw_config cfg;
97 struct snd_soc_acpi_mach *mach;
97};98};
98 99
99#define skl_to_ebus(s) (&(s)->ebus)100#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