Merge series "ASoC: Intel/SOF: extend run-time driver selection to ACPI devices" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

The module snd-intel-dspcfg, suggested by Jaroslav last year,
currently provide the means to select a PCI driver at run-time, based
on quirks, recommendations or user selection via a kernel
parameter. This capability removed a lot of confusions in
distributions and removed the need for recompilations to select legacy
HDaudio, SST or SOF drivers.

This patchset extends the concept to ACPI devices. This was driven by
the desire to at some point deprecate the Atom/SST driver for Baytrail
and Cherrytrail, which is no longer maintained by Intel. By having the
SOF driver enabled by distributions for Baytrail/Cherrytrail, we can
enable more end-user tests and make the transition easier for
distributions (likely in 2021 at this point).

This patchset provides the same solution for Broadwell, mainly to have
a single build for all Intel platforms. SOF on Broadwell remains an
option not recommended for distributions, as long as the 'catpt'
driver is maintained there is no burning desire to make SOF the
default on the three Broadwell-based platforms with the DSP
enabled.

Pierre-Louis Bossart (14):
  ASoC: Intel: broadwell: add missing pm_ops
  ASoC: Intel: bdw-rt5677: add missing pm_ops
  ALSA: hda: intel-dsp-config: add helper for ACPI DSP driver selection
  ASoC: soc-acpi: add helper to identify parent driver.
  ASoC: Intel: boards: byt/cht: set card and driver name at run time
  ASoC: Intel: byt/cht: set pm ops dynamically
  ASoC: SOF: acpi: add dynamic selection of DSP driver
  ASoC: Intel: Atom: add dynamic selection of DSP driver
  ASoC: SOF: Intel: allow for coexistence between SOF and Atom/SST
    drivers
  ALSA: hda: intel-dsp-config: add Broadwell ACPI DSP driver selection
  ASoC: Intel: broadwell: set card and driver name dynamically
  ASoC: Intel: catpt: add dynamic selection of DSP driver
  ASoC: SOF: Intel: allow for coexistence between SOF and catpt drivers
  ALSA: hda: intel-dsp-config: ignore dsp_driver parameter for PCI
    legacy devices

 include/sound/intel-dsp-config.h             |   7 ++
 include/sound/soc-acpi.h                     |   6 +
 sound/hda/intel-dsp-config.c                 | 111 +++++++++++++++++++
 sound/soc/intel/Kconfig                      |   2 +
 sound/soc/intel/atom/sst/sst_acpi.c          |   8 ++
 sound/soc/intel/boards/bdw-rt5650.c          |  17 ++-
 sound/soc/intel/boards/bdw-rt5677.c          |  18 ++-
 sound/soc/intel/boards/broadwell.c           |  20 ++--
 sound/soc/intel/boards/bytcht_cx2072x.c      |  27 +++--
 sound/soc/intel/boards/bytcht_da7213.c       |  27 +++--
 sound/soc/intel/boards/bytcht_es8316.c       |  29 +++--
 sound/soc/intel/boards/bytcr_rt5640.c        |  30 +++--
 sound/soc/intel/boards/bytcr_rt5651.c        |  27 +++--
 sound/soc/intel/boards/cht_bsw_max98090_ti.c |  29 +++--
 sound/soc/intel/boards/cht_bsw_nau8824.c     |  29 +++--
 sound/soc/intel/boards/cht_bsw_rt5645.c      |  38 ++++---
 sound/soc/intel/boards/cht_bsw_rt5672.c      |  29 +++--
 sound/soc/intel/catpt/device.c               |  12 ++
 sound/soc/sof/intel/Kconfig                  |  33 +++---
 sound/soc/sof/sof-acpi-dev.c                 |  14 ++-
 20 files changed, 392 insertions(+), 121 deletions(-)

--
2.25.1
This commit is contained in:
Mark Brown 2020-11-20 16:09:39 +00:00
commit 991e74d149
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
20 changed files with 392 additions and 121 deletions

View File

@ -21,6 +21,7 @@ enum {
#if IS_ENABLED(CONFIG_SND_INTEL_DSP_CONFIG)
int snd_intel_dsp_driver_probe(struct pci_dev *pci);
int snd_intel_acpi_dsp_driver_probe(struct device *dev, const u8 acpi_hid[ACPI_ID_LEN]);
#else
@ -29,6 +30,12 @@ static inline int snd_intel_dsp_driver_probe(struct pci_dev *pci)
return SND_INTEL_DSP_DRIVER_ANY;
}
static inline
int snd_intel_acpi_dsp_driver_probe(struct device *dev, const u8 acpi_hid[ACPI_ID_LEN])
{
return SND_INTEL_DSP_DRIVER_ANY;
}
#endif
#endif

View File

@ -171,4 +171,10 @@ struct snd_soc_acpi_codecs {
u8 codecs[SND_SOC_ACPI_MAX_CODECS][ACPI_ID_LEN];
};
static inline bool snd_soc_acpi_sof_parent(struct device *dev)
{
return dev->parent && dev->parent->driver && dev->parent->driver->name &&
!strcmp(dev->parent->driver->name, "sof-audio-acpi");
}
#endif

View File

@ -29,6 +29,7 @@ MODULE_PARM_DESC(dsp_driver, "Force the DSP driver for Intel DSP (0=auto, 1=lega
struct config_entry {
u32 flags;
u16 device;
u8 acpi_hid[ACPI_ID_LEN];
const struct dmi_system_id *dmi_table;
};
@ -378,6 +379,20 @@ int snd_intel_dsp_driver_probe(struct pci_dev *pci)
if (pci->vendor != 0x8086)
return SND_INTEL_DSP_DRIVER_ANY;
/*
* Legacy devices don't have a PCI-based DSP and use HDaudio
* for HDMI/DP support, ignore kernel parameter
*/
switch (pci->device) {
case 0x160c: /* Broadwell */
case 0x0a0c: /* Haswell */
case 0x0c0c:
case 0x0d0c:
case 0x0f04: /* Baytrail */
case 0x2284: /* Braswell */
return SND_INTEL_DSP_DRIVER_ANY;
}
if (dsp_driver > 0 && dsp_driver <= SND_INTEL_DSP_DRIVER_LAST)
return dsp_driver;
@ -433,6 +448,102 @@ int snd_intel_dsp_driver_probe(struct pci_dev *pci)
}
EXPORT_SYMBOL_GPL(snd_intel_dsp_driver_probe);
/*
* configuration table
* - the order of similar ACPI ID entries is important!
* - the first successful match will win
*/
static const struct config_entry acpi_config_table[] = {
/* BayTrail */
#if IS_ENABLED(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_ACPI)
{
.flags = FLAG_SST,
.acpi_hid = "80860F28",
},
#endif
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
{
.flags = FLAG_SOF,
.acpi_hid = "80860F28",
},
#endif
/* CherryTrail */
#if IS_ENABLED(CONFIG_SND_SST_ATOM_HIFI2_PLATFORM_ACPI)
{
.flags = FLAG_SST,
.acpi_hid = "808622A8",
},
#endif
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
{
.flags = FLAG_SOF,
.acpi_hid = "808622A8",
},
#endif
/* Broadwell */
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_CATPT)
{
.flags = FLAG_SST,
.acpi_hid = "INT3438"
},
#endif
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BROADWELL)
{
.flags = FLAG_SOF,
.acpi_hid = "INT3438"
},
#endif
/* Haswell - not supported by SOF but added for consistency */
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_CATPT)
{
.flags = FLAG_SST,
.acpi_hid = "INT33C8"
},
#endif
};
static const struct config_entry *snd_intel_acpi_dsp_find_config(const u8 acpi_hid[ACPI_ID_LEN],
const struct config_entry *table,
u32 len)
{
for (; len > 0; len--, table++) {
if (memcmp(table->acpi_hid, acpi_hid, ACPI_ID_LEN))
continue;
if (table->dmi_table && !dmi_check_system(table->dmi_table))
continue;
return table;
}
return NULL;
}
int snd_intel_acpi_dsp_driver_probe(struct device *dev, const u8 acpi_hid[ACPI_ID_LEN])
{
const struct config_entry *cfg;
if (dsp_driver > SND_INTEL_DSP_DRIVER_LEGACY && dsp_driver <= SND_INTEL_DSP_DRIVER_LAST)
return dsp_driver;
if (dsp_driver == SND_INTEL_DSP_DRIVER_LEGACY) {
dev_warn(dev, "dsp_driver parameter %d not supported, using automatic detection\n",
SND_INTEL_DSP_DRIVER_LEGACY);
}
/* find the configuration for the specific device */
cfg = snd_intel_acpi_dsp_find_config(acpi_hid, acpi_config_table,
ARRAY_SIZE(acpi_config_table));
if (!cfg)
return SND_INTEL_DSP_DRIVER_ANY;
if (cfg->flags & FLAG_SST)
return SND_INTEL_DSP_DRIVER_SST;
if (cfg->flags & FLAG_SOF)
return SND_INTEL_DSP_DRIVER_SOF;
return SND_INTEL_DSP_DRIVER_SST;
}
EXPORT_SYMBOL_GPL(snd_intel_acpi_dsp_driver_probe);
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("Intel DSP config driver");
MODULE_IMPORT_NS(SOUNDWIRE_INTEL_INIT);

View File

@ -25,6 +25,7 @@ config SND_SOC_INTEL_CATPT
select DW_DMAC_CORE
select SND_SOC_ACPI_INTEL_MATCH
select WANT_DEV_COREDUMP
select SND_INTEL_DSP_CONFIG
help
Enable support for Intel(R) Haswell and Broadwell platforms
with I2S codec present. This is a recommended option.
@ -56,6 +57,7 @@ config SND_SST_ATOM_HIFI2_PLATFORM_ACPI
depends on X86 && ACPI && PCI
select SND_SST_ATOM_HIFI2_PLATFORM
select SND_SOC_ACPI_INTEL_MATCH
select SND_INTEL_DSP_CONFIG
select IOSF_MBI
help
If you have a Intel Baytrail or Cherrytrail platform with an I2S

