| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * wm8770.c -- WM8770 ALSA SoC Audio driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2010 Wolfson Microelectronics plc |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Dimitris Papastamos <dp@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> |
|---|
| .. | .. |
|---|
| 450 | 447 | } |
|---|
| 451 | 448 | |
|---|
| 452 | 449 | /* Only need to set MCLK/LRCLK ratio if we're master */ |
|---|
| 453 | | - if (snd_soc_component_read32(component, WM8770_MSTRCTRL) & 0x100) { |
|---|
| 450 | + if (snd_soc_component_read(component, WM8770_MSTRCTRL) & 0x100) { |
|---|
| 454 | 451 | for (; i < ARRAY_SIZE(mclk_ratios); ++i) { |
|---|
| 455 | 452 | ratio = wm8770->sysclk / params_rate(params); |
|---|
| 456 | 453 | if (ratio == mclk_ratios[i]) |
|---|
| .. | .. |
|---|
| 475 | 472 | return 0; |
|---|
| 476 | 473 | } |
|---|
| 477 | 474 | |
|---|
| 478 | | -static int wm8770_mute(struct snd_soc_dai *dai, int mute) |
|---|
| 475 | +static int wm8770_mute(struct snd_soc_dai *dai, int mute, int direction) |
|---|
| 479 | 476 | { |
|---|
| 480 | 477 | struct snd_soc_component *component; |
|---|
| 481 | 478 | |
|---|
| .. | .. |
|---|
| 541 | 538 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) |
|---|
| 542 | 539 | |
|---|
| 543 | 540 | static const struct snd_soc_dai_ops wm8770_dai_ops = { |
|---|
| 544 | | - .digital_mute = wm8770_mute, |
|---|
| 541 | + .mute_stream = wm8770_mute, |
|---|
| 545 | 542 | .hw_params = wm8770_hw_params, |
|---|
| 546 | 543 | .set_fmt = wm8770_set_fmt, |
|---|
| 547 | 544 | .set_sysclk = wm8770_set_sysclk, |
|---|
| 545 | + .no_capture_mute = 1, |
|---|
| 548 | 546 | }; |
|---|
| 549 | 547 | |
|---|
| 550 | 548 | static struct snd_soc_dai_driver wm8770_dai = { |
|---|
| .. | .. |
|---|
| 666 | 664 | |
|---|
| 667 | 665 | /* This should really be moved into the regulator core */ |
|---|
| 668 | 666 | for (i = 0; i < ARRAY_SIZE(wm8770->supplies); i++) { |
|---|
| 669 | | - ret = regulator_register_notifier(wm8770->supplies[i].consumer, |
|---|
| 670 | | - &wm8770->disable_nb[i]); |
|---|
| 667 | + ret = devm_regulator_register_notifier( |
|---|
| 668 | + wm8770->supplies[i].consumer, |
|---|
| 669 | + &wm8770->disable_nb[i]); |
|---|
| 671 | 670 | if (ret) { |
|---|
| 672 | 671 | dev_err(&spi->dev, |
|---|
| 673 | 672 | "Failed to register regulator notifier: %d\n", |
|---|
| .. | .. |
|---|
| 687 | 686 | return ret; |
|---|
| 688 | 687 | } |
|---|
| 689 | 688 | |
|---|
| 690 | | -static int wm8770_spi_remove(struct spi_device *spi) |
|---|
| 691 | | -{ |
|---|
| 692 | | - struct wm8770_priv *wm8770 = spi_get_drvdata(spi); |
|---|
| 693 | | - int i; |
|---|
| 694 | | - |
|---|
| 695 | | - for (i = 0; i < ARRAY_SIZE(wm8770->supplies); ++i) |
|---|
| 696 | | - regulator_unregister_notifier(wm8770->supplies[i].consumer, |
|---|
| 697 | | - &wm8770->disable_nb[i]); |
|---|
| 698 | | - |
|---|
| 699 | | - return 0; |
|---|
| 700 | | -} |
|---|
| 701 | | - |
|---|
| 702 | 689 | static struct spi_driver wm8770_spi_driver = { |
|---|
| 703 | 690 | .driver = { |
|---|
| 704 | 691 | .name = "wm8770", |
|---|
| 705 | 692 | .of_match_table = wm8770_of_match, |
|---|
| 706 | 693 | }, |
|---|
| 707 | 694 | .probe = wm8770_spi_probe, |
|---|
| 708 | | - .remove = wm8770_spi_remove |
|---|
| 709 | 695 | }; |
|---|
| 710 | 696 | |
|---|
| 711 | 697 | module_spi_driver(wm8770_spi_driver); |
|---|