Skip to content

Commit

Permalink
ASoC: Intel: bytcr_rt5640: default routing and quirks on Baytrail-CR
Browse files Browse the repository at this point in the history
Auto routing based on Baytrail/Baytrail-CR detection

Signed-off-by: Pierre-Louis Bossart <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
plbossart authored and broonie committed Aug 15, 2016
1 parent 038a50e commit e214f5e
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion sound/soc/intel/boards/bytcr_rt5640.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@
#include <linux/device.h>
#include <linux/dmi.h>
#include <linux/slab.h>
#include <asm/cpu_device_id.h>
#include <asm/platform_sst_audio.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/jack.h>
#include "../../codecs/rt5640.h"
#include "../atom/sst-atom-controls.h"
#include "../common/sst-acpi.h"
#include "../common/sst-dsp.h"

enum {
BYT_RT5640_DMIC1_MAP,
Expand Down Expand Up @@ -189,7 +192,8 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
},
.driver_data = (unsigned long *)(BYT_RT5640_IN1_MAP |
BYT_RT5640_MONO_SPEAKER |
BYT_RT5640_DIFF_MIC
BYT_RT5640_DIFF_MIC |
BYT_RT5640_SSP0_AIF2
),
},
{
Expand Down Expand Up @@ -464,6 +468,18 @@ static char byt_rt5640_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */
static char byt_rt5640_codec_aif_name[12]; /* = "rt5640-aif[1|2]" */
static char byt_rt5640_cpu_dai_name[10]; /* = "ssp[0|2]-port" */

static bool is_valleyview(void)
{
static const struct x86_cpu_id cpu_ids[] __initconst = {
{ X86_VENDOR_INTEL, 6, 55 }, /* Valleyview, Bay Trail */
{}
};

if (!x86_match_cpu(cpu_ids))
return false;
return true;
}

static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
{
int ret_val = 0;
Expand Down Expand Up @@ -494,6 +510,20 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
byt_rt5640_dais[dai_index].codec_name = byt_rt5640_codec_name;
}

/*
* swap SSP0 if bytcr is detected
* (will be overridden if DMI quirk is detected)
*/
if (is_valleyview()) {
struct sst_platform_info *p_info = mach->pdata;
const struct sst_res_info *res_info = p_info->res_info;

/* TODO: use CHAN package info from BIOS to detect AIF1/AIF2 */
if (res_info->acpi_ipc_irq_index == 0) {
byt_rt5640_quirk |= BYT_RT5640_SSP0_AIF2;
}
}

/* check quirks before creating card */
dmi_check_system(byt_rt5640_quirk_table);

Expand Down

0 comments on commit e214f5e

Please sign in to comment.