summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/wcd938x.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2022-03-21 18:19:21 +0300
committerTakashi Iwai <tiwai@suse.de>2022-03-21 18:19:21 +0300
commit646b907e1559f006c79a752ee3eebe220ceb983d (patch)
tree39e9607c0ab85af410d46d3d8edf8c8f36ea652f /sound/soc/codecs/wcd938x.c
parenta6d4b685026cfe9837b07532db5d1e1681b5d129 (diff)
parent49a24e9d9c740d3bd8b1200f225f67d45e3d68a5 (diff)
downloadlinux-646b907e1559f006c79a752ee3eebe220ceb983d.tar.xz
Merge tag 'asoc-v5.18' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Updates for v5.18 Quite a quiet release for ASoC, lots of work on drivers and platforms but nothing too groundbreaking but not much on the core itself: - Start of moving SoF to support multiple IPC mechanisms. - Use of NHLT ACPI table to reduce the amount of quirking required for Intel systems. - Some building blocks for use in forthcoming Intel AVS driver for legacy Intel DSP firmwares. - Support for AMD PDM, Atmel PDMC, Awinic AW8738, i.MX cards with TLV320AIC31xx, Intel machines with CS35L41 and ESSX8336, Mediatek MT8181 wideband bluetooth, nVidia Tegra234, Qualcomm SC7280, Renesas RZ/V2L, Texas Instruments TAS585M
Diffstat (limited to 'sound/soc/codecs/wcd938x.c')
-rw-r--r--sound/soc/codecs/wcd938x.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c
index 9ae65cbabb1a..782877db8c3c 100644
--- a/sound/soc/codecs/wcd938x.c
+++ b/sound/soc/codecs/wcd938x.c
@@ -6,6 +6,7 @@
#include <linux/platform_device.h>
#include <linux/device.h>
#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/pm_runtime.h>
#include <linux/component.h>
@@ -194,6 +195,7 @@ struct wcd938x_priv {
int ear_rx_path;
int variant;
int reset_gpio;
+ struct gpio_desc *us_euro_gpio;
u32 micb1_mv;
u32 micb2_mv;
u32 micb3_mv;
@@ -4199,6 +4201,22 @@ static void wcd938x_dt_parse_micbias_info(struct device *dev, struct wcd938x_pri
dev_info(dev, "%s: Micbias4 DT property not found\n", __func__);
}
+static bool wcd938x_swap_gnd_mic(struct snd_soc_component *component, bool active)
+{
+ int value;
+
+ struct wcd938x_priv *wcd938x;
+
+ wcd938x = snd_soc_component_get_drvdata(component);
+
+ value = gpiod_get_value(wcd938x->us_euro_gpio);
+
+ gpiod_set_value(wcd938x->us_euro_gpio, !value);
+
+ return true;
+}
+
+
static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device *dev)
{
struct wcd_mbhc_config *cfg = &wcd938x->mbhc_cfg;
@@ -4211,6 +4229,15 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device
return wcd938x->reset_gpio;
}
+ wcd938x->us_euro_gpio = devm_gpiod_get_optional(dev, "us-euro",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(wcd938x->us_euro_gpio)) {
+ dev_err(dev, "us-euro swap Control GPIO not found\n");
+ return PTR_ERR(wcd938x->us_euro_gpio);
+ }
+
+ cfg->swap_gnd_mic = wcd938x_swap_gnd_mic;
+
wcd938x->supplies[0].supply = "vdd-rxtx";
wcd938x->supplies[1].supply = "vdd-io";
wcd938x->supplies[2].supply = "vdd-buck";