Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60046406 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown
Browse files

ASoC: Intel: move all ACPI match tables to common module



First step of cleaning, move all tables to soc-acpi-intel-match module.
The tables remain in separate files per platform to keep them
manageable. Skylake+ platforms are still handled elsewhere since
there is no conflict with SOF for now, but this will have to be
handled at a later point.

Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: default avatarLiam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 976b5a0e
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line

/*
 * Copyright (C) 2017, Intel Corporation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version
 * 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef __LINUX_SND_SOC_ACPI_INTEL_MATCH_H
#define __LINUX_SND_SOC_ACPI_INTEL_MATCH_H

#include <linux/stddef.h>
#include <linux/acpi.h>

/*
 * these tables are not constants, some fields can be used for
 * pdata or machine ops
 */
extern struct snd_soc_acpi_mach snd_soc_acpi_intel_haswell_machines[];
extern struct snd_soc_acpi_mach snd_soc_acpi_intel_broadwell_machines[];
extern struct snd_soc_acpi_mach snd_soc_acpi_intel_baytrail_legacy_machines[];
extern struct snd_soc_acpi_mach snd_soc_acpi_intel_baytrail_machines[];
extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cherrytrail_machines[];

#endif
+14 −10
Original line number Diff line number Diff line
@@ -27,10 +27,14 @@ config SND_SST_IPC_ACPI
	select SND_SOC_INTEL_SST
	select IOSF_MBI

config SND_SOC_INTEL_COMMON
	tristate

config SND_SOC_INTEL_SST
	tristate
	select SND_SOC_INTEL_COMMON
	select SND_SOC_INTEL_SST_ACPI if ACPI
	select SND_SOC_INTEL_SST_MATCH if ACPI
	select SND_SOC_ACPI_INTEL_MATCH if ACPI

config SND_SOC_INTEL_SST_FIRMWARE
	tristate
@@ -39,7 +43,7 @@ config SND_SOC_INTEL_SST_FIRMWARE
config SND_SOC_INTEL_SST_ACPI
	tristate

config SND_SOC_INTEL_SST_MATCH
config SND_SOC_ACPI_INTEL_MATCH
	tristate
	select SND_SOC_ACPI if ACPI

@@ -145,7 +149,7 @@ config SND_SOC_INTEL_BYTCR_RT5640_MACH
	select SND_SOC_RT5640
	select SND_SST_ATOM_HIFI2_PLATFORM
	select SND_SST_IPC_ACPI
	select SND_SOC_INTEL_SST_MATCH if ACPI
	select SND_SOC_ACPI_INTEL_MATCH if ACPI
	help
          This adds support for ASoC machine driver for Intel(R) Baytrail and Baytrail-CR
          platforms with RT5640 audio codec.
@@ -158,7 +162,7 @@ config SND_SOC_INTEL_BYTCR_RT5651_MACH
	select SND_SOC_RT5651
	select SND_SST_ATOM_HIFI2_PLATFORM
	select SND_SST_IPC_ACPI
	select SND_SOC_INTEL_SST_MATCH if ACPI
	select SND_SOC_ACPI_INTEL_MATCH if ACPI
	help
          This adds support for ASoC machine driver for Intel(R) Baytrail and Baytrail-CR
          platforms with RT5651 audio codec.
@@ -171,7 +175,7 @@ config SND_SOC_INTEL_CHT_BSW_RT5672_MACH
        select SND_SOC_RT5670
        select SND_SST_ATOM_HIFI2_PLATFORM
        select SND_SST_IPC_ACPI
	select SND_SOC_INTEL_SST_MATCH if ACPI
	select SND_SOC_ACPI_INTEL_MATCH if ACPI
        help
          This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell
          platforms with RT5672 audio codec.
@@ -184,7 +188,7 @@ config SND_SOC_INTEL_CHT_BSW_RT5645_MACH
	select SND_SOC_RT5645
	select SND_SST_ATOM_HIFI2_PLATFORM
	select SND_SST_IPC_ACPI
	select SND_SOC_INTEL_SST_MATCH if ACPI
	select SND_SOC_ACPI_INTEL_MATCH if ACPI
	help
	  This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell
	  platforms with RT5645/5650 audio codec.
@@ -197,7 +201,7 @@ config SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH
	select SND_SOC_TS3A227E
	select SND_SST_ATOM_HIFI2_PLATFORM
	select SND_SST_IPC_ACPI
	select SND_SOC_INTEL_SST_MATCH if ACPI
	select SND_SOC_ACPI_INTEL_MATCH if ACPI
	help
	  This adds support for ASoC machine driver for Intel(R) Cherrytrail & Braswell
	  platforms with MAX98090 audio codec it also can support TI jack chip as aux device.
