| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2017 BayLibre, SAS. |
|---|
| 3 | 4 | * 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. |
|---|
| 18 | 5 | */ |
|---|
| 19 | 6 | |
|---|
| 20 | 7 | #include <linux/gpio/consumer.h> |
|---|
| 21 | 8 | #include <linux/module.h> |
|---|
| 9 | +#include <linux/regulator/consumer.h> |
|---|
| 22 | 10 | #include <sound/soc.h> |
|---|
| 23 | 11 | |
|---|
| 24 | 12 | #define DRV_NAME "simple-amplifier" |
|---|
| .. | .. |
|---|
| 58 | 46 | (SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD)), |
|---|
| 59 | 47 | SND_SOC_DAPM_OUTPUT("OUTL"), |
|---|
| 60 | 48 | SND_SOC_DAPM_OUTPUT("OUTR"), |
|---|
| 49 | + SND_SOC_DAPM_REGULATOR_SUPPLY("VCC", 20, 0), |
|---|
| 61 | 50 | }; |
|---|
| 62 | 51 | |
|---|
| 63 | 52 | static const struct snd_soc_dapm_route simple_amp_dapm_routes[] = { |
|---|
| 64 | 53 | { "DRV", NULL, "INL" }, |
|---|
| 65 | 54 | { "DRV", NULL, "INR" }, |
|---|
| 55 | + { "OUTL", NULL, "VCC" }, |
|---|
| 56 | + { "OUTR", NULL, "VCC" }, |
|---|
| 66 | 57 | { "OUTL", NULL, "DRV" }, |
|---|
| 67 | 58 | { "OUTR", NULL, "DRV" }, |
|---|
| 68 | 59 | }; |
|---|
| .. | .. |
|---|
| 85 | 76 | return -ENOMEM; |
|---|
| 86 | 77 | platform_set_drvdata(pdev, priv); |
|---|
| 87 | 78 | |
|---|
| 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); |
|---|
| 89 | 81 | if (IS_ERR(priv->gpiod_enable)) { |
|---|
| 90 | 82 | err = PTR_ERR(priv->gpiod_enable); |
|---|
| 91 | 83 | if (err != -EPROBE_DEFER) |
|---|