Skip to contentSkip to conversation

dt-bindings: sound: tlv320adcx140: Add GPI config property

PATCH In review Dan Murphy 3 participants 6 messages May 26, 2020 – May 28, 2020

Subsystems (4)
lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

PATCH 1/2 dt-bindings: sound: tlv320adcx140: Add GPI config property

Add an array property that configures the General Purpose Input (GPI) register. The device has 4 GPI pins and each pin can be configured in 1 of 7 different ways.

---
 .../bindings/sound/tlv320adcx140.yaml         | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
Documentation/devicetree/bindings/sound/tlv320adcx140.yaml +27 -0
index daa6cc0e031b..e8a69b1c7ca9 100644
@@ -86,6 +86,32 @@ properties:
           maximum: 1
         default: [0, 0, 0, 0]
 
+  ti,gpi-config:
+    description: |
+       Defines the configuration for the general purpose input pins (GPI).
+       The array is defined as <GPI1 GPI2 GPI3 GPI4>.
+
+       0 - (default) disabled
+       1 - GPIX is configured as a general-purpose input (GPI)
+       2 - GPIX is configured as a master clock input (MCLK)
+       3 - GPIX is configured as an ASI input for daisy-chain (SDIN)
+       4 - GPIX is configured as a PDM data input for channel 1 and channel
+            (PDMDIN1)
+       5 - GPIX is configured as a PDM data input for channel 3 and channel
+            (PDMDIN2)
+       6 - GPIX is configured as a PDM data input for channel 5 and channel
+            (PDMDIN3)
+       7 - GPIX is configured as a PDM data input for channel 7 and channel
+            (PDMDIN4)
+
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32-array
+      - minItems: 1
+        maxItems: 4
+        items:
+          maximum: 1
+        default: [0, 0, 0, 0]
+
 required:
   - compatible
   - reg
@@ -101,6 +127,7 @@ examples:
         reg = <0x4c>;
         ti,mic-bias-source = <6>;
         ti,pdm-edge-select = <0 1 0 1>;
+        ti,gpi-config = <4 5 6 7>;
         reset-gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
       };
     };
Signature · 1 line
2.26.2
author
#1 lore raw

PATCH 2/2 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.

---
 sound/soc/codecs/tlv320adcx140.c | 28 ++++++++++++++++++++++++++++
 sound/soc/codecs/tlv320adcx140.h |  7 +++++++
 2 files changed, 35 insertions(+)
sound/soc/codecs/tlv320adcx140.c +28 -0
index 2fe0df3b7550..35fe8ee5bce9 100644
@@ -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;
 
@@ -807,6 +810,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;
sound/soc/codecs/tlv320adcx140.h +7 -0
index 247827f315f1..39206bf1af12 100644
@@ -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_ */
Signature · 1 line
2.26.2
maintainer
#2 lore raw
In reply to Dan Murphy
Quoted 3 lines · Dan Murphy

Add an array property that configures the General Purpose Input (GPI) register. The device has 4 GPI pins and each pin can be configured in 1 of 7 different ways.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] dt-bindings: sound: tlv320adcx140: Add GPI config property

      commit: 2465d32bea35d1d56c6cfb08a96ebea3b475d8ec
[2/2] ASoC: tlv320adcx140: Add support for configuring GPI pins
      commit: 3c35e79cead31c3bd79875ae90f9655dc77ad13c

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

maintainer
#3 lore raw
In reply to Dan Murphy
Quoted 3 lines · Dan Murphy

Add an array property that configures the General Purpose Input (GPI) register. The device has 4 GPI pins and each pin can be configured in 1 of 7 different ways.

Dan seems to have trouble running get_maintainers.pl and Cc'ing the DT list. Running 'make dt_binding_check' also seems to be a problem. Now linux-next has these warnings:

