linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/2] dt-bindings: tas2562: Convert the tas2562 binding to yaml
@ 2020-06-12 16:06 Dan Murphy
  2020-06-12 16:06 ` [PATCH v3 2/2] ASoC: tas2562: Update shutdown GPIO property Dan Murphy
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Murphy @ 2020-06-12 16:06 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, robh
  Cc: alsa-devel, linux-kernel, devicetree, Dan Murphy

Convert the TAS2562 text file to yaml format.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 .../devicetree/bindings/sound/tas2562.txt     | 34 ----------
 .../devicetree/bindings/sound/tas2562.yaml    | 65 +++++++++++++++++++
 2 files changed, 65 insertions(+), 34 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/tas2562.txt
 create mode 100644 Documentation/devicetree/bindings/sound/tas2562.yaml

diff --git a/Documentation/devicetree/bindings/sound/tas2562.txt b/Documentation/devicetree/bindings/sound/tas2562.txt
deleted file mode 100644
index 94796b547184..000000000000
--- a/Documentation/devicetree/bindings/sound/tas2562.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-Texas Instruments TAS2562 Smart PA
-
-The TAS2562 is a mono, digital input Class-D audio amplifier optimized for
-efficiently driving high peak power into small loudspeakers.
-Integrated speaker voltage and current sense provides for
-real time monitoring of loudspeaker behavior.
-
-Required properties:
- - #address-cells  - Should be <1>.
- - #size-cells     - Should be <0>.
- - compatible:	   - Should contain "ti,tas2562", "ti,tas2563".
- - reg:		   - The i2c address. Should be 0x4c, 0x4d, 0x4e or 0x4f.
- - ti,imon-slot-no:- TDM TX current sense time slot.
-
-Optional properties:
-- interrupt-parent: phandle to the interrupt controller which provides
-                    the interrupt.
-- interrupts: (GPIO) interrupt to which the chip is connected.
-- shut-down: GPIO used to control the state of the device.
-
-Examples:
-tas2562@4c {
-        #address-cells = <1>;
-        #size-cells = <0>;
-        compatible = "ti,tas2562";
-        reg = <0x4c>;
-
-        interrupt-parent = <&gpio1>;
-        interrupts = <14>;
-
-	shut-down = <&gpio1 15 0>;
-        ti,imon-slot-no = <0>;
-};
-
diff --git a/Documentation/devicetree/bindings/sound/tas2562.yaml b/Documentation/devicetree/bindings/sound/tas2562.yaml
new file mode 100644
index 000000000000..bb51fd88c41a
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/tas2562.yaml
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-2-Clause)
+# Copyright (C) 2019 Texas Instruments Incorporated
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/sound/tas2562.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Texas Instruments TAS2562 Smart PA
+
+maintainers:
+  - Dan Murphy <dmurphy@ti.com>
+
+description: |
+  The TAS2562 is a mono, digital input Class-D audio amplifier optimized for
+  efficiently driving high peak power into small loudspeakers.
+  Integrated speaker voltage and current sense provides for
+  real time monitoring of loudspeaker behavior.
+
+properties:
+  compatible:
+    enum:
+      - ti,tas2562
+      - ti,tas2563
+
+  reg:
+    maxItems: 1
+    description: |
+       I2C address of the device can be one of these 0x4c, 0x4d, 0x4e or 0x4f
+
+  shutdown-gpio:
+    description: GPIO used to control the state of the device.
+
+  interrupts:
+    maxItems: 1
+
+  ti,imon-slot-no:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: TDM TX current sense time slot.
+
+  '#sound-dai-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+   #include <dt-bindings/gpio/gpio.h>
+   i2c0 {
+     #address-cells = <1>;
+     #size-cells = <0>;
+     codec: codec@4c {
+       compatible = "ti,tas2562";
+       reg = <0x4c>;
+       #sound-dai-cells = <1>;
+       interrupt-parent = <&gpio1>;
+       interrupts = <14>;
+       shutdown-gpio = <&gpio1 15 0>;
+       ti,imon-slot-no = <0>;
+     };
+   };
+
-- 
2.26.2


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

* [PATCH v3 2/2] ASoC: tas2562: Update shutdown GPIO property
  2020-06-12 16:06 [PATCH v3 1/2] dt-bindings: tas2562: Convert the tas2562 binding to yaml Dan Murphy
@ 2020-06-12 16:06 ` Dan Murphy
  2020-06-12 16:09   ` Mark Brown
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Murphy @ 2020-06-12 16:06 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, robh
  Cc: alsa-devel, linux-kernel, devicetree, Dan Murphy

Update the shutdown GPIO property to be shutdown from shut-down.

Fixes: c173dba44c2d2 ("ASoC: tas2562: Introduce the TAS2562 amplifier")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 sound/soc/codecs/tas2562.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c
index 7fae88655a0f..a2019ec07c3d 100644
--- a/sound/soc/codecs/tas2562.c
+++ b/sound/soc/codecs/tas2562.c
@@ -619,7 +619,7 @@ static int tas2562_parse_dt(struct tas2562_data *tas2562)
 	struct device *dev = tas2562->dev;
 	int ret = 0;
 
-	tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shut-down-gpio",
+	tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown",
 						      GPIOD_OUT_HIGH);
 	if (IS_ERR(tas2562->sdz_gpio)) {
 		if (PTR_ERR(tas2562->sdz_gpio) == -EPROBE_DEFER) {
-- 
2.26.2


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

* Re: [PATCH v3 2/2] ASoC: tas2562: Update shutdown GPIO property
  2020-06-12 16:06 ` [PATCH v3 2/2] ASoC: tas2562: Update shutdown GPIO property Dan Murphy
