summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/jz4770.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/jz4770.c')
-rw-r--r--sound/soc/codecs/jz4770.c50
1 files changed, 11 insertions, 39 deletions
diff --git a/sound/soc/codecs/jz4770.c b/sound/soc/codecs/jz4770.c
index 1d0c467ab57b..6b86d47028d7 100644
--- a/sound/soc/codecs/jz4770.c
+++ b/sound/soc/codecs/jz4770.c
@@ -217,7 +217,7 @@ static int jz4770_codec_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_component *codec = dai->component;
- struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(codec);
+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec);
/*
* SYSCLK output from the codec to the AIC is required to keep the
@@ -234,7 +234,7 @@ static void jz4770_codec_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_component *codec = dai->component;
- struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(codec);
+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
snd_soc_dapm_disable_pin(dapm, "SYSCLK");
@@ -245,6 +245,7 @@ static int jz4770_codec_pcm_trigger(struct snd_pcm_substream *substream,
int cmd, struct snd_soc_dai *dai)
{
struct snd_soc_component *codec = dai->component;
+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec);
int ret = 0;
switch (cmd) {
@@ -252,8 +253,7 @@ static int jz4770_codec_pcm_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
- snd_soc_component_force_bias_level(codec,
- SND_SOC_BIAS_ON);
+ snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_ON);
break;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
@@ -331,43 +331,15 @@ static const struct snd_kcontrol_new jz4770_codec_snd_controls[] = {
};
static const struct snd_kcontrol_new jz4770_codec_pcm_playback_controls[] = {
- {
- .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
- .name = "Volume",
- .info = snd_soc_info_volsw,
- .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ
- | SNDRV_CTL_ELEM_ACCESS_READWRITE,
- .tlv.p = dac_tlv,
- .get = snd_soc_dapm_get_volsw,
- .put = snd_soc_dapm_put_volsw,
- /*
- * NOTE: DACR/DACL are inversed; the gain value written to DACR
- * seems to affect the left channel, and the gain value written
- * to DACL seems to affect the right channel.
- */
- .private_value = SOC_DOUBLE_R_VALUE(JZ4770_CODEC_REG_GCR_DACR,
- JZ4770_CODEC_REG_GCR_DACL,
- REG_GCR_GAIN_OFFSET,
- REG_GCR_GAIN_MAX, 1),
- },
+ SOC_DAPM_DOUBLE_R_TLV("Volume", JZ4770_CODEC_REG_GCR_DACR,
+ JZ4770_CODEC_REG_GCR_DACL, REG_GCR_GAIN_OFFSET,
+ REG_GCR_GAIN_MAX, 1, dac_tlv),
};
static const struct snd_kcontrol_new jz4770_codec_hp_playback_controls[] = {
- {
- .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
- .name = "Volume",
- .info = snd_soc_info_volsw,
- .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ
- | SNDRV_CTL_ELEM_ACCESS_READWRITE,
- .tlv.p = out_tlv,
- .get = snd_soc_dapm_get_volsw,
- .put = snd_soc_dapm_put_volsw,
- /* HPR/HPL inversed for the same reason as above */
- .private_value = SOC_DOUBLE_R_VALUE(JZ4770_CODEC_REG_GCR_HPR,
- JZ4770_CODEC_REG_GCR_HPL,
- REG_GCR_GAIN_OFFSET,
- REG_GCR_GAIN_MAX, 1),
- },
+ SOC_DAPM_DOUBLE_R_TLV("Volume", JZ4770_CODEC_REG_GCR_HPR,
+ JZ4770_CODEC_REG_GCR_HPL, REG_GCR_GAIN_OFFSET,
+ REG_GCR_GAIN_MAX, 1, out_tlv),
};
static int hpout_event(struct snd_soc_dapm_widget *w,
@@ -872,7 +844,7 @@ static const u8 jz4770_codec_reg_defaults[] = {
0x07, 0x44, 0x1F, 0x00
};
-static struct regmap_config jz4770_codec_regmap_config = {
+static const struct regmap_config jz4770_codec_regmap_config = {
.reg_bits = 7,
.val_bits = 8,