Created
March 8, 2017 16:41
-
-
Save dsd/cf2bb8d3a559ec9571a2c43674781e73 to your computer and use it in GitHub Desktop.
hack rt5640 cht machine driver to drive ess8316
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/sound/soc/intel/atom/sst/sst_acpi.c b/sound/soc/intel/atom/sst/sst_acpi.c | |
index 2b67181..2a1ec22 100644 | |
--- a/sound/soc/intel/atom/sst/sst_acpi.c | |
+++ b/sound/soc/intel/atom/sst/sst_acpi.c | |
@@ -467,7 +467,7 @@ static struct sst_acpi_mach sst_acpi_chv[] = { | |
{"ESSX8316", "bytcht_nocodec", "intel/fw_sst_22a8.bin", "bytcht_nocodec", NULL, | |
&chv_platform_data }, | |
#else | |
- {"ESSX8316", "cht-es8316", "intel/fw_sst_22a8.bin", "cht-bsw", NULL, | |
+ {"ESSX8316", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL, | |
&chv_platform_data }, | |
#endif | |
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c | |
index f504a0e..ecd8a54 100644 | |
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c | |
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c | |
@@ -67,6 +67,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w, | |
struct snd_soc_dai *codec_dai; | |
int ret; | |
+return 0; | |
codec_dai = cht_get_codec_dai(card); | |
if (!codec_dai) { | |
dev_err(card->dev, "Codec dai not found; Unable to set platform clock\n"); | |
@@ -101,20 +102,18 @@ static const struct snd_soc_dapm_widget cht_dapm_widgets[] = { | |
}; | |
static const struct snd_soc_dapm_route cht_rt5645_audio_map[] = { | |
- {"IN1P", NULL, "Headset Mic"}, | |
- {"IN1N", NULL, "Headset Mic"}, | |
- {"DMIC L1", NULL, "Int Mic"}, | |
- {"DMIC R1", NULL, "Int Mic"}, | |
+ {"MIC1", NULL, "Headset Mic"}, | |
+ {"MIC2", NULL, "Int Mic"}, | |
{"Headphone", NULL, "HPOL"}, | |
{"Headphone", NULL, "HPOR"}, | |
- {"Ext Spk", NULL, "SPOL"}, | |
- {"Ext Spk", NULL, "SPOR"}, | |
- {"AIF1 Playback", NULL, "ssp2 Tx"}, | |
+ {"Ext Spk", NULL, "HPOL"}, | |
+ {"Ext Spk", NULL, "HPOR"}, | |
+ {"Playback", NULL, "ssp2 Tx"}, | |
{"ssp2 Tx", NULL, "codec_out0"}, | |
{"ssp2 Tx", NULL, "codec_out1"}, | |
{"codec_in0", NULL, "ssp2 Rx" }, | |
{"codec_in1", NULL, "ssp2 Rx" }, | |
- {"ssp2 Rx", NULL, "AIF1 Capture"}, | |
+ {"ssp2 Rx", NULL, "Capture"}, | |
{"Headphone", NULL, "Platform Clock"}, | |
{"Headset Mic", NULL, "Platform Clock"}, | |
{"Int Mic", NULL, "Platform Clock"}, | |
@@ -168,6 +167,10 @@ static int cht_aif1_hw_params(struct snd_pcm_substream *substream, | |
int ret; | |
/* set codec PLL source to the 19.2MHz platform clock (MCLK) */ | |
+ ret = snd_soc_dai_set_sysclk(codec_dai, 19200000, | |
+ params_rate(params) * 512, | |
+ SND_SOC_CLOCK_IN); | |
+return 0; | |
ret = snd_soc_dai_set_pll(codec_dai, 0, RT5645_PLL1_S_MCLK, | |
CHT_PLAT_CLK_3_HZ, params_rate(params) * 512); | |
if (ret < 0) { | |
@@ -194,18 +197,20 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) | |
struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card); | |
/* Select clk_i2s1_asrc as ASRC clock source */ | |
+#if 0 | |
rt5645_sel_asrc_clk_src(codec, | |
RT5645_DA_STEREO_FILTER | | |
RT5645_DA_MONO_L_FILTER | | |
RT5645_DA_MONO_R_FILTER | | |
RT5645_AD_STEREO_FILTER, | |
RT5645_CLK_SEL_I2S1_ASRC); | |
+#endif | |
/* TDM 4 slots 24 bit, set Rx & Tx bitmask to 4 active slots */ | |
ret = snd_soc_dai_set_tdm_slot(codec_dai, 0xF, 0xF, 4, 24); | |
if (ret < 0) { | |
dev_err(runtime->dev, "can't set codec TDM slot %d\n", ret); | |
- return ret; | |
+ //return ret; | |
} | |
if (ctx->acpi_card->codec_type == CODEC_TYPE_RT5650) | |
@@ -223,7 +228,7 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime) | |
return ret; | |
} | |
- rt5645_set_jack_detect(codec, &ctx->jack, &ctx->jack, &ctx->jack); | |
+ //rt5645_set_jack_detect(codec, &ctx->jack, &ctx->jack, &ctx->jack); | |
return ret; | |
} | |
@@ -301,8 +306,8 @@ static struct snd_soc_dai_link cht_dailink[] = { | |
.cpu_dai_name = "ssp2-port", | |
.platform_name = "sst-mfld-platform", | |
.no_pcm = 1, | |
- .codec_dai_name = "rt5645-aif1", | |
- .codec_name = "i2c-10EC5645:00", | |
+ .codec_dai_name = "ES8316 HiFi", | |
+ .codec_name = "i2c-ESSX8316:00", | |
.dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF | |
| SND_SOC_DAIFMT_CBS_CFS, | |
.init = cht_codec_init, | |
@@ -342,6 +347,7 @@ static struct snd_soc_card snd_soc_card_chtrt5650 = { | |
}; | |
static struct cht_acpi_card snd_soc_cards[] = { | |
+ {"ESSX8316", CODEC_TYPE_RT5645, &snd_soc_card_chtrt5645}, | |
{"10EC5640", CODEC_TYPE_RT5645, &snd_soc_card_chtrt5645}, | |
{"10EC5645", CODEC_TYPE_RT5645, &snd_soc_card_chtrt5645}, | |
{"10EC5650", CODEC_TYPE_RT5650, &snd_soc_card_chtrt5650}, | |
@@ -378,7 +384,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev) | |
/* set correct codec name */ | |
for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) | |
- if (!strcmp(card->dai_link[i].codec_name, "i2c-10EC5645:00")) { | |
+ if (!strcmp(card->dai_link[i].codec_name, "i2c-ESSX8316:00")) { | |
card->dai_link[i].codec_name = drv->codec_name; | |
dai_index = i; | |
} | |
-- | |
2.9.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment