summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorOleksandr Suvorov <oleksandr.suvorov@toradex.com>2019-05-03 17:28:11 +0300
committerOleksandr Suvorov <oleksandr.suvorov@toradex.com>2019-05-03 17:28:11 +0300
commit60f67ac489323fff175a9eeef595ea2c15f47518 (patch)
treeebf76e3edbfcc3e6f1906cb0ffe40ecd2f347201 /sound
parent5593961ab55c07b752a59bdd74a311717809c8df (diff)
ASoC: sgtl5000: Add on/off control for HP/LINE out
- adding mute/unmute controls for headphone and lineout allows alsa-compatible sound players automatically unmute output port to play music. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/sgtl5000.c16
-rw-r--r--sound/soc/codecs/sgtl5000.h3
2 files changed, 16 insertions, 3 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 3f0ac04db975..63eec38f2b97 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -403,20 +403,30 @@ static const struct snd_kcontrol_new sgtl5000_snd_controls[] = {
.put = dac_put_volsw,
},
+ /* ADC Capture */
SOC_DOUBLE("Capture Volume", SGTL5000_CHIP_ANA_ADC_CTRL, 0, 4, 0xf, 0),
SOC_SINGLE_TLV("Capture Attenuate Switch (-6dB)",
SGTL5000_CHIP_ANA_ADC_CTRL,
8, 2, 0, capture_6db_attenuate),
- SOC_SINGLE("Capture ZC Switch", SGTL5000_CHIP_ANA_CTRL, 1, 1, 0),
+ SOC_SINGLE("Capture ZC Switch", SGTL5000_CHIP_ANA_CTRL,
+ SGTL5000_ADC_ZCD_EN, 1, 0),
+ /* Headphone */
SOC_DOUBLE_TLV("Headphone Playback Volume",
SGTL5000_CHIP_ANA_HP_CTRL,
0, 8,
0x7f, 1,
headphone_volume),
SOC_SINGLE("Headphone Playback ZC Switch", SGTL5000_CHIP_ANA_CTRL,
- 5, 1, 0),
+ SGTL5000_HP_ZCD_EN, 1, 0),
+ SOC_SINGLE("Headphone Playback Switch", SGTL5000_CHIP_ANA_CTRL,
+ SGTL5000_HP_MUTE_SHIFT, 1, 1),
+ /* Lineout */
+ SOC_SINGLE("Lineout Playback Switch", SGTL5000_CHIP_ANA_CTRL,
+ SGTL5000_LINE_MUTE_SHIFT, 1, 1),
+
+ /* Microphone */
SOC_SINGLE_TLV("Mic Volume", SGTL5000_CHIP_MIC_CTRL,
0, 3, 0, mic_gain_tlv),
};
@@ -1289,7 +1299,7 @@ static int sgtl5000_probe(struct snd_soc_codec *codec)
{
int ret;
struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
- int zcd_mask = SGTL5000_HP_ZCD_EN | SGTL5000_ADC_ZCD_EN;
+ unsigned int zcd_mask = SGTL5000_HP_ZCD_EN | SGTL5000_ADC_ZCD_EN;
/* setup i2c data ops */
ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_I2C);
diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h
index d3a68bbfea00..2ff43adcaec0 100644
--- a/sound/soc/codecs/sgtl5000.h
+++ b/sound/soc/codecs/sgtl5000.h
@@ -236,6 +236,7 @@
* SGTL5000_CHIP_ANA_CTRL
*/
#define SGTL5000_LINE_OUT_MUTE 0x0100
+#define SGTL5000_LINE_MUTE_SHIFT 8
#define SGTL5000_HP_SEL_MASK 0x0040
#define SGTL5000_HP_SEL_SHIFT 6
#define SGTL5000_HP_SEL_WIDTH 1
@@ -243,6 +244,7 @@
#define SGTL5000_HP_SEL_LINE_IN 0x1
#define SGTL5000_HP_ZCD_EN 0x0020
#define SGTL5000_HP_MUTE 0x0010
+#define SGTL5000_HP_MUTE_SHIFT 4
#define SGTL5000_ADC_SEL_MASK 0x0004
#define SGTL5000_ADC_SEL_SHIFT 2
#define SGTL5000_ADC_SEL_WIDTH 1
@@ -250,6 +252,7 @@
#define SGTL5000_ADC_SEL_LINE_IN 0x1
#define SGTL5000_ADC_ZCD_EN 0x0002
#define SGTL5000_ADC_MUTE 0x0001
+#define SGTL5000_ADC_MUTE_SHIFT 0
/*
* SGTL5000_CHIP_LINREG_CTRL