@@ -209,7 +213,7 @@ config SND_SOC_INTEL_BYT_CHT_DA7213_MACH
	select SND_SOC_DA7213
	select SND_SST_ATOM_HIFI2_PLATFORM
	select SND_SST_IPC_ACPI
	select SND_SOC_INTEL_SST_MATCH if ACPI
	select SND_SOC_ACPI_INTEL_MATCH if ACPI
	help
	  This adds support for ASoC machine driver for Intel(R) Baytrail & CherryTrail
	  platforms with DA7212/7213 audio codec.
@@ -221,7 +225,7 @@ config SND_SOC_INTEL_BYT_CHT_ES8316_MACH
	select SND_SOC_ES8316
	select SND_SST_ATOM_HIFI2_PLATFORM
	select SND_SST_IPC_ACPI
	select SND_SOC_INTEL_SST_MATCH if ACPI
	select SND_SOC_ACPI_INTEL_MATCH if ACPI
	help
	  This adds support for ASoC machine driver for Intel(R) Baytrail &
	  Cherrytrail platforms with ES8316 audio codec.
@@ -232,7 +236,7 @@ config SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH
	depends on X86_INTEL_LPSS && I2C && ACPI
	select SND_SST_ATOM_HIFI2_PLATFORM
	select SND_SST_IPC_ACPI
	select SND_SOC_INTEL_SST_MATCH if ACPI
	select SND_SOC_ACPI_INTEL_MATCH if ACPI
	help
	  This adds support for ASoC machine driver for the MinnowBoard Max or
	  Up boards and provides access to I2S signals on the Low-Speed
+1 −1
Original line number Diff line number Diff line
# Core support
obj-$(CONFIG_SND_SOC_INTEL_SST) += common/
obj-$(CONFIG_SND_SOC_INTEL_COMMON) += common/

# Platform Support
obj-$(CONFIG_SND_SOC_INTEL_HASWELL) += haswell/
+19 −292
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
#include <asm/cpu_device_id.h>
#include <asm/iosf_mbi.h>
#include <sound/soc-acpi.h>
#include <sound/soc-acpi-intel-match.h>
#include "../sst-mfld-platform.h"
#include "../../common/sst-dsp.h"
#include "sst.h"
@@ -238,19 +239,26 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)
	return 0;
}

static int is_byt(void)
{
	bool status = false;
	static const struct x86_cpu_id cpu_ids[] = {
		{ X86_VENDOR_INTEL, 6, 55 }, /* Valleyview, Bay Trail */
		{}
	};
	if (x86_match_cpu(cpu_ids))
		status = true;
	return status;
}

static int is_byt_cr(struct device *dev, bool *bytcr)
{
	int status = 0;

	if (IS_ENABLED(CONFIG_IOSF_MBI)) {
		static const struct x86_cpu_id cpu_ids[] = {
			{ X86_VENDOR_INTEL, 6, 55 }, /* Valleyview, Bay Trail */
			{}
		};
		u32 bios_status;

		if (!x86_match_cpu(cpu_ids) || !iosf_mbi_available()) {
		if (!is_byt() || !iosf_mbi_available()) {
			/* bail silently */
			return status;
		}
@@ -303,6 +311,10 @@ static int sst_acpi_probe(struct platform_device *pdev)
		return -ENODEV;
	}

	if (is_byt())
		mach->pdata = &byt_rvp_platform_data;
	else
		mach->pdata = &chv_platform_data;
	pdata = mach->pdata;

	ret = kstrtouint(id->id, 16, &dev_id);
@@ -380,294 +392,9 @@ static int sst_acpi_remove(struct platform_device *pdev)
	return 0;
}

static unsigned long cht_machine_id;

#define CHT_SURFACE_MACH 1
#define BYT_THINKPAD_10  2

static int cht_surface_quirk_cb(const struct dmi_system_id *id)
{
	cht_machine_id = CHT_SURFACE_MACH;
	return 1;
}

static int byt_thinkpad10_quirk_cb(const struct dmi_system_id *id)
{
	cht_machine_id = BYT_THINKPAD_10;
	return 1;
}


static const struct dmi_system_id byt_table[] = {
	{
		.callback = byt_thinkpad10_quirk_cb,
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad 10"),
		},
	},
	{
		.callback = byt_thinkpad10_quirk_cb,
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Tablet B"),
		},
	},
	{
		.callback = byt_thinkpad10_quirk_cb,
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Miix 2 10"),
		},
	},
	{ }
};

static const struct dmi_system_id cht_table[] = {
	{
		.callback = cht_surface_quirk_cb,
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
			DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
		},
	},
	{ }
};


static struct snd_soc_acpi_mach cht_surface_mach = {
	.id = "10EC5640",
	.drv_name = "cht-bsw-rt5645",
	.fw_filename = "intel/fw_sst_22a8.bin",
	.board = "cht-bsw",
	.pdata = &chv_platform_data,
};

static struct snd_soc_acpi_mach byt_thinkpad_10 = {
	.id = "10EC5640",
	.drv_name = "cht-bsw-rt5672",
	.fw_filename = "intel/fw_sst_0f28.bin",
	.board = "cht-bsw",
	.pdata = &byt_rvp_platform_data,
};

static struct snd_soc_acpi_mach *cht_quirk(void *arg)
{
	struct snd_soc_acpi_mach *mach = arg;

	dmi_check_system(cht_table);

	if (cht_machine_id == CHT_SURFACE_MACH)
		return &cht_surface_mach;
	else
		return mach;
}

static struct snd_soc_acpi_mach *byt_quirk(void *arg)
{
	struct snd_soc_acpi_mach *mach = arg;

	dmi_check_system(byt_table);

	if (cht_machine_id == BYT_THINKPAD_10)
		return &byt_thinkpad_10;
	else
		return mach;
}


static struct snd_soc_acpi_mach sst_acpi_bytcr[] = {
	{
		.id = "10EC5640",
		.drv_name = "bytcr_rt5640",
		.fw_filename = "intel/fw_sst_0f28.bin",
		.board = "bytcr_rt5640",
		.machine_quirk = byt_quirk,
		.pdata = &byt_rvp_platform_data,
	},
	{
		.id = "10EC5642",
		.drv_name = "bytcr_rt5640",
		.fw_filename = "intel/fw_sst_0f28.bin",
		.board = "bytcr_rt5640",
		.pdata = &byt_rvp_platform_data
	},
	{
		.id = "INTCCFFD",
		.drv_name = "bytcr_rt5640",
		.fw_filename = "intel/fw_sst_0f28.bin",
		.board = "bytcr_rt5640",
		.pdata = &byt_rvp_platform_data
	},
	{
		.id = "10EC5651",
		.drv_name = "bytcr_rt5651",
		.fw_filename = "intel/fw_sst_0f28.bin",
		.board = "bytcr_rt5651",
		.pdata = &byt_rvp_platform_data
	},
	{
		.id = "DLGS7212",
		.drv_name = "bytcht_da7213",
		.fw_filename = "intel/fw_sst_0f28.bin",
		.board = "bytcht_da7213",
		.pdata = &byt_rvp_platform_data
	},
	{
		.id = "DLGS7213",
		.drv_name = "bytcht_da7213",
		.fw_filename = "intel/fw_sst_0f28.bin",
		.board = "bytcht_da7213",
		.pdata = &byt_rvp_platform_data
	},
	/* some Baytrail platforms rely on RT5645, use CHT machine driver */
	{
		.id = "10EC5645",
		.drv_name = "cht-bsw-rt5645",
		.fw_filename = "intel/fw_sst_0f28.bin",
		.board = "cht-bsw",
		.pdata = &byt_rvp_platform_data
	},
	{
		.id = "10EC5648",
		.drv_name = "cht-bsw-rt5645",
		.fw_filename = "intel/fw_sst_0f28.bin",
		.board = "cht-bsw",
		.pdata = &byt_rvp_platform_data
	},
	/* use CHT driver to Baytrail Chromebooks */
	{
		.id = "193C9890",
		.drv_name = "cht-bsw-max98090",
		.fw_filename = "intel/fw_sst_0f28.bin",
		.board = "cht-bsw",
		.pdata = &byt_rvp_platform_data
	},
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
	/*
	 * This is always last in the table so that it is selected only when
	 * enabled explicitly and there is no codec-related information in SSDT
	 */
	{
		.id = "80860F28",
		.drv_name = "bytcht_nocodec",
		.fw_filename = "intel/fw_sst_0f28.bin",
		.board = "bytcht_nocodec",
		.pdata = &byt_rvp_platform_data
	},
#endif
	{},
};

