1 // SPDX-License-Identifier: GPL-2.0-only
3 // tegra210_mixer.c - Tegra210 MIXER driver
5 // Copyright (c) 2021 NVIDIA CORPORATION. All rights reserved.
8 #include <linux/device.h>
10 #include <linux/mod_devicetable.h>
11 #include <linux/module.h>
12 #include <linux/platform_device.h>
13 #include <linux/pm_runtime.h>
14 #include <linux/regmap.h>
15 #include <sound/core.h>
16 #include <sound/pcm.h>
17 #include <sound/pcm_params.h>
18 #include <sound/soc.h>
20 #include "tegra210_mixer.h"
21 #include "tegra_cif.h"
23 #define MIXER_REG(reg, id) ((reg) + ((id) * TEGRA210_MIXER_REG_STRIDE))
24 #define MIXER_REG_BASE(reg) ((reg) % TEGRA210_MIXER_REG_STRIDE)
26 #define MIXER_GAIN_CFG_RAM_ADDR(id) \
27 (TEGRA210_MIXER_GAIN_CFG_RAM_ADDR_0 + \
28 ((id) * TEGRA210_MIXER_GAIN_CFG_RAM_ADDR_STRIDE))
30 #define MIXER_RX_REG_DEFAULTS(id) \
31 { MIXER_REG(TEGRA210_MIXER_RX1_CIF_CTRL, id), 0x00007700}, \
32 { MIXER_REG(TEGRA210_MIXER_RX1_CTRL, id), 0x00010823}, \
33 { MIXER_REG(TEGRA210_MIXER_RX1_PEAK_CTRL, id), 0x000012c0}
35 #define MIXER_TX_REG_DEFAULTS(id) \
36 { MIXER_REG(TEGRA210_MIXER_TX1_INT_MASK, (id)), 0x00000001}, \
37 { MIXER_REG(TEGRA210_MIXER_TX1_CIF_CTRL, (id)), 0x00007700}
39 #define REG_DURATION_PARAM(reg, i) ((reg) + NUM_GAIN_POLY_COEFFS + 1 + (i))
41 static const struct reg_default tegra210_mixer_reg_defaults[] = {
43 MIXER_RX_REG_DEFAULTS(0),
44 MIXER_RX_REG_DEFAULTS(1),
45 MIXER_RX_REG_DEFAULTS(2),
46 MIXER_RX_REG_DEFAULTS(3),
47 MIXER_RX_REG_DEFAULTS(4),
48 MIXER_RX_REG_DEFAULTS(5),
49 MIXER_RX_REG_DEFAULTS(6),
50 MIXER_RX_REG_DEFAULTS(7),
51 MIXER_RX_REG_DEFAULTS(8),
52 MIXER_RX_REG_DEFAULTS(9),
54 MIXER_TX_REG_DEFAULTS(0),
55 MIXER_TX_REG_DEFAULTS(1),
56 MIXER_TX_REG_DEFAULTS(2),
57 MIXER_TX_REG_DEFAULTS(3),
58 MIXER_TX_REG_DEFAULTS(4),
60 { TEGRA210_MIXER_CG, 0x00000001},
61 { TEGRA210_MIXER_GAIN_CFG_RAM_CTRL, 0x00004000},
62 { TEGRA210_MIXER_PEAKM_RAM_CTRL, 0x00004000},
63 { TEGRA210_MIXER_ENABLE, 0x1 },
66 /* Default gain parameters */
67 static const struct tegra210_mixer_gain_params gain_params = {
68 /* Polynomial coefficients */
69 { 0, 0, 0, 0, 0, 0, 0, 0x1000000, 0 },
72 /* Duration Parameters */
73 { 0, 0, 0x400, 0x8000000 },
76 static int __maybe_unused tegra210_mixer_runtime_suspend(struct device *dev)
78 struct tegra210_mixer *mixer = dev_get_drvdata(dev);
80 regcache_cache_only(mixer->regmap, true);
81 regcache_mark_dirty(mixer->regmap);
86 static int __maybe_unused tegra210_mixer_runtime_resume(struct device *dev)
88 struct tegra210_mixer *mixer = dev_get_drvdata(dev);
90 regcache_cache_only(mixer->regmap, false);
91 regcache_sync(mixer->regmap);
96 static int tegra210_mixer_write_ram(struct tegra210_mixer *mixer,
100 unsigned int reg, val;
104 err = regmap_read_poll_timeout(mixer->regmap,
105 TEGRA210_MIXER_GAIN_CFG_RAM_CTRL,
106 val, !(val & 0x80000000), 10, 10000);
110 reg = (addr << TEGRA210_MIXER_GAIN_CFG_RAM_ADDR_SHIFT) &
111 TEGRA210_MIXER_GAIN_CFG_RAM_ADDR_MASK;
112 reg |= TEGRA210_MIXER_GAIN_CFG_RAM_ADDR_INIT_EN;
113 reg |= TEGRA210_MIXER_GAIN_CFG_RAM_RW_WRITE;
114 reg |= TEGRA210_MIXER_GAIN_CFG_RAM_SEQ_ACCESS_EN;
116 regmap_write(mixer->regmap,
117 TEGRA210_MIXER_GAIN_CFG_RAM_CTRL,
119 regmap_write(mixer->regmap,
120 TEGRA210_MIXER_GAIN_CFG_RAM_DATA,
126 static int tegra210_mixer_configure_gain(struct snd_soc_component *cmpnt,
127 unsigned int id, bool instant_gain)
129 struct tegra210_mixer *mixer = snd_soc_component_get_drvdata(cmpnt);
130 unsigned int reg = MIXER_GAIN_CFG_RAM_ADDR(id);
133 pm_runtime_get_sync(cmpnt->dev);
135 /* Write default gain poly coefficients */
136 for (i = 0; i < NUM_GAIN_POLY_COEFFS; i++) {
137 err = tegra210_mixer_write_ram(mixer, reg + i,
138 gain_params.poly_coeff[i]);
144 /* Write stored gain value */
145 err = tegra210_mixer_write_ram(mixer, reg + NUM_GAIN_POLY_COEFFS,
146 mixer->gain_value[id]);
150 /* Write duration parameters */
151 for (i = 0; i < NUM_DURATION_PARMS; i++) {
157 val = gain_params.duration[i];
159 err = tegra210_mixer_write_ram(mixer,
160 REG_DURATION_PARAM(reg, i),
166 /* Trigger to apply gain configurations */
167 err = tegra210_mixer_write_ram(mixer, reg + REG_CFG_DONE_TRIGGER,
168 VAL_CFG_DONE_TRIGGER);
171 pm_runtime_put(cmpnt->dev);
176 static int tegra210_mixer_get_gain(struct snd_kcontrol *kcontrol,
177 struct snd_ctl_elem_value *ucontrol)
179 struct soc_mixer_control *mc =
180 (struct soc_mixer_control *)kcontrol->private_value;
181 struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
182 struct tegra210_mixer *mixer = snd_soc_component_get_drvdata(cmpnt);
183 unsigned int reg = mc->reg;
186 i = (reg - TEGRA210_MIXER_GAIN_CFG_RAM_ADDR_0) /
187 TEGRA210_MIXER_GAIN_CFG_RAM_ADDR_STRIDE;
189 ucontrol->value.integer.value[0] = mixer->gain_value[i];
194 static int tegra210_mixer_apply_gain(struct snd_kcontrol *kcontrol,
195 struct snd_ctl_elem_value *ucontrol,
198 struct soc_mixer_control *mc =
199 (struct soc_mixer_control *)kcontrol->private_value;
200 struct snd_soc_component *cmpnt = snd_soc_kcontrol_component(kcontrol);
201 struct tegra210_mixer *mixer = snd_soc_component_get_drvdata(cmpnt);
202 unsigned int reg = mc->reg, id;
205 /* Save gain value for specific MIXER input */
206 id = (reg - TEGRA210_MIXER_GAIN_CFG_RAM_ADDR_0) /
207 TEGRA210_MIXER_GAIN_CFG_RAM_ADDR_STRIDE;
209 if (mixer->gain_value[id] == ucontrol->value.integer.value[0])
212 mixer->gain_value[id] = ucontrol->value.integer.value[0];
214 err = tegra210_mixer_configure_gain(cmpnt, id, instant_gain);
216 dev_err(cmpnt->dev, "Failed to apply gain\n");
223 static int tegra210_mixer_put_gain(struct snd_kcontrol *kcontrol,
224 struct snd_ctl_elem_value *ucontrol)
226 return tegra210_mixer_apply_gain(kcontrol, ucontrol, false);
229 static int tegra210_mixer_put_instant_gain(struct snd_kcontrol *kcontrol,
230 struct snd_ctl_elem_value *ucontrol)
232 return tegra210_mixer_apply_gain(kcontrol, ucontrol, true);
235 static int tegra210_mixer_set_audio_cif(struct tegra210_mixer *mixer,
236 struct snd_pcm_hw_params *params,
240 unsigned int channels, audio_bits;
241 struct tegra_cif_conf cif_conf;
243 memset(&cif_conf, 0, sizeof(struct tegra_cif_conf));
245 channels = params_channels(params);
247 switch (params_format(params)) {
248 case SNDRV_PCM_FORMAT_S16_LE:
249 audio_bits = TEGRA_ACIF_BITS_16;
251 case SNDRV_PCM_FORMAT_S32_LE:
252 audio_bits = TEGRA_ACIF_BITS_32;
258 cif_conf.audio_ch = channels;
259 cif_conf.client_ch = channels;
260 cif_conf.audio_bits = audio_bits;
261 cif_conf.client_bits = audio_bits;
263 tegra_set_cif(mixer->regmap,
264 reg + (id * TEGRA210_MIXER_REG_STRIDE),
270 static int tegra210_mixer_in_hw_params(struct snd_pcm_substream *substream,
271 struct snd_pcm_hw_params *params,
272 struct snd_soc_dai *dai)
274 struct tegra210_mixer *mixer = snd_soc_dai_get_drvdata(dai);
277 err = tegra210_mixer_set_audio_cif(mixer, params,
278 TEGRA210_MIXER_RX1_CIF_CTRL,
283 return tegra210_mixer_configure_gain(dai->component, dai->id, false);
286 static int tegra210_mixer_out_hw_params(struct snd_pcm_substream *substream,
287 struct snd_pcm_hw_params *params,
288 struct snd_soc_dai *dai)
290 struct tegra210_mixer *mixer = snd_soc_dai_get_drvdata(dai);
292 return tegra210_mixer_set_audio_cif(mixer, params,
293 TEGRA210_MIXER_TX1_CIF_CTRL,
294 dai->id - TEGRA210_MIXER_RX_MAX);
297 static const struct snd_soc_dai_ops tegra210_mixer_out_dai_ops = {
298 .hw_params = tegra210_mixer_out_hw_params,
301 static const struct snd_soc_dai_ops tegra210_mixer_in_dai_ops = {
302 .hw_params = tegra210_mixer_in_hw_params,
307 .name = "MIXER-RX-CIF"#id, \
309 .stream_name = "RX" #id "-CIF-Playback",\
312 .rates = SNDRV_PCM_RATE_8000_192000, \
313 .formats = SNDRV_PCM_FMTBIT_S8 | \
314 SNDRV_PCM_FMTBIT_S16_LE | \
315 SNDRV_PCM_FMTBIT_S32_LE, \
318 .stream_name = "RX" #id "-CIF-Capture", \
321 .rates = SNDRV_PCM_RATE_8000_192000, \
322 .formats = SNDRV_PCM_FMTBIT_S8 | \
323 SNDRV_PCM_FMTBIT_S16_LE | \
324 SNDRV_PCM_FMTBIT_S32_LE, \
326 .ops = &tegra210_mixer_in_dai_ops, \
329 #define OUT_DAI(id) \
331 .name = "MIXER-TX-CIF" #id, \
333 .stream_name = "TX" #id "-CIF-Playback",\
336 .rates = SNDRV_PCM_RATE_8000_192000, \
337 .formats = SNDRV_PCM_FMTBIT_S8 | \
338 SNDRV_PCM_FMTBIT_S16_LE | \
339 SNDRV_PCM_FMTBIT_S32_LE, \
342 .stream_name = "TX" #id "-CIF-Capture", \
345 .rates = SNDRV_PCM_RATE_8000_192000, \
346 .formats = SNDRV_PCM_FMTBIT_S8 | \
347 SNDRV_PCM_FMTBIT_S16_LE | \
348 SNDRV_PCM_FMTBIT_S32_LE, \
350 .ops = &tegra210_mixer_out_dai_ops, \
353 static struct snd_soc_dai_driver tegra210_mixer_dais[] = {
374 #define ADDER_CTRL_DECL(name, reg) \
375 static const struct snd_kcontrol_new name[] = { \
376 SOC_DAPM_SINGLE("RX1", reg, 0, 1, 0), \
377 SOC_DAPM_SINGLE("RX2", reg, 1, 1, 0), \
378 SOC_DAPM_SINGLE("RX3", reg, 2, 1, 0), \
379 SOC_DAPM_SINGLE("RX4", reg, 3, 1, 0), \
380 SOC_DAPM_SINGLE("RX5", reg, 4, 1, 0), \
381 SOC_DAPM_SINGLE("RX6", reg, 5, 1, 0), \
382 SOC_DAPM_SINGLE("RX7", reg, 6, 1, 0), \
383 SOC_DAPM_SINGLE("RX8", reg, 7, 1, 0), \
384 SOC_DAPM_SINGLE("RX9", reg, 8, 1, 0), \
385 SOC_DAPM_SINGLE("RX10", reg, 9, 1, 0), \
388 ADDER_CTRL_DECL(adder1, TEGRA210_MIXER_TX1_ADDER_CONFIG);
389 ADDER_CTRL_DECL(adder2, TEGRA210_MIXER_TX2_ADDER_CONFIG);
390 ADDER_CTRL_DECL(adder3, TEGRA210_MIXER_TX3_ADDER_CONFIG);
391 ADDER_CTRL_DECL(adder4, TEGRA210_MIXER_TX4_ADDER_CONFIG);
392 ADDER_CTRL_DECL(adder5, TEGRA210_MIXER_TX5_ADDER_CONFIG);
394 #define GAIN_CTRL(id) \
395 SOC_SINGLE_EXT("RX" #id " Gain Volume", \
396 MIXER_GAIN_CFG_RAM_ADDR((id) - 1), 0, \
397 0x20000, 0, tegra210_mixer_get_gain, \
398 tegra210_mixer_put_gain), \
399 SOC_SINGLE_EXT("RX" #id " Instant Gain Volume", \
400 MIXER_GAIN_CFG_RAM_ADDR((id) - 1), 0, \
401 0x20000, 0, tegra210_mixer_get_gain, \
402 tegra210_mixer_put_instant_gain),
404 /* Volume controls for all MIXER inputs */
405 static const struct snd_kcontrol_new tegra210_mixer_gain_ctls[] = {
418 static const struct snd_soc_dapm_widget tegra210_mixer_widgets[] = {
419 SND_SOC_DAPM_AIF_IN("RX1", NULL, 0, SND_SOC_NOPM, 0, 0),
420 SND_SOC_DAPM_AIF_IN("RX2", NULL, 0, SND_SOC_NOPM, 0, 0),
421 SND_SOC_DAPM_AIF_IN("RX3", NULL, 0, SND_SOC_NOPM, 0, 0),
422 SND_SOC_DAPM_AIF_IN("RX4", NULL, 0, SND_SOC_NOPM, 0, 0),
423 SND_SOC_DAPM_AIF_IN("RX5", NULL, 0, SND_SOC_NOPM, 0, 0),
424 SND_SOC_DAPM_AIF_IN("RX6", NULL, 0, SND_SOC_NOPM, 0, 0),
425 SND_SOC_DAPM_AIF_IN("RX7", NULL, 0, SND_SOC_NOPM, 0, 0),
426 SND_SOC_DAPM_AIF_IN("RX8", NULL, 0, SND_SOC_NOPM, 0, 0),
427 SND_SOC_DAPM_AIF_IN("RX9", NULL, 0, SND_SOC_NOPM, 0, 0),
428 SND_SOC_DAPM_AIF_IN("RX10", NULL, 0, SND_SOC_NOPM, 0, 0),
429 SND_SOC_DAPM_AIF_OUT("TX1", NULL, 0, TEGRA210_MIXER_TX1_ENABLE, 0, 0),
430 SND_SOC_DAPM_AIF_OUT("TX2", NULL, 0, TEGRA210_MIXER_TX2_ENABLE, 0, 0),
431 SND_SOC_DAPM_AIF_OUT("TX3", NULL, 0, TEGRA210_MIXER_TX3_ENABLE, 0, 0),
432 SND_SOC_DAPM_AIF_OUT("TX4", NULL, 0, TEGRA210_MIXER_TX4_ENABLE, 0, 0),
433 SND_SOC_DAPM_AIF_OUT("TX5", NULL, 0, TEGRA210_MIXER_TX5_ENABLE, 0, 0),
434 SND_SOC_DAPM_MIXER("Adder1", SND_SOC_NOPM, 1, 0, adder1,
436 SND_SOC_DAPM_MIXER("Adder2", SND_SOC_NOPM, 1, 0, adder2,
438 SND_SOC_DAPM_MIXER("Adder3", SND_SOC_NOPM, 1, 0, adder3,
440 SND_SOC_DAPM_MIXER("Adder4", SND_SOC_NOPM, 1, 0, adder4,
442 SND_SOC_DAPM_MIXER("Adder5", SND_SOC_NOPM, 1, 0, adder5,
446 #define RX_ROUTES(id, sname) \
447 { "RX" #id " XBAR-" sname, NULL, "RX" #id " XBAR-TX" }, \
448 { "RX" #id "-CIF-" sname, NULL, "RX" #id " XBAR-" sname }, \
449 { "RX" #id, NULL, "RX" #id "-CIF-" sname }
451 #define MIXER_RX_ROUTES(id) \
452 RX_ROUTES(id, "Playback"), \
453 RX_ROUTES(id, "Capture")
455 #define ADDER_ROUTES(id, sname) \
456 { "Adder" #id, "RX1", "RX1" }, \
457 { "Adder" #id, "RX2", "RX2" }, \
458 { "Adder" #id, "RX3", "RX3" }, \
459 { "Adder" #id, "RX4", "RX4" }, \
460 { "Adder" #id, "RX5", "RX5" }, \
461 { "Adder" #id, "RX6", "RX6" }, \
462 { "Adder" #id, "RX7", "RX7" }, \
463 { "Adder" #id, "RX8", "RX8" }, \
464 { "Adder" #id, "RX9", "RX9" }, \
465 { "Adder" #id, "RX10", "RX10" }, \
466 { "TX" #id, NULL, "Adder" #id }, \
467 { "TX" #id "-CIF-" sname, NULL, "TX" #id }, \
468 { "TX" #id " XBAR-" sname, NULL, "TX" #id "-CIF-" sname }, \
469 { "TX" #id " XBAR-RX", NULL, "TX" #id " XBAR-" sname } \
471 #define TX_ROUTES(id, sname) \
472 ADDER_ROUTES(1, sname), \
473 ADDER_ROUTES(2, sname), \
474 ADDER_ROUTES(3, sname), \
475 ADDER_ROUTES(4, sname), \
476 ADDER_ROUTES(5, sname)
478 #define MIXER_TX_ROUTES(id) \
479 TX_ROUTES(id, "Playback"), \
480 TX_ROUTES(id, "Capture")
482 static const struct snd_soc_dapm_route tegra210_mixer_routes[] = {
502 static const struct snd_soc_component_driver tegra210_mixer_cmpnt = {
503 .dapm_widgets = tegra210_mixer_widgets,
504 .num_dapm_widgets = ARRAY_SIZE(tegra210_mixer_widgets),
505 .dapm_routes = tegra210_mixer_routes,
506 .num_dapm_routes = ARRAY_SIZE(tegra210_mixer_routes),
507 .controls = tegra210_mixer_gain_ctls,
508 .num_controls = ARRAY_SIZE(tegra210_mixer_gain_ctls),
511 static bool tegra210_mixer_wr_reg(struct device *dev,
514 if (reg < TEGRA210_MIXER_RX_LIMIT)
515 reg = MIXER_REG_BASE(reg);
516 else if (reg < TEGRA210_MIXER_TX_LIMIT)
517 reg = MIXER_REG_BASE(reg) + TEGRA210_MIXER_TX1_ENABLE;
520 case TEGRA210_MIXER_RX1_SOFT_RESET:
521 case TEGRA210_MIXER_RX1_CIF_CTRL ... TEGRA210_MIXER_RX1_PEAK_CTRL:
523 case TEGRA210_MIXER_TX1_ENABLE:
524 case TEGRA210_MIXER_TX1_SOFT_RESET:
525 case TEGRA210_MIXER_TX1_INT_MASK ... TEGRA210_MIXER_TX1_ADDER_CONFIG:
527 case TEGRA210_MIXER_ENABLE ... TEGRA210_MIXER_CG:
528 case TEGRA210_MIXER_GAIN_CFG_RAM_CTRL ... TEGRA210_MIXER_CTRL:
535 static bool tegra210_mixer_rd_reg(struct device *dev,
538 if (reg < TEGRA210_MIXER_RX_LIMIT)
539 reg = MIXER_REG_BASE(reg);
540 else if (reg < TEGRA210_MIXER_TX_LIMIT)
541 reg = MIXER_REG_BASE(reg) + TEGRA210_MIXER_TX1_ENABLE;
544 case TEGRA210_MIXER_RX1_SOFT_RESET ... TEGRA210_MIXER_RX1_SAMPLE_COUNT:
545 case TEGRA210_MIXER_TX1_ENABLE ... TEGRA210_MIXER_TX1_ADDER_CONFIG:
546 case TEGRA210_MIXER_ENABLE ... TEGRA210_MIXER_CTRL:
553 static bool tegra210_mixer_volatile_reg(struct device *dev,
556 if (reg < TEGRA210_MIXER_RX_LIMIT)
557 reg = MIXER_REG_BASE(reg);
558 else if (reg < TEGRA210_MIXER_TX_LIMIT)
559 reg = MIXER_REG_BASE(reg) + TEGRA210_MIXER_TX1_ENABLE;
562 case TEGRA210_MIXER_RX1_SOFT_RESET:
563 case TEGRA210_MIXER_RX1_STATUS:
565 case TEGRA210_MIXER_TX1_SOFT_RESET:
566 case TEGRA210_MIXER_TX1_STATUS:
567 case TEGRA210_MIXER_TX1_INT_STATUS:
568 case TEGRA210_MIXER_TX1_INT_SET:
570 case TEGRA210_MIXER_SOFT_RESET:
571 case TEGRA210_MIXER_STATUS:
572 case TEGRA210_MIXER_INT_STATUS:
573 case TEGRA210_MIXER_GAIN_CFG_RAM_CTRL:
574 case TEGRA210_MIXER_GAIN_CFG_RAM_DATA:
575 case TEGRA210_MIXER_PEAKM_RAM_CTRL:
576 case TEGRA210_MIXER_PEAKM_RAM_DATA:
583 static bool tegra210_mixer_precious_reg(struct device *dev,
587 case TEGRA210_MIXER_GAIN_CFG_RAM_DATA:
588 case TEGRA210_MIXER_PEAKM_RAM_DATA:
595 static const struct regmap_config tegra210_mixer_regmap_config = {
599 .max_register = TEGRA210_MIXER_CTRL,
600 .writeable_reg = tegra210_mixer_wr_reg,
601 .readable_reg = tegra210_mixer_rd_reg,
602 .volatile_reg = tegra210_mixer_volatile_reg,
603 .precious_reg = tegra210_mixer_precious_reg,
604 .reg_defaults = tegra210_mixer_reg_defaults,
605 .num_reg_defaults = ARRAY_SIZE(tegra210_mixer_reg_defaults),
606 .cache_type = REGCACHE_FLAT,
609 static const struct of_device_id tegra210_mixer_of_match[] = {
610 { .compatible = "nvidia,tegra210-amixer" },
613 MODULE_DEVICE_TABLE(of, tegra210_mixer_of_match);
615 static int tegra210_mixer_platform_probe(struct platform_device *pdev)
617 struct device *dev = &pdev->dev;
618 struct tegra210_mixer *mixer;
622 mixer = devm_kzalloc(dev, sizeof(*mixer), GFP_KERNEL);
626 dev_set_drvdata(dev, mixer);
628 /* Use default gain value for all MIXER inputs */
629 for (i = 0; i < TEGRA210_MIXER_RX_MAX; i++)
630 mixer->gain_value[i] = gain_params.gain_value;
632 regs = devm_platform_ioremap_resource(pdev, 0);
634 return PTR_ERR(regs);
636 mixer->regmap = devm_regmap_init_mmio(dev, regs,
637 &tegra210_mixer_regmap_config);
638 if (IS_ERR(mixer->regmap)) {
639 dev_err(dev, "regmap init failed\n");
640 return PTR_ERR(mixer->regmap);
643 regcache_cache_only(mixer->regmap, true);
645 err = devm_snd_soc_register_component(dev, &tegra210_mixer_cmpnt,
647 ARRAY_SIZE(tegra210_mixer_dais));
649 dev_err(dev, "can't register MIXER component, err: %d\n", err);
653 pm_runtime_enable(dev);
658 static void tegra210_mixer_platform_remove(struct platform_device *pdev)
660 pm_runtime_disable(&pdev->dev);
663 static const struct dev_pm_ops tegra210_mixer_pm_ops = {
664 SET_RUNTIME_PM_OPS(tegra210_mixer_runtime_suspend,
665 tegra210_mixer_runtime_resume, NULL)
666 SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
667 pm_runtime_force_resume)
670 static struct platform_driver tegra210_mixer_driver = {
672 .name = "tegra210_mixer",
673 .of_match_table = tegra210_mixer_of_match,
674 .pm = &tegra210_mixer_pm_ops,
676 .probe = tegra210_mixer_platform_probe,
677 .remove_new = tegra210_mixer_platform_remove,
679 module_platform_driver(tegra210_mixer_driver);
681 MODULE_AUTHOR("Arun Shamanna Lakshmi <aruns@nvidia.com>");
682 MODULE_DESCRIPTION("Tegra210 MIXER ASoC driver");
683 MODULE_LICENSE("GPL v2");