.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * ALSA SoC TLV320AIC23 codec driver |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * Copyright: (C) 2008 Mistral Solutions Pvt Ltd., |
---|
6 | 7 | * |
---|
7 | 8 | * Based on sound/soc/codecs/wm8731.c by Richard Purdie |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or modify |
---|
10 | | - * it under the terms of the GNU General Public License version 2 as |
---|
11 | | - * published by the Free Software Foundation. |
---|
12 | 9 | * |
---|
13 | 10 | * Notes: |
---|
14 | 11 | * The AIC23 is a driver for a low power stereo audio |
---|
.. | .. |
---|
70 | 67 | static const struct snd_kcontrol_new tlv320aic23_rec_src_mux_controls = |
---|
71 | 68 | SOC_DAPM_ENUM("Input Select", rec_src_enum); |
---|
72 | 69 | |
---|
73 | | -static SOC_ENUM_SINGLE_DECL(tlv320aic23_rec_src, |
---|
74 | | - TLV320AIC23_ANLG, 2, rec_src_text); |
---|
75 | 70 | static SOC_ENUM_SINGLE_DECL(tlv320aic23_deemph, |
---|
76 | 71 | TLV320AIC23_DIGT, 1, deemph_text); |
---|
77 | 72 | |
---|
.. | .. |
---|
96 | 91 | */ |
---|
97 | 92 | val = (val >= 4) ? 4 : (3 - val); |
---|
98 | 93 | |
---|
99 | | - reg = snd_soc_component_read32(component, TLV320AIC23_ANLG) & (~0x1C0); |
---|
| 94 | + reg = snd_soc_component_read(component, TLV320AIC23_ANLG) & (~0x1C0); |
---|
100 | 95 | snd_soc_component_write(component, TLV320AIC23_ANLG, reg | (val << 6)); |
---|
101 | 96 | |
---|
102 | 97 | return 0; |
---|
.. | .. |
---|
108 | 103 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
---|
109 | 104 | u16 val; |
---|
110 | 105 | |
---|
111 | | - val = snd_soc_component_read32(component, TLV320AIC23_ANLG) & (0x1C0); |
---|
| 106 | + val = snd_soc_component_read(component, TLV320AIC23_ANLG) & (0x1C0); |
---|
112 | 107 | val = val >> 6; |
---|
113 | 108 | val = (val >= 4) ? 4 : (3 - val); |
---|
114 | 109 | ucontrol->value.integer.value[0] = val; |
---|
.. | .. |
---|
299 | 294 | static void get_current_sample_rates(struct snd_soc_component *component, int mclk, |
---|
300 | 295 | u32 *sample_rate_adc, u32 *sample_rate_dac) |
---|
301 | 296 | { |
---|
302 | | - int src = snd_soc_component_read32(component, TLV320AIC23_SRATE); |
---|
| 297 | + int src = snd_soc_component_read(component, TLV320AIC23_SRATE); |
---|
303 | 298 | int sr = (src >> 2) & 0x0f; |
---|
304 | 299 | int val = (mclk / bosr_usb_divisor_table[src & 3]); |
---|
305 | 300 | int adc = (val * sr_adc_mult_table[sr]) / SR_MULT; |
---|
.. | .. |
---|
361 | 356 | if (ret < 0) |
---|
362 | 357 | return ret; |
---|
363 | 358 | |
---|
364 | | - iface_reg = snd_soc_component_read32(component, TLV320AIC23_DIGT_FMT) & ~(0x03 << 2); |
---|
| 359 | + iface_reg = snd_soc_component_read(component, TLV320AIC23_DIGT_FMT) & ~(0x03 << 2); |
---|
365 | 360 | |
---|
366 | 361 | switch (params_width(params)) { |
---|
367 | 362 | case 16: |
---|
.. | .. |
---|
399 | 394 | struct aic23 *aic23 = snd_soc_component_get_drvdata(component); |
---|
400 | 395 | |
---|
401 | 396 | /* deactivate */ |
---|
402 | | - if (!snd_soc_component_is_active(component)) { |
---|
| 397 | + if (!snd_soc_component_active(component)) { |
---|
403 | 398 | udelay(50); |
---|
404 | 399 | snd_soc_component_write(component, TLV320AIC23_ACTIVE, 0x0); |
---|
405 | 400 | } |
---|
.. | .. |
---|
409 | 404 | aic23->requested_adc = 0; |
---|
410 | 405 | } |
---|
411 | 406 | |
---|
412 | | -static int tlv320aic23_mute(struct snd_soc_dai *dai, int mute) |
---|
| 407 | +static int tlv320aic23_mute(struct snd_soc_dai *dai, int mute, int direction) |
---|
413 | 408 | { |
---|
414 | 409 | struct snd_soc_component *component = dai->component; |
---|
415 | 410 | u16 reg; |
---|
416 | 411 | |
---|
417 | | - reg = snd_soc_component_read32(component, TLV320AIC23_DIGT); |
---|
| 412 | + reg = snd_soc_component_read(component, TLV320AIC23_DIGT); |
---|
418 | 413 | if (mute) |
---|
419 | 414 | reg |= TLV320AIC23_DACM_MUTE; |
---|
420 | 415 | |
---|
.. | .. |
---|
432 | 427 | struct snd_soc_component *component = codec_dai->component; |
---|
433 | 428 | u16 iface_reg; |
---|
434 | 429 | |
---|
435 | | - iface_reg = snd_soc_component_read32(component, TLV320AIC23_DIGT_FMT) & (~0x03); |
---|
| 430 | + iface_reg = snd_soc_component_read(component, TLV320AIC23_DIGT_FMT) & (~0x03); |
---|
436 | 431 | |
---|
437 | 432 | /* set master/slave audio interface */ |
---|
438 | 433 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
---|
.. | .. |
---|
454 | 449 | break; |
---|
455 | 450 | case SND_SOC_DAIFMT_DSP_A: |
---|
456 | 451 | iface_reg |= TLV320AIC23_LRP_ON; |
---|
457 | | - /* fall through */ |
---|
| 452 | + fallthrough; |
---|
458 | 453 | case SND_SOC_DAIFMT_DSP_B: |
---|
459 | 454 | iface_reg |= TLV320AIC23_FOR_DSP; |
---|
460 | 455 | break; |
---|
.. | .. |
---|
484 | 479 | static int tlv320aic23_set_bias_level(struct snd_soc_component *component, |
---|
485 | 480 | enum snd_soc_bias_level level) |
---|
486 | 481 | { |
---|
487 | | - u16 reg = snd_soc_component_read32(component, TLV320AIC23_PWR) & 0x17f; |
---|
| 482 | + u16 reg = snd_soc_component_read(component, TLV320AIC23_PWR) & 0x17f; |
---|
488 | 483 | |
---|
489 | 484 | switch (level) { |
---|
490 | 485 | case SND_SOC_BIAS_ON: |
---|
.. | .. |
---|
517 | 512 | .prepare = tlv320aic23_pcm_prepare, |
---|
518 | 513 | .hw_params = tlv320aic23_hw_params, |
---|
519 | 514 | .shutdown = tlv320aic23_shutdown, |
---|
520 | | - .digital_mute = tlv320aic23_mute, |
---|
| 515 | + .mute_stream = tlv320aic23_mute, |
---|
521 | 516 | .set_fmt = tlv320aic23_set_dai_fmt, |
---|
522 | 517 | .set_sysclk = tlv320aic23_set_dai_sysclk, |
---|
| 518 | + .no_capture_mute = 1, |
---|
523 | 519 | }; |
---|
524 | 520 | |
---|
525 | 521 | static struct snd_soc_dai_driver tlv320aic23_dai = { |
---|