[PATCH 3/3] ASoC: codecs: max98088: Added digital mute function =

Jin Park jinyoungp at nvidia.com
Wed May 11 07:56:14 CEST 2011


in DAI1 and DAI2

Added digital mute function in DAI1 and DAI2.

Signed-off-by: Jin Park <jinyoungp at nvidia.com<mailto:jinyoungp at nvidia.com=
>>
---
sound/soc/codecs/max98088.c |   32 ++++++++++++++++++++++++++++++++
sound/soc/codecs/max98088.h |   13 +++++++++++++
2 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index c520093..b5ccf37 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -1582,6 +1582,36 @@ static int max98088_dai2_set_fmt(struct snd_soc_da=
i *codec_dai,
=20       return 0;
}

+static int max98088_dai1_digital_mute(struct snd_soc_dai *codec_dai, int=
=20mute)
+{
+       struct snd_soc_codec *codec =3D codec_dai->codec;
+       int reg;
+
+       if (mute)
+               reg =3D M98088_DAI_MUTE;
+       else
+               reg =3D 0;
+
+       snd_soc_update_bits(codec, M98088_REG_2F_LVL_DAI1_PLAY,
+                           M98088_DAI_MUTE_MASK, reg);
+       return 0;
+}
+
+static int max98088_dai2_digital_mute(struct snd_soc_dai *codec_dai, int=
=20mute)
+{
+       struct snd_soc_codec *codec =3D codec_dai->codec;
+       int reg;
+
+       if (mute)
+               reg =3D M98088_DAI_MUTE;
+       else
+               reg =3D 0;
+
+       snd_soc_update_bits(codec, M98088_REG_31_LVL_DAI2_PLAY,
+                           M98088_DAI_MUTE_MASK, reg);
+       return 0;
+}
+
static void max98088_sync_cache(struct snd_soc_codec *codec)
{
=20       u16 *reg_cache =3D codec->reg_cache;
@@ -1643,12 +1673,14 @@ static struct snd_soc_dai_ops max98088_dai1_ops =3D=
=20{
=20       .set_sysclk =3D max98088_dai_set_sysclk,
=20       .set_fmt =3D max98088_dai1_set_fmt,
=20       .hw_params =3D max98088_dai1_hw_params,
+       .digital_mute =3D max98088_dai1_digital_mute,
};

=20static struct snd_soc_dai_ops max98088_dai2_ops =3D {
=20       .set_sysclk =3D max98088_dai_set_sysclk,
=20       .set_fmt =3D max98088_dai2_set_fmt,
=20       .hw_params =3D max98088_dai2_hw_params,
+       .digital_mute =3D max98088_dai2_digital_mute,
};

=20static struct snd_soc_dai_driver max98088_dai[] =3D {
diff --git a/sound/soc/codecs/max98088.h b/sound/soc/codecs/max98088.h
index 56554c7..be89a4f 100644
--- a/sound/soc/codecs/max98088.h
+++ b/sound/soc/codecs/max98088.h
@@ -133,6 +133,19 @@
=20       #define M98088_REC_LINEMODE             (1<<7)
=20       #define M98088_REC_LINEMODE_MASK        (1<<7)

+/* M98088_REG_2D_MIX_SPK_CNTL */
+       #define M98088_MIX_SPKR_GAIN_MASK       (3<<2)
+       #define M98088_MIX_SPKR_GAIN_SHIFT      2
+       #define M98088_MIX_SPKL_GAIN_MASK       (3<<0)
+       #define M98088_MIX_SPKL_GAIN_SHIFT      0
+
+/* M98088_REG_2F_LVL_DAI1_PLAY, M98088_REG_31_LVL_DAI2_PLAY */
+       #define M98088_DAI_MUTE                 (1<<7)
+       #define M98088_DAI_MUTE_MASK            (1<<7)
+       #define M98088_DAI_VOICE_GAIN_MASK      (3<<4)
+       #define M98088_DAI_ATTENUATION_MASK     (0xF<<0)
+       #define M98088_DAI_ATTENUATION_SHIFT    0
+
/* M98088_REG_35_LVL_MIC1, M98088_REG_36_LVL_MIC2 */
=20       #define M98088_MICPRE_MASK              (3<<5)
=20       #define M98088_MICPRE_SHIFT             5
--
1.7.1



Best regards,
Jinyoung.


-------------------------------------------------------------------------=
----------
This email message is for the sole use of the intended recipient(s) and m=
ay contain
confidential information.  Any unauthorized review, use, disclosure or di=
stribution
is prohibited.  If you are not the intended recipient, please contact the=
=20sender by
reply email and destroy all copies of the original message.
-------------------------------------------------------------------------=
----------


More information about the Alsa-devel mailing list