linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dt-bindings: sound: tlv320adcx140: Add GPI config property
@ 2020-05-26 20:09 Dan Murphy
  2020-05-26 20:09 ` [PATCH 2/2] ASoC: tlv320adcx140: Add support for configuring GPI pins Dan Murphy
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dan Murphy @ 2020-05-26 20:09 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai
  Cc: alsa-devel, linux-kernel, devicetree, 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.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 .../bindings/sound/tlv320adcx140.yaml         | 27 +++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml b/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml
index daa6cc0e031b..e8a69b1c7ca9 100644
--- a/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml
+++ b/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml
@@ -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>;
       };
     };
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] ASoC: tlv320adcx140: Add support for configuring GPI pins
  2020-05-26 20:09 [PATCH 1/2] dt-bindings: sound: tlv320adcx140: Add GPI config property Dan Murphy
@ 2020-05-26 20:09 ` Dan Murphy
  2020-05-27 14:58 ` [PATCH 1/2] dt-bindings: sound: tlv320adcx140: Add GPI config property Mark Brown
  2020-05-28 14:05 ` Rob Herring
  2 siblings, 0 replies; 6+ messages in thread
From: Dan Murphy @ 2020-05-26 20:09 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai
  Cc: alsa-devel, linux-kernel, devicetree, Dan Murphy

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>
---
 sound/soc/codecs/tlv320adcx140.c | 28 ++++++++++++++++++++++++++++
 sound/soc/codecs/tlv320adcx140.h |  7 +++++++
 2 files changed, 35 insertions(+)

diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c
index 2fe0df3b7550..35fe8ee5bce9 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;
 
@@ -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;
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_ */
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] dt-bindings: sound: tlv320adcx140: Add GPI config property
  2020-05-26 20:09 [PATCH 1/2] dt-bindings: sound: tlv320adcx140: Add GPI config property Dan Murphy
  2020-05-26 20:09 ` [PATCH 2/2] ASoC: tlv320adcx140: Add support for configuring GPI pins Dan Murphy
@ 2020-05-27 14:58 ` Mark Brown
  2020-05-28 14:05 ` Rob Herring
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2020-05-27 14:58 UTC (permalink / raw)
  To: lgirdwood, tiwai, Dan Murphy, perex; +Cc: linux-kernel, alsa-devel, devicetree

On Tue, 26 May 2020 15:09:16 -0500, Dan Murphy wrote:
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] dt-bindings: sound: tlv320adcx140: Add GPI config property
  2020-05-26 20:09 [PATCH 1/2] dt-bindings: sound: tlv320adcx140: Add GPI config property Dan Murphy
  2020-05-26 20:09 ` [PATCH 2/2] ASoC: tlv320adcx140: Add support for configuring GPI pins Dan Murphy
  2020-05-27 14:58 ` [PATCH 1/2] dt-bindings: sound: tlv320adcx140: Add GPI config property Mark Brown
@ 2020-05-28 14:05 ` Rob Herring
  2020-05-28 14:20   ` Dan Murphy
  2 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2020-05-28 14:05 UTC (permalink / raw)
  To: Dan Murphy
  Cc: lgirdwood, broonie, perex, tiwai, devicetree, alsa-devel, linux-kernel

On Tue, May 26, 2020 at 03:09:16PM -0500, Dan Murphy wrote:
> 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.

> 
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
>  .../bindings/sound/tlv320adcx140.yaml         | 27 +++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml b/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml
> index daa6cc0e031b..e8a69b1c7ca9 100644
> --- a/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml
> +++ b/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml
> @@ -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

I believe you want '7' here.

> +        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>;
>        };
>      };
> -- 
> 2.26.2
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] dt-bindings: sound: tlv320adcx140: Add GPI config property
  2020-05-28 14:05 ` Rob Herring
@ 2020-05-28 14:20   ` Dan Murphy
  2020-05-28 14:32     ` Rob Herring
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Murphy @ 2020-05-28 14:20 UTC (permalink / raw)
  To: Rob Herring
  Cc: lgirdwood, broonie, perex, tiwai, devicetree, alsa-devel, linux-kernel

Rob

On 5/28/20 9:05 AM, Rob Herring wrote:
> On Tue, May 26, 2020 at 03:09:16PM -0500, Dan Murphy wrote:
>> 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 devicetree@vger.kernel.org was cc'd.

I will fix this warning.

Dan



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] dt-bindings: sound: tlv320adcx140: Add GPI config property
  2020-05-28 14:20   ` Dan Murphy
@ 2020-05-28 14:32     ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2020-05-28 14:32 UTC (permalink / raw)
  To: Dan Murphy
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	devicetree, Linux-ALSA, linux-kernel

On Thu, May 28, 2020 at 8:20 AM Dan Murphy <dmurphy@ti.com> wrote:
>
> Rob
>
> On 5/28/20 9:05 AM, Rob Herring wrote:
> > On Tue, May 26, 2020 at 03:09:16PM -0500, Dan Murphy wrote:
> >> 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 devicetree@vger.kernel.org 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-28 14:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26 20:09 [PATCH 1/2] dt-bindings: sound: tlv320adcx140: Add GPI config property Dan Murphy
2020-05-26 20:09 ` [PATCH 2/2] ASoC: tlv320adcx140: Add support for configuring GPI pins Dan Murphy
2020-05-27 14:58 ` [PATCH 1/2] dt-bindings: sound: tlv320adcx140: Add GPI config property Mark Brown
2020-05-28 14:05 ` Rob Herring
2020-05-28 14:20   ` Dan Murphy
2020-05-28 14:32     ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).