Skip to content

Commit

Permalink
ASoC: Intel: Atom: auto-detection of Baytrail-CR
Browse files Browse the repository at this point in the history
BYT-CR needs special handling to deal with BIOS issues.
For some reason the IPC interrupt index is also modified from
the Baytrail-T reference. Routing also needs to use SSP0-AIF1
(done with firmware that swaps SSP2 and SSP0, no change in DAPM
graph)

Use PUNIT BIOS config bits to infer platform details.
Assume regular Baytrail configs if status is incorrect or
CONFIG_IOSF_MBI is not enabled.

Tested on Asus T100TA and T100TAF.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
  • Loading branch information
plbossart committed Mar 31, 2016
1 parent bcc896c commit d525971
Showing 1 changed file with 99 additions and 10 deletions.
109 changes: 99 additions & 10 deletions sound/soc/intel/atom/sst/sst_acpi.c
Expand Up @@ -38,6 +38,8 @@
#include <acpi/platform/aclinux.h>
#include <acpi/actypes.h>
#include <acpi/acpi_bus.h>
#include <asm/cpu_device_id.h>
#include <asm/iosf_mbi.h>
#include "../sst-mfld-platform.h"
#include "../../common/sst-dsp.h"
#include "../../common/sst-acpi.h"
Expand Down Expand Up @@ -112,6 +114,28 @@ static const struct sst_res_info byt_rvp_res_info = {
.acpi_ipc_irq_index = 5,
};

/* BYTCR has different BIOS from BYT */
static const struct sst_res_info bytcr_res_info = {
.shim_offset = 0x140000,
.shim_size = 0x000100,
.shim_phy_addr = SST_BYT_SHIM_PHY_ADDR,
.ssp0_offset = 0xa0000,
.ssp0_size = 0x1000,
.dma0_offset = 0x98000,
.dma0_size = 0x4000,
.dma1_offset = 0x9c000,
.dma1_size = 0x4000,
.iram_offset = 0x0c0000,
.iram_size = 0x14000,
.dram_offset = 0x100000,
.dram_size = 0x28000,
.mbox_offset = 0x144000,
.mbox_size = 0x1000,
.acpi_lpe_res_index = 0,
.acpi_ddr_index = 2,
.acpi_ipc_irq_index = 0
};

static struct sst_platform_info byt_rvp_platform_data = {
.probe_data = &byt_fwparse_info,
.ipc_info = &byt_ipc_info,
Expand Down Expand Up @@ -214,6 +238,51 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)
return 0;
}


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[] __initconst = {
{ X86_VENDOR_INTEL, 6, 55 }, /* Valleyview, Bay Trail */
{}
};
int status;
u32 bios_status;

if (!x86_match_cpu(cpu_ids) || !iosf_mbi_available()) {
/* bail silently */
return status;
}

/* FIXME:
* clean identifiers when Andy Shevchenko's patches
* are upstream
*/
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))
*bytcr = true;
else
dev_info(dev, "BYT-CR not detected\n");
}
} else {
dev_info(dev, "IOSF_MBI not enabled, no BYT-CR detection\n");
}
return status;
}


static int sst_acpi_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
Expand All @@ -225,6 +294,7 @@ static int sst_acpi_probe(struct platform_device *pdev)
struct platform_device *plat_dev;
struct sst_platform_info *pdata;
unsigned int dev_id;
bool bytcr = false;

id = acpi_match_device(dev->driver->acpi_match_table, dev);
if (!id)
Expand Down Expand Up @@ -273,7 +343,22 @@ static int sst_acpi_probe(struct platform_device *pdev)

/* Fill sst platform data */
ctx->pdata = pdata;
strcpy(ctx->firmware_name, mach->fw_filename);



ret = is_byt_cr(dev, &bytcr);
if (!((ret < 0) || (bytcr == false))) {
dev_info(dev, "Detected Baytrail-CR platform\n");

/* override resource info */
byt_rvp_platform_data.res_info = &bytcr_res_info;

snprintf(ctx->firmware_name, sizeof(ctx->firmware_name),
"%s%s", mach->fw_filename, "_ssp0.bin");
} else {
snprintf(ctx->firmware_name, sizeof(ctx->firmware_name),
"%s%s", mach->fw_filename, ".bin");
}

ret = sst_platform_get_resources(ctx);
if (ret)
Expand Down Expand Up @@ -320,30 +405,34 @@ static int sst_acpi_remove(struct platform_device *pdev)
return 0;
}

/*
* .bin extension for firmware name will be added after auto detection
* of Baytrail CR platform
*/
static struct sst_acpi_mach sst_acpi_bytcr[] = {
{"10EC5640", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
{"10EC5640", "bytcr_rt5640", "intel/fw_sst_0f28", "bytcr_rt5640", NULL,
&byt_rvp_platform_data },
{"10EC5642", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
{"10EC5642", "bytcr_rt5640", "intel/fw_sst_0f28", "bytcr_rt5640", NULL,
&byt_rvp_platform_data },
{"INTCCFFD", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
{"INTCCFFD", "bytcr_rt5640", "intel/fw_sst_0f28", "bytcr_rt5640", NULL,
&byt_rvp_platform_data },
{"10EC5651", "bytcr_rt5651", "intel/fw_sst_0f28.bin", "bytcr_rt5651", NULL,
{"10EC5651", "bytcr_rt5651", "intel/fw_sst_0f28", "bytcr_rt5651", NULL,
&byt_rvp_platform_data },
{},
};

/* Cherryview-based platforms: CherryTrail and Braswell */
static struct sst_acpi_mach sst_acpi_chv[] = {
{"10EC5670", "cht-bsw-rt5672", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
{"10EC5670", "cht-bsw-rt5672", "intel/fw_sst_22a8", "cht-bsw", NULL,
&chv_platform_data },
{"10EC5645", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
{"10EC5645", "cht-bsw-rt5645", "intel/fw_sst_22a8", "cht-bsw", NULL,
&chv_platform_data },
{"10EC5650", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
{"10EC5650", "cht-bsw-rt5645", "intel/fw_sst_22a8", "cht-bsw", NULL,
&chv_platform_data },
{"193C9890", "cht-bsw-max98090", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
{"193C9890", "cht-bsw-max98090", "intel/fw_sst_22a8", "cht-bsw", NULL,
&chv_platform_data },
/* some CHT-T platforms rely on RT5640, use Baytrail machine driver */
{"10EC5640", "bytcr_rt5640", "intel/fw_sst_22a8.bin", "bytcr_rt5640", NULL,
{"10EC5640", "bytcr_rt5640", "intel/fw_sst_22a8", "bytcr_rt5640", NULL,
&chv_platform_data },

{},
Expand Down

0 comments on commit d525971

Please sign in to comment.