aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorDan Murphy <dmurphy@ti.com>2020-05-26 15:09:17 -0500
committerMark Brown <broonie@kernel.org>2020-05-27 14:48:52 +0100
commit3c35e79cead31c3bd79875ae90f9655dc77ad13c (patch)
treeea45bd5e4618434a9a153e8bc6155c73416f1f40 /sound
parentdt-bindings: sound: tlv320adcx140: Add GPI config property (diff)
downloadlinux-dev-3c35e79cead31c3bd79875ae90f9655dc77ad13c.tar.xz
linux-dev-3c35e79cead31c3bd79875ae90f9655dc77ad13c.zip
ASoC: tlv320adcx140: Add support for configuring GPI pins
Add support to configure the GPI pins to the specific configuration. The pins can be disabled or be configured as data input for any of the digital mic channels. In addition the GPI can be used a a general purpose input, a Master clock input or an ASI input for daisy chaining devices. Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200526200917.10385-2-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/tlv320adcx140.c28
-rw-r--r--sound/soc/codecs/tlv320adcx140.h7
2 files changed, 35 insertions, 0 deletions
diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c
index 472d759ba8a3..dd1176574f45 100644
--- a/sound/soc/codecs/tlv320adcx140.c
+++ b/sound/soc/codecs/tlv320adcx140.c
@@ -764,6 +764,9 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
int pdm_count;
u32 pdm_edges[ADCX140_NUM_PDM_EDGES];
u32 pdm_edge_val = 0;
+ int gpi_count;
+ u32 gpi_inputs[ADCX140_NUM_GPI_PINS];
+ u32 gpi_input_val = 0;
int i;
int ret;
@@ -809,6 +812,31 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
return ret;
}
+ gpi_count = device_property_count_u32(adcx140->dev, "ti,gpi-config");
+ if (gpi_count <= ADCX140_NUM_GPI_PINS && gpi_count > 0) {
+ ret = device_property_read_u32_array(adcx140->dev,
+ "ti,gpi-config",
+ gpi_inputs, gpi_count);
+ if (ret)
+ return ret;
+
+ gpi_input_val = gpi_inputs[ADCX140_GPI1_INDEX] << ADCX140_GPI_SHIFT |
+ gpi_inputs[ADCX140_GPI2_INDEX];
+
+ ret = regmap_write(adcx140->regmap, ADCX140_GPI_CFG0,
+ gpi_input_val);
+ if (ret)
+ return ret;
+
+ gpi_input_val = gpi_inputs[ADCX140_GPI3_INDEX] << ADCX140_GPI_SHIFT |
+ gpi_inputs[ADCX140_GPI4_INDEX];
+
+ ret = regmap_write(adcx140->regmap, ADCX140_GPI_CFG1,
+ gpi_input_val);
+ if (ret)
+ return ret;
+ }
+
ret = adcx140_reset(adcx140);
if (ret)
goto out;
diff --git a/sound/soc/codecs/tlv320adcx140.h b/sound/soc/codecs/tlv320adcx140.h
index 247827f315f1..39206bf1af12 100644
--- a/sound/soc/codecs/tlv320adcx140.h
+++ b/sound/soc/codecs/tlv320adcx140.h
@@ -132,4 +132,11 @@
#define ADCX140_NUM_PDM_EDGES 4
#define ADCX140_PDM_EDGE_SHIFT 7
+#define ADCX140_NUM_GPI_PINS 4
+#define ADCX140_GPI_SHIFT 4
+#define ADCX140_GPI1_INDEX 0
+#define ADCX140_GPI2_INDEX 1
+#define ADCX140_GPI3_INDEX 2
+#define ADCX140_GPI4_INDEX 3
+
#endif /* _TLV320ADCX140_ */