Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ad52ab5 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: wcd934x: add DSD support for lineout path"

parents cbb135e3 0e608ded
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -97,6 +97,11 @@ static const struct snd_soc_dapm_route tavil_dsd_audio_map[] = {
	{"DSD_FILTER_1", NULL, "DSD_R IF MUX"},
	{"DSD_FILTER_1", NULL, "RX INT2 NATIVE SUPPLY"},
	{"RX INT2 MIX3", "DSD HPHR Switch", "DSD_FILTER_1"},

	{"DSD_FILTER_0", NULL, "RX INT3 NATIVE SUPPLY"},
	{"RX INT3 MIX3", "DSD LO1 Switch", "DSD_FILTER_0"},
	{"DSD_FILTER_1", NULL, "RX INT4 NATIVE SUPPLY"},
	{"RX INT4 MIX3", "DSD LO2 Switch", "DSD_FILTER_1"},
};

static bool is_valid_dsd_interpolator(int interp_num)
+4 −2
Original line number Diff line number Diff line
@@ -872,7 +872,8 @@ const struct snd_soc_dapm_route tavil_audio_map[] = {
	{"RX INT3 SEC MIX", NULL, "RX INT3_1 INTERP"},
	{"RX INT3 MIX2", NULL, "RX INT3 SEC MIX"},
	{"RX INT3 MIX2", NULL, "RX INT3 MIX2 INP"},
	{"RX INT3 DAC", NULL, "RX INT3 MIX2"},
	{"RX INT3 MIX3", NULL, "RX INT3 MIX2"},
	{"RX INT3 DAC", NULL, "RX INT3 MIX3"},
	{"RX INT3 DAC", NULL, "RX_BIAS"},
	{"LINEOUT1 PA", NULL, "RX INT3 DAC"},
	{"LINEOUT1", NULL, "LINEOUT1 PA"},
@@ -882,7 +883,8 @@ const struct snd_soc_dapm_route tavil_audio_map[] = {
	{"RX INT4 SEC MIX", NULL, "RX INT4_1 MIX1"},
	{"RX INT4 MIX2", NULL, "RX INT4 SEC MIX"},
	{"RX INT4 MIX2", NULL, "RX INT4 MIX2 INP"},
	{"RX INT4 DAC", NULL, "RX INT4 MIX2"},
	{"RX INT4 MIX3", NULL, "RX INT4 MIX2"},
	{"RX INT4 DAC", NULL, "RX INT4 MIX3"},
	{"RX INT4 DAC", NULL, "RX_BIAS"},
	{"LINEOUT2 PA", NULL, "RX INT4 DAC"},
	{"LINEOUT2", NULL, "LINEOUT2 PA"},
+29 −2
Original line number Diff line number Diff line
@@ -2295,6 +2295,9 @@ static int tavil_codec_enable_lineout_pa(struct snd_soc_dapm_widget *w,
{
	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
	u16 lineout_vol_reg = 0, lineout_mix_vol_reg = 0;
	u16 dsd_mute_reg = 0, dsd_clk_reg = 0;
	struct tavil_priv *tavil = snd_soc_codec_get_drvdata(codec);
	struct tavil_dsd_config *dsd_conf = tavil->dsd_config;

	dev_dbg(codec->dev, "%s %s %d\n", __func__, w->name, event);

@@ -2302,9 +2305,13 @@ static int tavil_codec_enable_lineout_pa(struct snd_soc_dapm_widget *w,
		if (w->shift == 7) {
			lineout_vol_reg = WCD934X_CDC_RX3_RX_PATH_CTL;
			lineout_mix_vol_reg = WCD934X_CDC_RX3_RX_PATH_MIX_CTL;
			dsd_mute_reg = WCD934X_CDC_DSD0_CFG2;
			dsd_clk_reg = WCD934X_CDC_DSD0_PATH_CTL;
		} else if (w->shift == 6) {
			lineout_vol_reg = WCD934X_CDC_RX4_RX_PATH_CTL;
			lineout_mix_vol_reg = WCD934X_CDC_RX4_RX_PATH_MIX_CTL;
			dsd_mute_reg = WCD934X_CDC_DSD1_CFG2;
			dsd_clk_reg = WCD934X_CDC_DSD1_PATH_CTL;
		}
	} else {
		dev_err(codec->dev, "%s: Error enabling lineout PA\n",
@@ -2329,6 +2336,12 @@ static int tavil_codec_enable_lineout_pa(struct snd_soc_dapm_widget *w,
			snd_soc_update_bits(codec,
					    lineout_mix_vol_reg,
					    0x10, 0x00);
		if (dsd_conf && (snd_soc_read(codec, dsd_clk_reg) & 0x01))
			snd_soc_update_bits(codec, dsd_mute_reg, 0x04, 0x00);
		break;
	case SND_SOC_DAPM_PRE_PMD:
		if (dsd_conf && (snd_soc_read(codec, dsd_clk_reg) & 0x01))
			snd_soc_update_bits(codec, dsd_mute_reg, 0x04, 0x04);
		break;
	case SND_SOC_DAPM_POST_PMD:
		/*
@@ -6821,6 +6834,16 @@ static const struct snd_kcontrol_new hphr_mixer[] = {
			tavil_dsd_mixer_get, tavil_dsd_mixer_put),
};

static const struct snd_kcontrol_new lo1_mixer[] = {
	SOC_SINGLE_EXT("DSD LO1 Switch", SND_SOC_NOPM, INTERP_LO1, 1, 0,
			tavil_dsd_mixer_get, tavil_dsd_mixer_put),
};

static const struct snd_kcontrol_new lo2_mixer[] = {
	SOC_SINGLE_EXT("DSD LO2 Switch", SND_SOC_NOPM, INTERP_LO2, 1, 0,
			tavil_dsd_mixer_get, tavil_dsd_mixer_put),
};

static const struct snd_soc_dapm_widget tavil_dapm_widgets[] = {
	SND_SOC_DAPM_AIF_IN_E("AIF1 PB", "AIF1 Playback", 0, SND_SOC_NOPM,
		AIF1_PB, 0, tavil_codec_enable_slimrx,
@@ -6953,7 +6976,11 @@ static const struct snd_soc_dapm_widget tavil_dapm_widgets[] = {
	SND_SOC_DAPM_MIXER("RX INT2 MIX3", SND_SOC_NOPM, 0, 0, hphr_mixer,
			   ARRAY_SIZE(hphr_mixer)),
	SND_SOC_DAPM_MIXER("RX INT3 MIX2", SND_SOC_NOPM, 0, 0, NULL, 0),
	SND_SOC_DAPM_MIXER("RX INT3 MIX3", SND_SOC_NOPM, 0, 0, lo1_mixer,
			   ARRAY_SIZE(lo1_mixer)),
	SND_SOC_DAPM_MIXER("RX INT4 MIX2", SND_SOC_NOPM, 0, 0, NULL, 0),
	SND_SOC_DAPM_MIXER("RX INT4 MIX3", SND_SOC_NOPM, 0, 0, lo2_mixer,
			   ARRAY_SIZE(lo2_mixer)),
	SND_SOC_DAPM_MIXER("RX INT7 MIX2", SND_SOC_NOPM, 0, 0, NULL, 0),
	SND_SOC_DAPM_MIXER_E("RX INT7 CHAIN", SND_SOC_NOPM, 0, 0,
		NULL, 0, tavil_codec_spk_boost_event,
@@ -7342,11 +7369,11 @@ static const struct snd_soc_dapm_widget tavil_dapm_widgets[] = {
	SND_SOC_DAPM_PGA_E("LINEOUT1 PA", WCD934X_ANA_LO_1_2, 7, 0, NULL, 0,
		tavil_codec_enable_lineout_pa,
		SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
		SND_SOC_DAPM_POST_PMD),
		SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_PGA_E("LINEOUT2 PA", WCD934X_ANA_LO_1_2, 6, 0, NULL, 0,
		tavil_codec_enable_lineout_pa,
		SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
		SND_SOC_DAPM_POST_PMD),
		SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
	SND_SOC_DAPM_PGA_E("ANC EAR PA", WCD934X_ANA_EAR, 7, 0, NULL, 0,
		tavil_codec_enable_ear_pa, SND_SOC_DAPM_POST_PMU |
		SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),