summaryrefslogtreecommitdiff
path: root/sound/soc/sof/sof-acpi-dev.c
diff options
context:
space:
mode:
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>2019-05-30 14:50:11 +0300
committerMark Brown <broonie@kernel.org>2019-05-30 18:33:26 +0300
commit536cfd2f375d36f4316c0b93bb9e0eaf78e0ef6c (patch)
tree2990c0ffb102ef23ac6316329c71ce9083d8d0ee /sound/soc/sof/sof-acpi-dev.c
parentf499edf9fa90f184af9f457fd0912a788754af25 (diff)
downloadlinux-536cfd2f375d36f4316c0b93bb9e0eaf78e0ef6c.tar.xz
ASoC: Intel: use common helpers to detect CPUs
We have duplicated code in multiple locations (atom, machine drivers, SOF) to detect Baytrail, Cherrytrail and other SOCs. This is not very elegant, and introduces dependencies on CONFIG_X86 that prevent COMPILE_TEST from working. Add common helpers to provide same functionality in a cleaner way. This will also help support the DMI-based quirks being introduced to handle SOF/SST autodetection. Reviewed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/sof-acpi-dev.c')
-rw-r--r--sound/soc/sof/sof-acpi-dev.c57
1 files changed, 2 insertions, 55 deletions
diff --git a/sound/soc/sof/sof-acpi-dev.c b/sound/soc/sof/sof-acpi-dev.c
index e9cf69874b5b..c8dafb1ac54e 100644
--- a/sound/soc/sof/sof-acpi-dev.c
+++ b/sound/soc/sof/sof-acpi-dev.c
@@ -15,10 +15,7 @@
#include <sound/soc-acpi.h>
#include <sound/soc-acpi-intel-match.h>
#include <sound/sof.h>
-#ifdef CONFIG_X86
-#include <asm/iosf_mbi.h>
-#endif
-
+#include "../intel/common/soc-intel-quirks.h"
#include "ops.h"
/* platform specific devices */
@@ -99,56 +96,6 @@ static const struct sof_dev_desc sof_acpi_baytrail_desc = {
.arch_ops = &sof_xtensa_arch_ops
};
-#ifdef CONFIG_X86 /* TODO: move this to common helper */
-
-static bool is_byt_cr(struct platform_device *pdev)
-{
- struct device *dev = &pdev->dev;
- int status;
-
- if (iosf_mbi_available()) {
- u32 bios_status;
- status = iosf_mbi_read(BT_MBI_UNIT_PMC, /* 0x04 PUNIT */
- MBI_REG_READ, /* 0x10 */
- 0x006, /* BIOS_CONFIG */
- &bios_status);
-
- if (status) {
- dev_err(dev, "could not read PUNIT BIOS_CONFIG\n");
- } else {
- /* bits 26:27 mirror PMIC options */
- bios_status = (bios_status >> 26) & 3;
-
- if (bios_status == 1 || bios_status == 3) {
- dev_info(dev, "Detected Baytrail-CR platform\n");
- return true;
- }
-
- dev_info(dev, "BYT-CR not detected\n");
- }
- } else {
- dev_info(dev, "IOSF_MBI not available, no BYT-CR detection\n");
- }
-
- if (platform_get_resource(pdev, IORESOURCE_IRQ, 5) == NULL) {
- /*
- * Some devices detected as BYT-T have only a single IRQ listed,
- * causing platform_get_irq with index 5 to return -ENXIO.
- * The correct IRQ in this case is at index 0, as on BYT-CR.
- */
- dev_info(dev, "Falling back to Baytrail-CR platform\n");
- return true;
- }
-
- return false;
-}
-#else
-static int is_byt_cr(struct platform_device *pdev)
-{
- return 0;
-}
-#endif
-
static const struct sof_dev_desc sof_acpi_cherrytrail_desc = {
.machines = snd_soc_acpi_intel_cherrytrail_machines,
.resindex_lpe_base = 0,
@@ -200,7 +147,7 @@ static int sof_acpi_probe(struct platform_device *pdev)
return -ENODEV;
#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
- if (desc == &sof_acpi_baytrail_desc && is_byt_cr(pdev))
+ if (desc == &sof_acpi_baytrail_desc && soc_intel_is_byt_cr(pdev))
desc = &sof_acpi_baytrailcr_desc;
#endif