]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ASoC: Intel: Atom: move atom driver to common acpi match
authorVinod Koul <vinod.koul@intel.com>
Thu, 5 Nov 2015 16:04:12 +0000 (21:34 +0530)
committerMark Brown <broonie@kernel.org>
Mon, 16 Nov 2015 10:08:09 +0000 (10:08 +0000)
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: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/Kconfig
sound/soc/intel/atom/sst/sst_acpi.c
sound/soc/intel/common/sst-acpi.c
sound/soc/intel/common/sst-acpi.h

index 7b778ab85f8b41234487d0810f4c350f6dc09775..13a762172b5de5af65e425c3aa5acdca4e75b8d5 100644 (file)
@@ -24,6 +24,7 @@ config SND_SST_IPC_PCI
 config SND_SST_IPC_ACPI
        tristate
        select SND_SST_IPC
+       select SND_SOC_INTEL_SST
        depends on ACPI
 
 config SND_SOC_INTEL_SST
index bb19b5801466b4ed04cbc681c11911353ccab2cb..f3d109eb3800a8eec06d9fa9a2c3aa83d0a26c90 100644 (file)
 #include <acpi/acpi_bus.h>
 #include "../sst-mfld-platform.h"
 #include "../../common/sst-dsp.h"
+#include "../../common/sst-acpi.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 */
 #define SST_BYT_IRAM_PHY_START 0xff2c0000
 #define SST_BYT_IRAM_PHY_END   0xff2d4000
@@ -223,37 +214,16 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)
        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)
 {
        struct device *dev = &pdev->dev;
        int ret = 0;
        struct intel_sst_drv *ctx;
        const struct acpi_device_id *id;
-       struct sst_machines *mach;
+       struct sst_acpi_mach *mach;
        struct platform_device *mdev;
        struct platform_device *plat_dev;
+       struct sst_platform_info *pdata;
        unsigned int dev_id;
 
        id = acpi_match_device(dev->driver->acpi_match_table, dev);
@@ -261,12 +231,13 @@ static int sst_acpi_probe(struct platform_device *pdev)
                return -ENODEV;
        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);
        if (mach == NULL) {
                dev_err(dev, "No matching machine driver found\n");
                return -ENODEV;
        }
+       pdata = mach->pdata;
 
        ret = kstrtouint(id->id, 16, &dev_id);
        if (ret < 0) {
@@ -276,16 +247,16 @@ static int sst_acpi_probe(struct platform_device *pdev)
 
        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)) {
-               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);
        }
 
        /* 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)) {
-               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);
        }
 
@@ -294,8 +265,8 @@ static int sst_acpi_probe(struct platform_device *pdev)
                return ret;
 
        /* Fill sst platform data */
-       ctx->pdata = mach->pdata;
-       strcpy(ctx->firmware_name, mach->firmware);
+       ctx->pdata = pdata;
+       strcpy(ctx->firmware_name, mach->fw_filename);
 
        ret = sst_platform_get_resources(ctx);
        if (ret)
@@ -342,22 +313,22 @@ static int sst_acpi_remove(struct platform_device *pdev)
        return 0;
 }
 
-static struct sst_machines sst_acpi_bytcr[] = {
-       {"10EC5640", "T100", "bytt100_rt5640", NULL, "intel/fw_sst_0f28.bin",
+static struct sst_acpi_mach sst_acpi_bytcr[] = {
+       {"10EC5640", "bytt100_rt5640", "intel/fw_sst_0f28.bin", "T100", NULL,
                                                &byt_rvp_platform_data },
        {},
 };
 
 /* Cherryview-based platforms: CherryTrail and Braswell */
-static struct sst_machines sst_acpi_chv[] = {
-       {"10EC5670", "cht-bsw", "cht-bsw-rt5672", NULL, "intel/fw_sst_22a8.bin",
+static struct sst_acpi_mach sst_acpi_chv[] = {
+       {"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 },
-       {"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 },
-       {"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 },
-       {"193C9890", "cht-bsw", "cht-bsw-max98090", NULL,
-       "intel/fw_sst_22a8.bin", &chv_platform_data },
        {},
 };
 
index 94a43e6fcf88e0a4ade72c9c06b34310570d852e..7a85c576dad33575efed4ca9eabb1ccf64970383 100644 (file)
@@ -180,7 +180,7 @@ static int sst_acpi_remove(struct platform_device *pdev)
 }
 
 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 = {
 };
 
 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 = {
 };
 
 static struct sst_acpi_mach baytrail_machines[] = {
-       { "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-48kHz_i2s_master" },
-       { "193C9890", "byt-max98090", "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", NULL, NULL, NULL },
        {}
 };
 
index 1dc059590ead619fee2bcb260219a6d5acbf524d..3ee3b7ab5d037b053e2f862ffbaa19c25b3f8e11 100644 (file)
@@ -25,4 +25,9 @@ struct sst_acpi_mach {
        const char *drv_name;
        /* firmware file name */
        const char *fw_filename;
+
+       /* board name */
+       const char *board;
+       void (*machine_quirk)(void);
+       void *pdata;
 };