diff options
| -rw-r--r-- | sound/soc/codecs/rt5645.c | 56 | ||||
| -rw-r--r-- | sound/soc/codecs/rt5645.h | 6 |
2 files changed, 60 insertions, 2 deletions
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 6f6da0abe220..fbaf36aeb587 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
| @@ -1943,6 +1943,56 @@ static int rt5650_hp_event(struct snd_soc_dapm_widget *w, | |||
| 1943 | return 0; | 1943 | return 0; |
| 1944 | } | 1944 | } |
| 1945 | 1945 | ||
| 1946 | static int rt5645_set_micbias1_event(struct snd_soc_dapm_widget *w, | ||
| 1947 | struct snd_kcontrol *k, int event) | ||
| 1948 | { | ||
| 1949 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
| 1950 | |||
| 1951 | switch (event) { | ||
| 1952 | case SND_SOC_DAPM_PRE_PMU: | ||
| 1953 | snd_soc_update_bits(codec, RT5645_GEN_CTRL2, | ||
| 1954 | RT5645_MICBIAS1_POW_CTRL_SEL_MASK, | ||
| 1955 | RT5645_MICBIAS1_POW_CTRL_SEL_M); | ||
| 1956 | break; | ||
| 1957 | |||
| 1958 | case SND_SOC_DAPM_POST_PMD: | ||
| 1959 | snd_soc_update_bits(codec, RT5645_GEN_CTRL2, | ||
| 1960 | RT5645_MICBIAS1_POW_CTRL_SEL_MASK, | ||
| 1961 | RT5645_MICBIAS1_POW_CTRL_SEL_A); | ||
| 1962 | break; | ||
| 1963 | |||
| 1964 | default: | ||
| 1965 | return 0; | ||
| 1966 | } | ||
| 1967 | |||
| 1968 | return 0; | ||
| 1969 | } | ||
| 1970 | |||
| 1971 | static int rt5645_set_micbias2_event(struct snd_soc_dapm_widget *w, | ||
| 1972 | struct snd_kcontrol *k, int event) | ||
| 1973 | { | ||
| 1974 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
| 1975 | |||
| 1976 | switch (event) { | ||
| 1977 | case SND_SOC_DAPM_PRE_PMU: | ||
| 1978 | snd_soc_update_bits(codec, RT5645_GEN_CTRL2, | ||
| 1979 | RT5645_MICBIAS2_POW_CTRL_SEL_MASK, | ||
| 1980 | RT5645_MICBIAS2_POW_CTRL_SEL_M); | ||
| 1981 | break; | ||
| 1982 | |||
| 1983 | case SND_SOC_DAPM_POST_PMD: | ||
| 1984 | snd_soc_update_bits(codec, RT5645_GEN_CTRL2, | ||
| 1985 | RT5645_MICBIAS2_POW_CTRL_SEL_MASK, | ||
| 1986 | RT5645_MICBIAS2_POW_CTRL_SEL_A); | ||
| 1987 | break; | ||
| 1988 | |||
| 1989 | default: | ||
| 1990 | return 0; | ||
| 1991 | } | ||
| 1992 | |||
| 1993 | return 0; | ||
| 1994 | } | ||
| 1995 | |||
| 1946 | static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = { | 1996 | static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = { |
| 1947 | SND_SOC_DAPM_SUPPLY("LDO2", RT5645_PWR_MIXER, | 1997 | SND_SOC_DAPM_SUPPLY("LDO2", RT5645_PWR_MIXER, |
| 1948 | RT5645_PWR_LDO2_BIT, 0, NULL, 0), | 1998 | RT5645_PWR_LDO2_BIT, 0, NULL, 0), |
| @@ -1981,9 +2031,11 @@ static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = { | |||
| 1981 | /* Input Side */ | 2031 | /* Input Side */ |
| 1982 | /* micbias */ | 2032 | /* micbias */ |
| 1983 | SND_SOC_DAPM_SUPPLY("micbias1", RT5645_PWR_ANLG2, | 2033 | SND_SOC_DAPM_SUPPLY("micbias1", RT5645_PWR_ANLG2, |
| 1984 | RT5645_PWR_MB1_BIT, 0, NULL, 0), | 2034 | RT5645_PWR_MB1_BIT, 0, rt5645_set_micbias1_event, |
| 2035 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
| 1985 | SND_SOC_DAPM_SUPPLY("micbias2", RT5645_PWR_ANLG2, | 2036 | SND_SOC_DAPM_SUPPLY("micbias2", RT5645_PWR_ANLG2, |
| 1986 | RT5645_PWR_MB2_BIT, 0, NULL, 0), | 2037 | RT5645_PWR_MB2_BIT, 0, rt5645_set_micbias2_event, |
| 2038 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
| 1987 | /* Input Lines */ | 2039 | /* Input Lines */ |
| 1988 | SND_SOC_DAPM_INPUT("DMIC L1"), | 2040 | SND_SOC_DAPM_INPUT("DMIC L1"), |
| 1989 | SND_SOC_DAPM_INPUT("DMIC R1"), | 2041 | SND_SOC_DAPM_INPUT("DMIC R1"), |
diff --git a/sound/soc/codecs/rt5645.h b/sound/soc/codecs/rt5645.h index cfc5f97549eb..940325b28c29 100644 --- a/sound/soc/codecs/rt5645.h +++ b/sound/soc/codecs/rt5645.h | |||
| @@ -2117,6 +2117,12 @@ enum { | |||
| 2117 | #define RT5645_RXDC_SRC_STO (0x0 << 7) | 2117 | #define RT5645_RXDC_SRC_STO (0x0 << 7) |
| 2118 | #define RT5645_RXDC_SRC_MONO (0x1 << 7) | 2118 | #define RT5645_RXDC_SRC_MONO (0x1 << 7) |
| 2119 | #define RT5645_RXDC_SRC_SFT (7) | 2119 | #define RT5645_RXDC_SRC_SFT (7) |
| 2120 | #define RT5645_MICBIAS1_POW_CTRL_SEL_MASK (0x1 << 5) | ||
| 2121 | #define RT5645_MICBIAS1_POW_CTRL_SEL_A (0x0 << 5) | ||
| 2122 | #define RT5645_MICBIAS1_POW_CTRL_SEL_M (0x1 << 5) | ||
| 2123 | #define RT5645_MICBIAS2_POW_CTRL_SEL_MASK (0x1 << 4) | ||
| 2124 | #define RT5645_MICBIAS2_POW_CTRL_SEL_A (0x0 << 4) | ||
| 2125 | #define RT5645_MICBIAS2_POW_CTRL_SEL_M (0x1 << 4) | ||
| 2120 | #define RT5645_RXDP2_SEL_MASK (0x1 << 3) | 2126 | #define RT5645_RXDP2_SEL_MASK (0x1 << 3) |
| 2121 | #define RT5645_RXDP2_SEL_IF2 (0x0 << 3) | 2127 | #define RT5645_RXDP2_SEL_IF2 (0x0 << 3) |
| 2122 | #define RT5645_RXDP2_SEL_ADC (0x1 << 3) | 2128 | #define RT5645_RXDP2_SEL_ADC (0x1 << 3) |
