hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/soc/codecs/wm8510.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * wm8510.c -- WM8510 ALSA Soc Audio driver
34 *
45 * Copyright 2006 Wolfson Microelectronics PLC.
56 *
67 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
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.
118 */
129
1310 #include <linux/module.h>
....@@ -321,11 +318,11 @@
321318
322319 if (freq_in == 0 || freq_out == 0) {
323320 /* Clock CODEC directly from MCLK */
324
- reg = snd_soc_component_read32(component, WM8510_CLOCK);
321
+ reg = snd_soc_component_read(component, WM8510_CLOCK);
325322 snd_soc_component_write(component, WM8510_CLOCK, reg & 0x0ff);
326323
327324 /* Turn off PLL */
328
- reg = snd_soc_component_read32(component, WM8510_POWER1);
325
+ reg = snd_soc_component_read(component, WM8510_POWER1);
329326 snd_soc_component_write(component, WM8510_POWER1, reg & 0x1df);
330327 return 0;
331328 }
....@@ -336,11 +333,11 @@
336333 snd_soc_component_write(component, WM8510_PLLK1, pll_div.k >> 18);
337334 snd_soc_component_write(component, WM8510_PLLK2, (pll_div.k >> 9) & 0x1ff);
338335 snd_soc_component_write(component, WM8510_PLLK3, pll_div.k & 0x1ff);
339
- reg = snd_soc_component_read32(component, WM8510_POWER1);
336
+ reg = snd_soc_component_read(component, WM8510_POWER1);
340337 snd_soc_component_write(component, WM8510_POWER1, reg | 0x020);
341338
342339 /* Run CODEC from PLL instead of MCLK */
343
- reg = snd_soc_component_read32(component, WM8510_CLOCK);
340
+ reg = snd_soc_component_read(component, WM8510_CLOCK);
344341 snd_soc_component_write(component, WM8510_CLOCK, reg | 0x100);
345342
346343 return 0;
....@@ -357,23 +354,23 @@
357354
358355 switch (div_id) {
359356 case WM8510_OPCLKDIV:
360
- reg = snd_soc_component_read32(component, WM8510_GPIO) & 0x1cf;
357
+ reg = snd_soc_component_read(component, WM8510_GPIO) & 0x1cf;
361358 snd_soc_component_write(component, WM8510_GPIO, reg | div);
362359 break;
363360 case WM8510_MCLKDIV:
364
- reg = snd_soc_component_read32(component, WM8510_CLOCK) & 0x11f;
361
+ reg = snd_soc_component_read(component, WM8510_CLOCK) & 0x11f;
365362 snd_soc_component_write(component, WM8510_CLOCK, reg | div);
366363 break;
367364 case WM8510_ADCCLK:
368
- reg = snd_soc_component_read32(component, WM8510_ADC) & 0x1f7;
365
+ reg = snd_soc_component_read(component, WM8510_ADC) & 0x1f7;
369366 snd_soc_component_write(component, WM8510_ADC, reg | div);
370367 break;
371368 case WM8510_DACCLK:
372
- reg = snd_soc_component_read32(component, WM8510_DAC) & 0x1f7;
369
+ reg = snd_soc_component_read(component, WM8510_DAC) & 0x1f7;
373370 snd_soc_component_write(component, WM8510_DAC, reg | div);
374371 break;
375372 case WM8510_BCLKDIV:
376
- reg = snd_soc_component_read32(component, WM8510_CLOCK) & 0x1e3;
373
+ reg = snd_soc_component_read(component, WM8510_CLOCK) & 0x1e3;
377374 snd_soc_component_write(component, WM8510_CLOCK, reg | div);
378375 break;
379376 default:
....@@ -388,7 +385,7 @@
388385 {
389386 struct snd_soc_component *component = codec_dai->component;
390387 u16 iface = 0;
391
- u16 clk = snd_soc_component_read32(component, WM8510_CLOCK) & 0x1fe;
388
+ u16 clk = snd_soc_component_read(component, WM8510_CLOCK) & 0x1fe;
392389
393390 /* set master/slave audio interface */
394391 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
....@@ -445,8 +442,8 @@
445442 struct snd_soc_dai *dai)
446443 {
447444 struct snd_soc_component *component = dai->component;
448
- u16 iface = snd_soc_component_read32(component, WM8510_IFACE) & 0x19f;
449
- u16 adn = snd_soc_component_read32(component, WM8510_ADD) & 0x1f1;
445
+ u16 iface = snd_soc_component_read(component, WM8510_IFACE) & 0x19f;
446
+ u16 adn = snd_soc_component_read(component, WM8510_ADD) & 0x1f1;
450447
451448 /* bit size */
452449 switch (params_width(params)) {
....@@ -490,10 +487,10 @@
490487 return 0;
491488 }
492489
493
-static int wm8510_mute(struct snd_soc_dai *dai, int mute)
490
+static int wm8510_mute(struct snd_soc_dai *dai, int mute, int direction)
494491 {
495492 struct snd_soc_component *component = dai->component;
496
- u16 mute_reg = snd_soc_component_read32(component, WM8510_DAC) & 0xffbf;
493
+ u16 mute_reg = snd_soc_component_read(component, WM8510_DAC) & 0xffbf;
497494
498495 if (mute)
499496 snd_soc_component_write(component, WM8510_DAC, mute_reg | 0x40);
....@@ -507,7 +504,7 @@
507504 enum snd_soc_bias_level level)
508505 {
509506 struct wm8510_priv *wm8510 = snd_soc_component_get_drvdata(component);
510
- u16 power1 = snd_soc_component_read32(component, WM8510_POWER1) & ~0x3;
507
+ u16 power1 = snd_soc_component_read(component, WM8510_POWER1) & ~0x3;
511508
512509 switch (level) {
513510 case SND_SOC_BIAS_ON:
....@@ -550,10 +547,11 @@
550547
551548 static const struct snd_soc_dai_ops wm8510_dai_ops = {
552549 .hw_params = wm8510_pcm_hw_params,
553
- .digital_mute = wm8510_mute,
550
+ .mute_stream = wm8510_mute,
554551 .set_fmt = wm8510_set_dai_fmt,
555552 .set_clkdiv = wm8510_set_dai_clkdiv,
556553 .set_pll = wm8510_set_dai_pll,
554
+ .no_capture_mute = 1,
557555 };
558556
559557 static struct snd_soc_dai_driver wm8510_dai = {