Commit 12cc291b authored by Vinod Koul's avatar Vinod Koul Committed by Mark Brown

ASoC: Intel: Atom: move atom driver to common acpi match

This patch moves the atom driver to use the common acpi match
functions.  Since atom driver has few more information in machine
table, these are appended to table and set to NULL for common
driver
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 95f09801
...@@ -24,6 +24,7 @@ config SND_SST_IPC_PCI ...@@ -24,6 +24,7 @@ config SND_SST_IPC_PCI
config SND_SST_IPC_ACPI config SND_SST_IPC_ACPI
tristate tristate
select SND_SST_IPC select SND_SST_IPC
select SND_SOC_INTEL_SST
depends on ACPI depends on ACPI
config SND_SOC_INTEL_SST config SND_SOC_INTEL_SST
......
...@@ -40,18 +40,9 @@ ...@@ -40,18 +40,9 @@
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include "../sst-mfld-platform.h" #include "../sst-mfld-platform.h"
#include "../../common/sst-dsp.h" #include "../../common/sst-dsp.h"
#include "../../common/sst-acpi.h"
#include "sst.h" #include "sst.h"
struct sst_machines {
char *codec_id;
char board[32];
char machine[32];
void (*machine_quirk)(void);
char firmware[FW_NAME_SIZE];
struct sst_platform_info *pdata;
};
/* LPE viewpoint addresses */ /* LPE viewpoint addresses */
#define SST_BYT_IRAM_PHY_START 0xff2c0000 #define SST_BYT_IRAM_PHY_START 0xff2c0000
#define SST_BYT_IRAM_PHY_END 0xff2d4000 #define SST_BYT_IRAM_PHY_END 0xff2d4000
...@@ -223,37 +214,16 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx) ...@@ -223,37 +214,16 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)
return 0; return 0;
} }
static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
void *context, void **ret)
{
*(bool *)context = true;
return AE_OK;
}
static struct sst_machines *sst_acpi_find_machine(
struct sst_machines *machines)
{
struct sst_machines *mach;
bool found = false;
for (mach = machines; mach->codec_id; mach++)
if (ACPI_SUCCESS(acpi_get_devices(mach->codec_id,
sst_acpi_mach_match,
&found, NULL)) && found)
return mach;
return NULL;
}
static int sst_acpi_probe(struct platform_device *pdev) static int sst_acpi_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int ret = 0; int ret = 0;
struct intel_sst_drv *ctx; struct intel_sst_drv *ctx;
const struct acpi_device_id *id; const struct acpi_device_id *id;
struct sst_machines *mach; struct sst_acpi_mach *mach;
struct platform_device *mdev; struct platform_device *mdev;
struct platform_device *plat_dev; struct platform_device *plat_dev;
struct sst_platform_info *pdata;
unsigned int dev_id; unsigned int dev_id;
id = acpi_match_device(dev->driver->acpi_match_table, dev); id = acpi_match_device(dev->driver->acpi_match_table, dev);
...@@ -261,12 +231,13 @@ static int sst_acpi_probe(struct platform_device *pdev) ...@@ -261,12 +231,13 @@ static int sst_acpi_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
dev_dbg(dev, "for %s", id->id); dev_dbg(dev, "for %s", id->id);
mach = (struct sst_machines *)id->driver_data; mach = (struct sst_acpi_mach *)id->driver_data;
mach = sst_acpi_find_machine(mach); mach = sst_acpi_find_machine(mach);
if (mach == NULL) { if (mach == NULL) {
dev_err(dev, "No matching machine driver found\n"); dev_err(dev, "No matching machine driver found\n");
return -ENODEV; return -ENODEV;
} }
pdata = mach->pdata;
ret = kstrtouint(id->id, 16, &dev_id); ret = kstrtouint(id->id, 16, &dev_id);
if (ret < 0) { if (ret < 0) {
...@@ -276,16 +247,16 @@ static int sst_acpi_probe(struct platform_device *pdev) ...@@ -276,16 +247,16 @@ static int sst_acpi_probe(struct platform_device *pdev)
dev_dbg(dev, "ACPI device id: %x\n", dev_id); dev_dbg(dev, "ACPI device id: %x\n", dev_id);
plat_dev = platform_device_register_data(dev, mach->pdata->platform, -1, NULL, 0); plat_dev = platform_device_register_data(dev, pdata->platform, -1, NULL, 0);
if (IS_ERR(plat_dev)) { if (IS_ERR(plat_dev)) {
dev_err(dev, "Failed to create machine device: %s\n", mach->pdata->platform); dev_err(dev, "Failed to create machine device: %s\n", pdata->platform);
return PTR_ERR(plat_dev); return PTR_ERR(plat_dev);
} }
/* Create platform device for sst machine driver */ /* Create platform device for sst machine driver */
mdev = platform_device_register_data(dev, mach->machine, -1, NULL, 0); mdev = platform_device_register_data(dev, mach->drv_name, -1, NULL, 0);
if (IS_ERR(mdev)) { if (IS_ERR(mdev)) {
dev_err(dev, "Failed to create machine device: %s\n", mach->machine); dev_err(dev, "Failed to create machine device: %s\n", mach->drv_name);
return PTR_ERR(mdev); return PTR_ERR(mdev);
} }
...@@ -294,8 +265,8 @@ static int sst_acpi_probe(struct platform_device *pdev) ...@@ -294,8 +265,8 @@ static int sst_acpi_probe(struct platform_device *pdev)
return ret; return ret;
/* Fill sst platform data */ /* Fill sst platform data */
ctx->pdata = mach->pdata; ctx->pdata = pdata;
strcpy(ctx->firmware_name, mach->firmware); strcpy(ctx->firmware_name, mach->fw_filename);
ret = sst_platform_get_resources(ctx); ret = sst_platform_get_resources(ctx);
if (ret) if (ret)
...@@ -342,22 +313,22 @@ static int sst_acpi_remove(struct platform_device *pdev) ...@@ -342,22 +313,22 @@ static int sst_acpi_remove(struct platform_device *pdev)
return 0; return 0;
} }
static struct sst_machines sst_acpi_bytcr[] = { static struct sst_acpi_mach sst_acpi_bytcr[] = {
{"10EC5640", "T100", "bytt100_rt5640", NULL, "intel/fw_sst_0f28.bin", {"10EC5640", "bytt100_rt5640", "intel/fw_sst_0f28.bin", "T100", NULL,
&byt_rvp_platform_data }, &byt_rvp_platform_data },
{}, {},
}; };
/* Cherryview-based platforms: CherryTrail and Braswell */ /* Cherryview-based platforms: CherryTrail and Braswell */
static struct sst_machines sst_acpi_chv[] = { static struct sst_acpi_mach sst_acpi_chv[] = {
{"10EC5670", "cht-bsw", "cht-bsw-rt5672", NULL, "intel/fw_sst_22a8.bin", {"10EC5670", "cht-bsw-rt5672", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
&chv_platform_data },
{"10EC5645", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
&chv_platform_data }, &chv_platform_data },
{"10EC5645", "cht-bsw", "cht-bsw-rt5645", NULL, "intel/fw_sst_22a8.bin", {"10EC5650", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
&chv_platform_data }, &chv_platform_data },
{"10EC5650", "cht-bsw", "cht-bsw-rt5645", NULL, "intel/fw_sst_22a8.bin", {"193C9890", "cht-bsw-max98090", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
&chv_platform_data }, &chv_platform_data },
{"193C9890", "cht-bsw", "cht-bsw-max98090", NULL,
"intel/fw_sst_22a8.bin", &chv_platform_data },
{}, {},
}; };
......
...@@ -180,7 +180,7 @@ static int sst_acpi_remove(struct platform_device *pdev) ...@@ -180,7 +180,7 @@ static int sst_acpi_remove(struct platform_device *pdev)
} }
static struct sst_acpi_mach haswell_machines[] = { static struct sst_acpi_mach haswell_machines[] = {
{ "INT33CA", "haswell-audio", "intel/IntcSST1.bin" }, { "INT33CA", "haswell-audio", "intel/IntcSST1.bin", NULL, NULL, NULL },
{} {}
}; };
...@@ -198,7 +198,7 @@ static struct sst_acpi_desc sst_acpi_haswell_desc = { ...@@ -198,7 +198,7 @@ static struct sst_acpi_desc sst_acpi_haswell_desc = {
}; };
static struct sst_acpi_mach broadwell_machines[] = { static struct sst_acpi_mach broadwell_machines[] = {
{ "INT343A", "broadwell-audio", "intel/IntcSST2.bin" }, { "INT343A", "broadwell-audio", "intel/IntcSST2.bin", NULL, NULL, NULL },
{} {}
}; };
...@@ -216,8 +216,8 @@ static struct sst_acpi_desc sst_acpi_broadwell_desc = { ...@@ -216,8 +216,8 @@ static struct sst_acpi_desc sst_acpi_broadwell_desc = {
}; };
static struct sst_acpi_mach baytrail_machines[] = { static struct sst_acpi_mach baytrail_machines[] = {
{ "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-48kHz_i2s_master" }, { "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-48kHz_i2s_master", NULL, NULL, NULL },
{ "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-48kHz_i2s_master" }, { "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-48kHz_i2s_master", NULL, NULL, NULL },
{} {}
}; };
......
...@@ -25,4 +25,9 @@ struct sst_acpi_mach { ...@@ -25,4 +25,9 @@ struct sst_acpi_mach {
const char *drv_name; const char *drv_name;
/* firmware file name */ /* firmware file name */
const char *fw_filename; const char *fw_filename;
/* board name */
const char *board;
void (*machine_quirk)(void);
void *pdata;
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment