| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * wm8510.c -- WM8510 ALSA Soc Audio driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2006 Wolfson Microelectronics PLC. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * 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. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 321 | 318 | |
|---|
| 322 | 319 | if (freq_in == 0 || freq_out == 0) { |
|---|
| 323 | 320 | /* Clock CODEC directly from MCLK */ |
|---|
| 324 | | - reg = snd_soc_component_read32(component, WM8510_CLOCK); |
|---|
| 321 | + reg = snd_soc_component_read(component, WM8510_CLOCK); |
|---|
| 325 | 322 | snd_soc_component_write(component, WM8510_CLOCK, reg & 0x0ff); |
|---|
| 326 | 323 | |
|---|
| 327 | 324 | /* Turn off PLL */ |
|---|
| 328 | | - reg = snd_soc_component_read32(component, WM8510_POWER1); |
|---|
| 325 | + reg = snd_soc_component_read(component, WM8510_POWER1); |
|---|
| 329 | 326 | snd_soc_component_write(component, WM8510_POWER1, reg & 0x1df); |
|---|
| 330 | 327 | return 0; |
|---|
| 331 | 328 | } |
|---|
| .. | .. |
|---|
| 336 | 333 | snd_soc_component_write(component, WM8510_PLLK1, pll_div.k >> 18); |
|---|
| 337 | 334 | snd_soc_component_write(component, WM8510_PLLK2, (pll_div.k >> 9) & 0x1ff); |
|---|
| 338 | 335 | 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); |
|---|
| 340 | 337 | snd_soc_component_write(component, WM8510_POWER1, reg | 0x020); |
|---|
| 341 | 338 | |
|---|
| 342 | 339 | /* 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); |
|---|
| 344 | 341 | snd_soc_component_write(component, WM8510_CLOCK, reg | 0x100); |
|---|
| 345 | 342 | |
|---|
| 346 | 343 | return 0; |
|---|
| .. | .. |
|---|
| 357 | 354 | |
|---|
| 358 | 355 | switch (div_id) { |
|---|
| 359 | 356 | case WM8510_OPCLKDIV: |
|---|
| 360 | | - reg = snd_soc_component_read32(component, WM8510_GPIO) & 0x1cf; |
|---|
| 357 | + reg = snd_soc_component_read(component, WM8510_GPIO) & 0x1cf; |
|---|
| 361 | 358 | snd_soc_component_write(component, WM8510_GPIO, reg | div); |
|---|
| 362 | 359 | break; |
|---|
| 363 | 360 | case WM8510_MCLKDIV: |
|---|
| 364 | | - reg = snd_soc_component_read32(component, WM8510_CLOCK) & 0x11f; |
|---|
| 361 | + reg = snd_soc_component_read(component, WM8510_CLOCK) & 0x11f; |
|---|
| 365 | 362 | snd_soc_component_write(component, WM8510_CLOCK, reg | div); |
|---|
| 366 | 363 | break; |
|---|
| 367 | 364 | case WM8510_ADCCLK: |
|---|
| 368 | | - reg = snd_soc_component_read32(component, WM8510_ADC) & 0x1f7; |
|---|
| 365 | + reg = snd_soc_component_read(component, WM8510_ADC) & 0x1f7; |
|---|
| 369 | 366 | snd_soc_component_write(component, WM8510_ADC, reg | div); |
|---|
| 370 | 367 | break; |
|---|
| 371 | 368 | case WM8510_DACCLK: |
|---|
| 372 | | - reg = snd_soc_component_read32(component, WM8510_DAC) & 0x1f7; |
|---|
| 369 | + reg = snd_soc_component_read(component, WM8510_DAC) & 0x1f7; |
|---|
| 373 | 370 | snd_soc_component_write(component, WM8510_DAC, reg | div); |
|---|
| 374 | 371 | break; |
|---|
| 375 | 372 | case WM8510_BCLKDIV: |
|---|
| 376 | | - reg = snd_soc_component_read32(component, WM8510_CLOCK) & 0x1e3; |
|---|
| 373 | + reg = snd_soc_component_read(component, WM8510_CLOCK) & 0x1e3; |
|---|
| 377 | 374 | snd_soc_component_write(component, WM8510_CLOCK, reg | div); |
|---|
| 378 | 375 | break; |
|---|
| 379 | 376 | default: |
|---|
| .. | .. |
|---|
| 388 | 385 | { |
|---|
| 389 | 386 | struct snd_soc_component *component = codec_dai->component; |
|---|
| 390 | 387 | 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; |
|---|
| 392 | 389 | |
|---|
| 393 | 390 | /* set master/slave audio interface */ |
|---|
| 394 | 391 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
|---|
| .. | .. |
|---|
| 445 | 442 | struct snd_soc_dai *dai) |
|---|
| 446 | 443 | { |
|---|
| 447 | 444 | 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; |
|---|
| 450 | 447 | |
|---|
| 451 | 448 | /* bit size */ |
|---|
| 452 | 449 | switch (params_width(params)) { |
|---|
| .. | .. |
|---|
| 490 | 487 | return 0; |
|---|
| 491 | 488 | } |
|---|
| 492 | 489 | |
|---|
| 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) |
|---|
| 494 | 491 | { |
|---|
| 495 | 492 | 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; |
|---|
| 497 | 494 | |
|---|
| 498 | 495 | if (mute) |
|---|
| 499 | 496 | snd_soc_component_write(component, WM8510_DAC, mute_reg | 0x40); |
|---|
| .. | .. |
|---|
| 507 | 504 | enum snd_soc_bias_level level) |
|---|
| 508 | 505 | { |
|---|
| 509 | 506 | 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; |
|---|
| 511 | 508 | |
|---|
| 512 | 509 | switch (level) { |
|---|
| 513 | 510 | case SND_SOC_BIAS_ON: |
|---|
| .. | .. |
|---|
| 550 | 547 | |
|---|
| 551 | 548 | static const struct snd_soc_dai_ops wm8510_dai_ops = { |
|---|
| 552 | 549 | .hw_params = wm8510_pcm_hw_params, |
|---|
| 553 | | - .digital_mute = wm8510_mute, |
|---|
| 550 | + .mute_stream = wm8510_mute, |
|---|
| 554 | 551 | .set_fmt = wm8510_set_dai_fmt, |
|---|
| 555 | 552 | .set_clkdiv = wm8510_set_dai_clkdiv, |
|---|
| 556 | 553 | .set_pll = wm8510_set_dai_pll, |
|---|
| 554 | + .no_capture_mute = 1, |
|---|
| 557 | 555 | }; |
|---|
| 558 | 556 | |
|---|
| 559 | 557 | static struct snd_soc_dai_driver wm8510_dai = { |
|---|