diff options
author | Liam Girdwood <lrg@ti.com> | 2012-01-11 07:43:24 -0500 |
---|---|---|
committer | Liam Girdwood <lrg@ti.com> | 2012-01-11 07:43:24 -0500 |
commit | e48b46ba169181dc88ea48e31dcb4afcf8778397 (patch) | |
tree | 48aea71559fec05f3cfab43602657aaa60cf8627 /sound/soc | |
parent | f75a8ff67d161b5166a2c2360bb2ffaefd5eb853 (diff) |
ASoC: twl6040 - Add method to query optimum PDM_DL1 gain
The DL1 PDM interface adds a little gain depending on the output device.
Add a method to retrieve the gain value for machine driver usage.
Signed-off-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/twl6040.c | 23 | ||||
-rw-r--r-- | sound/soc/codecs/twl6040.h | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 3376e6fad2a2..5b9c79b6f65e 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <sound/pcm.h> | 33 | #include <sound/pcm.h> |
34 | #include <sound/pcm_params.h> | 34 | #include <sound/pcm_params.h> |
35 | #include <sound/soc.h> | 35 | #include <sound/soc.h> |
36 | #include <sound/soc-dapm.h> | ||
36 | #include <sound/initval.h> | 37 | #include <sound/initval.h> |
37 | #include <sound/tlv.h> | 38 | #include <sound/tlv.h> |
38 | 39 | ||
@@ -1012,6 +1013,28 @@ static int twl6040_pll_put_enum(struct snd_kcontrol *kcontrol, | |||
1012 | return 0; | 1013 | return 0; |
1013 | } | 1014 | } |
1014 | 1015 | ||
1016 | int twl6040_get_dl1_gain(struct snd_soc_codec *codec) | ||
1017 | { | ||
1018 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
1019 | |||
1020 | if (snd_soc_dapm_get_pin_status(dapm, "EP")) | ||
1021 | return -1; /* -1dB */ | ||
1022 | |||
1023 | if (snd_soc_dapm_get_pin_status(dapm, "HSOR") || | ||
1024 | snd_soc_dapm_get_pin_status(dapm, "HSOL")) { | ||
1025 | |||
1026 | u8 val = snd_soc_read(codec, TWL6040_REG_HSLCTL); | ||
1027 | if (val & TWL6040_HSDACMODE) | ||
1028 | /* HSDACL in LP mode */ | ||
1029 | return -8; /* -8dB */ | ||
1030 | else | ||
1031 | /* HSDACL in HP mode */ | ||
1032 | return -1; /* -1dB */ | ||
1033 | } | ||
1034 | return 0; /* 0dB */ | ||
1035 | } | ||
1036 | EXPORT_SYMBOL_GPL(twl6040_get_dl1_gain); | ||
1037 | |||
1015 | int twl6040_get_clk_id(struct snd_soc_codec *codec) | 1038 | int twl6040_get_clk_id(struct snd_soc_codec *codec) |
1016 | { | 1039 | { |
1017 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 1040 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); |
diff --git a/sound/soc/codecs/twl6040.h b/sound/soc/codecs/twl6040.h index a83277bdb851..ef273f1fac2f 100644 --- a/sound/soc/codecs/twl6040.h +++ b/sound/soc/codecs/twl6040.h | |||
@@ -34,6 +34,7 @@ enum twl6040_trim { | |||
34 | #define TWL6040_HSF_TRIM_LEFT(x) (x & 0x0f) | 34 | #define TWL6040_HSF_TRIM_LEFT(x) (x & 0x0f) |
35 | #define TWL6040_HSF_TRIM_RIGHT(x) ((x >> 4) & 0x0f) | 35 | #define TWL6040_HSF_TRIM_RIGHT(x) ((x >> 4) & 0x0f) |
36 | 36 | ||
37 | int twl6040_get_dl1_gain(struct snd_soc_codec *codec); | ||
37 | void twl6040_hs_jack_detect(struct snd_soc_codec *codec, | 38 | void twl6040_hs_jack_detect(struct snd_soc_codec *codec, |
38 | struct snd_soc_jack *jack, int report); | 39 | struct snd_soc_jack *jack, int report); |
39 | int twl6040_get_clk_id(struct snd_soc_codec *codec); | 40 | int twl6040_get_clk_id(struct snd_soc_codec *codec); |