hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/soc/codecs/simple-amplifier.c
....@@ -1,24 +1,12 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2017 BayLibre, SAS.
34 * Author: Jerome Brunet <jbrunet@baylibre.com>
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of version 2 of the GNU General Public License as
7
- * published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful, but
10
- * WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
- * General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU General Public License
15
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
16
- * The full GNU General Public License is included in this distribution
17
- * in the file called COPYING.
185 */
196
207 #include <linux/gpio/consumer.h>
218 #include <linux/module.h>
9
+#include <linux/regulator/consumer.h>
2210 #include <sound/soc.h>
2311
2412 #define DRV_NAME "simple-amplifier"
....@@ -58,11 +46,14 @@
5846 (SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD)),
5947 SND_SOC_DAPM_OUTPUT("OUTL"),
6048 SND_SOC_DAPM_OUTPUT("OUTR"),
49
+ SND_SOC_DAPM_REGULATOR_SUPPLY("VCC", 20, 0),
6150 };
6251
6352 static const struct snd_soc_dapm_route simple_amp_dapm_routes[] = {
6453 { "DRV", NULL, "INL" },
6554 { "DRV", NULL, "INR" },
55
+ { "OUTL", NULL, "VCC" },
56
+ { "OUTR", NULL, "VCC" },
6657 { "OUTL", NULL, "DRV" },
6758 { "OUTR", NULL, "DRV" },
6859 };
....@@ -85,7 +76,8 @@
8576 return -ENOMEM;
8677 platform_set_drvdata(pdev, priv);
8778
88
- priv->gpiod_enable = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
79
+ priv->gpiod_enable = devm_gpiod_get_optional(dev, "enable",
80
+ GPIOD_OUT_LOW);
8981 if (IS_ERR(priv->gpiod_enable)) {
9082 err = PTR_ERR(priv->gpiod_enable);
9183 if (err != -EPROBE_DEFER)