Skip to contentSkip to conversation

ASoC: tlv320aic32x4: Add support for tlv320aic32x6

PATCH In review Dan Murphy 2 participants 4 messages Jul 12, 2017 – Jul 17, 2017

Subsystems (4)
lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

PATCH 1/2 ASoC: tlv320aic32x4: Add support for tlv320aic32x6

Add support for the tlv320aic32x6 family of devices. These devices share the same register set as the tlv320aic32x4 and this driver can be re-used.

TLV320aic32x6 data sheets are here:
tlv320aic3256 - http://www.ti.com/lit/gpn/tlv320aic3256
tlv320aic3206 - http://www.ti.com/lit/gpn/tlv320aic3206

---
 Documentation/devicetree/bindings/sound/tlv320aic32x4.txt | 4 +++-
 sound/soc/codecs/tlv320aic32x4-i2c.c                      | 2 ++
 sound/soc/codecs/tlv320aic32x4-spi.c                      | 2 ++
 3 files changed, 7 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/sound/tlv320aic32x4.txt +3 -1
index 5e2741af27be..9651fc7503a4 100644
@@ -3,7 +3,9 @@ Texas Instruments - tlv320aic32x4 Codec module
 The tlv320aic32x4 serial control bus communicates through I2C protocols
 
 Required properties:
- - compatible: Should be "ti,tlv320aic32x4"
+ - compatible - "string" - One of:
+	"ti,tlv320aic32x4" TLV320AIC3204
+	"ti,tlv320aic32x6" TLV320AIC3206, TLV320AIC3256
  - reg: I2C slave address
  - supply-*: Required supply regulators are:
     "iov" - digital IO power supply