@ 2020-06-12 16:09   ` Mark Brown
  2020-06-12 16:18     ` Dan Murphy
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2020-06-12 16:09 UTC (permalink / raw)
  To: Dan Murphy
  Cc: lgirdwood, perex, tiwai, robh, alsa-devel, linux-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 353 bytes --]

On Fri, Jun 12, 2020 at 11:06:03AM -0500, Dan Murphy wrote:

> -	tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shut-down-gpio",
> +	tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown",
>  						      GPIOD_OUT_HIGH);

This also changes the name from shut-down to shutdown which will be
incompatible (IIRC we do try -gpio as well as -gpios).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v3 2/2] ASoC: tas2562: Update shutdown GPIO property
  2020-06-12 16:09   ` Mark Brown
@ 2020-06-12 16:18     ` Dan Murphy
  2020-06-12 16:22       ` Mark Brown
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Murphy @ 2020-06-12 16:18 UTC (permalink / raw)
  To: Mark Brown
  Cc: lgirdwood, perex, tiwai, robh, alsa-devel, linux-kernel, devicetree

Mark

On 6/12/20 11:09 AM, Mark Brown wrote:
> On Fri, Jun 12, 2020 at 11:06:03AM -0500, Dan Murphy wrote:
>
>> -	tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shut-down-gpio",
>> +	tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown",
>>   						      GPIOD_OUT_HIGH);
> This also changes the name from shut-down to shutdown which will be
> incompatible (IIRC we do try -gpio as well as -gpios).
Yes the non-standardish name was highlighted by Rob[1].

Also I checked the GPIO library and it looks at both -gpio and gpios as 
property suffixes.

Since this is a single GPIO the singular should be used in this case

[1] https://lore.kernel.org/patchwork/patch/1251670/

Dan


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

* Re: [PATCH v3 2/2] ASoC: tas2562: Update shutdown GPIO property
  2020-06-12 16:18     ` Dan Murphy
@ 2020-06-12 16:22       ` Mark Brown
  2020-06-12 16:27         ` Dan Murphy
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2020-06-12 16:22 UTC (permalink / raw)
  To: Dan Murphy
  Cc: lgirdwood, perex, tiwai, robh, alsa-devel, linux-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]

On Fri, Jun 12, 2020 at 11:18:57AM -0500, Dan Murphy wrote:
> On 6/12/20 11:09 AM, Mark Brown wrote:
> > On Fri, Jun 12, 2020 at 11:06:03AM -0500, Dan Murphy wrote:

> > > -	tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shut-down-gpio",
> > > +	tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown",
> > >   						      GPIOD_OUT_HIGH);

> > This also changes the name from shut-down to shutdown which will be
> > incompatible (IIRC we do try -gpio as well as -gpios).

> Yes the non-standardish name was highlighted by Rob[1].

Yes, but we released with it so it's an ABI now and we should still
support the old name.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v3 2/2] ASoC: tas2562: Update shutdown GPIO property
  2020-06-12 16:22       ` Mark Brown
@ 2020-06-12 16:27         ` Dan Murphy
  2020-06-12 16:30           ` Mark Brown
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Murphy @ 2020-06-12 16:27 UTC (permalink / raw)
  To: Mark Brown
  Cc: lgirdwood, perex, tiwai, robh, alsa-devel, linux-kernel, devicetree

Mark

On 6/12/20 11:22 AM, Mark Brown wrote:
> On Fri, Jun 12, 2020 at 11:18:57AM -0500, Dan Murphy wrote:
>> On 6/12/20 11:09 AM, Mark Brown wrote:
>>> On Fri, Jun 12, 2020 at 11:06:03AM -0500, Dan Murphy wrote:
>>>> -	tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shut-down-gpio",
>>>> +	tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown",
>>>>    						      GPIOD_OUT_HIGH);
>>> This also changes the name from shut-down to shutdown which will be
>>> incompatible (IIRC we do try -gpio as well as -gpios).
>> Yes the non-standardish name was highlighted by Rob[1].
> Yes, but we released with it so it's an ABI now and we should still
> support the old name.

Well should we then just revert back to the non-standard name and just 
fix up the code?

Or should we support both properties?

Dan


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

* Re: [PATCH v3 2/2] ASoC: tas2562: Update shutdown GPIO property
  2020-06-12 16:27         ` Dan Murphy
