.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * wm8731.c -- WM8731 ALSA SoC Audio driver |
---|
3 | 4 | * |
---|
.. | .. |
---|
7 | 8 | * Author: Richard Purdie <richard@openedhand.com> |
---|
8 | 9 | * |
---|
9 | 10 | * Based on wm8753.c by Liam Girdwood |
---|
10 | | - * |
---|
11 | | - * This program is free software; you can redistribute it and/or modify |
---|
12 | | - * it under the terms of the GNU General Public License version 2 as |
---|
13 | | - * published by the Free Software Foundation. |
---|
14 | 11 | */ |
---|
15 | 12 | |
---|
16 | 13 | #include <linux/module.h> |
---|
.. | .. |
---|
339 | 336 | { |
---|
340 | 337 | struct snd_soc_component *component = dai->component; |
---|
341 | 338 | struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(component); |
---|
342 | | - u16 iface = snd_soc_component_read32(component, WM8731_IFACE) & 0xfff3; |
---|
| 339 | + u16 iface = snd_soc_component_read(component, WM8731_IFACE) & 0xfff3; |
---|
343 | 340 | int i = get_coeff(wm8731->sysclk, params_rate(params)); |
---|
344 | 341 | u16 srate = (coeff_div[i].sr << 2) | |
---|
345 | 342 | (coeff_div[i].bosr << 1) | coeff_div[i].usb; |
---|
.. | .. |
---|
369 | 366 | return 0; |
---|
370 | 367 | } |
---|
371 | 368 | |
---|
372 | | -static int wm8731_mute(struct snd_soc_dai *dai, int mute) |
---|
| 369 | +static int wm8731_mute(struct snd_soc_dai *dai, int mute, int direction) |
---|
373 | 370 | { |
---|
374 | 371 | struct snd_soc_component *component = dai->component; |
---|
375 | | - u16 mute_reg = snd_soc_component_read32(component, WM8731_APDIGI) & 0xfff7; |
---|
| 372 | + u16 mute_reg = snd_soc_component_read(component, WM8731_APDIGI) & 0xfff7; |
---|
376 | 373 | |
---|
377 | 374 | if (mute) |
---|
378 | 375 | snd_soc_component_write(component, WM8731_APDIGI, mute_reg | 0x8); |
---|
.. | .. |
---|
513 | 510 | } |
---|
514 | 511 | |
---|
515 | 512 | /* Clear PWROFF, gate CLKOUT, everything else as-is */ |
---|
516 | | - reg = snd_soc_component_read32(component, WM8731_PWR) & 0xff7f; |
---|
| 513 | + reg = snd_soc_component_read(component, WM8731_PWR) & 0xff7f; |
---|
517 | 514 | snd_soc_component_write(component, WM8731_PWR, reg | 0x0040); |
---|
518 | 515 | break; |
---|
519 | 516 | case SND_SOC_BIAS_OFF: |
---|
.. | .. |
---|
549 | 546 | static const struct snd_soc_dai_ops wm8731_dai_ops = { |
---|
550 | 547 | .startup = wm8731_startup, |
---|
551 | 548 | .hw_params = wm8731_hw_params, |
---|
552 | | - .digital_mute = wm8731_mute, |
---|
| 549 | + .mute_stream = wm8731_mute, |
---|
553 | 550 | .set_sysclk = wm8731_set_dai_sysclk, |
---|
554 | 551 | .set_fmt = wm8731_set_dai_fmt, |
---|
| 552 | + .no_capture_mute = 1, |
---|
555 | 553 | }; |
---|
556 | 554 | |
---|
557 | 555 | static struct snd_soc_dai_driver wm8731_dai = { |
---|
.. | .. |
---|
604 | 602 | ret = wm8731_reset(wm8731->regmap); |
---|
605 | 603 | if (ret < 0) { |
---|
606 | 604 | dev_err(dev, "Failed to issue reset: %d\n", ret); |
---|
607 | | - goto err_regulator_enable; |
---|
| 605 | + goto err; |
---|
608 | 606 | } |
---|
609 | 607 | |
---|
610 | 608 | /* Clear POWEROFF, keep everything else disabled */ |
---|
.. | .. |
---|
621 | 619 | |
---|
622 | 620 | regcache_mark_dirty(wm8731->regmap); |
---|
623 | 621 | |
---|
624 | | -err_regulator_enable: |
---|
625 | | - /* Regulators will be enabled by bias management */ |
---|
626 | | - regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); |
---|
627 | | - |
---|
| 622 | +err: |
---|
628 | 623 | return ret; |
---|
629 | 624 | } |
---|
630 | 625 | |
---|
.. | .. |
---|
768 | 763 | ret = PTR_ERR(wm8731->regmap); |
---|
769 | 764 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", |
---|
770 | 765 | ret); |
---|
771 | | - return ret; |
---|
| 766 | + goto err_regulator_enable; |
---|
772 | 767 | } |
---|
773 | 768 | |
---|
774 | 769 | ret = wm8731_hw_init(&i2c->dev, wm8731); |
---|
775 | 770 | if (ret != 0) |
---|
776 | | - return ret; |
---|
| 771 | + goto err_regulator_enable; |
---|
777 | 772 | |
---|
778 | 773 | ret = devm_snd_soc_register_component(&i2c->dev, |
---|
779 | 774 | &soc_component_dev_wm8731, &wm8731_dai, 1); |
---|
780 | 775 | if (ret != 0) { |
---|
781 | 776 | dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); |
---|
782 | | - return ret; |
---|
| 777 | + goto err_regulator_enable; |
---|
783 | 778 | } |
---|
784 | 779 | |
---|
785 | 780 | return 0; |
---|
| 781 | + |
---|
| 782 | +err_regulator_enable: |
---|
| 783 | + /* Regulators will be enabled by bias management */ |
---|
| 784 | + regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); |
---|
| 785 | + |
---|
| 786 | + return ret; |
---|
786 | 787 | } |
---|
787 | 788 | |
---|
788 | 789 | static int wm8731_i2c_remove(struct i2c_client *client) |
---|