Commit 0ae9fd3b authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Mark Brown

ASoC: qcom: remove hardcoded i2s port number

This patch attempts to remove the hardcoded i2s port number in lpass
driver. Now the the port number comes from the dai id field.

This will allow other SOCs to use different port numbers on the lpass
driver.
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: default avatarKenneth Westfield <kwestfie@codeaurora.org>
Acked-by: default avatarKenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9bae4880
...@@ -138,8 +138,7 @@ static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream, ...@@ -138,8 +138,7 @@ static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream,
} }
ret = regmap_write(drvdata->lpaif_map, ret = regmap_write(drvdata->lpaif_map,
LPAIF_I2SCTL_REG(drvdata->variant, LPAIF_I2SCTL_REG(drvdata->variant, dai->driver->id),
LPAIF_I2S_PORT_MI2S),
regval); regval);
if (ret) { if (ret) {
dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n", dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n",
...@@ -164,8 +163,8 @@ static int lpass_cpu_daiops_hw_free(struct snd_pcm_substream *substream, ...@@ -164,8 +163,8 @@ static int lpass_cpu_daiops_hw_free(struct snd_pcm_substream *substream,
int ret; int ret;
ret = regmap_write(drvdata->lpaif_map, ret = regmap_write(drvdata->lpaif_map,
LPAIF_I2SCTL_REG(drvdata->variant, LPAIF_I2SCTL_REG(drvdata->variant, dai->driver->id),
LPAIF_I2S_PORT_MI2S), 0); 0);
if (ret) if (ret)
dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n", dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n",
__func__, ret); __func__, ret);
...@@ -180,7 +179,7 @@ static int lpass_cpu_daiops_prepare(struct snd_pcm_substream *substream, ...@@ -180,7 +179,7 @@ static int lpass_cpu_daiops_prepare(struct snd_pcm_substream *substream,
int ret; int ret;
ret = regmap_update_bits(drvdata->lpaif_map, ret = regmap_update_bits(drvdata->lpaif_map,
LPAIF_I2SCTL_REG(drvdata->variant, LPAIF_I2S_PORT_MI2S), LPAIF_I2SCTL_REG(drvdata->variant, dai->driver->id),
LPAIF_I2SCTL_SPKEN_MASK, LPAIF_I2SCTL_SPKEN_ENABLE); LPAIF_I2SCTL_SPKEN_MASK, LPAIF_I2SCTL_SPKEN_ENABLE);
if (ret) if (ret)
dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n", dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n",
...@@ -201,7 +200,7 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, ...@@ -201,7 +200,7 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
ret = regmap_update_bits(drvdata->lpaif_map, ret = regmap_update_bits(drvdata->lpaif_map,
LPAIF_I2SCTL_REG(drvdata->variant, LPAIF_I2SCTL_REG(drvdata->variant,
LPAIF_I2S_PORT_MI2S), dai->driver->id),
LPAIF_I2SCTL_SPKEN_MASK, LPAIF_I2SCTL_SPKEN_MASK,
LPAIF_I2SCTL_SPKEN_ENABLE); LPAIF_I2SCTL_SPKEN_ENABLE);
if (ret) if (ret)
...@@ -213,7 +212,7 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, ...@@ -213,7 +212,7 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
ret = regmap_update_bits(drvdata->lpaif_map, ret = regmap_update_bits(drvdata->lpaif_map,
LPAIF_I2SCTL_REG(drvdata->variant, LPAIF_I2SCTL_REG(drvdata->variant,
LPAIF_I2S_PORT_MI2S), dai->driver->id),
LPAIF_I2SCTL_SPKEN_MASK, LPAIF_I2SCTL_SPKEN_MASK,
LPAIF_I2SCTL_SPKEN_DISABLE); LPAIF_I2SCTL_SPKEN_DISABLE);
if (ret) if (ret)
...@@ -243,8 +242,7 @@ int asoc_qcom_lpass_cpu_dai_probe(struct snd_soc_dai *dai) ...@@ -243,8 +242,7 @@ int asoc_qcom_lpass_cpu_dai_probe(struct snd_soc_dai *dai)
/* ensure audio hardware is disabled */ /* ensure audio hardware is disabled */
ret = regmap_write(drvdata->lpaif_map, ret = regmap_write(drvdata->lpaif_map,
LPAIF_I2SCTL_REG(drvdata->variant, LPAIF_I2SCTL_REG(drvdata->variant, dai->driver->id), 0);
LPAIF_I2S_PORT_MI2S), 0);
if (ret) if (ret)
dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n", dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n",
__func__, ret); __func__, ret);
......
...@@ -43,6 +43,7 @@ enum lpaif_dma_channels { ...@@ -43,6 +43,7 @@ enum lpaif_dma_channels {
}; };
static struct snd_soc_dai_driver ipq806x_lpass_cpu_dai_driver = { static struct snd_soc_dai_driver ipq806x_lpass_cpu_dai_driver = {
.id = IPQ806X_LPAIF_I2S_PORT_MI2S,
.playback = { .playback = {
.stream_name = "lpass-cpu-playback", .stream_name = "lpass-cpu-playback",
.formats = SNDRV_PCM_FMTBIT_S16 | .formats = SNDRV_PCM_FMTBIT_S16 |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment