Commit b0ec761b authored by Daniel Mack's avatar Daniel Mack Committed by Mark Brown

ASoC: ak4104: convert to direct regmap API usage

Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 6dbe51c2
...@@ -55,6 +55,7 @@ static int ak4104_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -55,6 +55,7 @@ static int ak4104_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int format) unsigned int format)
{ {
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_codec *codec = codec_dai->codec;
struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec);
int val = 0; int val = 0;
int ret; int ret;
...@@ -77,7 +78,7 @@ static int ak4104_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -77,7 +78,7 @@ static int ak4104_set_dai_fmt(struct snd_soc_dai *codec_dai,
if ((format & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS) if ((format & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS)
return -EINVAL; return -EINVAL;
ret = snd_soc_update_bits(codec, AK4104_REG_CONTROL1, ret = regmap_update_bits(ak4104->regmap, AK4104_REG_CONTROL1,
AK4104_CONTROL1_DIF0 | AK4104_CONTROL1_DIF1, AK4104_CONTROL1_DIF0 | AK4104_CONTROL1_DIF1,
val); val);
if (ret < 0) if (ret < 0)
...@@ -91,11 +92,12 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream, ...@@ -91,11 +92,12 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_codec *codec = dai->codec;
struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec);
int val = 0; int val = 0;
/* set the IEC958 bits: consumer mode, no copyright bit */ /* set the IEC958 bits: consumer mode, no copyright bit */
val |= IEC958_AES0_CON_NOT_COPYRIGHT; val |= IEC958_AES0_CON_NOT_COPYRIGHT;
snd_soc_write(codec, AK4104_REG_CHN_STATUS(0), val); regmap_write(ak4104->regmap, AK4104_REG_CHN_STATUS(0), val);
val = 0; val = 0;
...@@ -132,7 +134,7 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream, ...@@ -132,7 +134,7 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream,
return -EINVAL; return -EINVAL;
} }
return snd_soc_write(codec, AK4104_REG_CHN_STATUS(3), val); return regmap_write(ak4104->regmap, AK4104_REG_CHN_STATUS(3), val);
} }
static const struct snd_soc_dai_ops ak4101_dai_ops = { static const struct snd_soc_dai_ops ak4101_dai_ops = {
...@@ -160,19 +162,16 @@ static int ak4104_probe(struct snd_soc_codec *codec) ...@@ -160,19 +162,16 @@ static int ak4104_probe(struct snd_soc_codec *codec)
int ret; int ret;
codec->control_data = ak4104->regmap; codec->control_data = ak4104->regmap;
ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
if (ret != 0)
return ret;
/* set power-up and non-reset bits */ /* set power-up and non-reset bits */
ret = snd_soc_update_bits(codec, AK4104_REG_CONTROL1, ret = regmap_update_bits(ak4104->regmap, AK4104_REG_CONTROL1,
AK4104_CONTROL1_PW | AK4104_CONTROL1_RSTN, AK4104_CONTROL1_PW | AK4104_CONTROL1_RSTN,
AK4104_CONTROL1_PW | AK4104_CONTROL1_RSTN); AK4104_CONTROL1_PW | AK4104_CONTROL1_RSTN);
if (ret < 0) if (ret < 0)
return ret; return ret;
/* enable transmitter */ /* enable transmitter */
ret = snd_soc_update_bits(codec, AK4104_REG_TX, ret = regmap_update_bits(ak4104->regmap, AK4104_REG_TX,
AK4104_TX_TXE, AK4104_TX_TXE); AK4104_TX_TXE, AK4104_TX_TXE);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -182,7 +181,9 @@ static int ak4104_probe(struct snd_soc_codec *codec) ...@@ -182,7 +181,9 @@ static int ak4104_probe(struct snd_soc_codec *codec)
static int ak4104_remove(struct snd_soc_codec *codec) static int ak4104_remove(struct snd_soc_codec *codec)
{ {
snd_soc_update_bits(codec, AK4104_REG_CONTROL1, struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec);
regmap_update_bits(ak4104->regmap, AK4104_REG_CONTROL1,
AK4104_CONTROL1_PW | AK4104_CONTROL1_RSTN, 0); AK4104_CONTROL1_PW | AK4104_CONTROL1_RSTN, 0);
return 0; return 0;
......
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