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

Commit 8f61c20c authored by Surendar Karka's avatar Surendar Karka Committed by Surendar karka
Browse files

ASoC: msm: dynamically control i2s switch gpio



Set i2s switch gpio to output high when TDM BE is
started and make the gpio to output low so that
BT can use the i2s lines.

CRs-Fixed: 2185727
Change-Id: I5fd1a3687a42fd6cc171af35c2165b0c9259b93c
Signed-off-by: default avatarSurendar karka <sukark@codeaurora.org>
parent 259f2973
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -144,6 +144,7 @@ static int apq8009_auxpcm_rate = 8000;
static atomic_t pri_mi2s_clk_ref;
static atomic_t quat_mi2s_clk_ref;
static atomic_t auxpcm_mi2s_clk_ref;
static int tdm_i2s_switch_enable = -EINVAL;

static int apq8009_enable_extcodec_ext_clk(struct snd_soc_codec *codec,
					int enable, bool dapm);
@@ -1490,6 +1491,9 @@ static int msm_tdm_startup(struct snd_pcm_substream *substream)
		if (ret < 0)
			pr_err("%s: failed to activate primary TDM gpio set\n",
				 __func__);
		/* Enable I2S switch to turn on TDM mics for SOM*/
		if (tdm_i2s_switch_enable >= 0)
			gpio_direction_output(tdm_i2s_switch_enable, 1);
		break;
	default:
		pr_err("dai id 0x%x not supported", cpu_dai->id);
@@ -1527,6 +1531,9 @@ static void msm_tdm_shutdown(struct snd_pcm_substream *substream)
				__func__, "pri_tdm");
			return;
		}

		if (tdm_i2s_switch_enable >= 0)
			gpio_direction_output(tdm_i2s_switch_enable, 0);
		break;
	default:
		break;
@@ -2743,7 +2750,6 @@ static int apq8009_asoc_machine_probe(struct platform_device *pdev)
	const char *mclk = "qcom,msm-mclk-freq";
	const char *type = NULL;
	int ret, id;
	int tdm_i2s_switch_enable = -EINVAL;

	pdata = devm_kzalloc(&pdev->dev,
			sizeof(struct apq8009_asoc_mach_data), GFP_KERNEL);
@@ -2852,7 +2858,6 @@ static int apq8009_asoc_machine_probe(struct platform_device *pdev)
			pr_err("%s: Failed to request gpio\n", __func__);
			goto err;
		}
		gpio_direction_output(tdm_i2s_switch_enable, 1);
	} else
		dev_err(&pdev->dev, "Looking up %s property in node %s failed\n",
			"qcom,tdm-i2s-switch-enable",