View File

@ -21,6 +21,7 @@
#include <linux/acpi.h>
#include <asm/platform_sst_audio.h>
#include <sound/core.h>
#include <sound/intel-dsp-config.h>
#include <sound/soc.h>
#include <sound/compress_driver.h>
#include <acpi/acbuffer.h>
@ -246,6 +247,13 @@ static int sst_acpi_probe(struct platform_device *pdev)
id = acpi_match_device(dev->driver->acpi_match_table, dev);
if (!id)
return -ENODEV;
ret = snd_intel_acpi_dsp_driver_probe(dev, id->id);
if (ret != SND_INTEL_DSP_DRIVER_ANY && ret != SND_INTEL_DSP_DRIVER_SST) {
dev_dbg(dev, "SST ACPI driver not selected, aborting probe\n");
return -ENODEV;
}
dev_dbg(dev, "for %s\n", id->id);
mach = (struct snd_soc_acpi_mach *)id->driver_data;

View File

@ -262,14 +262,12 @@ static struct snd_soc_dai_link bdw_rt5650_dais[] = {
},
};
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BROADWELL)
/* use space before codec name to simplify card ID, and simplify driver name */
#define CARD_NAME "bdw rt5650" /* card name will be 'sof-bdw rt5650' */
#define DRIVER_NAME "SOF"
#else
#define SOF_CARD_NAME "bdw rt5650" /* card name will be 'sof-bdw rt5650' */
#define SOF_DRIVER_NAME "SOF"
#define CARD_NAME "bdw-rt5650"
#define DRIVER_NAME NULL /* card name will be used for driver name */
#endif
/* ASoC machine driver for Broadwell DSP + RT5650 */
static struct snd_soc_card bdw_rt5650_card = {
@ -309,6 +307,15 @@ static int bdw_rt5650_probe(struct platform_device *pdev)
if (ret)
return ret;
/* set card and driver name */
if (snd_soc_acpi_sof_parent(&pdev->dev)) {
bdw_rt5650_card.name = SOF_CARD_NAME;
bdw_rt5650_card.driver_name = SOF_DRIVER_NAME;
} else {
bdw_rt5650_card.name = CARD_NAME;
bdw_rt5650_card.driver_name = DRIVER_NAME;
}
snd_soc_card_set_drvdata(&bdw_rt5650_card, bdw_rt5650);
return devm_snd_soc_register_card(&pdev->dev, &bdw_rt5650_card);

View File

@ -387,14 +387,12 @@ static int bdw_rt5677_resume_post(struct snd_soc_card *card)
return 0;
}
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BROADWELL)
/* use space before codec name to simplify card ID, and simplify driver name */
#define CARD_NAME "bdw rt5677" /* card name will be 'sof-bdw rt5677' */
#define DRIVER_NAME "SOF"
#else
#define SOF_CARD_NAME "bdw rt5677" /* card name will be 'sof-bdw rt5677' */
#define SOF_DRIVER_NAME "SOF"
#define CARD_NAME "bdw-rt5677"
#define DRIVER_NAME NULL /* card name will be used for driver name */
#endif
/* ASoC machine driver for Broadwell DSP + RT5677 */
static struct snd_soc_card bdw_rt5677_card = {
@ -437,6 +435,15 @@ static int bdw_rt5677_probe(struct platform_device *pdev)
if (ret)
return ret;
/* set card and driver name */
if (snd_soc_acpi_sof_parent(&pdev->dev)) {
bdw_rt5677_card.name = SOF_CARD_NAME;
bdw_rt5677_card.driver_name = SOF_DRIVER_NAME;
} else {
bdw_rt5677_card.name = CARD_NAME;
bdw_rt5677_card.driver_name = DRIVER_NAME;
}
snd_soc_card_set_drvdata(&bdw_rt5677_card, bdw_rt5677);
return devm_snd_soc_register_card(&pdev->dev, &bdw_rt5677_card);
@ -446,6 +453,7 @@ static struct platform_driver bdw_rt5677_audio = {
.probe = bdw_rt5677_probe,
.driver = {
.name = "bdw-rt5677",
.pm = &snd_soc_pm_ops
},
};

View File

@ -262,19 +262,15 @@ static int broadwell_resume(struct snd_soc_card *card){
return 0;
}
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BROADWELL)
/* use space before codec name to simplify card ID, and simplify driver name */
#define CARD_NAME "bdw rt286" /* card name will be 'sof-bdw rt286' */
#define DRIVER_NAME "SOF"
#else
#define SOF_CARD_NAME "bdw rt286" /* card name will be 'sof-bdw rt286' */
#define SOF_DRIVER_NAME "SOF"
#define CARD_NAME "broadwell-rt286"
#define DRIVER_NAME NULL /* card name will be used for driver name */
#endif
/* broadwell audio machine driver for WPT + RT286S */
static struct snd_soc_card broadwell_rt286 = {
.name = CARD_NAME,
.driver_name = DRIVER_NAME,
.owner = THIS_MODULE,
.dai_link = broadwell_rt286_dais,
.num_links = ARRAY_SIZE(broadwell_rt286_dais),
@ -303,6 +299,15 @@ static int broadwell_audio_probe(struct platform_device *pdev)
if (ret)
return ret;
/* set card and driver name */
if (snd_soc_acpi_sof_parent(&pdev->dev)) {
broadwell_rt286.name = SOF_CARD_NAME;
broadwell_rt286.driver_name = SOF_DRIVER_NAME;
} else {
broadwell_rt286.name = CARD_NAME;
broadwell_rt286.driver_name = DRIVER_NAME;
}
return devm_snd_soc_register_card(&pdev->dev, &broadwell_rt286);
}
@ -318,6 +323,7 @@ static struct platform_driver broadwell_audio = {
.remove = broadwell_audio_remove,
.driver = {
.name = "broadwell-audio",
.pm = &snd_soc_pm_ops
},
};

View File

@ -205,14 +205,12 @@ static struct snd_soc_dai_link byt_cht_cx2072x_dais[] = {
},
};
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
/* use space before codec name to simplify card ID, and simplify driver name */
#define CARD_NAME "bytcht cx2072x" /* card name will be 'sof-bytcht cx2072x' */
#define DRIVER_NAME "SOF"
#else
#define SOF_CARD_NAME "bytcht cx2072x" /* card name will be 'sof-bytcht cx2072x' */
#define SOF_DRIVER_NAME "SOF"
#define CARD_NAME "bytcht-cx2072x"
#define DRIVER_NAME NULL /* card name will be used for driver name */
#endif
/* SoC card */
static struct snd_soc_card byt_cht_cx2072x_card = {
@ -236,6 +234,7 @@ static int snd_byt_cht_cx2072x_probe(struct platform_device *pdev)
struct snd_soc_acpi_mach *mach;
struct acpi_device *adev;
int dai_index = 0;
bool sof_parent;
int i, ret;
byt_cht_cx2072x_card.dev = &pdev->dev;
@ -265,15 +264,27 @@ static int snd_byt_cht_cx2072x_probe(struct platform_device *pdev)
if (ret)
return ret;
sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
/* set card and driver name */
if (sof_parent) {
byt_cht_cx2072x_card.name = SOF_CARD_NAME;
byt_cht_cx2072x_card.driver_name = SOF_DRIVER_NAME;
} else {
byt_cht_cx2072x_card.name = CARD_NAME;
byt_cht_cx2072x_card.driver_name = DRIVER_NAME;
}
/* set pm ops */
if (sof_parent)
pdev->dev.driver->pm = &snd_soc_pm_ops;
return devm_snd_soc_register_card(&pdev->dev, &byt_cht_cx2072x_card);
}
static struct platform_driver snd_byt_cht_cx2072x_driver = {
.driver = {
.name = "bytcht_cx2072x",
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
.pm = &snd_soc_pm_ops,
#endif
},
.probe = snd_byt_cht_cx2072x_probe,
};

View File