@ 2020-06-12 16:30           ` Mark Brown
  2020-06-12 16:56             ` Dan Murphy
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2020-06-12 16:30 UTC (permalink / raw)
  To: Dan Murphy
  Cc: lgirdwood, perex, tiwai, robh, alsa-devel, linux-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 260 bytes --]

On Fri, Jun 12, 2020 at 11:27:04AM -0500, Dan Murphy wrote:

> Well should we then just revert back to the non-standard name and just fix
> up the code?

> Or should we support both properties?

Either option is fine for me, supporting both is a little nicer.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v3 2/2] ASoC: tas2562: Update shutdown GPIO property
  2020-06-12 16:30           ` Mark Brown
@ 2020-06-12 16:56             ` Dan Murphy
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Murphy @ 2020-06-12 16:56 UTC (permalink / raw)
  To: Mark Brown
  Cc: lgirdwood, perex, tiwai, robh, alsa-devel, linux-kernel, devicetree

Mark

On 6/12/20 11:30 AM, Mark Brown wrote:
> On Fri, Jun 12, 2020 at 11:27:04AM -0500, Dan Murphy wrote:
>
>> Well should we then just revert back to the non-standard name and just fix
>> up the code?
>> Or should we support both properties?
> Either option is fine for me, supporting both is a little nicer.

Sounds good I will mark the incorrect property as deprecated: true

Dan


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

* [PATCH v3 2/2] ASoC: tas2562: Update shutdown GPIO property
  2020-07-23 16:08 [PATCH v3 1/2] dt-bindings: tas2562: Convert the tas2562 binding to yaml Dan Murphy
@ 2020-07-23 16:08 ` Dan Murphy
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Murphy @ 2020-07-23 16:08 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, robh
  Cc: devicetree, alsa-devel, linux-kernel, Dan Murphy

Update the shutdown GPIO property to be shutdown from shut-down.

Fixes: c173dba44c2d2 ("ASoC: tas2562: Introduce the TAS2562 amplifier")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 sound/soc/codecs/tas2562.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c
index e74628061040..99920c691d28 100644
--- a/sound/soc/codecs/tas2562.c
+++ b/sound/soc/codecs/tas2562.c
@@ -680,13 +680,26 @@ static int tas2562_parse_dt(struct tas2562_data *tas2562)
 	struct device *dev = tas2562->dev;
 	int ret = 0;
 
-	tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shut-down",
-						    GPIOD_OUT_HIGH);
+	tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH);
 	if (IS_ERR(tas2562->sdz_gpio)) {
-		if (PTR_ERR(tas2562->sdz_gpio) == -EPROBE_DEFER) {
-			tas2562->sdz_gpio = NULL;
+		if (PTR_ERR(tas2562->sdz_gpio) == -EPROBE_DEFER)
 			return -EPROBE_DEFER;
-		}
+
+		tas2562->sdz_gpio = NULL;
+	}
+
+	/*
+	 * The shut-down property is deprecated but needs to be checked for
+	 * backwards compatibility.
+	 */
+	if (tas2562->sdz_gpio == NULL) {
+		tas2562->sdz_gpio = devm_gpiod_get_optional(dev, "shut-down",
+							      GPIOD_OUT_HIGH);
+		if (IS_ERR(tas2562->sdz_gpio))
+			if (PTR_ERR(tas2562->sdz_gpio) == -EPROBE_DEFER)
+				return -EPROBE_DEFER;
+
+		tas2562->sdz_gpio = NULL;
 	}
 
 	ret = fwnode_property_read_u32(dev->fwnode, "ti,imon-slot-no",
-- 
2.27.0


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

end of thread, other threads:[~2020-07-23 16:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-12 16:06 [PATCH v3 1/2] dt-bindings: tas2562: Convert the tas2562 binding to yaml Dan Murphy
2020-06-12 16:06 ` [PATCH v3 2/2] ASoC: tas2562: Update shutdown GPIO property Dan Murphy
2020-06-12 16:09   ` Mark Brown
2020-06-12 16:18     ` Dan Murphy
2020-06-12 16:22       ` Mark Brown
2020-06-12 16:27         ` Dan Murphy
2020-06-12 16:30           ` Mark Brown
2020-06-12 16:56             ` Dan Murphy
2020-07-23 16:08 [PATCH v3 1/2] dt-bindings: tas2562: Convert the tas2562 binding to yaml Dan Murphy
2020-07-23 16:08 ` [PATCH v3 2/2] ASoC: tas2562: Update shutdown GPIO property Dan Murphy

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).