.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * wm8993.c -- WM8993 ALSA SoC audio driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright 2009-12 Wolfson Microelectronics plc |
---|
5 | 6 | * |
---|
6 | 7 | * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License version 2 as |
---|
10 | | - * published by the Free Software Foundation. |
---|
11 | 8 | */ |
---|
12 | 9 | |
---|
13 | 10 | #include <linux/module.h> |
---|
.. | .. |
---|
486 | 483 | wm8993->fll_fref = 0; |
---|
487 | 484 | wm8993->fll_fout = 0; |
---|
488 | 485 | |
---|
489 | | - reg1 = snd_soc_component_read32(component, WM8993_FLL_CONTROL_1); |
---|
| 486 | + reg1 = snd_soc_component_read(component, WM8993_FLL_CONTROL_1); |
---|
490 | 487 | reg1 &= ~WM8993_FLL_ENA; |
---|
491 | 488 | snd_soc_component_write(component, WM8993_FLL_CONTROL_1, reg1); |
---|
492 | 489 | |
---|
.. | .. |
---|
497 | 494 | if (ret != 0) |
---|
498 | 495 | return ret; |
---|
499 | 496 | |
---|
500 | | - reg5 = snd_soc_component_read32(component, WM8993_FLL_CONTROL_5); |
---|
| 497 | + reg5 = snd_soc_component_read(component, WM8993_FLL_CONTROL_5); |
---|
501 | 498 | reg5 &= ~WM8993_FLL_CLK_SRC_MASK; |
---|
502 | 499 | |
---|
503 | 500 | switch (fll_id) { |
---|
.. | .. |
---|
519 | 516 | |
---|
520 | 517 | /* Any FLL configuration change requires that the FLL be |
---|
521 | 518 | * disabled first. */ |
---|
522 | | - reg1 = snd_soc_component_read32(component, WM8993_FLL_CONTROL_1); |
---|
| 519 | + reg1 = snd_soc_component_read(component, WM8993_FLL_CONTROL_1); |
---|
523 | 520 | reg1 &= ~WM8993_FLL_ENA; |
---|
524 | 521 | snd_soc_component_write(component, WM8993_FLL_CONTROL_1, reg1); |
---|
525 | 522 | |
---|
.. | .. |
---|
535 | 532 | (fll_div.fll_fratio << WM8993_FLL_FRATIO_SHIFT)); |
---|
536 | 533 | snd_soc_component_write(component, WM8993_FLL_CONTROL_3, fll_div.k); |
---|
537 | 534 | |
---|
538 | | - reg4 = snd_soc_component_read32(component, WM8993_FLL_CONTROL_4); |
---|
| 535 | + reg4 = snd_soc_component_read(component, WM8993_FLL_CONTROL_4); |
---|
539 | 536 | reg4 &= ~WM8993_FLL_N_MASK; |
---|
540 | 537 | reg4 |= fll_div.n << WM8993_FLL_N_SHIFT; |
---|
541 | 538 | snd_soc_component_write(component, WM8993_FLL_CONTROL_4, reg4); |
---|
.. | .. |
---|
586 | 583 | case WM8993_SYSCLK_MCLK: |
---|
587 | 584 | dev_dbg(component->dev, "Using %dHz MCLK\n", wm8993->mclk_rate); |
---|
588 | 585 | |
---|
589 | | - reg = snd_soc_component_read32(component, WM8993_CLOCKING_2); |
---|
| 586 | + reg = snd_soc_component_read(component, WM8993_CLOCKING_2); |
---|
590 | 587 | reg &= ~(WM8993_MCLK_DIV | WM8993_SYSCLK_SRC); |
---|
591 | 588 | if (wm8993->mclk_rate > 13500000) { |
---|
592 | 589 | reg |= WM8993_MCLK_DIV; |
---|
.. | .. |
---|
602 | 599 | dev_dbg(component->dev, "Using %dHz FLL clock\n", |
---|
603 | 600 | wm8993->fll_fout); |
---|
604 | 601 | |
---|
605 | | - reg = snd_soc_component_read32(component, WM8993_CLOCKING_2); |
---|
| 602 | + reg = snd_soc_component_read(component, WM8993_CLOCKING_2); |
---|
606 | 603 | reg |= WM8993_SYSCLK_SRC; |
---|
607 | 604 | if (wm8993->fll_fout > 13500000) { |
---|
608 | 605 | reg |= WM8993_MCLK_DIV; |
---|
.. | .. |
---|
1076 | 1073 | switch (clk_id) { |
---|
1077 | 1074 | case WM8993_SYSCLK_MCLK: |
---|
1078 | 1075 | wm8993->mclk_rate = freq; |
---|
1079 | | - /* fall through */ |
---|
| 1076 | + fallthrough; |
---|
1080 | 1077 | case WM8993_SYSCLK_FLL: |
---|
1081 | 1078 | wm8993->sysclk_source = clk_id; |
---|
1082 | 1079 | break; |
---|
.. | .. |
---|
1093 | 1090 | { |
---|
1094 | 1091 | struct snd_soc_component *component = dai->component; |
---|
1095 | 1092 | struct wm8993_priv *wm8993 = snd_soc_component_get_drvdata(component); |
---|
1096 | | - unsigned int aif1 = snd_soc_component_read32(component, WM8993_AUDIO_INTERFACE_1); |
---|
1097 | | - unsigned int aif4 = snd_soc_component_read32(component, WM8993_AUDIO_INTERFACE_4); |
---|
| 1093 | + unsigned int aif1 = snd_soc_component_read(component, WM8993_AUDIO_INTERFACE_1); |
---|
| 1094 | + unsigned int aif4 = snd_soc_component_read(component, WM8993_AUDIO_INTERFACE_4); |
---|
1098 | 1095 | |
---|
1099 | 1096 | aif1 &= ~(WM8993_BCLK_DIR | WM8993_AIF_BCLK_INV | |
---|
1100 | 1097 | WM8993_AIF_LRCLK_INV | WM8993_AIF_FMT_MASK); |
---|
.. | .. |
---|
1124 | 1121 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
---|
1125 | 1122 | case SND_SOC_DAIFMT_DSP_B: |
---|
1126 | 1123 | aif1 |= WM8993_AIF_LRCLK_INV; |
---|
1127 | | - /* fall through */ |
---|
| 1124 | + fallthrough; |
---|
1128 | 1125 | case SND_SOC_DAIFMT_DSP_A: |
---|
1129 | 1126 | aif1 |= 0x18; |
---|
1130 | 1127 | break; |
---|
.. | .. |
---|
1193 | 1190 | int ret, i, best, best_val, cur_val; |
---|
1194 | 1191 | unsigned int clocking1, clocking3, aif1, aif4; |
---|
1195 | 1192 | |
---|
1196 | | - clocking1 = snd_soc_component_read32(component, WM8993_CLOCKING_1); |
---|
| 1193 | + clocking1 = snd_soc_component_read(component, WM8993_CLOCKING_1); |
---|
1197 | 1194 | clocking1 &= ~WM8993_BCLK_DIV_MASK; |
---|
1198 | 1195 | |
---|
1199 | | - clocking3 = snd_soc_component_read32(component, WM8993_CLOCKING_3); |
---|
| 1196 | + clocking3 = snd_soc_component_read(component, WM8993_CLOCKING_3); |
---|
1200 | 1197 | clocking3 &= ~(WM8993_CLK_SYS_RATE_MASK | WM8993_SAMPLE_RATE_MASK); |
---|
1201 | 1198 | |
---|
1202 | | - aif1 = snd_soc_component_read32(component, WM8993_AUDIO_INTERFACE_1); |
---|
| 1199 | + aif1 = snd_soc_component_read(component, WM8993_AUDIO_INTERFACE_1); |
---|
1203 | 1200 | aif1 &= ~WM8993_AIF_WL_MASK; |
---|
1204 | 1201 | |
---|
1205 | | - aif4 = snd_soc_component_read32(component, WM8993_AUDIO_INTERFACE_4); |
---|
| 1202 | + aif4 = snd_soc_component_read(component, WM8993_AUDIO_INTERFACE_4); |
---|
1206 | 1203 | aif4 &= ~WM8993_LRCLK_RATE_MASK; |
---|
1207 | 1204 | |
---|
1208 | 1205 | /* What BCLK do we need? */ |
---|
.. | .. |
---|
1302 | 1299 | |
---|
1303 | 1300 | /* ReTune Mobile? */ |
---|
1304 | 1301 | if (wm8993->pdata.num_retune_configs) { |
---|
1305 | | - u16 eq1 = snd_soc_component_read32(component, WM8993_EQ1); |
---|
| 1302 | + u16 eq1 = snd_soc_component_read(component, WM8993_EQ1); |
---|
1306 | 1303 | struct wm8993_retune_mobile_setting *s; |
---|
1307 | 1304 | |
---|
1308 | 1305 | best = 0; |
---|
.. | .. |
---|
1333 | 1330 | return 0; |
---|
1334 | 1331 | } |
---|
1335 | 1332 | |
---|
1336 | | -static int wm8993_digital_mute(struct snd_soc_dai *codec_dai, int mute) |
---|
| 1333 | +static int wm8993_mute(struct snd_soc_dai *codec_dai, int mute, int direction) |
---|
1337 | 1334 | { |
---|
1338 | 1335 | struct snd_soc_component *component = codec_dai->component; |
---|
1339 | 1336 | unsigned int reg; |
---|
1340 | 1337 | |
---|
1341 | | - reg = snd_soc_component_read32(component, WM8993_DAC_CTRL); |
---|
| 1338 | + reg = snd_soc_component_read(component, WM8993_DAC_CTRL); |
---|
1342 | 1339 | |
---|
1343 | 1340 | if (mute) |
---|
1344 | 1341 | reg |= WM8993_DAC_MUTE; |
---|
.. | .. |
---|
1447 | 1444 | .set_sysclk = wm8993_set_sysclk, |
---|
1448 | 1445 | .set_fmt = wm8993_set_dai_fmt, |
---|
1449 | 1446 | .hw_params = wm8993_hw_params, |
---|
1450 | | - .digital_mute = wm8993_digital_mute, |
---|
| 1447 | + .mute_stream = wm8993_mute, |
---|
1451 | 1448 | .set_pll = wm8993_set_fll, |
---|
1452 | 1449 | .set_tdm_slot = wm8993_set_tdm_slot, |
---|
| 1450 | + .no_capture_mute = 1, |
---|
1453 | 1451 | }; |
---|
1454 | 1452 | |
---|
1455 | 1453 | #define WM8993_RATES SNDRV_PCM_RATE_8000_48000 |
---|