diff options
-rw-r--r-- | MAINTAINERS | 6 | ||||
-rw-r--r-- | sound/soc/codecs/Kconfig | 11 | ||||
-rw-r--r-- | sound/soc/codecs/Makefile | 2 | ||||
-rw-r--r-- | sound/soc/codecs/tas2552.c | 10 | ||||
-rw-r--r-- | sound/soc/codecs/tfa9879.c | 328 | ||||
-rw-r--r-- | sound/soc/codecs/tfa9879.h | 202 | ||||
-rw-r--r-- | sound/soc/codecs/tlv320aic23.c | 21 | ||||
-rw-r--r-- | sound/soc/codecs/tlv320aic31xx.c | 18 | ||||
-rw-r--r-- | sound/soc/tegra/tegra_rt5640.c | 6 |
9 files changed, 560 insertions, 44 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index c721042e7e45..dd9a4e979a08 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -6601,6 +6601,12 @@ S: Supported | |||
6601 | F: drivers/gpu/drm/i2c/tda998x_drv.c | 6601 | F: drivers/gpu/drm/i2c/tda998x_drv.c |
6602 | F: include/drm/i2c/tda998x.h | 6602 | F: include/drm/i2c/tda998x.h |
6603 | 6603 | ||
6604 | NXP TFA9879 DRIVER | ||
6605 | M: Peter Rosin <peda@axentia.se> | ||
6606 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | ||
6607 | S: Maintained | ||
6608 | F: sound/soc/codecs/tfa9879* | ||
6609 | |||
6604 | OMAP SUPPORT | 6610 | OMAP SUPPORT |
6605 | M: Tony Lindgren <tony@atomide.com> | 6611 | M: Tony Lindgren <tony@atomide.com> |
6606 | L: linux-omap@vger.kernel.org | 6612 | L: linux-omap@vger.kernel.org |
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index cf7d33537468..4e984e15358f 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -102,6 +102,7 @@ config SND_SOC_ALL_CODECS | |||
102 | select SND_SOC_STAC9766 if SND_SOC_AC97_BUS | 102 | select SND_SOC_STAC9766 if SND_SOC_AC97_BUS |
103 | select SND_SOC_TAS2552 if I2C | 103 | select SND_SOC_TAS2552 if I2C |
104 | select SND_SOC_TAS5086 if I2C | 104 | select SND_SOC_TAS5086 if I2C |
105 | select SND_SOC_TFA9879 if I2C | ||
105 | select SND_SOC_TLV320AIC23_I2C if I2C | 106 | select SND_SOC_TLV320AIC23_I2C if I2C |
106 | select SND_SOC_TLV320AIC23_SPI if SPI_MASTER | 107 | select SND_SOC_TLV320AIC23_SPI if SPI_MASTER |
107 | select SND_SOC_TLV320AIC26 if SPI_MASTER | 108 | select SND_SOC_TLV320AIC26 if SPI_MASTER |
@@ -596,15 +597,21 @@ config SND_SOC_TAS5086 | |||
596 | tristate "Texas Instruments TAS5086 speaker amplifier" | 597 | tristate "Texas Instruments TAS5086 speaker amplifier" |
597 | depends on I2C | 598 | depends on I2C |
598 | 599 | ||
600 | config SND_SOC_TFA9879 | ||
601 | tristate "NXP Semiconductors TFA9879 amplifier" | ||
602 | depends on I2C | ||
603 | |||
599 | config SND_SOC_TLV320AIC23 | 604 | config SND_SOC_TLV320AIC23 |
600 | tristate | 605 | tristate |
601 | 606 | ||
602 | config SND_SOC_TLV320AIC23_I2C | 607 | config SND_SOC_TLV320AIC23_I2C |
603 | tristate | 608 | tristate "Texas Instruments TLV320AIC23 audio CODEC - I2C" |
609 | depends on I2C | ||
604 | select SND_SOC_TLV320AIC23 | 610 | select SND_SOC_TLV320AIC23 |
605 | 611 | ||
606 | config SND_SOC_TLV320AIC23_SPI | 612 | config SND_SOC_TLV320AIC23_SPI |
607 | tristate | 613 | tristate "Texas Instruments TLV320AIC23 audio CODEC - SPI" |
614 | depends on SPI_MASTER | ||
608 | select SND_SOC_TLV320AIC23 | 615 | select SND_SOC_TLV320AIC23 |
609 | 616 | ||
610 | config SND_SOC_TLV320AIC26 | 617 | config SND_SOC_TLV320AIC26 |
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index a6f4fbad1552..c94b5a8582ef 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile | |||
@@ -104,6 +104,7 @@ snd-soc-sta350-objs := sta350.o | |||
104 | snd-soc-sta529-objs := sta529.o | 104 | snd-soc-sta529-objs := sta529.o |
105 | snd-soc-stac9766-objs := stac9766.o | 105 | snd-soc-stac9766-objs := stac9766.o |
106 | snd-soc-tas5086-objs := tas5086.o | 106 | snd-soc-tas5086-objs := tas5086.o |
107 | snd-soc-tfa9879-objs := tfa9879.o | ||
107 | snd-soc-tlv320aic23-objs := tlv320aic23.o | 108 | snd-soc-tlv320aic23-objs := tlv320aic23.o |
108 | snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o | 109 | snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o |
109 | snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o | 110 | snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o |
@@ -280,6 +281,7 @@ obj-$(CONFIG_SND_SOC_STA529) += snd-soc-sta529.o | |||
280 | obj-$(CONFIG_SND_SOC_STAC9766) += snd-soc-stac9766.o | 281 | obj-$(CONFIG_SND_SOC_STAC9766) += snd-soc-stac9766.o |
281 | obj-$(CONFIG_SND_SOC_TAS2552) += snd-soc-tas2552.o | 282 | obj-$(CONFIG_SND_SOC_TAS2552) += snd-soc-tas2552.o |
282 | obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o | 283 | obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o |
284 | obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o | ||
283 | obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o | 285 | obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o |
284 | obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o | 286 | obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o |
285 | obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o | 287 | obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o |
diff --git a/sound/soc/codecs/tas2552.c b/sound/soc/codecs/tas2552.c index f039dc825971..b505212019e2 100644 --- a/sound/soc/codecs/tas2552.c +++ b/sound/soc/codecs/tas2552.c | |||
@@ -345,7 +345,6 @@ static const struct reg_default tas2552_init_regs[] = { | |||
345 | static int tas2552_codec_probe(struct snd_soc_codec *codec) | 345 | static int tas2552_codec_probe(struct snd_soc_codec *codec) |
346 | { | 346 | { |
347 | struct tas2552_data *tas2552 = snd_soc_codec_get_drvdata(codec); | 347 | struct tas2552_data *tas2552 = snd_soc_codec_get_drvdata(codec); |
348 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
349 | int ret; | 348 | int ret; |
350 | 349 | ||
351 | tas2552->codec = codec; | 350 | tas2552->codec = codec; |
@@ -390,11 +389,6 @@ static int tas2552_codec_probe(struct snd_soc_codec *codec) | |||
390 | snd_soc_write(codec, TAS2552_CFG_2, TAS2552_BOOST_EN | | 389 | snd_soc_write(codec, TAS2552_CFG_2, TAS2552_BOOST_EN | |
391 | TAS2552_APT_EN | TAS2552_LIM_EN); | 390 | TAS2552_APT_EN | TAS2552_LIM_EN); |
392 | 391 | ||
393 | snd_soc_dapm_new_controls(dapm, tas2552_dapm_widgets, | ||
394 | ARRAY_SIZE(tas2552_dapm_widgets)); | ||
395 | snd_soc_dapm_add_routes(dapm, tas2552_audio_map, | ||
396 | ARRAY_SIZE(tas2552_audio_map)); | ||
397 | |||
398 | return 0; | 392 | return 0; |
399 | 393 | ||
400 | patch_fail: | 394 | patch_fail: |
@@ -462,6 +456,10 @@ static struct snd_soc_codec_driver soc_codec_dev_tas2552 = { | |||
462 | .resume = tas2552_resume, | 456 | .resume = tas2552_resume, |
463 | .controls = tas2552_snd_controls, | 457 | .controls = tas2552_snd_controls, |
464 | .num_controls = ARRAY_SIZE(tas2552_snd_controls), | 458 | .num_controls = ARRAY_SIZE(tas2552_snd_controls), |
459 | .dapm_widgets = tas2552_dapm_widgets, | ||
460 | .num_dapm_widgets = ARRAY_SIZE(tas2552_dapm_widgets), | ||
461 | .dapm_routes = tas2552_audio_map, | ||
462 | .num_dapm_routes = ARRAY_SIZE(tas2552_audio_map), | ||
465 | }; | 463 | }; |
466 | 464 | ||
467 | static const struct regmap_config tas2552_regmap_config = { | 465 | static const struct regmap_config tas2552_regmap_config = { |
diff --git a/sound/soc/codecs/tfa9879.c b/sound/soc/codecs/tfa9879.c new file mode 100644 index 000000000000..16f1b71edb55 --- /dev/null +++ b/sound/soc/codecs/tfa9879.c | |||
@@ -0,0 +1,328 @@ | |||
1 | /* | ||
2 | * tfa9879.c -- driver for NXP Semiconductors TFA9879 | ||
3 | * | ||
4 | * Copyright (C) 2014 Axentia Technologies AB | ||
5 | * Author: Peter Rosin <peda@axentia.se> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/i2c.h> | ||
17 | #include <linux/regmap.h> | ||
18 | #include <sound/soc.h> | ||
19 | #include <sound/tlv.h> | ||
20 | #include <sound/pcm_params.h> | ||
21 | |||
22 | #include "tfa9879.h" | ||
23 | |||
24 | struct tfa9879_priv { | ||
25 | struct regmap *regmap; | ||
26 | int lsb_justified; | ||
27 | }; | ||
28 | |||
29 | static int tfa9879_hw_params(struct snd_pcm_substream *substream, | ||
30 | struct snd_pcm_hw_params *params, | ||
31 | struct snd_soc_dai *dai) | ||
32 | { | ||
33 | struct snd_soc_codec *codec = dai->codec; | ||
34 | struct tfa9879_priv *tfa9879 = snd_soc_codec_get_drvdata(codec); | ||
35 | int fs; | ||
36 | int i2s_set = 0; | ||
37 | |||
38 | switch (params_rate(params)) { | ||
39 | case 8000: | ||
40 | fs = TFA9879_I2S_FS_8000; | ||
41 | break; | ||
42 | case 11025: | ||
43 | fs = TFA9879_I2S_FS_11025; | ||
44 | break; | ||
45 | case 12000: | ||
46 | fs = TFA9879_I2S_FS_12000; | ||
47 | break; | ||
48 | case 16000: | ||
49 | fs = TFA9879_I2S_FS_16000; | ||
50 | break; | ||
51 | case 22050: | ||
52 | fs = TFA9879_I2S_FS_22050; | ||
53 | break; | ||
54 | case 24000: | ||
55 | fs = TFA9879_I2S_FS_24000; | ||
56 | break; | ||
57 | case 32000: | ||
58 | fs = TFA9879_I2S_FS_32000; | ||
59 | break; | ||
60 | case 44100: | ||
61 | fs = TFA9879_I2S_FS_44100; | ||
62 | break; | ||
63 | case 48000: | ||
64 | fs = TFA9879_I2S_FS_48000; | ||
65 | break; | ||
66 | case 64000: | ||
67 | fs = TFA9879_I2S_FS_64000; | ||
68 | break; | ||
69 | case 88200: | ||
70 | fs = TFA9879_I2S_FS_88200; | ||
71 | break; | ||
72 | case 96000: | ||
73 | fs = TFA9879_I2S_FS_96000; | ||
74 | break; | ||
75 | default: | ||
76 | return -EINVAL; | ||
77 | } | ||
78 | |||
79 | switch (params_width(params)) { | ||
80 | case 16: | ||
81 | i2s_set = TFA9879_I2S_SET_LSB_J_16; | ||
82 | break; | ||
83 | case 24: | ||
84 | i2s_set = TFA9879_I2S_SET_LSB_J_24; | ||
85 | break; | ||
86 | default: | ||
87 | return -EINVAL; | ||
88 | } | ||
89 | |||
90 | if (tfa9879->lsb_justified) | ||
91 | snd_soc_update_bits(codec, TFA9879_SERIAL_INTERFACE_1, | ||
92 | TFA9879_I2S_SET_MASK, | ||
93 | i2s_set << TFA9879_I2S_SET_SHIFT); | ||
94 | |||
95 | snd_soc_update_bits(codec, TFA9879_SERIAL_INTERFACE_1, | ||
96 | TFA9879_I2S_FS_MASK, | ||
97 | fs << TFA9879_I2S_FS_SHIFT); | ||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | static int tfa9879_digital_mute(struct snd_soc_dai *dai, int mute) | ||
102 | { | ||
103 | struct snd_soc_codec *codec = dai->codec; | ||
104 | |||
105 | snd_soc_update_bits(codec, TFA9879_MISC_CONTROL, | ||
106 | TFA9879_S_MUTE_MASK, | ||
107 | !!mute << TFA9879_S_MUTE_SHIFT); | ||
108 | |||
109 | return 0; | ||
110 | } | ||
111 | |||
112 | static int tfa9879_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) | ||
113 | { | ||
114 | struct snd_soc_codec *codec = dai->codec; | ||
115 | struct tfa9879_priv *tfa9879 = snd_soc_codec_get_drvdata(codec); | ||
116 | int i2s_set; | ||
117 | int sck_pol; | ||
118 | |||
119 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | ||
120 | case SND_SOC_DAIFMT_CBS_CFS: | ||
121 | break; | ||
122 | default: | ||
123 | return -EINVAL; | ||
124 | } | ||
125 | |||
126 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | ||
127 | case SND_SOC_DAIFMT_NB_NF: | ||
128 | sck_pol = TFA9879_SCK_POL_NORMAL; | ||
129 | break; | ||
130 | case SND_SOC_DAIFMT_IB_NF: | ||
131 | sck_pol = TFA9879_SCK_POL_INVERSE; | ||
132 | break; | ||
133 | default: | ||
134 | return -EINVAL; | ||
135 | } | ||
136 | |||
137 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | ||
138 | case SND_SOC_DAIFMT_I2S: | ||
139 | tfa9879->lsb_justified = 0; | ||
140 | i2s_set = TFA9879_I2S_SET_I2S_24; | ||
141 | break; | ||
142 | case SND_SOC_DAIFMT_LEFT_J: | ||
143 | tfa9879->lsb_justified = 0; | ||
144 | i2s_set = TFA9879_I2S_SET_MSB_J_24; | ||
145 | break; | ||
146 | case SND_SOC_DAIFMT_RIGHT_J: | ||
147 | tfa9879->lsb_justified = 1; | ||
148 | i2s_set = TFA9879_I2S_SET_LSB_J_24; | ||
149 | break; | ||
150 | default: | ||
151 | return -EINVAL; | ||
152 | } | ||
153 | |||
154 | snd_soc_update_bits(codec, TFA9879_SERIAL_INTERFACE_1, | ||
155 | TFA9879_SCK_POL_MASK, | ||
156 | sck_pol << TFA9879_SCK_POL_SHIFT); | ||
157 | snd_soc_update_bits(codec, TFA9879_SERIAL_INTERFACE_1, | ||
158 | TFA9879_I2S_SET_MASK, | ||
159 | i2s_set << TFA9879_I2S_SET_SHIFT); | ||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | static struct reg_default tfa9879_regs[] = { | ||
164 | { TFA9879_DEVICE_CONTROL, 0x0000 }, /* 0x00 */ | ||
165 | { TFA9879_SERIAL_INTERFACE_1, 0x0a18 }, /* 0x01 */ | ||
166 | { TFA9879_PCM_IOM2_FORMAT_1, 0x0007 }, /* 0x02 */ | ||
167 | { TFA9879_SERIAL_INTERFACE_2, 0x0a18 }, /* 0x03 */ | ||
168 | { TFA9879_PCM_IOM2_FORMAT_2, 0x0007 }, /* 0x04 */ | ||
169 | { TFA9879_EQUALIZER_A1, 0x59dd }, /* 0x05 */ | ||
170 | { TFA9879_EQUALIZER_A2, 0xc63e }, /* 0x06 */ | ||
171 | { TFA9879_EQUALIZER_B1, 0x651a }, /* 0x07 */ | ||
172 | { TFA9879_EQUALIZER_B2, 0xe53e }, /* 0x08 */ | ||
173 | { TFA9879_EQUALIZER_C1, 0x4616 }, /* 0x09 */ | ||
174 | { TFA9879_EQUALIZER_C2, 0xd33e }, /* 0x0a */ | ||
175 | { TFA9879_EQUALIZER_D1, 0x4df3 }, /* 0x0b */ | ||
176 | { TFA9879_EQUALIZER_D2, 0xea3e }, /* 0x0c */ | ||
177 | { TFA9879_EQUALIZER_E1, 0x5ee0 }, /* 0x0d */ | ||
178 | { TFA9879_EQUALIZER_E2, 0xf93e }, /* 0x0e */ | ||
179 | { TFA9879_BYPASS_CONTROL, 0x0093 }, /* 0x0f */ | ||
180 | { TFA9879_DYNAMIC_RANGE_COMPR, 0x92ba }, /* 0x10 */ | ||
181 | { TFA9879_BASS_TREBLE, 0x12a5 }, /* 0x11 */ | ||
182 | { TFA9879_HIGH_PASS_FILTER, 0x0004 }, /* 0x12 */ | ||
183 | { TFA9879_VOLUME_CONTROL, 0x10bd }, /* 0x13 */ | ||
184 | { TFA9879_MISC_CONTROL, 0x0000 }, /* 0x14 */ | ||
185 | }; | ||
186 | |||
187 | static bool tfa9879_volatile_reg(struct device *dev, unsigned int reg) | ||
188 | { | ||
189 | return reg == TFA9879_MISC_STATUS; | ||
190 | } | ||
191 | |||
192 | static const DECLARE_TLV_DB_SCALE(volume_tlv, -7050, 50, 1); | ||
193 | static const DECLARE_TLV_DB_SCALE(tb_gain_tlv, -1800, 200, 0); | ||
194 | static const char * const tb_freq_text[] = { | ||
195 | "Low", "Mid", "High" | ||
196 | }; | ||
197 | static const struct soc_enum treble_freq_enum = | ||
198 | SOC_ENUM_SINGLE(TFA9879_BASS_TREBLE, TFA9879_F_TRBLE_SHIFT, | ||
199 | ARRAY_SIZE(tb_freq_text), tb_freq_text); | ||
200 | static const struct soc_enum bass_freq_enum = | ||
201 | SOC_ENUM_SINGLE(TFA9879_BASS_TREBLE, TFA9879_F_BASS_SHIFT, | ||
202 | ARRAY_SIZE(tb_freq_text), tb_freq_text); | ||
203 | |||
204 | static const struct snd_kcontrol_new tfa9879_controls[] = { | ||
205 | SOC_SINGLE_TLV("PCM Playback Volume", TFA9879_VOLUME_CONTROL, | ||
206 | TFA9879_VOL_SHIFT, 0xbd, 1, volume_tlv), | ||
207 | SOC_SINGLE_TLV("Treble Volume", TFA9879_BASS_TREBLE, | ||
208 | TFA9879_G_TRBLE_SHIFT, 18, 0, tb_gain_tlv), | ||
209 | SOC_SINGLE_TLV("Bass Volume", TFA9879_BASS_TREBLE, | ||
210 | TFA9879_G_BASS_SHIFT, 18, 0, tb_gain_tlv), | ||
211 | SOC_ENUM("Treble Corner Freq", treble_freq_enum), | ||
212 | SOC_ENUM("Bass Corner Freq", bass_freq_enum), | ||
213 | }; | ||
214 | |||
215 | static const struct snd_soc_dapm_widget tfa9879_dapm_widgets[] = { | ||
216 | SND_SOC_DAPM_AIF_IN("AIFINL", "Playback", 0, SND_SOC_NOPM, 0, 0), | ||
217 | SND_SOC_DAPM_AIF_IN("AIFINR", "Playback", 1, SND_SOC_NOPM, 0, 0), | ||
218 | SND_SOC_DAPM_DAC("DAC", NULL, TFA9879_DEVICE_CONTROL, TFA9879_OPMODE_SHIFT, 0), | ||
219 | SND_SOC_DAPM_OUTPUT("LINEOUT"), | ||
220 | SND_SOC_DAPM_SUPPLY("POWER", TFA9879_DEVICE_CONTROL, TFA9879_POWERUP_SHIFT, 0, | ||
221 | NULL, 0), | ||
222 | }; | ||
223 | |||
224 | static const struct snd_soc_dapm_route tfa9879_dapm_routes[] = { | ||
225 | { "DAC", NULL, "AIFINL" }, | ||
226 | { "DAC", NULL, "AIFINR" }, | ||
227 | |||
228 | { "LINEOUT", NULL, "DAC" }, | ||
229 | |||
230 | { "DAC", NULL, "POWER" }, | ||
231 | }; | ||
232 | |||
233 | static const struct snd_soc_codec_driver tfa9879_codec = { | ||
234 | .controls = tfa9879_controls, | ||
235 | .num_controls = ARRAY_SIZE(tfa9879_controls), | ||
236 | |||
237 | .dapm_widgets = tfa9879_dapm_widgets, | ||
238 | .num_dapm_widgets = ARRAY_SIZE(tfa9879_dapm_widgets), | ||
239 | .dapm_routes = tfa9879_dapm_routes, | ||
240 | .num_dapm_routes = ARRAY_SIZE(tfa9879_dapm_routes), | ||
241 | }; | ||
242 | |||
243 | static const struct regmap_config tfa9879_regmap = { | ||
244 | .reg_bits = 8, | ||
245 | .val_bits = 16, | ||
246 | |||
247 | .volatile_reg = tfa9879_volatile_reg, | ||
248 | .max_register = TFA9879_MISC_STATUS, | ||
249 | .reg_defaults = tfa9879_regs, | ||
250 | .num_reg_defaults = ARRAY_SIZE(tfa9879_regs), | ||
251 | .cache_type = REGCACHE_RBTREE, | ||
252 | }; | ||
253 | |||
254 | static const struct snd_soc_dai_ops tfa9879_dai_ops = { | ||
255 | .hw_params = tfa9879_hw_params, | ||
256 | .digital_mute = tfa9879_digital_mute, | ||
257 | .set_fmt = tfa9879_set_fmt, | ||
258 | }; | ||
259 | |||
260 | #define TFA9879_RATES SNDRV_PCM_RATE_8000_96000 | ||
261 | |||
262 | #define TFA9879_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ | ||
263 | SNDRV_PCM_FMTBIT_S24_LE) | ||
264 | |||
265 | static struct snd_soc_dai_driver tfa9879_dai = { | ||
266 | .name = "tfa9879-hifi", | ||
267 | .playback = { | ||
268 | .stream_name = "Playback", | ||
269 | .channels_min = 2, | ||
270 | .channels_max = 2, | ||
271 | .rates = TFA9879_RATES, | ||
272 | .formats = TFA9879_FORMATS, }, | ||
273 | .ops = &tfa9879_dai_ops, | ||
274 | }; | ||
275 | |||
276 | static int tfa9879_i2c_probe(struct i2c_client *i2c, | ||
277 | const struct i2c_device_id *id) | ||
278 | { | ||
279 | struct tfa9879_priv *tfa9879; | ||
280 | int i; | ||
281 | |||
282 | tfa9879 = devm_kzalloc(&i2c->dev, sizeof(*tfa9879), GFP_KERNEL); | ||
283 | if (IS_ERR(tfa9879)) | ||
284 | return PTR_ERR(tfa9879); | ||
285 | |||
286 | i2c_set_clientdata(i2c, tfa9879); | ||
287 | |||
288 | tfa9879->regmap = devm_regmap_init_i2c(i2c, &tfa9879_regmap); | ||
289 | if (IS_ERR(tfa9879->regmap)) | ||
290 | return PTR_ERR(tfa9879->regmap); | ||
291 | |||
292 | /* Ensure the device is in reset state */ | ||
293 | for (i = 0; i < ARRAY_SIZE(tfa9879_regs); i++) | ||
294 | regmap_write(tfa9879->regmap, | ||
295 | tfa9879_regs[i].reg, tfa9879_regs[i].def); | ||
296 | |||
297 | return snd_soc_register_codec(&i2c->dev, &tfa9879_codec, | ||
298 | &tfa9879_dai, 1); | ||
299 | } | ||
300 | |||
301 | static int tfa9879_i2c_remove(struct i2c_client *client) | ||
302 | { | ||
303 | snd_soc_unregister_codec(&client->dev); | ||
304 | |||
305 | return 0; | ||
306 | } | ||
307 | |||
308 | static const struct i2c_device_id tfa9879_i2c_id[] = { | ||
309 | { "tfa9879", 0 }, | ||
310 | { } | ||
311 | }; | ||
312 | MODULE_DEVICE_TABLE(i2c, tfa9879_i2c_id); | ||
313 | |||
314 | static struct i2c_driver tfa9879_i2c_driver = { | ||
315 | .driver = { | ||
316 | .name = "tfa9879", | ||
317 | .owner = THIS_MODULE, | ||
318 | }, | ||
319 | .probe = tfa9879_i2c_probe, | ||
320 | .remove = tfa9879_i2c_remove, | ||
321 | .id_table = tfa9879_i2c_id, | ||
322 | }; | ||
323 | |||
324 | module_i2c_driver(tfa9879_i2c_driver); | ||
325 | |||
326 | MODULE_DESCRIPTION("ASoC NXP Semiconductors TFA9879 driver"); | ||
327 | MODULE_AUTHOR("Peter Rosin <peda@axentia.se>"); | ||
328 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/codecs/tfa9879.h b/sound/soc/codecs/tfa9879.h new file mode 100644 index 000000000000..3408c90c4628 --- /dev/null +++ b/sound/soc/codecs/tfa9879.h | |||
@@ -0,0 +1,202 @@ | |||
1 | /* | ||
2 | * tfa9879.h -- driver for NXP Semiconductors TFA9879 | ||
3 | * | ||
4 | * Copyright (C) 2014 Axentia Technologies AB | ||
5 | * Author: Peter Rosin <peda@axentia.se> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #ifndef _TFA9879_H | ||
15 | #define _TFA9879_H | ||
16 | |||
17 | #define TFA9879_DEVICE_CONTROL 0x00 | ||
18 | #define TFA9879_SERIAL_INTERFACE_1 0x01 | ||
19 | #define TFA9879_PCM_IOM2_FORMAT_1 0x02 | ||
20 | #define TFA9879_SERIAL_INTERFACE_2 0x03 | ||
21 | #define TFA9879_PCM_IOM2_FORMAT_2 0x04 | ||
22 | #define TFA9879_EQUALIZER_A1 0x05 | ||
23 | #define TFA9879_EQUALIZER_A2 0x06 | ||
24 | #define TFA9879_EQUALIZER_B1 0x07 | ||
25 | #define TFA9879_EQUALIZER_B2 0x08 | ||
26 | #define TFA9879_EQUALIZER_C1 0x09 | ||
27 | #define TFA9879_EQUALIZER_C2 0x0a | ||
28 | #define TFA9879_EQUALIZER_D1 0x0b | ||
29 | #define TFA9879_EQUALIZER_D2 0x0c | ||
30 | #define TFA9879_EQUALIZER_E1 0x0d | ||
31 | #define TFA9879_EQUALIZER_E2 0x0e | ||
32 | #define TFA9879_BYPASS_CONTROL 0x0f | ||
33 | #define TFA9879_DYNAMIC_RANGE_COMPR 0x10 | ||
34 | #define TFA9879_BASS_TREBLE 0x11 | ||
35 | #define TFA9879_HIGH_PASS_FILTER 0x12 | ||
36 | #define TFA9879_VOLUME_CONTROL 0x13 | ||
37 | #define TFA9879_MISC_CONTROL 0x14 | ||
38 | #define TFA9879_MISC_STATUS 0x15 | ||
39 | |||
40 | /* TFA9879_DEVICE_CONTROL */ | ||
41 | #define TFA9879_INPUT_SEL_MASK 0x0010 | ||
42 | #define TFA9879_INPUT_SEL_SHIFT 4 | ||
43 | #define TFA9879_OPMODE_MASK 0x0008 | ||
44 | #define TFA9879_OPMODE_SHIFT 3 | ||
45 | #define TFA9879_RESET_MASK 0x0002 | ||
46 | #define TFA9879_RESET_SHIFT 1 | ||
47 | #define TFA9879_POWERUP_MASK 0x0001 | ||
48 | #define TFA9879_POWERUP_SHIFT 0 | ||
49 | |||
50 | /* TFA9879_SERIAL_INTERFACE */ | ||
51 | #define TFA9879_MONO_SEL_MASK 0x0c00 | ||
52 | #define TFA9879_MONO_SEL_SHIFT 10 | ||
53 | #define TFA9879_MONO_SEL_LEFT 0 | ||
54 | #define TFA9879_MONO_SEL_RIGHT 1 | ||
55 | #define TFA9879_MONO_SEL_BOTH 2 | ||
56 | #define TFA9879_I2S_FS_MASK 0x03c0 | ||
57 | #define TFA9879_I2S_FS_SHIFT 6 | ||
58 | #define TFA9879_I2S_FS_8000 0 | ||
59 | #define TFA9879_I2S_FS_11025 1 | ||
60 | #define TFA9879_I2S_FS_12000 2 | ||
61 | #define TFA9879_I2S_FS_16000 3 | ||
62 | #define TFA9879_I2S_FS_22050 4 | ||
63 | #define TFA9879_I2S_FS_24000 5 | ||
64 | #define TFA9879_I2S_FS_32000 6 | ||
65 | #define TFA9879_I2S_FS_44100 7 | ||
66 | #define TFA9879_I2S_FS_48000 8 | ||
67 | #define TFA9879_I2S_FS_64000 9 | ||
68 | #define TFA9879_I2S_FS_88200 10 | ||
69 | #define TFA9879_I2S_FS_96000 11 | ||
70 | #define TFA9879_I2S_SET_MASK 0x0038 | ||
71 | #define TFA9879_I2S_SET_SHIFT 3 | ||
72 | #define TFA9879_I2S_SET_MSB_J_24 2 | ||
73 | #define TFA9879_I2S_SET_I2S_24 3 | ||
74 | #define TFA9879_I2S_SET_LSB_J_16 4 | ||
75 | #define TFA9879_I2S_SET_LSB_J_18 5 | ||
76 | #define TFA9879_I2S_SET_LSB_J_20 6 | ||
77 | #define TFA9879_I2S_SET_LSB_J_24 7 | ||
78 | #define TFA9879_SCK_POL_MASK 0x0004 | ||
79 | #define TFA9879_SCK_POL_SHIFT 2 | ||
80 | #define TFA9879_SCK_POL_NORMAL 0 | ||
81 | #define TFA9879_SCK_POL_INVERSE 1 | ||
82 | #define TFA9879_I_MODE_MASK 0x0003 | ||
83 | #define TFA9879_I_MODE_SHIFT 0 | ||
84 | #define TFA9879_I_MODE_I2S 0 | ||
85 | #define TFA9879_I_MODE_PCM_IOM2_SHORT 1 | ||
86 | #define TFA9879_I_MODE_PCM_IOM2_LONG 2 | ||
87 | |||
88 | /* TFA9879_PCM_IOM2_FORMAT */ | ||
89 | #define TFA9879_PCM_FS_MASK 0x0800 | ||
90 | #define TFA9879_PCM_FS_SHIFT 11 | ||
91 | #define TFA9879_A_LAW_MASK 0x0400 | ||
92 | #define TFA9879_A_LAW_SHIFT 10 | ||
93 | #define TFA9879_PCM_COMP_MASK 0x0200 | ||
94 | #define TFA9879_PCM_COMP_SHIFT 9 | ||
95 | #define TFA9879_PCM_DL_MASK 0x0100 | ||
96 | #define TFA9879_PCM_DL_SHIFT 8 | ||
97 | #define TFA9879_D1_SLOT_MASK 0x00f0 | ||
98 | #define TFA9879_D1_SLOT_SHIFT 4 | ||
99 | #define TFA9879_D2_SLOT_MASK 0x000f | ||
100 | #define TFA9879_D2_SLOT_SHIFT 0 | ||
101 | |||
102 | /* TFA9879_EQUALIZER_X1 */ | ||
103 | #define TFA9879_T1_MASK 0x8000 | ||
104 | #define TFA9879_T1_SHIFT 15 | ||
105 | #define TFA9879_K1M_MASK 0x7ff0 | ||
106 | #define TFA9879_K1M_SHIFT 4 | ||
107 | #define TFA9879_K1E_MASK 0x000f | ||
108 | #define TFA9879_K1E_SHIFT 0 | ||
109 | |||
110 | /* TFA9879_EQUALIZER_X2 */ | ||
111 | #define TFA9879_T2_MASK 0x8000 | ||
112 | #define TFA9879_T2_SHIFT 15 | ||
113 | #define TFA9879_K2M_MASK 0x7800 | ||
114 | #define TFA9879_K2M_SHIFT 11 | ||
115 | #define TFA9879_K2E_MASK 0x0700 | ||
116 | #define TFA9879_K2E_SHIFT 8 | ||
117 | #define TFA9879_K0_MASK 0x00fe | ||
118 | #define TFA9879_K0_SHIFT 1 | ||
119 | #define TFA9879_S_MASK 0x0001 | ||
120 | #define TFA9879_S_SHIFT 0 | ||
121 | |||
122 | /* TFA9879_BYPASS_CONTROL */ | ||
123 | #define TFA9879_L_OCP_MASK 0x00c0 | ||
124 | #define TFA9879_L_OCP_SHIFT 6 | ||
125 | #define TFA9879_L_OTP_MASK 0x0030 | ||
126 | #define TFA9879_L_OTP_SHIFT 4 | ||
127 | #define TFA9879_CLIPCTRL_MASK 0x0008 | ||
128 | #define TFA9879_CLIPCTRL_SHIFT 3 | ||
129 | #define TFA9879_HPF_BP_MASK 0x0004 | ||
130 | #define TFA9879_HPF_BP_SHIFT 2 | ||
131 | #define TFA9879_DRC_BP_MASK 0x0002 | ||
132 | #define TFA9879_DRC_BP_SHIFT 1 | ||
133 | #define TFA9879_EQ_BP_MASK 0x0001 | ||
134 | #define TFA9879_EQ_BP_SHIFT 0 | ||
135 | |||
136 | /* TFA9879_DYNAMIC_RANGE_COMPR */ | ||
137 | #define TFA9879_AT_LVL_MASK 0xf000 | ||
138 | #define TFA9879_AT_LVL_SHIFT 12 | ||
139 | #define TFA9879_AT_RATE_MASK 0x0f00 | ||
140 | #define TFA9879_AT_RATE_SHIFT 8 | ||
141 | #define TFA9879_RL_LVL_MASK 0x00f0 | ||
142 | #define TFA9879_RL_LVL_SHIFT 4 | ||
143 | #define TFA9879_RL_RATE_MASK 0x000f | ||
144 | #define TFA9879_RL_RATE_SHIFT 0 | ||
145 | |||
146 | /* TFA9879_BASS_TREBLE */ | ||
147 | #define TFA9879_G_TRBLE_MASK 0x3e00 | ||
148 | #define TFA9879_G_TRBLE_SHIFT 9 | ||
149 | #define TFA9879_F_TRBLE_MASK 0x0180 | ||
150 | #define TFA9879_F_TRBLE_SHIFT 7 | ||
151 | #define TFA9879_G_BASS_MASK 0x007c | ||
152 | #define TFA9879_G_BASS_SHIFT 2 | ||
153 | #define TFA9879_F_BASS_MASK 0x0003 | ||
154 | #define TFA9879_F_BASS_SHIFT 0 | ||
155 | |||
156 | /* TFA9879_HIGH_PASS_FILTER */ | ||
157 | #define TFA9879_HP_CTRL_MASK 0x00ff | ||
158 | #define TFA9879_HP_CTRL_SHIFT 0 | ||
159 | |||
160 | /* TFA9879_VOLUME_CONTROL */ | ||
161 | #define TFA9879_ZR_CRSS_MASK 0x1000 | ||
162 | #define TFA9879_ZR_CRSS_SHIFT 12 | ||
163 | #define TFA9879_VOL_MASK 0x00ff | ||
164 | #define TFA9879_VOL_SHIFT 0 | ||
165 | |||
166 | /* TFA9879_MISC_CONTROL */ | ||
167 | #define TFA9879_DE_PHAS_MASK 0x0c00 | ||
168 | #define TFA9879_DE_PHAS_SHIFT 10 | ||
169 | #define TFA9879_H_MUTE_MASK 0x0200 | ||
170 | #define TFA9879_H_MUTE_SHIFT 9 | ||
171 | #define TFA9879_S_MUTE_MASK 0x0100 | ||
172 | #define TFA9879_S_MUTE_SHIFT 8 | ||
173 | #define TFA9879_P_LIM_MASK 0x00ff | ||
174 | #define TFA9879_P_LIM_SHIFT 0 | ||
175 | |||
176 | /* TFA9879_MISC_STATUS */ | ||
177 | #define TFA9879_PS_MASK 0x4000 | ||
178 | #define TFA9879_PS_SHIFT 14 | ||
179 | #define TFA9879_PORA_MASK 0x2000 | ||
180 | #define TFA9879_PORA_SHIFT 13 | ||
181 | #define TFA9879_AMP_MASK 0x0600 | ||
182 | #define TFA9879_AMP_SHIFT 9 | ||
183 | #define TFA9879_IBP_2_MASK 0x0100 | ||
184 | #define TFA9879_IBP_2_SHIFT 8 | ||
185 | #define TFA9879_OFP_2_MASK 0x0080 | ||
186 | #define TFA9879_OFP_2_SHIFT 7 | ||
187 | #define TFA9879_UFP_2_MASK 0x0040 | ||
188 | #define TFA9879_UFP_2_SHIFT 6 | ||
189 | #define TFA9879_IBP_1_MASK 0x0020 | ||
190 | #define TFA9879_IBP_1_SHIFT 5 | ||
191 | #define TFA9879_OFP_1_MASK 0x0010 | ||
192 | #define TFA9879_OFP_1_SHIFT 4 | ||
193 | #define TFA9879_UFP_1_MASK 0x0008 | ||
194 | #define TFA9879_UFP_1_SHIFT 3 | ||
195 | #define TFA9879_OCPOKA_MASK 0x0004 | ||
196 | #define TFA9879_OCPOKA_SHIFT 2 | ||
197 | #define TFA9879_OCPOKB_MASK 0x0002 | ||
198 | #define TFA9879_OCPOKB_SHIFT 1 | ||
199 | #define TFA9879_OTPOK_MASK 0x0001 | ||
200 | #define TFA9879_OTPOK_SHIFT 0 | ||
201 | |||
202 | #endif | ||
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index d67167920c2f..cc17e7e5126e 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c | |||
@@ -540,19 +540,11 @@ static struct snd_soc_dai_driver tlv320aic23_dai = { | |||
540 | .ops = &tlv320aic23_dai_ops, | 540 | .ops = &tlv320aic23_dai_ops, |
541 | }; | 541 | }; |
542 | 542 | ||
543 | static int tlv320aic23_suspend(struct snd_soc_codec *codec) | ||
544 | { | ||
545 | tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF); | ||
546 | |||
547 | return 0; | ||
548 | } | ||
549 | |||
550 | static int tlv320aic23_resume(struct snd_soc_codec *codec) | 543 | static int tlv320aic23_resume(struct snd_soc_codec *codec) |
551 | { | 544 | { |
552 | struct aic23 *aic23 = snd_soc_codec_get_drvdata(codec); | 545 | struct aic23 *aic23 = snd_soc_codec_get_drvdata(codec); |
553 | regcache_mark_dirty(aic23->regmap); | 546 | regcache_mark_dirty(aic23->regmap); |
554 | regcache_sync(aic23->regmap); | 547 | regcache_sync(aic23->regmap); |
555 | tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | ||
556 | 548 | ||
557 | return 0; | 549 | return 0; |
558 | } | 550 | } |
@@ -562,9 +554,6 @@ static int tlv320aic23_codec_probe(struct snd_soc_codec *codec) | |||
562 | /* Reset codec */ | 554 | /* Reset codec */ |
563 | snd_soc_write(codec, TLV320AIC23_RESET, 0); | 555 | snd_soc_write(codec, TLV320AIC23_RESET, 0); |
564 | 556 | ||
565 | /* power on device */ | ||
566 | tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | ||
567 | |||
568 | snd_soc_write(codec, TLV320AIC23_DIGT, TLV320AIC23_DEEMP_44K); | 557 | snd_soc_write(codec, TLV320AIC23_DIGT, TLV320AIC23_DEEMP_44K); |
569 | 558 | ||
570 | /* Unmute input */ | 559 | /* Unmute input */ |
@@ -589,18 +578,12 @@ static int tlv320aic23_codec_probe(struct snd_soc_codec *codec) | |||
589 | return 0; | 578 | return 0; |
590 | } | 579 | } |
591 | 580 | ||
592 | static int tlv320aic23_remove(struct snd_soc_codec *codec) | ||
593 | { | ||
594 | tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF); | ||
595 | return 0; | ||
596 | } | ||
597 | |||
598 | static struct snd_soc_codec_driver soc_codec_dev_tlv320aic23 = { | 581 | static struct snd_soc_codec_driver soc_codec_dev_tlv320aic23 = { |
599 | .probe = tlv320aic23_codec_probe, | 582 | .probe = tlv320aic23_codec_probe, |
600 | .remove = tlv320aic23_remove, | ||
601 | .suspend = tlv320aic23_suspend, | ||
602 | .resume = tlv320aic23_resume, | 583 | .resume = tlv320aic23_resume, |
603 | .set_bias_level = tlv320aic23_set_bias_level, | 584 | .set_bias_level = tlv320aic23_set_bias_level, |
585 | .suspend_bias_off = true, | ||
586 | |||
604 | .controls = tlv320aic23_snd_controls, | 587 | .controls = tlv320aic23_snd_controls, |
605 | .num_controls = ARRAY_SIZE(tlv320aic23_snd_controls), | 588 | .num_controls = ARRAY_SIZE(tlv320aic23_snd_controls), |
606 | .dapm_widgets = tlv320aic23_dapm_widgets, | 589 | .dapm_widgets = tlv320aic23_dapm_widgets, |
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c index 93de5dd0a7b9..dc3223d6eca1 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c | |||
@@ -1057,18 +1057,6 @@ static int aic31xx_set_bias_level(struct snd_soc_codec *codec, | |||
1057 | return 0; | 1057 | return 0; |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | static int aic31xx_suspend(struct snd_soc_codec *codec) | ||
1061 | { | ||
1062 | aic31xx_set_bias_level(codec, SND_SOC_BIAS_OFF); | ||
1063 | return 0; | ||
1064 | } | ||
1065 | |||
1066 | static int aic31xx_resume(struct snd_soc_codec *codec) | ||
1067 | { | ||
1068 | aic31xx_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | ||
1069 | return 0; | ||
1070 | } | ||
1071 | |||
1072 | static int aic31xx_codec_probe(struct snd_soc_codec *codec) | 1060 | static int aic31xx_codec_probe(struct snd_soc_codec *codec) |
1073 | { | 1061 | { |
1074 | int ret = 0; | 1062 | int ret = 0; |
@@ -1111,8 +1099,6 @@ static int aic31xx_codec_remove(struct snd_soc_codec *codec) | |||
1111 | { | 1099 | { |
1112 | struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); | 1100 | struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); |
1113 | int i; | 1101 | int i; |
1114 | /* power down chip */ | ||
1115 | aic31xx_set_bias_level(codec, SND_SOC_BIAS_OFF); | ||
1116 | 1102 | ||
1117 | for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++) | 1103 | for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++) |
1118 | regulator_unregister_notifier(aic31xx->supplies[i].consumer, | 1104 | regulator_unregister_notifier(aic31xx->supplies[i].consumer, |
@@ -1124,9 +1110,9 @@ static int aic31xx_codec_remove(struct snd_soc_codec *codec) | |||
1124 | static struct snd_soc_codec_driver soc_codec_driver_aic31xx = { | 1110 | static struct snd_soc_codec_driver soc_codec_driver_aic31xx = { |
1125 | .probe = aic31xx_codec_probe, | 1111 | .probe = aic31xx_codec_probe, |
1126 | .remove = aic31xx_codec_remove, | 1112 | .remove = aic31xx_codec_remove, |
1127 | .suspend = aic31xx_suspend, | ||
1128 | .resume = aic31xx_resume, | ||
1129 | .set_bias_level = aic31xx_set_bias_level, | 1113 | .set_bias_level = aic31xx_set_bias_level, |
1114 | .suspend_bias_off = true, | ||
1115 | |||
1130 | .controls = aic31xx_snd_controls, | 1116 | .controls = aic31xx_snd_controls, |
1131 | .num_controls = ARRAY_SIZE(aic31xx_snd_controls), | 1117 | .num_controls = ARRAY_SIZE(aic31xx_snd_controls), |
1132 | .dapm_widgets = aic31xx_dapm_widgets, | 1118 | .dapm_widgets = aic31xx_dapm_widgets, |
diff --git a/sound/soc/tegra/tegra_rt5640.c b/sound/soc/tegra/tegra_rt5640.c index a6898831fb9f..4ebe3871e610 100644 --- a/sound/soc/tegra/tegra_rt5640.c +++ b/sound/soc/tegra/tegra_rt5640.c | |||
@@ -44,6 +44,7 @@ | |||
44 | struct tegra_rt5640 { | 44 | struct tegra_rt5640 { |
45 | struct tegra_asoc_utils_data util_data; | 45 | struct tegra_asoc_utils_data util_data; |
46 | int gpio_hp_det; | 46 | int gpio_hp_det; |
47 | enum of_gpio_flags gpio_hp_det_flags; | ||
47 | }; | 48 | }; |
48 | 49 | ||
49 | static int tegra_rt5640_asoc_hw_params(struct snd_pcm_substream *substream, | 50 | static int tegra_rt5640_asoc_hw_params(struct snd_pcm_substream *substream, |
@@ -119,6 +120,8 @@ static int tegra_rt5640_asoc_init(struct snd_soc_pcm_runtime *rtd) | |||
119 | 120 | ||
120 | if (gpio_is_valid(machine->gpio_hp_det)) { | 121 | if (gpio_is_valid(machine->gpio_hp_det)) { |
121 | tegra_rt5640_hp_jack_gpio.gpio = machine->gpio_hp_det; | 122 | tegra_rt5640_hp_jack_gpio.gpio = machine->gpio_hp_det; |
123 | tegra_rt5640_hp_jack_gpio.invert = | ||
124 | !!(machine->gpio_hp_det_flags & OF_GPIO_ACTIVE_LOW); | ||
122 | snd_soc_jack_add_gpios(&tegra_rt5640_hp_jack, | 125 | snd_soc_jack_add_gpios(&tegra_rt5640_hp_jack, |
123 | 1, | 126 | 1, |
124 | &tegra_rt5640_hp_jack_gpio); | 127 | &tegra_rt5640_hp_jack_gpio); |
@@ -180,7 +183,8 @@ static int tegra_rt5640_probe(struct platform_device *pdev) | |||
180 | platform_set_drvdata(pdev, card); | 183 | platform_set_drvdata(pdev, card); |
181 | snd_soc_card_set_drvdata(card, machine); | 184 | snd_soc_card_set_drvdata(card, machine); |
182 | 185 | ||
183 | machine->gpio_hp_det = of_get_named_gpio(np, "nvidia,hp-det-gpios", 0); | 186 | machine->gpio_hp_det = of_get_named_gpio_flags( |
187 | np, "nvidia,hp-det-gpios", 0, &machine->gpio_hp_det_flags); | ||
184 | if (machine->gpio_hp_det == -EPROBE_DEFER) | 188 | if (machine->gpio_hp_det == -EPROBE_DEFER) |
185 | return -EPROBE_DEFER; | 189 | return -EPROBE_DEFER; |
186 | 190 | ||