brcm2708: add linux 4.9 support
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.9 / 0074-Revert-Added-driver-for-HiFiBerry-Amp-amplifier-add-.patch
1 From 321a000ddec470ccbe496e6ae2cdc65286d8f491 Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Mon, 12 Dec 2016 16:26:54 +0000
4 Subject: [PATCH] Revert "Added driver for HiFiBerry Amp amplifier add-on
5 board"
6
7 This reverts commit 3e6b00833d92a50cbcc9922deb6e1bc8fcdbb587.
8 ---
9 sound/soc/bcm/Kconfig | 7 -
10 sound/soc/bcm/Makefile | 2 -
11 sound/soc/bcm/hifiberry_amp.c | 129 ---------------
12 sound/soc/codecs/Kconfig | 4 -
13 sound/soc/codecs/Makefile | 2 -
14 sound/soc/codecs/tas5713.c | 369 ------------------------------------------
15 sound/soc/codecs/tas5713.h | 210 ------------------------
16 7 files changed, 723 deletions(-)
17 delete mode 100644 sound/soc/bcm/hifiberry_amp.c
18 delete mode 100644 sound/soc/codecs/tas5713.c
19 delete mode 100644 sound/soc/codecs/tas5713.h
20
21 --- a/sound/soc/bcm/Kconfig
22 +++ b/sound/soc/bcm/Kconfig
23 @@ -38,13 +38,6 @@ config SND_BCM2708_SOC_HIFIBERRY_DIGI
24 help
25 Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board.
26
27 -config SND_BCM2708_SOC_HIFIBERRY_AMP
28 - tristate "Support for the HifiBerry Amp"
29 - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
30 - select SND_SOC_TAS5713
31 - help
32 - Say Y or M if you want to add support for the HifiBerry Amp amplifier board.
33 -
34 config SND_BCM2708_SOC_RPI_DAC
35 tristate "Support for RPi-DAC"
36 depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
37 --- a/sound/soc/bcm/Makefile
38 +++ b/sound/soc/bcm/Makefile
39 @@ -12,13 +12,11 @@ obj-$(CONFIG_SND_SOC_CYGNUS) += snd-soc-
40 snd-soc-hifiberry-dac-objs := hifiberry_dac.o
41 snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o
42 snd-soc-hifiberry-digi-objs := hifiberry_digi.o
43 -snd-soc-hifiberry-amp-objs := hifiberry_amp.o
44 snd-soc-rpi-dac-objs := rpi-dac.o
45 snd-soc-iqaudio-dac-objs := iqaudio-dac.o
46
47 obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC) += snd-soc-hifiberry-dac.o
48 obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o
49 obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI) += snd-soc-hifiberry-digi.o
50 -obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o
51 obj-$(CONFIG_SND_BCM2708_SOC_RPI_DAC) += snd-soc-rpi-dac.o
52 obj-$(CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC) += snd-soc-iqaudio-dac.o
53 --- a/sound/soc/bcm/hifiberry_amp.c
54 +++ /dev/null
55 @@ -1,129 +0,0 @@
56 -/*
57 - * ASoC Driver for HifiBerry AMP
58 - *
59 - * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com>
60 - * Copyright 2014
61 - *
62 - * This program is free software; you can redistribute it and/or
63 - * modify it under the terms of the GNU General Public License
64 - * version 2 as published by the Free Software Foundation.
65 - *
66 - * This program is distributed in the hope that it will be useful, but
67 - * WITHOUT ANY WARRANTY; without even the implied warranty of
68 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
69 - * General Public License for more details.
70 - */
71 -
72 -#include <linux/module.h>
73 -#include <linux/platform_device.h>
74 -
75 -#include <sound/core.h>
76 -#include <sound/pcm.h>
77 -#include <sound/pcm_params.h>
78 -#include <sound/soc.h>
79 -#include <sound/jack.h>
80 -
81 -static int snd_rpi_hifiberry_amp_init(struct snd_soc_pcm_runtime *rtd)
82 -{
83 - // ToDo: init of the dsp-registers.
84 - return 0;
85 -}
86 -
87 -static int snd_rpi_hifiberry_amp_hw_params( struct snd_pcm_substream *substream,
88 - struct snd_pcm_hw_params *params )
89 -{
90 - struct snd_soc_pcm_runtime *rtd = substream->private_data;
91 - struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
92 -
93 - return snd_soc_dai_set_bclk_ratio(cpu_dai, 64);
94 -}
95 -
96 -static struct snd_soc_ops snd_rpi_hifiberry_amp_ops = {
97 - .hw_params = snd_rpi_hifiberry_amp_hw_params,
98 -};
99 -
100 -static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = {
101 - {
102 - .name = "HifiBerry AMP",
103 - .stream_name = "HifiBerry AMP HiFi",
104 - .cpu_dai_name = "bcm2708-i2s.0",
105 - .codec_dai_name = "tas5713-hifi",
106 - .platform_name = "bcm2708-i2s.0",
107 - .codec_name = "tas5713.1-001b",
108 - .dai_fmt = SND_SOC_DAIFMT_I2S |
109 - SND_SOC_DAIFMT_NB_NF |
110 - SND_SOC_DAIFMT_CBS_CFS,
111 - .ops = &snd_rpi_hifiberry_amp_ops,
112 - .init = snd_rpi_hifiberry_amp_init,
113 - },
114 -};
115 -
116 -
117 -static struct snd_soc_card snd_rpi_hifiberry_amp = {
118 - .name = "snd_rpi_hifiberry_amp",
119 - .driver_name = "HifiberryAmp",
120 - .owner = THIS_MODULE,
121 - .dai_link = snd_rpi_hifiberry_amp_dai,
122 - .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai),
123 -};
124 -
125 -static const struct of_device_id snd_rpi_hifiberry_amp_of_match[] = {
126 - { .compatible = "hifiberry,hifiberry-amp", },
127 - {},
128 -};
129 -MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_amp_of_match);
130 -
131 -
132 -static int snd_rpi_hifiberry_amp_probe(struct platform_device *pdev)
133 -{
134 - int ret = 0;
135 -
136 - snd_rpi_hifiberry_amp.dev = &pdev->dev;
137 -
138 - if (pdev->dev.of_node) {
139 - struct device_node *i2s_node;
140 - struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_amp_dai[0];
141 - i2s_node = of_parse_phandle(pdev->dev.of_node,
142 - "i2s-controller", 0);
143 -
144 - if (i2s_node) {
145 - dai->cpu_dai_name = NULL;
146 - dai->cpu_of_node = i2s_node;
147 - dai->platform_name = NULL;
148 - dai->platform_of_node = i2s_node;
149 - }
150 - }
151 -
152 - ret = snd_soc_register_card(&snd_rpi_hifiberry_amp);
153 -
154 - if (ret != 0) {
155 - dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret);
156 - }
157 -
158 - return ret;
159 -}
160 -
161 -
162 -static int snd_rpi_hifiberry_amp_remove(struct platform_device *pdev)
163 -{
164 - return snd_soc_unregister_card(&snd_rpi_hifiberry_amp);
165 -}
166 -
167 -
168 -static struct platform_driver snd_rpi_hifiberry_amp_driver = {
169 - .driver = {
170 - .name = "snd-hifiberry-amp",
171 - .owner = THIS_MODULE,
172 - .of_match_table = snd_rpi_hifiberry_amp_of_match,
173 - },
174 - .probe = snd_rpi_hifiberry_amp_probe,
175 - .remove = snd_rpi_hifiberry_amp_remove,
176 -};
177 -
178 -
179 -module_platform_driver(snd_rpi_hifiberry_amp_driver);
180 -
181 -
182 -MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>");
183 -MODULE_DESCRIPTION("ASoC driver for HiFiBerry-AMP");
184 -MODULE_LICENSE("GPL v2");
185 --- a/sound/soc/codecs/Kconfig
186 +++ b/sound/soc/codecs/Kconfig
187 @@ -139,7 +139,6 @@ config SND_SOC_ALL_CODECS
188 select SND_SOC_TFA9879 if I2C
189 select SND_SOC_TLV320AIC23_I2C if I2C
190 select SND_SOC_TLV320AIC23_SPI if SPI_MASTER
191 - select SND_SOC_TAS5713 if I2C
192 select SND_SOC_TLV320AIC26 if SPI_MASTER
193 select SND_SOC_TLV320AIC31XX if I2C
194 select SND_SOC_TLV320AIC32X4_I2C if I2C
195 @@ -822,9 +821,6 @@ config SND_SOC_TFA9879
196 tristate "NXP Semiconductors TFA9879 amplifier"
197 depends on I2C
198
199 -config SND_SOC_TAS5713
200 - tristate
201 -
202 config SND_SOC_TLV320AIC23
203 tristate
204
205 --- a/sound/soc/codecs/Makefile
206 +++ b/sound/soc/codecs/Makefile
207 @@ -144,7 +144,6 @@ snd-soc-tas5086-objs := tas5086.o
208 snd-soc-tas571x-objs := tas571x.o
209 snd-soc-tas5720-objs := tas5720.o
210 snd-soc-tfa9879-objs := tfa9879.o
211 -snd-soc-tas5713-objs := tas5713.o
212 snd-soc-tlv320aic23-objs := tlv320aic23.o
213 snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o
214 snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o
215 @@ -367,7 +366,6 @@ obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc
216 obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o
217 obj-$(CONFIG_SND_SOC_TAS5720) += snd-soc-tas5720.o
218 obj-$(CONFIG_SND_SOC_TFA9879) += snd-soc-tfa9879.o
219 -obj-$(CONFIG_SND_SOC_TAS5713) += snd-soc-tas5713.o
220 obj-$(CONFIG_SND_SOC_TLV320AIC23) += snd-soc-tlv320aic23.o
221 obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o
222 obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o
223 --- a/sound/soc/codecs/tas5713.c
224 +++ /dev/null
225 @@ -1,369 +0,0 @@
226 -/*
227 - * ASoC Driver for TAS5713
228 - *
229 - * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com>
230 - * Copyright 2014
231 - *
232 - * This program is free software; you can redistribute it and/or
233 - * modify it under the terms of the GNU General Public License
234 - * version 2 as published by the Free Software Foundation.
235 - *
236 - * This program is distributed in the hope that it will be useful, but
237 - * WITHOUT ANY WARRANTY; without even the implied warranty of
238 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
239 - * General Public License for more details.
240 - */
241 -
242 -#include <linux/module.h>
243 -#include <linux/moduleparam.h>
244 -#include <linux/init.h>
245 -#include <linux/delay.h>
246 -#include <linux/pm.h>
247 -#include <linux/i2c.h>
248 -#include <linux/of_device.h>
249 -#include <linux/spi/spi.h>
250 -#include <linux/regmap.h>
251 -#include <linux/regulator/consumer.h>
252 -#include <linux/slab.h>
253 -#include <sound/core.h>
254 -#include <sound/pcm.h>
255 -#include <sound/pcm_params.h>
256 -#include <sound/soc.h>
257 -#include <sound/initval.h>
258 -#include <sound/tlv.h>
259 -
260 -#include <linux/kernel.h>
261 -#include <linux/string.h>
262 -#include <linux/fs.h>
263 -#include <asm/uaccess.h>
264 -
265 -#include "tas5713.h"
266 -
267 -
268 -static struct i2c_client *i2c;
269 -
270 -struct tas5713_priv {
271 - struct regmap *regmap;
272 - int mclk_div;
273 - struct snd_soc_codec *codec;
274 -};
275 -
276 -static struct tas5713_priv *priv_data;
277 -
278 -
279 -
280 -
281 -/*
282 - * _ _ ___ _ ___ _ _
283 - * /_\ | | / __| /_\ / __|___ _ _| |_ _ _ ___| |___
284 - * / _ \| |__\__ \/ _ \ | (__/ _ \ ' \ _| '_/ _ \ (_-<
285 - * /_/ \_\____|___/_/ \_\ \___\___/_||_\__|_| \___/_/__/
286 - *
287 - */
288 -
289 -static const DECLARE_TLV_DB_SCALE(tas5713_vol_tlv, -10000, 50, 1);
290 -
291 -
292 -static const struct snd_kcontrol_new tas5713_snd_controls[] = {
293 - SOC_SINGLE_TLV ("Master" , TAS5713_VOL_MASTER, 0, 248, 1, tas5713_vol_tlv),
294 - SOC_DOUBLE_R_TLV("Channels" , TAS5713_VOL_CH1, TAS5713_VOL_CH2, 0, 248, 1, tas5713_vol_tlv)
295 -};
296 -
297 -
298 -
299 -
300 -/*
301 - * __ __ _ _ ___ _
302 - * | \/ |__ _ __| |_ (_)_ _ ___ | \ _ _(_)_ _____ _ _
303 - * | |\/| / _` / _| ' \| | ' \/ -_) | |) | '_| \ V / -_) '_|
304 - * |_| |_\__,_\__|_||_|_|_||_\___| |___/|_| |_|\_/\___|_|
305 - *
306 - */
307 -
308 -static int tas5713_hw_params(struct snd_pcm_substream *substream,
309 - struct snd_pcm_hw_params *params,
310 - struct snd_soc_dai *dai)
311 -{
312 - u16 blen = 0x00;
313 -
314 - struct snd_soc_codec *codec;
315 - codec = dai->codec;
316 - priv_data->codec = dai->codec;
317 -
318 - switch (params_format(params)) {
319 - case SNDRV_PCM_FORMAT_S16_LE:
320 - blen = 0x03;
321 - break;
322 - case SNDRV_PCM_FORMAT_S20_3LE:
323 - blen = 0x1;
324 - break;
325 - case SNDRV_PCM_FORMAT_S24_LE:
326 - blen = 0x04;
327 - break;
328 - case SNDRV_PCM_FORMAT_S32_LE:
329 - blen = 0x05;
330 - break;
331 - default:
332 - dev_err(dai->dev, "Unsupported word length: %u\n",
333 - params_format(params));
334 - return -EINVAL;
335 - }
336 -
337 - // set word length
338 - snd_soc_update_bits(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x7, blen);
339 -
340 - return 0;
341 -}
342 -
343 -
344 -static int tas5713_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
345 -{
346 - unsigned int val = 0;
347 -
348 - struct tas5713_priv *tas5713;
349 - struct snd_soc_codec *codec = dai->codec;
350 - tas5713 = snd_soc_codec_get_drvdata(codec);
351 -
352 - if (mute) {
353 - val = TAS5713_SOFT_MUTE_ALL;
354 - }
355 -
356 - return regmap_write(tas5713->regmap, TAS5713_SOFT_MUTE, val);
357 -}
358 -
359 -
360 -static const struct snd_soc_dai_ops tas5713_dai_ops = {
361 - .hw_params = tas5713_hw_params,
362 - .mute_stream = tas5713_mute_stream,
363 -};
364 -
365 -
366 -static struct snd_soc_dai_driver tas5713_dai = {
367 - .name = "tas5713-hifi",
368 - .playback = {
369 - .stream_name = "Playback",
370 - .channels_min = 2,
371 - .channels_max = 2,
372 - .rates = SNDRV_PCM_RATE_8000_48000,
373 - .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE ),
374 - },
375 - .ops = &tas5713_dai_ops,
376 -};
377 -
378 -
379 -
380 -
381 -/*
382 - * ___ _ ___ _
383 - * / __|___ __| |___ __ | \ _ _(_)_ _____ _ _
384 - * | (__/ _ \/ _` / -_) _| | |) | '_| \ V / -_) '_|
385 - * \___\___/\__,_\___\__| |___/|_| |_|\_/\___|_|
386 - *
387 - */
388 -
389 -static int tas5713_remove(struct snd_soc_codec *codec)
390 -{
391 - struct tas5713_priv *tas5713;
392 -
393 - tas5713 = snd_soc_codec_get_drvdata(codec);
394 -
395 - return 0;
396 -}
397 -
398 -
399 -static int tas5713_probe(struct snd_soc_codec *codec)
400 -{
401 - struct tas5713_priv *tas5713;
402 - int i, ret;
403 -
404 - i2c = container_of(codec->dev, struct i2c_client, dev);
405 -
406 - tas5713 = snd_soc_codec_get_drvdata(codec);
407 -
408 - // Reset error
409 - ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00);
410 - if (ret < 0) return ret;
411 -
412 - // Trim oscillator
413 - ret = snd_soc_write(codec, TAS5713_OSC_TRIM, 0x00);
414 - if (ret < 0) return ret;
415 - msleep(1000);
416 -
417 - // Reset error
418 - ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00);
419 - if (ret < 0) return ret;
420 -
421 - // Clock mode: 44/48kHz, MCLK=64xfs
422 - ret = snd_soc_write(codec, TAS5713_CLOCK_CTRL, 0x60);
423 - if (ret < 0) return ret;
424 -
425 - // I2S 24bit
426 - ret = snd_soc_write(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x05);
427 - if (ret < 0) return ret;
428 -
429 - // Unmute
430 - ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00);
431 - if (ret < 0) return ret;
432 - ret = snd_soc_write(codec, TAS5713_SOFT_MUTE, 0x00);
433 - if (ret < 0) return ret;
434 -
435 - // Set volume to 0db
436 - ret = snd_soc_write(codec, TAS5713_VOL_MASTER, 0x00);
437 - if (ret < 0) return ret;
438 -
439 - // Now start programming the default initialization sequence
440 - for (i = 0; i < ARRAY_SIZE(tas5713_init_sequence); ++i) {
441 - ret = i2c_master_send(i2c,
442 - tas5713_init_sequence[i].data,
443 - tas5713_init_sequence[i].size);
444 - if (ret < 0) {
445 - printk(KERN_INFO "TAS5713 CODEC PROBE: InitSeq returns: %d\n", ret);
446 - }
447 - }
448 -
449 - // Unmute
450 - ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00);
451 - if (ret < 0) return ret;
452 -
453 - return 0;
454 -}
455 -
456 -
457 -static struct snd_soc_codec_driver soc_codec_dev_tas5713 = {
458 - .probe = tas5713_probe,
459 - .remove = tas5713_remove,
460 - .controls = tas5713_snd_controls,
461 - .num_controls = ARRAY_SIZE(tas5713_snd_controls),
462 -};
463 -
464 -
465 -
466 -
467 -/*
468 - * ___ ___ ___ ___ _
469 - * |_ _|_ ) __| | \ _ _(_)_ _____ _ _
470 - * | | / / (__ | |) | '_| \ V / -_) '_|
471 - * |___/___\___| |___/|_| |_|\_/\___|_|
472 - *
473 - */
474 -
475 -static const struct reg_default tas5713_reg_defaults[] = {
476 - { 0x07 ,0x80 }, // R7 - VOL_MASTER - -40dB
477 - { 0x08 , 30 }, // R8 - VOL_CH1 - 0dB
478 - { 0x09 , 30 }, // R9 - VOL_CH2 - 0dB
479 - { 0x0A ,0x80 }, // R10 - VOL_HEADPHONE - -40dB
480 -};
481 -
482 -
483 -static bool tas5713_reg_volatile(struct device *dev, unsigned int reg)
484 -{
485 - switch (reg) {
486 - case TAS5713_DEVICE_ID:
487 - case TAS5713_ERROR_STATUS:
488 - return true;
489 - default:
490 - return false;
491 - }
492 -}
493 -
494 -
495 -static const struct of_device_id tas5713_of_match[] = {
496 - { .compatible = "ti,tas5713", },
497 - { }
498 -};
499 -MODULE_DEVICE_TABLE(of, tas5713_of_match);
500 -
501 -
502 -static struct regmap_config tas5713_regmap_config = {
503 - .reg_bits = 8,
504 - .val_bits = 8,
505 -
506 - .max_register = TAS5713_MAX_REGISTER,
507 - .volatile_reg = tas5713_reg_volatile,
508 -
509 - .cache_type = REGCACHE_RBTREE,
510 - .reg_defaults = tas5713_reg_defaults,
511 - .num_reg_defaults = ARRAY_SIZE(tas5713_reg_defaults),
512 -};
513 -
514 -
515 -static int tas5713_i2c_probe(struct i2c_client *i2c,
516 - const struct i2c_device_id *id)
517 -{
518 - int ret;
519 -
520 - priv_data = devm_kzalloc(&i2c->dev, sizeof *priv_data, GFP_KERNEL);
521 - if (!priv_data)
522 - return -ENOMEM;
523 -
524 - priv_data->regmap = devm_regmap_init_i2c(i2c, &tas5713_regmap_config);
525 - if (IS_ERR(priv_data->regmap)) {
526 - ret = PTR_ERR(priv_data->regmap);
527 - return ret;
528 - }
529 -
530 - i2c_set_clientdata(i2c, priv_data);
531 -
532 - ret = snd_soc_register_codec(&i2c->dev,
533 - &soc_codec_dev_tas5713, &tas5713_dai, 1);
534 -
535 - return ret;
536 -}
537 -
538 -
539 -static int tas5713_i2c_remove(struct i2c_client *i2c)
540 -{
541 - snd_soc_unregister_codec(&i2c->dev);
542 - i2c_set_clientdata(i2c, NULL);
543 -
544 - kfree(priv_data);
545 -
546 - return 0;
547 -}
548 -
549 -
550 -static const struct i2c_device_id tas5713_i2c_id[] = {
551 - { "tas5713", 0 },
552 - { }
553 -};
554 -
555 -MODULE_DEVICE_TABLE(i2c, tas5713_i2c_id);
556 -
557 -
558 -static struct i2c_driver tas5713_i2c_driver = {
559 - .driver = {
560 - .name = "tas5713",
561 - .owner = THIS_MODULE,
562 - .of_match_table = tas5713_of_match,
563 - },
564 - .probe = tas5713_i2c_probe,
565 - .remove = tas5713_i2c_remove,
566 - .id_table = tas5713_i2c_id
567 -};
568 -
569 -
570 -static int __init tas5713_modinit(void)
571 -{
572 - int ret = 0;
573 -
574 - ret = i2c_add_driver(&tas5713_i2c_driver);
575 - if (ret) {
576 - printk(KERN_ERR "Failed to register tas5713 I2C driver: %d\n",
577 - ret);
578 - }
579 -
580 - return ret;
581 -}
582 -module_init(tas5713_modinit);
583 -
584 -
585 -static void __exit tas5713_exit(void)
586 -{
587 - i2c_del_driver(&tas5713_i2c_driver);
588 -}
589 -module_exit(tas5713_exit);
590 -
591 -
592 -MODULE_AUTHOR("Sebastian Eickhoff <basti.eickhoff@googlemail.com>");
593 -MODULE_DESCRIPTION("ASoC driver for TAS5713");
594 -MODULE_LICENSE("GPL v2");
595 --- a/sound/soc/codecs/tas5713.h
596 +++ /dev/null
597 @@ -1,210 +0,0 @@
598 -/*
599 - * ASoC Driver for TAS5713
600 - *
601 - * Author: Sebastian Eickhoff <basti.eickhoff@googlemail.com>
602 - * Copyright 2014
603 - *
604 - * This program is free software; you can redistribute it and/or
605 - * modify it under the terms of the GNU General Public License
606 - * version 2 as published by the Free Software Foundation.
607 - *
608 - * This program is distributed in the hope that it will be useful, but
609 - * WITHOUT ANY WARRANTY; without even the implied warranty of
610 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
611 - * General Public License for more details.
612 - */
613 -
614 -#ifndef _TAS5713_H
615 -#define _TAS5713_H
616 -
617 -
618 -// TAS5713 I2C-bus register addresses
619 -
620 -#define TAS5713_CLOCK_CTRL 0x00
621 -#define TAS5713_DEVICE_ID 0x01
622 -#define TAS5713_ERROR_STATUS 0x02
623 -#define TAS5713_SYSTEM_CTRL1 0x03
624 -#define TAS5713_SERIAL_DATA_INTERFACE 0x04
625 -#define TAS5713_SYSTEM_CTRL2 0x05
626 -#define TAS5713_SOFT_MUTE 0x06
627 -#define TAS5713_VOL_MASTER 0x07
628 -#define TAS5713_VOL_CH1 0x08
629 -#define TAS5713_VOL_CH2 0x09
630 -#define TAS5713_VOL_HEADPHONE 0x0A
631 -#define TAS5713_VOL_CONFIG 0x0E
632 -#define TAS5713_MODULATION_LIMIT 0x10
633 -#define TAS5713_IC_DLY_CH1 0x11
634 -#define TAS5713_IC_DLY_CH2 0x12
635 -#define TAS5713_IC_DLY_CH3 0x13
636 -#define TAS5713_IC_DLY_CH4 0x14
637 -
638 -#define TAS5713_START_STOP_PERIOD 0x1A
639 -#define TAS5713_OSC_TRIM 0x1B
640 -#define TAS5713_BKND_ERR 0x1C
641 -
642 -#define TAS5713_INPUT_MUX 0x20
643 -#define TAS5713_SRC_SELECT_CH4 0x21
644 -#define TAS5713_PWM_MUX 0x25
645 -
646 -#define TAS5713_CH1_BQ0 0x29
647 -#define TAS5713_CH1_BQ1 0x2A
648 -#define TAS5713_CH1_BQ2 0x2B
649 -#define TAS5713_CH1_BQ3 0x2C
650 -#define TAS5713_CH1_BQ4 0x2D
651 -#define TAS5713_CH1_BQ5 0x2E
652 -#define TAS5713_CH1_BQ6 0x2F
653 -#define TAS5713_CH1_BQ7 0x58
654 -#define TAS5713_CH1_BQ8 0x59
655 -
656 -#define TAS5713_CH2_BQ0 0x30
657 -#define TAS5713_CH2_BQ1 0x31
658 -#define TAS5713_CH2_BQ2 0x32
659 -#define TAS5713_CH2_BQ3 0x33
660 -#define TAS5713_CH2_BQ4 0x34
661 -#define TAS5713_CH2_BQ5 0x35
662 -#define TAS5713_CH2_BQ6 0x36
663 -#define TAS5713_CH2_BQ7 0x5C
664 -#define TAS5713_CH2_BQ8 0x5D
665 -
666 -#define TAS5713_CH4_BQ0 0x5A
667 -#define TAS5713_CH4_BQ1 0x5B
668 -#define TAS5713_CH3_BQ0 0x5E
669 -#define TAS5713_CH3_BQ1 0x5F
670 -
671 -#define TAS5713_DRC1_SOFTENING_FILTER_ALPHA_OMEGA 0x3B
672 -#define TAS5713_DRC1_ATTACK_RELEASE_RATE 0x3C
673 -#define TAS5713_DRC2_SOFTENING_FILTER_ALPHA_OMEGA 0x3E
674 -#define TAS5713_DRC2_ATTACK_RELEASE_RATE 0x3F
675 -#define TAS5713_DRC1_ATTACK_RELEASE_THRES 0x40
676 -#define TAS5713_DRC2_ATTACK_RELEASE_THRES 0x43
677 -#define TAS5713_DRC_CTRL 0x46
678 -
679 -#define TAS5713_BANK_SW_CTRL 0x50
680 -#define TAS5713_CH1_OUTPUT_MIXER 0x51
681 -#define TAS5713_CH2_OUTPUT_MIXER 0x52
682 -#define TAS5713_CH1_INPUT_MIXER 0x53
683 -#define TAS5713_CH2_INPUT_MIXER 0x54
684 -#define TAS5713_OUTPUT_POST_SCALE 0x56
685 -#define TAS5713_OUTPUT_PRESCALE 0x57
686 -
687 -#define TAS5713_IDF_POST_SCALE 0x62
688 -
689 -#define TAS5713_CH1_INLINE_MIXER 0x70
690 -#define TAS5713_CH1_INLINE_DRC_EN_MIXER 0x71
691 -#define TAS5713_CH1_R_CHANNEL_MIXER 0x72
692 -#define TAS5713_CH1_L_CHANNEL_MIXER 0x73
693 -#define TAS5713_CH2_INLINE_MIXER 0x74
694 -#define TAS5713_CH2_INLINE_DRC_EN_MIXER 0x75
695 -#define TAS5713_CH2_L_CHANNEL_MIXER 0x76
696 -#define TAS5713_CH2_R_CHANNEL_MIXER 0x77
697 -
698 -#define TAS5713_UPDATE_DEV_ADDR_KEY 0xF8
699 -#define TAS5713_UPDATE_DEV_ADDR_REG 0xF9
700 -
701 -#define TAS5713_REGISTER_COUNT 0x46
702 -#define TAS5713_MAX_REGISTER 0xF9
703 -
704 -
705 -// Bitmasks for registers
706 -#define TAS5713_SOFT_MUTE_ALL 0x07
707 -
708 -
709 -
710 -struct tas5713_init_command {
711 - const int size;
712 - const char *const data;
713 -};
714 -
715 -static const struct tas5713_init_command tas5713_init_sequence[] = {
716 -
717 - // Trim oscillator
718 - { .size = 2, .data = "\x1B\x00" },
719 - // System control register 1 (0x03): block DC
720 - { .size = 2, .data = "\x03\x80" },
721 - // Mute everything
722 - { .size = 2, .data = "\x05\x40" },
723 - // Modulation limit register (0x10): 97.7%
724 - { .size = 2, .data = "\x10\x02" },
725 - // Interchannel delay registers
726 - // (0x11, 0x12, 0x13, and 0x14): BD mode
727 - { .size = 2, .data = "\x11\xB8" },
728 - { .size = 2, .data = "\x12\x60" },
729 - { .size = 2, .data = "\x13\xA0" },
730 - { .size = 2, .data = "\x14\x48" },
731 - // PWM shutdown group register (0x19): no shutdown
732 - { .size = 2, .data = "\x19\x00" },
733 - // Input multiplexer register (0x20): BD mode
734 - { .size = 2, .data = "\x20\x00\x89\x77\x72" },
735 - // PWM output mux register (0x25)
736 - // Channel 1 --> OUTA, channel 1 neg --> OUTB
737 - // Channel 2 --> OUTC, channel 2 neg --> OUTD
738 - { .size = 5, .data = "\x25\x01\x02\x13\x45" },
739 - // DRC control (0x46): DRC off
740 - { .size = 5, .data = "\x46\x00\x00\x00\x00" },
741 - // BKND_ERR register (0x1C): 299ms reset period
742 - { .size = 2, .data = "\x1C\x07" },
743 - // Mute channel 3
744 - { .size = 2, .data = "\x0A\xFF" },
745 - // Volume configuration register (0x0E): volume slew 512 steps
746 - { .size = 2, .data = "\x0E\x90" },
747 - // Clock control register (0x00): 44/48kHz, MCLK=64xfs
748 - { .size = 2, .data = "\x00\x60" },
749 - // Bank switch and eq control (0x50): no bank switching
750 - { .size = 5, .data = "\x50\x00\x00\x00\x00" },
751 - // Volume registers (0x07, 0x08, 0x09, 0x0A)
752 - { .size = 2, .data = "\x07\x20" },
753 - { .size = 2, .data = "\x08\x30" },
754 - { .size = 2, .data = "\x09\x30" },
755 - { .size = 2, .data = "\x0A\xFF" },
756 - // 0x72, 0x73, 0x76, 0x77 input mixer:
757 - // no intermix between channels
758 - { .size = 5, .data = "\x72\x00\x00\x00\x00" },
759 - { .size = 5, .data = "\x73\x00\x80\x00\x00" },
760 - { .size = 5, .data = "\x76\x00\x00\x00\x00" },
761 - { .size = 5, .data = "\x77\x00\x80\x00\x00" },
762 - // 0x70, 0x71, 0x74, 0x75 inline DRC mixer:
763 - // no inline DRC inmix
764 - { .size = 5, .data = "\x70\x00\x80\x00\x00" },
765 - { .size = 5, .data = "\x71\x00\x00\x00\x00" },
766 - { .size = 5, .data = "\x74\x00\x80\x00\x00" },
767 - { .size = 5, .data = "\x75\x00\x00\x00\x00" },
768 - // 0x56, 0x57 Output scale
769 - { .size = 5, .data = "\x56\x00\x80\x00\x00" },
770 - { .size = 5, .data = "\x57\x00\x02\x00\x00" },
771 - // 0x3B, 0x3c
772 - { .size = 9, .data = "\x3B\x00\x08\x00\x00\x00\x78\x00\x00" },
773 - { .size = 9, .data = "\x3C\x00\x00\x01\x00\xFF\xFF\xFF\x00" },
774 - { .size = 9, .data = "\x3E\x00\x08\x00\x00\x00\x78\x00\x00" },
775 - { .size = 9, .data = "\x3F\x00\x00\x01\x00\xFF\xFF\xFF\x00" },
776 - { .size = 9, .data = "\x40\x00\x00\x01\x00\xFF\xFF\xFF\x00" },
777 - { .size = 9, .data = "\x43\x00\x00\x01\x00\xFF\xFF\xFF\x00" },
778 - // 0x51, 0x52: output mixer
779 - { .size = 9, .data = "\x51\x00\x80\x00\x00\x00\x00\x00\x00" },
780 - { .size = 9, .data = "\x52\x00\x80\x00\x00\x00\x00\x00\x00" },
781 - // PEQ defaults
782 - { .size = 21, .data = "\x29\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
783 - { .size = 21, .data = "\x2A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
784 - { .size = 21, .data = "\x2B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
785 - { .size = 21, .data = "\x2C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
786 - { .size = 21, .data = "\x2D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
787 - { .size = 21, .data = "\x2E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
788 - { .size = 21, .data = "\x2F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
789 - { .size = 21, .data = "\x30\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
790 - { .size = 21, .data = "\x31\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
791 - { .size = 21, .data = "\x32\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
792 - { .size = 21, .data = "\x33\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
793 - { .size = 21, .data = "\x34\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
794 - { .size = 21, .data = "\x35\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
795 - { .size = 21, .data = "\x36\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
796 - { .size = 21, .data = "\x58\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
797 - { .size = 21, .data = "\x59\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
798 - { .size = 21, .data = "\x5C\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
799 - { .size = 21, .data = "\x5D\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
800 - { .size = 21, .data = "\x5E\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
801 - { .size = 21, .data = "\x5F\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
802 - { .size = 21, .data = "\x5A\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
803 - { .size = 21, .data = "\x5B\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" },
804 -};
805 -
806 -
807 -#endif /* _TAS5713_H */