/* Cherryview-based platforms: CherryTrail and Braswell */
static struct snd_soc_acpi_mach sst_acpi_chv[] = {
	{
		.id = "10EC5670",
		.drv_name = "cht-bsw-rt5672",
		.fw_filename = "intel/fw_sst_22a8.bin",
		.board = "cht-bsw",
		.pdata = &chv_platform_data
	},
	{
		.id = "10EC5672",
		.drv_name = "cht-bsw-rt5672",
		.fw_filename = "intel/fw_sst_22a8.bin",
		.board = "cht-bsw",
		.pdata = &chv_platform_data
	},
	{
		.id = "10EC5645",
		.drv_name = "cht-bsw-rt5645",
		.fw_filename = "intel/fw_sst_22a8.bin",
		.board = "cht-bsw",
		.pdata = &chv_platform_data
	},
	{
		.id = "10EC5650",
		.drv_name = "cht-bsw-rt5645",
		.fw_filename = "intel/fw_sst_22a8.bin",
		.board = "cht-bsw",
		.pdata = &chv_platform_data
	},
	{
		.id = "10EC3270",
		.drv_name = "cht-bsw-rt5645",
		.fw_filename = "intel/fw_sst_22a8.bin",
		.board = "cht-bsw",
		.pdata = &chv_platform_data
	},

	{
		.id = "193C9890",
		.drv_name = "cht-bsw-max98090",
		.fw_filename = "intel/fw_sst_22a8.bin",
		.board = "cht-bsw",
		.pdata = &chv_platform_data
	},
	{
		.id = "DLGS7212",
		.drv_name = "bytcht_da7213",
		.fw_filename = "intel/fw_sst_22a8.bin",
		.board = "bytcht_da7213",
		.pdata = &chv_platform_data
	},
	{
		.id = "DLGS7213",
		.drv_name = "bytcht_da7213",
		.fw_filename = "intel/fw_sst_22a8.bin",
		.board = "bytcht_da7213",
		.pdata = &chv_platform_data
	},
	{
		.id = "ESSX8316",
		.drv_name = "bytcht_es8316",
		.fw_filename = "intel/fw_sst_22a8.bin",
		.board = "bytcht_es8316",
		.pdata = &chv_platform_data
	},
	/* some CHT-T platforms rely on RT5640, use Baytrail machine driver */
	{
		.id = "10EC5640",
		.drv_name = "bytcr_rt5640",
		.fw_filename = "intel/fw_sst_22a8.bin",
		.board = "bytcr_rt5640",
		.machine_quirk = cht_quirk,
		.pdata = &chv_platform_data
	},
	{
		.id = "10EC3276",
		.drv_name = "bytcr_rt5640",
		.fw_filename = "intel/fw_sst_22a8.bin",
		.board = "bytcr_rt5640",
		.pdata = &chv_platform_data
	},
	/* some CHT-T platforms rely on RT5651, use Baytrail machine driver */
	{
		.id = "10EC5651",
		.drv_name = "bytcr_rt5651",
		.fw_filename = "intel/fw_sst_22a8.bin",
		.board = "bytcr_rt5651",
		.pdata = &chv_platform_data
	},
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
	/*
	 * This is always last in the table so that it is selected only when
	 * enabled explicitly and there is no codec-related information in SSDT
	 */
	{
		.id = "808622A8",
		.drv_name = "bytcht_nocodec",
		.fw_filename = "intel/fw_sst_22a8.bin",
		.board = "bytcht_nocodec",
		.pdata = &chv_platform_data
	},
#endif
	{},
};

static const struct acpi_device_id sst_acpi_ids[] = {
	{ "80860F28", (unsigned long)&sst_acpi_bytcr},
	{ "808622A8", (unsigned long) &sst_acpi_chv},
	{ "80860F28", (unsigned long)&snd_soc_acpi_intel_baytrail_machines},
	{ "808622A8", (unsigned long)&snd_soc_acpi_intel_cherrytrail_machines},
	{ },
};

+2 −0
Original line number Diff line number Diff line
@@ -2,7 +2,9 @@ snd-soc-sst-dsp-objs := sst-dsp.o
snd-soc-sst-acpi-objs := sst-acpi.o
snd-soc-sst-ipc-objs := sst-ipc.o
snd-soc-sst-firmware-objs := sst-firmware.o
snd-soc-acpi-intel-match-objs := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-match.o soc-acpi-intel-hsw-bdw-match.o

obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o
obj-$(CONFIG_SND_SOC_INTEL_SST_ACPI) += snd-soc-sst-acpi.o
obj-$(CONFIG_SND_SOC_INTEL_SST_FIRMWARE) += snd-soc-sst-firmware.o
obj-$(CONFIG_SND_SOC_ACPI_INTEL_MATCH) += snd-soc-acpi-intel-match.o
Loading