Skip to content

Commit e17f522

Browse files
committed
ASOC: SOF: add info for hda machine driver
(1)Hda codec status and platform name are used by machine driver to create dai links, so it need to be set in sof core (2)Try HDA codec if no I2S codec is found Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
1 parent 2fc06d1 commit e17f522

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

include/sound/sof.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ struct snd_sof_pdata {
4747
const struct firmware *fw;
4848
const char *drv_name;
4949
const char *name;
50+
const char *platform;
5051

5152
/* parent device */
5253
struct device *dev;
@@ -59,6 +60,9 @@ struct snd_sof_pdata {
5960
unsigned int gpio;
6061
unsigned int active;
6162

63+
/* hda codec */
64+
unsigned long codec_mask;
65+
6266
/* machine */
6367
struct platform_device *pdev_mach;
6468
union {

sound/soc/sof/intel/hda.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,9 @@ static int hda_init_caps(struct snd_sof_dev *sdev)
415415
if (!bus->codec_mask)
416416
dev_info(bus->dev, "no hda codecs found!\n");
417417

418+
/* used by hda machine driver to create dai links */
419+
sdev->pdata->codec_mask = bus->codec_mask;
420+
418421
/* create codec instances */
419422
hda_codec_probe_bus(sdev);
420423

sound/soc/sof/sof-acpi-dev.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,9 @@ static int sof_acpi_probe(struct platform_device *pdev)
232232
if (ret < 0)
233233
return ret;
234234
#else
235-
dev_err(dev, "No matching ASoC machine driver found - aborting probe\n");
236-
return -ENODEV;
235+
dev_warn(dev, "No matching ASoC machine driver found - falling back to HDA codec\n");
236+
mach = snd_soc_acpi_intel_hda_machines;
237+
mach->sof_fw_filename = desc->nocodec_fw_filename;
237238
#endif
238239
}
239240
#endif
@@ -251,6 +252,7 @@ static int sof_acpi_probe(struct platform_device *pdev)
251252
priv->sof_pdata = sof_pdata;
252253
sof_pdata->dev = &pdev->dev;
253254
sof_pdata->type = SOF_DEVICE_APCI;
255+
sof_pdata->platform = "sof-audio";
254256
dev_set_drvdata(&pdev->dev, priv);
255257

256258
/* do we need to generate any machine plat data ? */

sound/soc/sof/sof-pci-dev.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ static int sof_pci_probe(struct pci_dev *pci,
229229
if (ret < 0)
230230
goto release_regions;
231231
#else
232-
dev_err(dev, "No matching ASoC machine driver found - aborting probe\n");
233-
ret = -ENODEV;
234-
goto release_regions;
232+
dev_warn(dev, "No matching ASoC machine driver found - falling back to HDA codec\n");
233+
mach = snd_soc_acpi_intel_hda_machines;
234+
mach->sof_fw_filename = desc->nocodec_fw_filename;
235235
#endif
236236
}
237237
#endif
@@ -245,6 +245,7 @@ static int sof_pci_probe(struct pci_dev *pci,
245245
priv->sof_pdata = sof_pdata;
246246
sof_pdata->dev = &pci->dev;
247247
sof_pdata->type = SOF_DEVICE_PCI;
248+
sof_pdata->platform = "sof-audio";
248249

249250
/* register sof-audio platform driver */
250251
ret = sof_create_platform_device(priv);

sound/soc/sof/sof-spi-dev.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,20 +130,9 @@ static int sof_spi_probe(struct spi_device *spi)
130130
sof_pdata->dev = dev;
131131
sof_pdata->type = SOF_DEVICE_SPI;
132132

133-
/* register machine driver */
134-
sof_pdata->pdev_mach =
135-
platform_device_register_data(dev, mach->drv_name, -1,
136-
sof_pdata, sizeof(*sof_pdata));
137-
if (IS_ERR(sof_pdata->pdev_mach))
138-
return PTR_ERR(sof_pdata->pdev_mach);
139-
140-
dev_dbg(dev, "created machine %s\n",
141-
dev_name(&sof_pdata->pdev_mach->dev));
142-
143133
/* register sof-audio platform driver */
144134
ret = sof_create_platform_device(priv);
145135
if (ret) {
146-
platform_device_unregister(sof_pdata->pdev_mach);
147136
dev_err(dev, "error: failed to create platform device!\n");
148137
return ret;
149138
}

0 commit comments

Comments
 (0)