Commit d11c2978 authored by Peter Rosin's avatar Peter Rosin Committed by Mark Brown

ASoC: pcm512x: Support SND_SOC_DAIFMT_CBM_CFS

Signed-off-by: default avatarPeter Rosin <peda@axentia.se>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7c4e1119
...@@ -464,6 +464,7 @@ static int pcm512x_dai_startup(struct snd_pcm_substream *substream, ...@@ -464,6 +464,7 @@ static int pcm512x_dai_startup(struct snd_pcm_substream *substream,
switch (pcm512x->fmt & SND_SOC_DAIFMT_MASTER_MASK) { switch (pcm512x->fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBM_CFM: case SND_SOC_DAIFMT_CBM_CFM:
case SND_SOC_DAIFMT_CBM_CFS:
return pcm512x_dai_startup_master(substream, dai); return pcm512x_dai_startup_master(substream, dai);
case SND_SOC_DAIFMT_CBS_CFS: case SND_SOC_DAIFMT_CBS_CFS:
...@@ -970,6 +971,8 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -970,6 +971,8 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec);
int alen; int alen;
int gpio; int gpio;
int clock_output;
int master_mode;
int ret; int ret;
dev_dbg(codec->dev, "hw_params %u Hz, %u channels\n", dev_dbg(codec->dev, "hw_params %u Hz, %u channels\n",
...@@ -1018,6 +1021,12 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1018,6 +1021,12 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
} }
return 0; return 0;
case SND_SOC_DAIFMT_CBM_CFM: case SND_SOC_DAIFMT_CBM_CFM:
clock_output = PCM512x_BCKO | PCM512x_LRKO;
master_mode = PCM512x_RLRK | PCM512x_RBCK;
break;
case SND_SOC_DAIFMT_CBM_CFS:
clock_output = PCM512x_BCKO;
master_mode = PCM512x_RBCK;
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -1114,7 +1123,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1114,7 +1123,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_BCLK_LRCLK_CFG, ret = regmap_update_bits(pcm512x->regmap, PCM512x_BCLK_LRCLK_CFG,
PCM512x_BCKP | PCM512x_BCKO | PCM512x_LRKO, PCM512x_BCKP | PCM512x_BCKO | PCM512x_LRKO,
PCM512x_BCKO | PCM512x_LRKO); clock_output);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to enable clock output: %d\n", ret); dev_err(codec->dev, "Failed to enable clock output: %d\n", ret);
return ret; return ret;
...@@ -1122,7 +1131,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream, ...@@ -1122,7 +1131,7 @@ static int pcm512x_hw_params(struct snd_pcm_substream *substream,
ret = regmap_update_bits(pcm512x->regmap, PCM512x_MASTER_MODE, ret = regmap_update_bits(pcm512x->regmap, PCM512x_MASTER_MODE,
PCM512x_RLRK | PCM512x_RBCK, PCM512x_RLRK | PCM512x_RBCK,
PCM512x_RLRK | PCM512x_RBCK); master_mode);
if (ret != 0) { if (ret != 0) {
dev_err(codec->dev, "Failed to enable master mode: %d\n", ret); dev_err(codec->dev, "Failed to enable master mode: %d\n", ret);
return ret; return ret;
......
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