forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/sound/soc/codecs/wm8770.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * wm8770.c -- WM8770 ALSA SoC Audio driver
34 *
45 * Copyright 2010 Wolfson Microelectronics plc
56 *
67 * 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.
118 */
129
1310 #include <linux/module.h>
....@@ -450,7 +447,7 @@
450447 }
451448
452449 /* 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) {
454451 for (; i < ARRAY_SIZE(mclk_ratios); ++i) {
455452 ratio = wm8770->sysclk / params_rate(params);
456453 if (ratio == mclk_ratios[i])
....@@ -475,7 +472,7 @@
475472 return 0;
476473 }
477474
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)
479476 {
480477 struct snd_soc_component *component;
481478
....@@ -541,10 +538,11 @@
541538 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
542539
543540 static const struct snd_soc_dai_ops wm8770_dai_ops = {
544
- .digital_mute = wm8770_mute,
541
+ .mute_stream = wm8770_mute,
545542 .hw_params = wm8770_hw_params,
546543 .set_fmt = wm8770_set_fmt,
547544 .set_sysclk = wm8770_set_sysclk,
545
+ .no_capture_mute = 1,
548546 };
549547
550548 static struct snd_soc_dai_driver wm8770_dai = {
....@@ -666,8 +664,9 @@
666664
667665 /* This should really be moved into the regulator core */
668666 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]);
671670 if (ret) {
672671 dev_err(&spi->dev,
673672 "Failed to register regulator notifier: %d\n",
....@@ -687,25 +686,12 @@
687686 return ret;
688687 }
689688
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
-
702689 static struct spi_driver wm8770_spi_driver = {
703690 .driver = {
704691 .name = "wm8770",
705692 .of_match_table = wm8770_of_match,
706693 },
707694 .probe = wm8770_spi_probe,
708
- .remove = wm8770_spi_remove
709695 };
710696
711697 module_spi_driver(wm8770_spi_driver);