@ -205,14 +205,12 @@ static struct snd_soc_dai_link dailink[] = {
},
};
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
/* use space before codec name to simplify card ID, and simplify driver name */
#define CARD_NAME "bytcht da7213" /* card name will be 'sof-bytcht da7213' */
#define DRIVER_NAME "SOF"
#else
#define SOF_CARD_NAME "bytcht da7213" /* card name will be 'sof-bytcht da7213' */
#define SOF_DRIVER_NAME "SOF"
#define CARD_NAME "bytcht-da7213"
#define DRIVER_NAME NULL /* card name will be used for driver name */
#endif
/* SoC card */
static struct snd_soc_card bytcht_da7213_card = {
@ -237,6 +235,7 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
struct snd_soc_acpi_mach *mach;
const char *platform_name;
struct acpi_device *adev;
bool sof_parent;
int dai_index = 0;
int ret_val = 0;
int i;
@ -269,6 +268,21 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
if (ret_val)
return ret_val;
sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
/* set card and driver name */
if (sof_parent) {
bytcht_da7213_card.name = SOF_CARD_NAME;
bytcht_da7213_card.driver_name = SOF_DRIVER_NAME;
} else {
bytcht_da7213_card.name = CARD_NAME;
bytcht_da7213_card.driver_name = DRIVER_NAME;
}
/* set pm ops */
if (sof_parent)
pdev->dev.driver->pm = &snd_soc_pm_ops;
ret_val = devm_snd_soc_register_card(&pdev->dev, card);
if (ret_val) {
dev_err(&pdev->dev,
@ -282,9 +296,6 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
static struct platform_driver bytcht_da7213_driver = {
.driver = {
.name = "bytcht_da7213",
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
.pm = &snd_soc_pm_ops,
#endif
},
.probe = bytcht_da7213_probe,
};

View File

@ -406,18 +406,14 @@ static int byt_cht_es8316_resume(struct snd_soc_card *card)
return 0;
}
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
/* use space before codec name to simplify card ID, and simplify driver name */
#define CARD_NAME "bytcht es8316" /* card name will be 'sof-bytcht es8316' */
#define DRIVER_NAME "SOF"
#else
#define SOF_CARD_NAME "bytcht es8316" /* card name will be 'sof-bytcht es8316' */
#define SOF_DRIVER_NAME "SOF"
#define CARD_NAME "bytcht-es8316"
#define DRIVER_NAME NULL /* card name will be used for driver name */
#endif
static struct snd_soc_card byt_cht_es8316_card = {
.name = CARD_NAME,
.driver_name = DRIVER_NAME,
.owner = THIS_MODULE,
.dai_link = byt_cht_es8316_dais,
.num_links = ARRAY_SIZE(byt_cht_es8316_dais),
@ -472,6 +468,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
const char *platform_name;
struct acpi_device *adev;
struct device *codec_dev;
bool sof_parent;
unsigned int cnt = 0;
int dai_index = 0;
int i;
@ -590,6 +587,21 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
byt_cht_es8316_card.long_name = long_name;
#endif
sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
/* set card and driver name */
if (sof_parent) {
byt_cht_es8316_card.name = SOF_CARD_NAME;
byt_cht_es8316_card.driver_name = SOF_DRIVER_NAME;
} else {
byt_cht_es8316_card.name = CARD_NAME;
byt_cht_es8316_card.driver_name = DRIVER_NAME;
}
/* set pm ops */
if (sof_parent)
dev->driver->pm = &snd_soc_pm_ops;
/* register the soc card */
snd_soc_card_set_drvdata(&byt_cht_es8316_card, priv);
@ -615,9 +627,6 @@ static int snd_byt_cht_es8316_mc_remove(struct platform_device *pdev)
static struct platform_driver snd_byt_cht_es8316_mc_driver = {
.driver = {
.name = "bytcht_es8316",
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
.pm = &snd_soc_pm_ops,
#endif
},
.probe = snd_byt_cht_es8316_mc_probe,
.remove = snd_byt_cht_es8316_mc_remove,

View File

@ -1136,18 +1136,14 @@ static int byt_rt5640_resume(struct snd_soc_card *card)
return 0;
}
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
/* use space before codec name to simplify card ID, and simplify driver name */
#define CARD_NAME "bytcht rt5640" /* card name will be 'sof-bytcht rt5640' */
#define DRIVER_NAME "SOF"
#else
#define SOF_CARD_NAME "bytcht rt5640" /* card name will be 'sof-bytcht rt5640' */
#define SOF_DRIVER_NAME "SOF"
#define CARD_NAME "bytcr-rt5640"
#define DRIVER_NAME NULL /* card name will be used for driver name */
#endif
static struct snd_soc_card byt_rt5640_card = {
.name = CARD_NAME,
.driver_name = DRIVER_NAME,
.owner = THIS_MODULE,
.dai_link = byt_rt5640_dais,
.num_links = ARRAY_SIZE(byt_rt5640_dais),
@ -1167,12 +1163,14 @@ struct acpi_chan_package { /* ACPICA seems to require 64 bit integers */
static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
static const char * const map_name[] = { "dmic1", "dmic2", "in1", "in3" };
const struct dmi_system_id *dmi_id;
struct byt_rt5640_private *priv;
struct snd_soc_acpi_mach *mach;
const char *platform_name;
struct acpi_device *adev;
bool sof_parent;
int ret_val = 0;
int dai_index = 0;
int i;
@ -1336,6 +1334,21 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
if (ret_val)
return ret_val;
sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
/* set card and driver name */
if (sof_parent) {
byt_rt5640_card.name = SOF_CARD_NAME;
byt_rt5640_card.driver_name = SOF_DRIVER_NAME;
} else {
byt_rt5640_card.name = CARD_NAME;
byt_rt5640_card.driver_name = DRIVER_NAME;
}
/* set pm ops */
if (sof_parent)
dev->driver->pm = &snd_soc_pm_ops;
ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5640_card);
if (ret_val) {
@ -1350,9 +1363,6 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
static struct platform_driver snd_byt_rt5640_mc_driver = {
.driver = {
.name = "bytcr_rt5640",
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
.pm = &snd_soc_pm_ops,
#endif
},
.probe = snd_byt_rt5640_mc_probe,
};

View File

@ -827,14 +827,12 @@ static int byt_rt5651_resume(struct snd_soc_card *card)
return 0;
}
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
/* use space before codec name to simplify card ID, and simplify driver name */
#define CARD_NAME "bytcht rt5651" /* card name will be 'sof-bytcht rt5651' */
#define DRIVER_NAME "SOF"
#else
#define SOF_CARD_NAME "bytcht rt5651" /* card name will be 'sof-bytcht rt5651' */
#define SOF_DRIVER_NAME "SOF"
#define CARD_NAME "bytcr-rt5651"
#define DRIVER_NAME NULL /* card name will be used for driver name */
#endif
static struct snd_soc_card byt_rt5651_card = {
.name = CARD_NAME,
@ -876,6 +874,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
const char *platform_name;
struct acpi_device *adev;
struct device *codec_dev;
bool sof_parent;
bool is_bytcr = false;
int ret_val = 0;
int dai_index = 0;
@ -1093,6 +1092,21 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
if (ret_val)
return ret_val;
sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
/* set card and driver name */
if (sof_parent) {
byt_rt5651_card.name = SOF_CARD_NAME;
byt_rt5651_card.driver_name = SOF_DRIVER_NAME;
} else {
byt_rt5651_card.name = CARD_NAME;
byt_rt5651_card.driver_name = DRIVER_NAME;
}
/* set pm ops */
if (sof_parent)
pdev->dev.driver->pm = &snd_soc_pm_ops;
ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5651_card);
if (ret_val) {
@ -1107,9 +1121,6 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
static struct platform_driver snd_byt_rt5651_mc_driver = {
.driver = {
.name = "bytcr_rt5651",
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
.pm = &snd_soc_pm_ops,
#endif
},
.probe = snd_byt_rt5651_mc_probe,
};

View File

@ -382,19 +382,15 @@ static struct snd_soc_dai_link cht_dailink[] = {
},
};
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
/* use space before codec name to simplify card ID, and simplify driver name */
#define CARD_NAME "bytcht max98090" /* card name will be 'sof-bytcht max98090 */
#define DRIVER_NAME "SOF"
#else
#define SOF_CARD_NAME "bytcht max98090" /* card name will be 'sof-bytcht max98090 */
#define SOF_DRIVER_NAME "SOF"
#define CARD_NAME "chtmax98090"
#define DRIVER_NAME NULL /* card name will be used for driver name */
#endif
/* SoC card */
static struct snd_soc_card snd_soc_card_cht = {
.name = CARD_NAME,
.driver_name = DRIVER_NAME,
.owner = THIS_MODULE,
.dai_link = cht_dailink,
.num_links = ARRAY_SIZE(cht_dailink),
@ -540,6 +536,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
const char *mclk_name;
struct snd_soc_acpi_mach *mach;
const char *platform_name;
bool sof_parent;
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
if (!drv)
@ -602,6 +599,21 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
}
}
sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
/* set card and driver name */
if (sof_parent) {
snd_soc_card_cht.name = SOF_CARD_NAME;
snd_soc_card_cht.driver_name = SOF_DRIVER_NAME;
} else {
snd_soc_card_cht.name = CARD_NAME;
snd_soc_card_cht.driver_name = DRIVER_NAME;
}
/* set pm ops */
if (sof_parent)
dev->driver->pm = &snd_soc_pm_ops;
ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
if (ret_val) {
dev_err(&pdev->dev,
@ -626,9 +638,6 @@ static int snd_cht_mc_remove(struct platform_device *pdev)
static struct platform_driver snd_cht_mc_driver = {
.driver = {
.name = "cht-bsw-max98090",
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
.pm = &snd_soc_pm_ops,
#endif
},
.probe = snd_cht_mc_probe,
.remove = snd_cht_mc_remove,

View File

@ -231,19 +231,15 @@ static struct snd_soc_dai_link cht_dailink[] = {
},
};
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
/* use space before codec name to simplify card ID, and simplify driver name */
#define CARD_NAME "bytcht nau8824" /* card name will be 'sof-bytcht nau8824 */
#define DRIVER_NAME "SOF"
#else
#define SOF_CARD_NAME "bytcht nau8824" /* card name will be 'sof-bytcht nau8824 */
#define SOF_DRIVER_NAME "SOF"
#define CARD_NAME "chtnau8824"
#define DRIVER_NAME NULL /* card name will be used for driver name */
#endif
/* SoC card */
static struct snd_soc_card snd_soc_card_cht = {
.name = CARD_NAME,
.driver_name = DRIVER_NAME,
.owner = THIS_MODULE,
.dai_link = cht_dailink,
.num_links = ARRAY_SIZE(cht_dailink),
@ -260,6 +256,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
struct cht_mc_private *drv;
struct snd_soc_acpi_mach *mach;
const char *platform_name;
bool sof_parent;
int ret_val;
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
@ -277,6 +274,21 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
if (ret_val)
return ret_val;
sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
/* set card and driver name */
if (sof_parent) {
snd_soc_card_cht.name = SOF_CARD_NAME;
snd_soc_card_cht.driver_name = SOF_DRIVER_NAME;
} else {
snd_soc_card_cht.name = CARD_NAME;
snd_soc_card_cht.driver_name = DRIVER_NAME;
}
/* set pm ops */
if (sof_parent)
pdev->dev.driver->pm = &snd_soc_pm_ops;
/* register the soc card */
ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
if (ret_val) {
@ -292,9 +304,6 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
static struct platform_driver snd_cht_mc_driver = {
.driver = {
.name = "cht-bsw-nau8824",
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
.pm = &snd_soc_pm_ops,
#endif
},
.probe = snd_cht_mc_probe,
};

View File

@ -479,21 +479,17 @@ static struct snd_soc_dai_link cht_dailink[] = {
},
};
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
/* use space before codec name to simplify card ID, and simplify driver name */
#define CARD_RT5645_NAME "bytcht rt5645" /* card name 'sof-bytcht rt5645' */
#define CARD_RT5650_NAME "bytcht rt5650" /* card name 'sof-bytcht rt5650' */
#define DRIVER_NAME "SOF"
#else
#define SOF_CARD_RT5645_NAME "bytcht rt5645" /* card name 'sof-bytcht rt5645' */
#define SOF_CARD_RT5650_NAME "bytcht rt5650" /* card name 'sof-bytcht rt5650' */
#define SOF_DRIVER_NAME "SOF"
#define CARD_RT5645_NAME "chtrt5645"
#define CARD_RT5650_NAME "chtrt5650"
#define DRIVER_NAME NULL /* card name will be used for driver name */
#endif
/* SoC card */
static struct snd_soc_card snd_soc_card_chtrt5645 = {
.name = CARD_RT5645_NAME,
.driver_name = DRIVER_NAME,
.owner = THIS_MODULE,
.dai_link = cht_dailink,
.num_links = ARRAY_SIZE(cht_dailink),
@ -506,8 +502,6 @@ static struct snd_soc_card snd_soc_card_chtrt5645 = {
};
static struct snd_soc_card snd_soc_card_chtrt5650 = {
.name = CARD_RT5650_NAME,
.driver_name = DRIVER_NAME,
.owner = THIS_MODULE,
.dai_link = cht_dailink,
.num_links = ARRAY_SIZE(cht_dailink),
@ -541,6 +535,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
const char *platform_name;
struct cht_mc_private *drv;
struct acpi_device *adev;
bool sof_parent;
bool found = false;
bool is_bytcr = false;
int dai_index = 0;
@ -680,6 +675,26 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
}
snd_soc_card_set_drvdata(card, drv);
sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
/* set card and driver name */
if (sof_parent) {
snd_soc_card_chtrt5645.name = SOF_CARD_RT5645_NAME;
snd_soc_card_chtrt5645.driver_name = SOF_DRIVER_NAME;
snd_soc_card_chtrt5650.name = SOF_CARD_RT5650_NAME;
snd_soc_card_chtrt5650.driver_name = SOF_DRIVER_NAME;
} else {
snd_soc_card_chtrt5645.name = CARD_RT5645_NAME;
snd_soc_card_chtrt5645.driver_name = DRIVER_NAME;
snd_soc_card_chtrt5650.name = CARD_RT5650_NAME;
snd_soc_card_chtrt5650.driver_name = DRIVER_NAME;
}
/* set pm ops */
if (sof_parent)
pdev->dev.driver->pm = &snd_soc_pm_ops;
ret_val = devm_snd_soc_register_card(&pdev->dev, card);
if (ret_val) {
dev_err(&pdev->dev,
@ -693,9 +708,6 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
static struct platform_driver snd_cht_mc_driver = {
.driver = {
.name = "cht-bsw-rt5645",
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
.pm = &snd_soc_pm_ops,
#endif
},
.probe = snd_cht_mc_probe,
};

View File

@ -382,19 +382,15 @@ static int cht_resume_post(struct snd_soc_card *card)
return 0;
}
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
/* use space before codec name to simplify card ID, and simplify driver name */
#define CARD_NAME "bytcht rt5672" /* card name will be 'sof-bytcht rt5672' */
#define DRIVER_NAME "SOF"
#else
#define SOF_CARD_NAME "bytcht rt5672" /* card name will be 'sof-bytcht rt5672' */
#define SOF_DRIVER_NAME "SOF"
#define CARD_NAME "cht-bsw-rt5672"
#define DRIVER_NAME NULL /* card name will be used for driver name */
#endif
/* SoC card */
static struct snd_soc_card snd_soc_card_cht = {
.name = CARD_NAME,
.driver_name = DRIVER_NAME,
.owner = THIS_MODULE,
.dai_link = cht_dailink,
.num_links = ARRAY_SIZE(cht_dailink),
@ -417,6 +413,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
struct snd_soc_acpi_mach *mach = pdev->dev.platform_data;
const char *platform_name;
struct acpi_device *adev;
bool sof_parent;
int i;
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
@ -458,6 +455,21 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
}
snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
/* set card and driver name */
if (sof_parent) {
snd_soc_card_cht.name = SOF_CARD_NAME;
snd_soc_card_cht.driver_name = SOF_DRIVER_NAME;
} else {
snd_soc_card_cht.name = CARD_NAME;
snd_soc_card_cht.driver_name = DRIVER_NAME;
}
/* set pm ops */
if (sof_parent)
pdev->dev.driver->pm = &snd_soc_pm_ops;
/* register the soc card */
ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
if (ret_val) {
@ -472,9 +484,6 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
static struct platform_driver snd_cht_mc_driver = {
.driver = {
.name = "cht-bsw-rt5672",
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
.pm = &snd_soc_pm_ops,
#endif
},
.probe = snd_cht_mc_probe,
};

View File

@ -19,6 +19,7 @@
#include <linux/pci.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <sound/intel-dsp-config.h>
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include <sound/soc-acpi-intel-match.h>
@ -239,9 +240,20 @@ static int catpt_acpi_probe(struct platform_device *pdev)
const struct catpt_spec *spec;
struct catpt_dev *cdev;
struct device *dev = &pdev->dev;
const struct acpi_device_id *id;
struct resource *res;
int ret;
id = acpi_match_device(dev->driver->acpi_match_table, dev);
if (!id)
return -ENODEV;
ret = snd_intel_acpi_dsp_driver_probe(dev, id->id);
if (ret != SND_INTEL_DSP_DRIVER_ANY && ret != SND_INTEL_DSP_DRIVER_SST) {
dev_dbg(dev, "CATPT ACPI driver not selected, aborting probe\n");
return -ENODEV;
}
spec = device_get_match_data(dev);
if (!spec)
return -ENODEV;

View File

@ -62,40 +62,41 @@ if SND_SOC_SOF_INTEL_ACPI
config SND_SOC_SOF_BAYTRAIL_SUPPORT
bool "SOF support for Baytrail, Braswell and Cherrytrail"
depends on SND_SST_ATOM_HIFI2_PLATFORM_ACPI=n
help
This adds support for Sound Open Firmware for Intel(R) platforms
using the Baytrail, Braswell or Cherrytrail processors.
This option is mutually exclusive with the Atom/SST and Baytrail
legacy drivers. If you want to enable SOF on Baytrail/Cherrytrail,
you need to deselect those options first.
SOF does not support Baytrail-CR for now, so this option is not
recommended for distros. At some point all legacy drivers will be
deprecated but not before all userspace firmware/topology/UCM files
are made available to downstream distros.
This option can coexist in the same build with the Atom legacy
drivers, currently the default but which will be deprecated
at some point.
Existing firmware/topology binaries and UCM configurations
typically located in the root file system are already
compatible with both SOF or Atom/SST legacy drivers.
This is a recommended option for distributions.
Say Y if you want to enable SOF on Baytrail/Cherrytrail.
If unsure select "N".
config SND_SOC_SOF_BAYTRAIL
tristate
select SND_SOC_SOF_INTEL_ATOM_HIFI_EP
select SND_INTEL_DSP_CONFIG
help
This option is not user-selectable but automagically handled by
'select' statements at a higher level.
config SND_SOC_SOF_BROADWELL_SUPPORT
bool "SOF support for Broadwell"
depends on SND_SOC_INTEL_HASWELL=n
select SND_INTEL_DSP_CONFIG
help
This adds support for Sound Open Firmware for Intel(R) platforms
using the Broadwell processors.
This option is mutually exclusive with the Haswell/Broadwell legacy
driver. If you want to enable SOF on Broadwell you need to deselect
the legacy driver first.
SOF does not fully support Broadwell yet, so this option is not
recommended for distros. At some point all legacy drivers will be
deprecated but not before all userspace firmware/topology/UCM files
are made available to downstream distros.
This option can coexist in the same build with the default 'catpt'
driver.
Existing firmware/topology binaries and UCM configurations typically
located in the root file system are already compatible with both SOF
or catpt drivers.
SOF does not fully support Broadwell and has limitations related to
DMA and suspend-resume, this is not a recommended option for
distributions.
Say Y if you want to enable SOF on Broadwell.
If unsure select "N".

View File

@ -12,6 +12,7 @@
#include <linux/firmware.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <sound/intel-dsp-config.h>
#include <sound/soc-acpi.h>
#include <sound/soc-acpi-intel-match.h>
#include <sound/sof.h>
@ -120,12 +121,23 @@ static void sof_acpi_probe_complete(struct device *dev)
static int sof_acpi_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
const struct acpi_device_id *id;
const struct sof_dev_desc *desc;
struct snd_sof_pdata *sof_pdata;
const struct snd_sof_dsp_ops *ops;
int ret;
dev_dbg(&pdev->dev, "ACPI DSP detected");
id = acpi_match_device(dev->driver->acpi_match_table, dev);
if (!id)
return -ENODEV;
ret = snd_intel_acpi_dsp_driver_probe(dev, id->id);
if (ret != SND_INTEL_DSP_DRIVER_ANY && ret != SND_INTEL_DSP_DRIVER_SOF) {
dev_dbg(dev, "SOF ACPI driver not selected, aborting probe\n");
return -ENODEV;
}
dev_dbg(dev, "ACPI DSP detected");
sof_pdata = devm_kzalloc(dev, sizeof(*sof_pdata), GFP_KERNEL);
if (!sof_pdata)