sound/soc/codecs/tlv320aic32x4-i2c.c +2 -0
index 59606cf3008f..385fa2e9525a 100644
@@ -47,12 +47,14 @@ static int aic32x4_i2c_remove(struct i2c_client *i2c)
 
 static const struct i2c_device_id aic32x4_i2c_id[] = {
 	{ "tlv320aic32x4", 0 },
+	{ "tlv320aic32x6", 1 },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(i2c, aic32x4_i2c_id);
 
 static const struct of_device_id aic32x4_of_id[] = {
 	{ .compatible = "ti,tlv320aic32x4", },
+	{ .compatible = "ti,tlv320aic32x6", },
 	{ /* senitel */ }
 };
 MODULE_DEVICE_TABLE(of, aic32x4_of_id);
sound/soc/codecs/tlv320aic32x4-spi.c +2 -0
index 724fcdd491b2..07d78ae51e05 100644
@@ -48,12 +48,14 @@ static int aic32x4_spi_remove(struct spi_device *spi)
 
 static const struct spi_device_id aic32x4_spi_id[] = {
 	{ "tlv320aic32x4", 0 },
+	{ "tlv320aic32x6", 1 },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(spi, aic32x4_spi_id);
 
 static const struct of_device_id aic32x4_of_id[] = {
 	{ .compatible = "ti,tlv320aic32x4", },
+	{ .compatible = "ti,tlv320aic32x6", },
 	{ /* senitel */ }
 };
 MODULE_DEVICE_TABLE(of, aic32x4_of_id);
Signature · 1 line
2.13.2.516.ge629a7d28
author
#1 lore raw

PATCH 2/2 ASoC: tlv320aic32x4: Add gpio configuration to the codec

Add the ability to configure the MFP1->MFP5 registers as GPIOs. In addition adding ALSA controls to get and set the GPIO state.

Per the data sheet each MFP can be configured as a GPIO input only, output only or either an input or output.

---
 .../devicetree/bindings/sound/tlv320aic32x4.txt    |   9 +
 include/sound/tlv320aic32x4.h                      |  23 +++
 sound/soc/codecs/tlv320aic32x4.c                   | 206 +++++++++++++++++++++
 sound/soc/codecs/tlv320aic32x4.h                   |   3 +
 4 files changed, 241 insertions(+)
Documentation/devicetree/bindings/sound/tlv320aic32x4.txt +9 -0
index 9651fc7503a4..ca75890f0d07 100644
@@ -20,6 +20,8 @@ Optional properties:
  - reset-gpios: Reset-GPIO phandle with args as described in gpio/gpio.txt
  - clocks/clock-names: Clock named 'mclk' for the master clock of the codec.
    See clock/clock-bindings.txt for information about the detailed format.
+ - aic32x4-gpio-func - <array of 5 int>
+	- Types are defined in include/sound/tlv320aic32x4.h
 
 
 Example:
@@ -29,4 +31,11 @@ codec: tlv320aic32x4@18 {
 	reg = <0x18>;
 	clocks = <&clks 201>;
 	clock-names = "mclk";
+	aic32x4-gpio-func= <
+			0xff /* AIC32X4_MFPX_DEFAULT_VALUE */
+			0xff /* AIC32X4_MFPX_DEFAULT_VALUE */
+			0x04 /* MFP3 AIC32X4_MFP3_GPIO_ENABLED */
+			0xff /* AIC32X4_MFPX_DEFAULT_VALUE */
+			0x08 /* MFP5 AIC32X4_MFP5_GPIO_INPUT */
+		>;
 };
include/sound/tlv320aic32x4.h +23 -0
index 24e5d991f148..22305c0ab31a 100644
@@ -22,7 +22,30 @@
 #define AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K	0x00000001
 #define AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K	0x00000002
 
+/* GPIO API */
+#define AIC32X4_MFPX_DEFAULT_VALUE	0xff
+
+#define AIC32X4_MFP1_DIN_DISABLED	0
+#define AIC32X4_MFP1_DIN_ENABLED	0x2
+#define AIC32X4_MFP1_GPIO_IN		0x4
+
+#define AIC32X4_MFP2_GPIO_OUT_LOW	0x0
+#define AIC32X4_MFP2_GPIO_OUT_HIGH	0x1
+
+#define AIC32X4_MFP_GPIO_ENABLED	0x4
+
+#define AIC32X4_MFP5_GPIO_DISABLED	0x0
+#define AIC32X4_MFP5_GPIO_INPUT		0x8
+#define AIC32X4_MFP5_GPIO_OUTPUT	0xc
+#define AIC32X4_MFP5_GPIO_OUT_LOW	0x0
+#define AIC32X4_MFP5_GPIO_OUT_HIGH	0x1
+
+struct aic32x4_setup_data {
+	unsigned int gpio_func[5];
+};
+
 struct aic32x4_pdata {
+	struct aic32x4_setup_data *setup;
 	u32 power_cfg;
 	u32 micpga_routing;
 	bool swapdacs;
sound/soc/codecs/tlv320aic32x4.c +206 -0

240 lines not on this page · raw message

sound/soc/codecs/tlv320aic32x4.h +3 -0
index a197dd51addc..da7cec482bcb 100644
@@ -44,8 +44,11 @@ int aic32x4_remove(struct device *dev);
 #define AIC32X4_IFACE4		31
 #define AIC32X4_IFACE5		32
 #define AIC32X4_IFACE6		33
+#define AIC32X4_GPIOCTL		52
 #define AIC32X4_DOUTCTL		53
 #define AIC32X4_DINCTL		54
+#define AIC32X4_MISOCTL		55
+#define AIC32X4_SCLKCTL		56
 #define AIC32X4_DACSPB		60
 #define AIC32X4_ADCSPB		61
 #define AIC32X4_DACSETUP	63
Signature · 1 line
2.13.2.516.ge629a7d28
maintainer
#2 lore raw

Applied "ASoC: tlv320aic32x4: Add gpio configuration to the codec" to the asoc tree

The patch

ASoC: tlv320aic32x4: Add gpio configuration to the codec

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From b9045b9c6b79d2ea5b888a0f9e9aa156d09ba8a9 Mon Sep 17 00:00:00 2001

From: Dan Murphy <[email protected]>
Date: Wed, 12 Jul 2017 13:37:00 -0500
Subject: [PATCH] ASoC: tlv320aic32x4: Add gpio configuration to the codec

Add the ability to configure the MFP1->MFP5 registers as GPIOs. In addition adding ALSA controls to get and set the GPIO state.

Per the data sheet each MFP can be configured as a GPIO input only, output only or either an input or output.

---
 .../devicetree/bindings/sound/tlv320aic32x4.txt    |   9 +
 include/sound/tlv320aic32x4.h                      |  23 +++
 sound/soc/codecs/tlv320aic32x4.c                   | 206 +++++++++++++++++++++
 sound/soc/codecs/tlv320aic32x4.h                   |   3 +
 4 files changed, 241 insertions(+)
Documentation/devicetree/bindings/sound/tlv320aic32x4.txt +9 -0
index 9651fc7503a4..ca75890f0d07 100644
@@ -20,6 +20,8 @@ Optional properties:
  - reset-gpios: Reset-GPIO phandle with args as described in gpio/gpio.txt
  - clocks/clock-names: Clock named 'mclk' for the master clock of the codec.
    See clock/clock-bindings.txt for information about the detailed format.
+ - aic32x4-gpio-func - <array of 5 int>
+	- Types are defined in include/sound/tlv320aic32x4.h
 
 
 Example:
@@ -29,4 +31,11 @@ codec: tlv320aic32x4@18 {
 	reg = <0x18>;
 	clocks = <&clks 201>;
 	clock-names = "mclk";
+	aic32x4-gpio-func= <
+			0xff /* AIC32X4_MFPX_DEFAULT_VALUE */
+			0xff /* AIC32X4_MFPX_DEFAULT_VALUE */
+			0x04 /* MFP3 AIC32X4_MFP3_GPIO_ENABLED */
+			0xff /* AIC32X4_MFPX_DEFAULT_VALUE */
+			0x08 /* MFP5 AIC32X4_MFP5_GPIO_INPUT */
+		>;
 };
include/sound/tlv320aic32x4.h +23 -0
index 24e5d991f148..22305c0ab31a 100644
@@ -22,7 +22,30 @@
 #define AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K	0x00000001
 #define AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K	0x00000002
 
+/* GPIO API */
+#define AIC32X4_MFPX_DEFAULT_VALUE	0xff
+
+#define AIC32X4_MFP1_DIN_DISABLED	0
+#define AIC32X4_MFP1_DIN_ENABLED	0x2
+#define AIC32X4_MFP1_GPIO_IN		0x4
+
+#define AIC32X4_MFP2_GPIO_OUT_LOW	0x0
+#define AIC32X4_MFP2_GPIO_OUT_HIGH	0x1
+
+#define AIC32X4_MFP_GPIO_ENABLED	0x4
+
+#define AIC32X4_MFP5_GPIO_DISABLED	0x0
+#define AIC32X4_MFP5_GPIO_INPUT		0x8
+#define AIC32X4_MFP5_GPIO_OUTPUT	0xc
+#define AIC32X4_MFP5_GPIO_OUT_LOW	0x0
+#define AIC32X4_MFP5_GPIO_OUT_HIGH	0x1
+
+struct aic32x4_setup_data {
+	unsigned int gpio_func[5];
+};
+
 struct aic32x4_pdata {
+	struct aic32x4_setup_data *setup;
 	u32 power_cfg;
 	u32 micpga_routing;
 	bool swapdacs;
sound/soc/codecs/tlv320aic32x4.c +206 -0

240 lines not on this page · raw message

sound/soc/codecs/tlv320aic32x4.h +3 -0
index a197dd51addc..da7cec482bcb 100644
@@ -44,8 +44,11 @@ int aic32x4_remove(struct device *dev);
 #define AIC32X4_IFACE4		31
 #define AIC32X4_IFACE5		32
 #define AIC32X4_IFACE6		33
+#define AIC32X4_GPIOCTL		52
 #define AIC32X4_DOUTCTL		53
 #define AIC32X4_DINCTL		54
+#define AIC32X4_MISOCTL		55
+#define AIC32X4_SCLKCTL		56
 #define AIC32X4_DACSPB		60
 #define AIC32X4_ADCSPB		61
 #define AIC32X4_DACSETUP	63
Signature · 1 line
2.13.2
maintainer
#3 lore raw

Applied "ASoC: tlv320aic32x4: Add support for tlv320aic32x6" to the asoc tree

In reply to Dan Murphy

The patch

ASoC: tlv320aic32x4: Add support for tlv320aic32x6

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From fde0543f1129967dfa73f1fa3477c7fe12052da5 Mon Sep 17 00:00:00 2001

From: Dan Murphy <[email protected]>
Date: Wed, 12 Jul 2017 13:36:59 -0500
Subject: [PATCH] ASoC: tlv320aic32x4: Add support for tlv320aic32x6

Add support for the tlv320aic32x6 family of devices. These devices share the same register set as the tlv320aic32x4 and this driver can be re-used.

TLV320aic32x6 data sheets are here:
tlv320aic3256 - http://www.ti.com/lit/gpn/tlv320aic3256
tlv320aic3206 - http://www.ti.com/lit/gpn/tlv320aic3206

---
 Documentation/devicetree/bindings/sound/tlv320aic32x4.txt | 4 +++-
 sound/soc/codecs/tlv320aic32x4-i2c.c                      | 2 ++
 sound/soc/codecs/tlv320aic32x4-spi.c                      | 2 ++
 3 files changed, 7 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/sound/tlv320aic32x4.txt +3 -1
index 5e2741af27be..9651fc7503a4 100644
@@ -3,7 +3,9 @@ Texas Instruments - tlv320aic32x4 Codec module
 The tlv320aic32x4 serial control bus communicates through I2C protocols
 
 Required properties:
- - compatible: Should be "ti,tlv320aic32x4"
+ - compatible - "string" - One of:
+	"ti,tlv320aic32x4" TLV320AIC3204
+	"ti,tlv320aic32x6" TLV320AIC3206, TLV320AIC3256
  - reg: I2C slave address
  - supply-*: Required supply regulators are:
     "iov" - digital IO power supply
sound/soc/codecs/tlv320aic32x4-i2c.c +2 -0
index 59606cf3008f..385fa2e9525a 100644
@@ -47,12 +47,14 @@ static int aic32x4_i2c_remove(struct i2c_client *i2c)
 
 static const struct i2c_device_id aic32x4_i2c_id[] = {
 	{ "tlv320aic32x4", 0 },
+	{ "tlv320aic32x6", 1 },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(i2c, aic32x4_i2c_id);
 
 static const struct of_device_id aic32x4_of_id[] = {
 	{ .compatible = "ti,tlv320aic32x4", },
+	{ .compatible = "ti,tlv320aic32x6", },
 	{ /* senitel */ }
 };
 MODULE_DEVICE_TABLE(of, aic32x4_of_id);
sound/soc/codecs/tlv320aic32x4-spi.c +2 -0
index 724fcdd491b2..07d78ae51e05 100644
@@ -48,12 +48,14 @@ static int aic32x4_spi_remove(struct spi_device *spi)
 
 static const struct spi_device_id aic32x4_spi_id[] = {
 	{ "tlv320aic32x4", 0 },
+	{ "tlv320aic32x6", 1 },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(spi, aic32x4_spi_id);
 
 static const struct of_device_id aic32x4_of_id[] = {
 	{ .compatible = "ti,tlv320aic32x4", },
+	{ .compatible = "ti,tlv320aic32x6", },
 	{ /* senitel */ }
 };
 MODULE_DEVICE_TABLE(of, aic32x4_of_id);
Signature · 1 line
2.13.2