1 From 87d450d98ef1f69dd6f5255c3b7e665c130935ea Mon Sep 17 00:00:00 2001
2 From: allocom <sparky-dev@allo.com>
3 Date: Thu, 19 Apr 2018 12:12:26 +0530
4 Subject: [PATCH 281/454] Drivers for Allo Katana DAC
7 arch/arm/boot/dts/overlays/Makefile | 1 +
8 arch/arm/boot/dts/overlays/README | 6 +
9 .../allo-katana-dac-audio-overlay.dts | 46 +++
10 arch/arm/configs/bcm2709_defconfig | 1 +
11 arch/arm/configs/bcmrpi_defconfig | 1 +
12 sound/soc/bcm/Kconfig | 7 +
13 sound/soc/bcm/Makefile | 2 +
14 sound/soc/bcm/allo-katana-dac.c | 105 ++++++
15 sound/soc/codecs/Kconfig | 10 +
16 sound/soc/codecs/Makefile | 4 +
17 sound/soc/codecs/sabre-ess-i2c.c | 69 ++++
18 sound/soc/codecs/sabre-ess.c | 300 ++++++++++++++++++
19 sound/soc/codecs/sabre-ess.h | 62 ++++
20 13 files changed, 614 insertions(+)
21 create mode 100644 arch/arm/boot/dts/overlays/allo-katana-dac-audio-overlay.dts
22 create mode 100644 sound/soc/bcm/allo-katana-dac.c
23 create mode 100644 sound/soc/codecs/sabre-ess-i2c.c
24 create mode 100644 sound/soc/codecs/sabre-ess.c
25 create mode 100644 sound/soc/codecs/sabre-ess.h
27 --- a/arch/arm/boot/dts/overlays/Makefile
28 +++ b/arch/arm/boot/dts/overlays/Makefile
29 @@ -9,6 +9,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
30 akkordion-iqdacplus.dtbo \
31 allo-boss-dac-pcm512x-audio.dtbo \
33 + allo-katana-dac-audio.dtbo \
34 allo-piano-dac-pcm512x-audio.dtbo \
35 allo-piano-dac-plus-pcm512x-audio.dtbo \
37 --- a/arch/arm/boot/dts/overlays/README
38 +++ b/arch/arm/boot/dts/overlays/README
39 @@ -317,6 +317,12 @@ Load: dtoverlay=allo-digione
44 +Info: Configures the Allo Katana audio card
45 +Load: dtoverlay=allo-katana-dac-audio
49 Name: allo-piano-dac-pcm512x-audio
50 Info: Configures the Allo Piano DAC (2.0/2.1) audio cards.
51 (NB. This initial support is for 2.0 channel audio ONLY! ie. stereo.
53 +++ b/arch/arm/boot/dts/overlays/allo-katana-dac-audio-overlay.dts
56 + * Definitions for Allo Katana DAC boards
58 + * NB. The Katana DAC board contains SABER DAC.
65 + compatible = "brcm,bcm2708";
77 + #address-cells = <1>;
82 + #sound-dai-cells = <0>;
83 + compatible = "saber,sabre-ess";
92 + katana_dac: __overlay__ {
93 + compatible = "allo,katana-dac";
94 + i2s-controller = <&i2s>;
101 --- a/arch/arm/configs/bcm2709_defconfig
102 +++ b/arch/arm/configs/bcm2709_defconfig
103 @@ -894,6 +894,7 @@ CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m
104 CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC_PLUS=m
105 CONFIG_SND_BCM2708_SOC_ALLO_BOSS_DAC=m
106 CONFIG_SND_BCM2708_SOC_ALLO_DIGIONE=m
107 +CONFIG_SND_BCM2708_SOC_ALLO_KATANA_DAC=m
108 CONFIG_SND_BCM2708_SOC_FE_PI_AUDIO=m
110 CONFIG_SND_SOC_ADAU1701=m
111 --- a/arch/arm/configs/bcmrpi_defconfig
112 +++ b/arch/arm/configs/bcmrpi_defconfig
113 @@ -887,6 +887,7 @@ CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m
114 CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC_PLUS=m
115 CONFIG_SND_BCM2708_SOC_ALLO_BOSS_DAC=m
116 CONFIG_SND_BCM2708_SOC_ALLO_DIGIONE=m
117 +CONFIG_SND_BCM2708_SOC_ALLO_KATANA_DAC=m
118 CONFIG_SND_BCM2708_SOC_FE_PI_AUDIO=m
120 CONFIG_SND_SOC_ADAU1701=m
121 --- a/sound/soc/bcm/Kconfig
122 +++ b/sound/soc/bcm/Kconfig
123 @@ -175,6 +175,13 @@ config SND_BCM2708_SOC_ALLO_DIGIONE
125 Say Y or M if you want to add support for Allo DigiOne.
127 +config SND_BCM2708_SOC_ALLO_KATANA_DAC
128 + tristate "Support for Allo Katana DAC"
129 + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
130 + select SND_SOC_SABRE_ESS_I2C
132 + Say Y or M if you want to add support for Allo Katana DAC.
134 config SND_BCM2708_SOC_FE_PI_AUDIO
135 tristate "Support for Fe-Pi-Audio"
136 depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
137 --- a/sound/soc/bcm/Makefile
138 +++ b/sound/soc/bcm/Makefile
139 @@ -34,6 +34,7 @@ snd-soc-allo-boss-dac-objs := allo-boss-
140 snd-soc-allo-piano-dac-objs := allo-piano-dac.o
141 snd-soc-allo-piano-dac-plus-objs := allo-piano-dac-plus.o
142 snd-soc-allo-digione-objs := allo-digione.o
143 +snd-soc-allo-katana-dac-objs := allo-katana-dac.o
144 snd-soc-pisound-objs := pisound.o
145 snd-soc-fe-pi-audio-objs := fe-pi-audio.o
147 @@ -60,5 +61,6 @@ obj-$(CONFIG_SND_BCM2708_SOC_ALLO_BOSS_D
148 obj-$(CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC) += snd-soc-allo-piano-dac.o
149 obj-$(CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC_PLUS) += snd-soc-allo-piano-dac-plus.o
150 obj-$(CONFIG_SND_BCM2708_SOC_ALLO_DIGIONE) += snd-soc-allo-digione.o
151 +obj-$(CONFIG_SND_BCM2708_SOC_ALLO_KATANA_DAC) += snd-soc-allo-katana-dac.o
152 obj-$(CONFIG_SND_PISOUND) += snd-soc-pisound.o
153 obj-$(CONFIG_SND_BCM2708_SOC_FE_PI_AUDIO) += snd-soc-fe-pi-audio.o
155 +++ b/sound/soc/bcm/allo-katana-dac.c
158 + * ASoC Driver for KATANA DAC
160 + * Author: Jaikumar <jaikumar@cem-solutions.net>
163 + * This program is free software; you can redistribute it and/or
164 + * modify it under the terms of the GNU General Public License
165 + * version 2 as published by the Free Software Foundation.
167 + * This program is distributed in the hope that it will be useful, but
168 + * WITHOUT ANY WARRANTY; without even the implied warranty of
169 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
170 + * General Public License for more details.
173 +#include <linux/module.h>
174 +#include <linux/platform_device.h>
176 +#include <sound/core.h>
177 +#include <sound/pcm.h>
178 +#include <sound/pcm_params.h>
179 +#include <sound/soc.h>
181 +static struct snd_soc_dai_link snd_allo_katana_dac_dai[] = {
183 + .name = "KATANA DAC",
184 + //.stream_name = "KATANA DAC HiFi [Master]",
185 + .stream_name = "KATANA DAC",
186 + .cpu_dai_name = "bcm2708-i2s.0",
187 + //.codec_dai_name = "es9038q2m-hifi",
188 + .codec_dai_name = "sabre-ess",
189 + .platform_name = "bcm2708-i2s.0",
190 + //.codec_name = "es9038q2m.1-0030",
191 + .codec_name = "sabre-ess.1-0030",
192 + .dai_fmt = SND_SOC_DAIFMT_I2S |
193 + SND_SOC_DAIFMT_NB_NF |
194 + SND_SOC_DAIFMT_CBM_CFM,
198 +/* audio machine driver */
199 +static struct snd_soc_card snd_allo_katana_dac = {
200 + .name = "snd_allo_katana_dac",
201 + .owner = THIS_MODULE,
202 + .dai_link = snd_allo_katana_dac_dai,
203 + .num_links = ARRAY_SIZE(snd_allo_katana_dac_dai),
206 +static int snd_allo_katana_dac_probe(struct platform_device *pdev)
210 + snd_allo_katana_dac.dev = &pdev->dev;
212 + if (pdev->dev.of_node) {
213 + struct device_node *i2s_node;
214 + struct snd_soc_dai_link *dai = &snd_allo_katana_dac_dai[0];
216 + i2s_node = of_parse_phandle(pdev->dev.of_node,
217 + "i2s-controller", 0);
220 + dai->cpu_dai_name = NULL;
221 + dai->cpu_of_node = i2s_node;
222 + dai->platform_name = NULL;
223 + dai->platform_of_node = i2s_node;
227 + ret = snd_soc_register_card(&snd_allo_katana_dac);
228 + if (ret && ret != -EPROBE_DEFER)
229 + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
235 +static int snd_allo_katana_dac_remove(struct platform_device *pdev)
237 + return snd_soc_unregister_card(&snd_allo_katana_dac);
240 +static const struct of_device_id snd_allo_katana_dac_of_match[] = {
241 + { .compatible = "allo,katana-dac", },
244 +MODULE_DEVICE_TABLE(of, snd_allo_katana_dac_of_match);
246 +static struct platform_driver snd_allo_katana_dac_driver = {
248 + .name = "snd-katana-dac",
249 + .owner = THIS_MODULE,
250 + .of_match_table = snd_allo_katana_dac_of_match,
252 + .probe = snd_allo_katana_dac_probe,
253 + .remove = snd_allo_katana_dac_remove,
256 +module_platform_driver(snd_allo_katana_dac_driver);
258 +MODULE_AUTHOR("Jaikumar <jaikumar@cem-solutions.net>");
259 +MODULE_DESCRIPTION("ALSA ASoC Machine Driver for Allo Katana DAC");
260 +MODULE_LICENSE("GPL v2");
262 --- a/sound/soc/codecs/Kconfig
263 +++ b/sound/soc/codecs/Kconfig
264 @@ -77,6 +77,7 @@ config SND_SOC_ALL_CODECS
265 select SND_SOC_ES8328_SPI if SPI_MASTER
266 select SND_SOC_ES8328_I2C if I2C
267 select SND_SOC_ES7134
268 + select SND_SOC_SABRE_ESS_I2C if I2C
269 select SND_SOC_GTM601
270 select SND_SOC_HDAC_HDMI
271 select SND_SOC_ICS43432
272 @@ -1186,4 +1187,13 @@ config SND_SOC_TPA6130A2
273 tristate "Texas Instruments TPA6130A2 headphone amplifier"
276 +config SND_SOC_SABRE_ESS
279 +config SND_SOC_SABRE_ESS_I2C
280 + tristate "Sabre SABRE ESS CODEC - I2C"
282 + select SND_SOC_SABRE_ESS
286 --- a/sound/soc/codecs/Makefile
287 +++ b/sound/soc/codecs/Makefile
288 @@ -71,6 +71,8 @@ snd-soc-es8316-objs := es8316.o
289 snd-soc-es8328-objs := es8328.o
290 snd-soc-es8328-i2c-objs := es8328-i2c.o
291 snd-soc-es8328-spi-objs := es8328-spi.o
292 +snd-soc-sabre-ess-objs := sabre-ess.o
293 +snd-soc-sabre-ess-i2c-objs := sabre-ess-i2c.o
294 snd-soc-gtm601-objs := gtm601.o
295 snd-soc-hdac-hdmi-objs := hdac_hdmi.o
296 snd-soc-ics43432-objs := ics43432.o
297 @@ -313,6 +315,8 @@ obj-$(CONFIG_SND_SOC_ES8316) += snd-s
298 obj-$(CONFIG_SND_SOC_ES8328) += snd-soc-es8328.o
299 obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o
300 obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o
301 +obj-$(CONFIG_SND_SOC_SABRE_ESS) += snd-soc-sabre-ess.o
302 +obj-$(CONFIG_SND_SOC_SABRE_ESS_I2C) += snd-soc-sabre-ess-i2c.o
303 obj-$(CONFIG_SND_SOC_GTM601) += snd-soc-gtm601.o
304 obj-$(CONFIG_SND_SOC_HDAC_HDMI) += snd-soc-hdac-hdmi.o
305 obj-$(CONFIG_SND_SOC_ICS43432) += snd-soc-ics43432.o
307 +++ b/sound/soc/codecs/sabre-ess-i2c.c
310 + * Driver for the SABRE ESS CODECs
312 + * Author: Jaikumar <jaikumar@cem-solutions.net>
315 + * This program is free software; you can redistribute it and/or
316 + * modify it under the terms of the GNU General Public License
317 + * version 2 as published by the Free Software Foundation.
319 + * This program is distributed in the hope that it will be useful, but
320 + * WITHOUT ANY WARRANTY; without even the implied warranty of
321 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
322 + * General Public License for more details.
325 +#include <linux/init.h>
326 +#include <linux/module.h>
327 +#include <linux/i2c.h>
329 +#include "sabre-ess.h"
331 +static int sabre_ess_i2c_probe(struct i2c_client *i2c,
332 + const struct i2c_device_id *id)
334 + struct regmap *regmap;
335 + struct regmap_config config = sabre_ess_regmap;
337 + regmap = devm_regmap_init_i2c(i2c, &config);
338 + if (IS_ERR(regmap))
339 + return PTR_ERR(regmap);
341 + return sabre_ess_probe(&i2c->dev, regmap);
344 +static int sabre_ess_i2c_remove(struct i2c_client *i2c)
346 + sabre_ess_remove(&i2c->dev);
350 +static const struct i2c_device_id sabre_ess_i2c_id[] = {
354 +MODULE_DEVICE_TABLE(i2c, sabre_ess_i2c_id);
356 +static const struct of_device_id sabre_ess_of_match[] = {
357 + { .compatible = "saber,sabre-ess", },
360 +MODULE_DEVICE_TABLE(of, sabre_ess_of_match);
362 +static struct i2c_driver sabre_ess_i2c_driver = {
363 + .probe = sabre_ess_i2c_probe,
364 + .remove = sabre_ess_i2c_remove,
365 + .id_table = sabre_ess_i2c_id,
367 + .name = "sabre-ess",
368 + .of_match_table = sabre_ess_of_match,
372 +module_i2c_driver(sabre_ess_i2c_driver);
374 +MODULE_DESCRIPTION("ASoC SABRE ESS codec driver - I2C");
375 +MODULE_AUTHOR("Jaikumar <jaikumar@cem-solutions.net>");
376 +MODULE_LICENSE("GPL v2");
379 +++ b/sound/soc/codecs/sabre-ess.c
382 + * Driver for the SABRE ESS CODEC
384 + * Author: Jaikumar <jaikumar@cem-solutions.net>
387 + * This program is free software; you can redistribute it and/or
388 + * modify it under the terms of the GNU General Public License
389 + * version 2 as published by the Free Software Foundation.
391 + * This program is distributed in the hope that it will be useful, but
392 + * WITHOUT ANY WARRANTY; without even the implied warranty of
393 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
394 + * General Public License for more details.
398 +#include <linux/init.h>
399 +#include <linux/module.h>
400 +#include <linux/clk.h>
401 +#include <linux/kernel.h>
402 +#include <linux/pm_runtime.h>
403 +#include <linux/regmap.h>
404 +#include <linux/regulator/consumer.h>
405 +#include <linux/gcd.h>
406 +#include <sound/soc.h>
407 +#include <sound/soc-dapm.h>
408 +#include <sound/pcm_params.h>
409 +#include <sound/tlv.h>
411 +#include "sabre-ess.h"
413 +struct sabre_ess_priv {
414 + struct regmap *regmap;
418 +static const struct reg_default sabre_ess_reg_defaults[] = {
419 + { SABRE_ESS_RESET, 0x00 },
420 + { SABRE_ESS_VOLUME_1, 0xF0 },
421 + { SABRE_ESS_VOLUME_2, 0xF0 },
422 + { SABRE_ESS_MUTE, 0x00 },
423 + { SABRE_ESS_DSP_PROGRAM, 0x04 },
424 + { SABRE_ESS_DEEMPHASIS, 0x00 },
425 + { SABRE_ESS_DOP, 0x01 },
426 + { SABRE_ESS_FORMAT, 0xb4 },
429 +static const char * const sabre_ess_dsp_program_texts[] = {
430 + "Linear Phase Fast Roll-off Filter",
431 + "Linear Phase Slow Roll-off Filter",
432 + "Minimum Phase Fast Roll-off Filter",
433 + "Minimum Phase Slow Roll-off Filter",
434 + "Apodizing Fast Roll-off Filter",
435 + "Corrected Minimum Phase Fast Roll-off Filter",
436 + "Brick Wall Filter",
439 +static const unsigned int sabre_ess_dsp_program_values[] = {
449 +static SOC_VALUE_ENUM_SINGLE_DECL(sabre_ess_dsp_program,
450 + SABRE_ESS_DSP_PROGRAM, 0, 0x07,
451 + sabre_ess_dsp_program_texts,
452 + sabre_ess_dsp_program_values);
454 +static const char * const sabre_ess_deemphasis_texts[] = {
461 +static const unsigned int sabre_ess_deemphasis_values[] = {
468 +static SOC_VALUE_ENUM_SINGLE_DECL(sabre_ess_deemphasis,
469 + SABRE_ESS_DEEMPHASIS, 0, 0x03,
470 + sabre_ess_deemphasis_texts,
471 + sabre_ess_deemphasis_values);
473 +static const SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(master_tlv, -12700, 0);
475 +static const struct snd_kcontrol_new sabre_ess_controls[] = {
476 + SOC_DOUBLE_R_TLV("Master Playback Volume", SABRE_ESS_VOLUME_1,
477 + SABRE_ESS_VOLUME_2, 0, 255, 1, master_tlv),
478 + SOC_DOUBLE("Master Playback Switch", SABRE_ESS_MUTE, 0, 0, 1, 1),
479 + SOC_ENUM("DSP Program Route", sabre_ess_dsp_program),
480 + SOC_ENUM("Deemphasis Route", sabre_ess_deemphasis),
481 + SOC_SINGLE("DoP Playback Switch", SABRE_ESS_DOP, 0, 1, 1)
484 +static bool sabre_ess_readable_register(struct device *dev, unsigned int reg)
487 + case SABRE_ESS_CHIP_ID_REG:
494 +static int sabre_ess_hw_params(struct snd_pcm_substream *substream,
495 + struct snd_pcm_hw_params *params,
496 + struct snd_soc_dai *dai)
498 + struct snd_soc_codec *codec = dai->codec;
499 + struct sabre_ess_priv *sabre_ess = snd_soc_codec_get_drvdata(codec);
503 + dev_dbg(codec->dev, "hw_params %u Hz, %u channels\n",
504 + params_rate(params),
505 + params_channels(params));
507 + switch (sabre_ess->fmt & SND_SOC_DAIFMT_MASTER_MASK) {
508 + case SND_SOC_DAIFMT_CBM_CFM: // master
509 + if (params_channels(params) == 2)
510 + fmt = SABRE_ESS_CHAN_STEREO;
512 + fmt = SABRE_ESS_CHAN_MONO;
514 + switch (params_width(params)) {
516 + fmt |= SABRE_ESS_ALEN_16;
519 + fmt |= SABRE_ESS_ALEN_24;
522 + fmt |= SABRE_ESS_ALEN_32;
525 + dev_err(codec->dev, "Bad frame size: %d\n",
526 + params_width(params));
530 + switch (params_rate(params)) {
532 + fmt |= SABRE_ESS_RATE_44100;
535 + fmt |= SABRE_ESS_RATE_48000;
538 + fmt |= SABRE_ESS_RATE_88200;
541 + fmt |= SABRE_ESS_RATE_96000;
544 + fmt |= SABRE_ESS_RATE_176400;
547 + fmt |= SABRE_ESS_RATE_192000;
550 + fmt |= SABRE_ESS_RATE_352800;
553 + fmt |= SABRE_ESS_RATE_384000;
556 + dev_err(codec->dev, "Bad sample rate: %d\n",
557 + params_rate(params));
561 + ret = regmap_write(sabre_ess->regmap, SABRE_ESS_FORMAT, fmt);
563 + dev_err(codec->dev, "Failed to set format: %d\n", ret);
575 +static int sabre_ess_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
577 + struct snd_soc_codec *codec = dai->codec;
578 + struct sabre_ess_priv *sabre_ess = snd_soc_codec_get_drvdata(codec);
580 + sabre_ess->fmt = fmt;
585 +static const struct snd_soc_dai_ops sabre_ess_dai_ops = {
586 + .hw_params = sabre_ess_hw_params,
587 + .set_fmt = sabre_ess_set_fmt,
590 +static struct snd_soc_dai_driver sabre_ess_dai = {
591 + .name = "sabre-ess",
593 + .stream_name = "Playback",
596 + .rates = SNDRV_PCM_RATE_CONTINUOUS,
598 + .rate_max = 384000,
599 + .formats = SNDRV_PCM_FMTBIT_S16_LE |
600 + SNDRV_PCM_FMTBIT_S32_LE
602 + .ops = &sabre_ess_dai_ops,
605 +static struct snd_soc_codec_driver sabre_ess_codec_driver = {
606 + .idle_bias_off = false,
608 + .component_driver = {
609 + .controls = sabre_ess_controls,
610 + .num_controls = ARRAY_SIZE(sabre_ess_controls),
614 +static const struct regmap_range_cfg sabre_ess_range = {
615 + .name = "Pages", .range_min = SABRE_ESS_VIRT_BASE,
616 + .range_max = SABRE_ESS_MAX_REGISTER,
617 + .selector_reg = SABRE_ESS_PAGE,
618 + .selector_mask = 0xff,
619 + .window_start = 0, .window_len = 0x100,
622 +const struct regmap_config sabre_ess_regmap = {
626 + .ranges = &sabre_ess_range,
629 + .max_register = SABRE_ESS_MAX_REGISTER,
630 + .readable_reg = sabre_ess_readable_register,
631 + .reg_defaults = sabre_ess_reg_defaults,
632 + .num_reg_defaults = ARRAY_SIZE(sabre_ess_reg_defaults),
633 + .cache_type = REGCACHE_RBTREE,
635 +EXPORT_SYMBOL_GPL(sabre_ess_regmap);
637 +int sabre_ess_probe(struct device *dev, struct regmap *regmap)
639 + struct sabre_ess_priv *sabre_ess;
640 + unsigned int chip_id = 0;
643 + sabre_ess = devm_kzalloc(dev, sizeof(struct sabre_ess_priv),
648 + dev_set_drvdata(dev, sabre_ess);
649 + sabre_ess->regmap = regmap;
651 + ret = regmap_read(regmap, SABRE_ESS_CHIP_ID_REG, &chip_id);
652 + if ((ret != 0) || (chip_id != SABRE_ESS_CHIP_ID)) {
653 + dev_err(dev, "Failed to read Chip or wrong Chip id: %d\n", ret);
656 + regmap_update_bits(regmap, SABRE_ESS_RESET, 0x01, 0x01);
659 + ret = snd_soc_register_codec(dev, &sabre_ess_codec_driver,
660 + &sabre_ess_dai, 1);
662 + dev_err(dev, "failed to register codec: %d\n", ret);
668 +EXPORT_SYMBOL_GPL(sabre_ess_probe);
670 +void sabre_ess_remove(struct device *dev)
672 + snd_soc_unregister_codec(dev);
673 + pm_runtime_disable(dev);
675 +EXPORT_SYMBOL_GPL(sabre_ess_remove);
677 +MODULE_DESCRIPTION("ASoC SABRE ESS codec driver");
678 +MODULE_AUTHOR("Jaikumar <jaikumar@cem-solutions.net>");
679 +MODULE_LICENSE("GPL v2");
682 +++ b/sound/soc/codecs/sabre-ess.h
685 + * Driver for the SABRE ESS CODEC
687 + * Author: Jaikumar <jaikumar@cem-solutions.net>
690 + * This program is free software; you can redistribute it and/or
691 + * modify it under the terms of the GNU General Public License
692 + * version 2 as published by the Free Software Foundation.
694 + * This program is distributed in the hope that it will be useful, but
695 + * WITHOUT ANY WARRANTY; without even the implied warranty of
696 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
697 + * General Public License for more details.
700 +#ifndef _SND_SOC_SABRE_ESS_
701 +#define _SND_SOC_SABRE_ESS_
703 +#include <linux/pm.h>
704 +#include <linux/regmap.h>
706 +#define SABRE_ESS_CHIP_ID 0x30
707 +#define SABRE_ESS_VIRT_BASE 0x100
708 +#define SABRE_ESS_PAGE 0
710 +#define SABRE_ESS_CHIP_ID_REG (SABRE_ESS_VIRT_BASE + 0)
711 +#define SABRE_ESS_RESET (SABRE_ESS_VIRT_BASE + 1)
712 +#define SABRE_ESS_VOLUME_1 (SABRE_ESS_VIRT_BASE + 2)
713 +#define SABRE_ESS_VOLUME_2 (SABRE_ESS_VIRT_BASE + 3)
714 +#define SABRE_ESS_MUTE (SABRE_ESS_VIRT_BASE + 4)
715 +#define SABRE_ESS_DSP_PROGRAM (SABRE_ESS_VIRT_BASE + 5)
716 +#define SABRE_ESS_DEEMPHASIS (SABRE_ESS_VIRT_BASE + 6)
717 +#define SABRE_ESS_DOP (SABRE_ESS_VIRT_BASE + 7)
718 +#define SABRE_ESS_FORMAT (SABRE_ESS_VIRT_BASE + 8)
719 +#define SABRE_ESS_COMMAND (SABRE_ESS_VIRT_BASE + 9)
720 +#define SABRE_ESS_MAX_REGISTER (SABRE_ESS_VIRT_BASE + 9)
722 +#define SABRE_ESS_FMT 0xff
723 +#define SABRE_ESS_CHAN_MONO 0x00
724 +#define SABRE_ESS_CHAN_STEREO 0x80
725 +#define SABRE_ESS_ALEN_16 0x10
726 +#define SABRE_ESS_ALEN_24 0x20
727 +#define SABRE_ESS_ALEN_32 0x30
728 +#define SABRE_ESS_RATE_11025 0x01
729 +#define SABRE_ESS_RATE_22050 0x02
730 +#define SABRE_ESS_RATE_32000 0x03
731 +#define SABRE_ESS_RATE_44100 0x04
732 +#define SABRE_ESS_RATE_48000 0x05
733 +#define SABRE_ESS_RATE_88200 0x06
734 +#define SABRE_ESS_RATE_96000 0x07
735 +#define SABRE_ESS_RATE_176400 0x08
736 +#define SABRE_ESS_RATE_192000 0x09
737 +#define SABRE_ESS_RATE_352800 0x0a
738 +#define SABRE_ESS_RATE_384000 0x0b
740 +extern const struct regmap_config sabre_ess_regmap;
742 +int sabre_ess_probe(struct device *dev, struct regmap *regmap);
743 +void sabre_ess_remove(struct device *dev);
745 +#endif /* _SND_SOC_SABRE_ESS_ */