/builds/robherring/linux-dt-bindings/Documentation/devicetree/bindings/sound/tlv320adcx140.example.dt.yaml: codec@4c: ti,gpi-config:0:0: 4 is greater than the maximum of 1 /builds/robherring/linux-dt-bindings/Documentation/devicetree/bindings/sound/tlv320adcx140.example.dt.yaml: codec@4c: ti,gpi-config:0:1: 5 is greater than the maximum of 1 /builds/robherring/linux-dt-bindings/Documentation/devicetree/bindings/sound/tlv320adcx140.example.dt.yaml: codec@4c: ti,gpi-config:0:2: 6 is greater than the maximum of 1 /builds/robherring/linux-dt-bindings/Documentation/devicetree/bindings/sound/tlv320adcx140.example.dt.yaml: codec@4c: ti,gpi-config:0:3: 7 is greater than the maximum of 1

Please send a fix.

Quoted 28 lines
---
 .../bindings/sound/tlv320adcx140.yaml         | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)
Documentation/devicetree/bindings/sound/tlv320adcx140.yaml +14 -0
index daa6cc0e031b..e8a69b1c7ca9 100644
@@ -86,6 +86,32 @@ properties:
           maximum: 1
         default: [0, 0, 0, 0]
 
+  ti,gpi-config:
+    description: |
+       Defines the configuration for the general purpose input pins (GPI).
+       The array is defined as <GPI1 GPI2 GPI3 GPI4>.
+
+       0 - (default) disabled
+       1 - GPIX is configured as a general-purpose input (GPI)
+       2 - GPIX is configured as a master clock input (MCLK)
+       3 - GPIX is configured as an ASI input for daisy-chain (SDIN)
+       4 - GPIX is configured as a PDM data input for channel 1 and channel
+            (PDMDIN1)
+       5 - GPIX is configured as a PDM data input for channel 3 and channel
+            (PDMDIN2)
+       6 - GPIX is configured as a PDM data input for channel 5 and channel

Documentation/devicetree/bindings/sound/tlv320adcx140.yaml properties: · line 112

Quoted 10 lines
Documentation/devicetree/bindings/sound/tlv320adcx140.yaml +10 -0
+            (PDMDIN3)
+       7 - GPIX is configured as a PDM data input for channel 7 and channel
+            (PDMDIN4)
+
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32-array
+      - minItems: 1
+        maxItems: 4
+        items:
+          maximum: 1

I believe you want '7' here.

Quoted 16 lines
Documentation/devicetree/bindings/sound/tlv320adcx140.yaml +3 -0
+        default: [0, 0, 0, 0]
+
 required:
   - compatible
   - reg
@@ -101,6 +127,7 @@ examples:
         reg = <0x4c>;
         ti,mic-bias-source = <6>;
         ti,pdm-edge-select = <0 1 0 1>;
+        ti,gpi-config = <4 5 6 7>;
         reset-gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
       };
     };
Signature · 1 line
2.26.2
author
#4 lore raw

Rob

Quoted 7 lines · Rob Herring
Quoted 3 lines · Dan Murphy

Add an array property that configures the General Purpose Input (GPI) register. The device has 4 GPI pins and each pin can be configured in 1 of 7 different ways.

Dan seems to have trouble running get_maintainers.pl and Cc'ing the DT list. Running 'make dt_binding_check' also seems to be a problem. Now linux-next has these warnings:

I don't have an issue with doing get_maintainers.  All the maintainers listed were added to the patch.

And [email protected] was cc'd.

I will fix this warning.

Dan

maintainer
#5 lore raw
Quoted 8 lines · Dan Murphy

Rob

Quoted 4 lines · Rob Herring
Quoted 3 lines · Dan Murphy

Add an array property that configures the General Purpose Input (GPI) register. The device has 4 GPI pins and each pin can be configured in 1 of 7 different ways.

Quoted 8 lines
Quoted 3 lines

Dan seems to have trouble running get_maintainers.pl and Cc'ing the DT list. Running 'make dt_binding_check' also seems to be a problem. Now linux-next has these warnings:

I don't have an issue with doing get_maintainers. All the maintainers listed were added to the patch.

And [email protected] was cc'd.

Indeed, sorry for my rant. Some reason my search didn't find it.

Not sure why my tester didn't flag this either...

Rob