aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorPeter Rosin <peda@axentia.se>2014-11-08 08:40:17 -0500
committerMark Brown <broonie@kernel.org>2014-11-09 04:46:43 -0500
commitfbace43e8817113475ebda00e28593baa436a131 (patch)
tree80ca37d0a0bbf6a78e6a399b84a9e63c6405b0d0 /sound/soc
parentf114040e3ea6e07372334ade75d1ee0775c355e1 (diff)
ASoC: tfa9879: New driver for NXP Semiconductors TFA9879 amplifier.
Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/Kconfig5
-rw-r--r--sound/soc/codecs/Makefile2
-rw-r--r--sound/soc/codecs/tfa9879.c328
-rw-r--r--sound/soc/codecs/tfa9879.h202
4 files changed, 537 insertions, 0 deletions
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index a68d1731a8fd..99b34a97499f 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -101,6 +101,7 @@ config SND_SOC_ALL_CODECS
101 select SND_SOC_STAC9766 if SND_SOC_AC97_BUS 101 select SND_SOC_STAC9766 if SND_SOC_AC97_BUS
102 select SND_SOC_TAS2552 if I2C 102 select SND_SOC_TAS2552 if I2C
103 select SND_SOC_TAS5086 if I2C 103 select SND_SOC_TAS5086 if I2C
104 select SND_SOC_TFA9879 if I2C
104 select SND_SOC_TLV320AIC23_I2C if I2C 105 select SND_SOC_TLV320AIC23_I2C if I2C
105 select SND_SOC_TLV320AIC23_SPI if SPI_MASTER 106 select SND_SOC_TLV320AIC23_SPI if SPI_MASTER
106 select SND_SOC_TLV320AIC26 if SPI_MASTER 107 select SND_SOC_TLV320AIC26 if SPI_MASTER
@@ -577,6 +578,10 @@ config SND_SOC_TAS5086
577 tristate "Texas Instruments TAS5086 speaker amplifier" 578 tristate "Texas Instruments TAS5086 speaker amplifier"
578 depends on I2C 579 depends on I2C
579 580
581config SND_SOC_TFA9879
582 tristate "NXP Semiconductors TFA9879 amplifier"
583 depends on I2C
584
580config SND_SOC_TLV320AIC23 585config SND_SOC_TLV320AIC23
581 tristate 586 tristate
582 587
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 5dce451661e4..ccfa2ab158be 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -101,6 +101,7 @@ snd-soc-sta350-objs := sta350.o
101snd-soc-sta529-objs := sta529.o 101snd-soc-sta529-objs := sta529.o
102snd-soc-stac9766-objs := stac9766.o 102snd-soc-stac9766-objs := stac9766.o
103snd-soc-tas5086-objs := tas5086.o 103snd-soc-tas5086-objs := tas5086.o
104snd-soc-tfa9879-objs := tfa9879.o
104snd-soc-tlv320aic23-objs := tlv320aic23.o 105snd-soc-tlv320aic23-objs := tlv320aic23.o
105snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o 106snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o
106snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o 107snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o
@@ -274,6 +275,7 @@ obj-$(CONFIG_SND_SOC_STA529) += snd-soc-sta529.o
274obj-$(CONFIG_SND_SOC_STAC9766) += snd-soc-stac9766.o 275obj-$(CONFIG_SND_SOC_STAC9766) += snd-soc-stac9766.o
275obj-$(CONFIG_SND_SOC_TAS2552) += snd-soc-tas2552.o 276obj-$(CONFIG_SND_SOC_TAS2552) += snd-soc-tas2552.o
276obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o 277obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o
278obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o
277obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o 279obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o
278obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o 280obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o
279obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o 281obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o
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
24struct tfa9879_priv {
25 struct regmap *regmap;
26 int lsb_justified;
27};
28
29static 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
101static 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
112static 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
163static 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
187static bool tfa9879_volatile_reg(struct device *dev, unsigned int reg)
188{
189 return reg == TFA9879_MISC_STATUS;
190}
191
192static const DECLARE_TLV_DB_SCALE(volume_tlv, -7050, 50, 1);
193static const DECLARE_TLV_DB_SCALE(tb_gain_tlv, -1800, 200, 0);
194static const char * const tb_freq_text[] = {
195 "Low", "Mid", "High"
196};
197static 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);
200static 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
204static 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
215static const struct snd_soc_dapm_widget tfa9879_dapm_widgets[] = {
216SND_SOC_DAPM_AIF_IN("AIFINL", "Playback", 0, SND_SOC_NOPM, 0, 0),
217SND_SOC_DAPM_AIF_IN("AIFINR", "Playback", 1, SND_SOC_NOPM, 0, 0),
218SND_SOC_DAPM_DAC("DAC", NULL, TFA9879_DEVICE_CONTROL, TFA9879_OPMODE_SHIFT, 0),
219SND_SOC_DAPM_OUTPUT("LINEOUT"),
220SND_SOC_DAPM_SUPPLY("POWER", TFA9879_DEVICE_CONTROL, TFA9879_POWERUP_SHIFT, 0,
221 NULL, 0),
222};
223
224static 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
233static 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
243static 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
254static 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
265static 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
276static 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
301static int tfa9879_i2c_remove(struct i2c_client *client)
302{
303 snd_soc_unregister_codec(&client->dev);
304
305 return 0;
306}
307
308static const struct i2c_device_id tfa9879_i2c_id[] = {
309 { "tfa9879", 0 },
310 { }
311};
312MODULE_DEVICE_TABLE(i2c, tfa9879_i2c_id);
313
314static 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
324module_i2c_driver(tfa9879_i2c_driver);
325
326MODULE_DESCRIPTION("ASoC NXP Semiconductors TFA9879 driver");
327MODULE_AUTHOR("Peter Rosin <peda@axentia.se>");
328MODULE_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