linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] ASoC: tas2562: Add right and left channel slot programming
@ 2020-06-26 15:41 Dan Murphy
  2020-06-26 15:41 ` [PATCH 2/4] dt-bindings: tas2562: Add voltage sense slot property Dan Murphy
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Dan Murphy @ 2020-06-26 15:41 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai
  Cc: alsa-devel, linux-kernel, robh, devicetree, Dan Murphy

Add programming for the tdm slots for the right and left. This also
requires configuring the RX/TX offsets for the DAI format type.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 sound/soc/codecs/tas2562.c | 71 +++++++++++++++++++++++++++++---------
 sound/soc/codecs/tas2562.h |  5 ++-
 2 files changed, 59 insertions(+), 17 deletions(-)

diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c
index d26e30a2948c..1d3c381aeefe 100644
--- a/sound/soc/codecs/tas2562.c
+++ b/sound/soc/codecs/tas2562.c
@@ -175,7 +175,37 @@ static int tas2562_set_dai_tdm_slot(struct snd_soc_dai *dai,
 {
 	struct snd_soc_component *component = dai->component;
 	struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component);
-	int ret = 0;
+	int left_slot, right_slot;
+	int slots_cfg;
+	int ret;
+
+	if (!tx_mask) {
+		dev_err(component->dev, "tx masks must not be 0\n");
+		return -EINVAL;
+	}
+
+	if (slots == 1) {
+		if (tx_mask != 1)
+			return -EINVAL;
+
+		left_slot = 0;
+		right_slot = 0;
+	} else {
+		left_slot = __ffs(tx_mask);
+		tx_mask &= ~(1 << left_slot);
+		if (tx_mask == 0) {
+			right_slot = left_slot;
+		} else {
+			right_slot = __ffs(tx_mask);
+			tx_mask &= ~(1 << right_slot);
+		}
+	}
+
+	slots_cfg = (right_slot << TAS2562_RIGHT_SLOT_SHIFT) | left_slot;
+
+	ret = snd_soc_component_write(component, TAS2562_TDM_CFG3, slots_cfg);
+	if (ret < 0)
+		return ret;
 
 	switch (slot_width) {
 	case 16:
@@ -208,6 +238,18 @@ static int tas2562_set_dai_tdm_slot(struct snd_soc_dai *dai,
 	if (ret < 0)
 		return ret;
 
+	ret = snd_soc_component_update_bits(component, TAS2562_TDM_CFG5,
+					    TAS2562_TDM_CFG5_VSNS_SLOT_MASK,
+					    tas2562->v_sense_slot);
+	if (ret < 0)
+		return ret;
+
+	ret = snd_soc_component_update_bits(component, TAS2562_TDM_CFG6,
+					    TAS2562_TDM_CFG6_ISNS_SLOT_MASK,
+					    tas2562->i_sense_slot);
+	if (ret < 0)
+		return ret;
+
 	return 0;
 }
 
@@ -285,7 +327,8 @@ static int tas2562_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 {
 	struct snd_soc_component *component = dai->component;
 	struct tas2562_data *tas2562 = snd_soc_component_get_drvdata(component);
-	u8 tdm_rx_start_slot = 0, asi_cfg_1 = 0;
+	u8 asi_cfg_1 = 0;
+	u8 tdm_rx_start_slot = 0;
 	int ret;
 
 	switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
@@ -307,27 +350,23 @@ static int tas2562_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 		dev_err(tas2562->dev, "Failed to set RX edge\n");
 		return ret;
 	}
-
 	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
-	case (SND_SOC_DAIFMT_I2S):
-	case (SND_SOC_DAIFMT_DSP_A):
-	case (SND_SOC_DAIFMT_DSP_B):
-		tdm_rx_start_slot = BIT(1);
-		break;
-	case (SND_SOC_DAIFMT_LEFT_J):
+	case SND_SOC_DAIFMT_LEFT_J:
+	case SND_SOC_DAIFMT_DSP_B:
 		tdm_rx_start_slot = 0;
 		break;
-	default:
-		dev_err(tas2562->dev, "DAI Format is not found, fmt=0x%x\n",
-			fmt);
-		ret = -EINVAL;
+	case SND_SOC_DAIFMT_I2S:
+	case SND_SOC_DAIFMT_DSP_A:
+		tdm_rx_start_slot = 1;
 		break;
+	default:
+		dev_err(tas2562->dev,
+			"DAI Format is not found, fmt=0x%x\n", fmt);
+		return -EINVAL;
 	}
 
 	ret = snd_soc_component_update_bits(component, TAS2562_TDM_CFG1,
-					    TAS2562_TDM_CFG1_RX_OFFSET_MASK,
-					    tdm_rx_start_slot);
-
+				TAS2562_RX_OFF_MASK, (tdm_rx_start_slot << 1));
 	if (ret < 0)
 		return ret;
 
diff --git a/sound/soc/codecs/tas2562.h b/sound/soc/codecs/tas2562.h
index 28e75fc431d0..18209f397921 100644
--- a/sound/soc/codecs/tas2562.h
+++ b/sound/soc/codecs/tas2562.h
@@ -34,6 +34,10 @@
 #define TAS2562_TDM_DET		TAS2562_REG(0, 0x11)
 #define TAS2562_REV_ID		TAS2562_REG(0, 0x7d)
 
+#define TAS2562_RX_OFF_MASK	GENMASK(5, 1)
+#define TAS2562_TX_OFF_MASK	GENMASK(3, 1)
+#define TAS2562_RIGHT_SLOT_SHIFT 4
+
 /* Page 2 */
 #define TAS2562_DVC_CFG1	TAS2562_REG(2, 0x0c)
 #define TAS2562_DVC_CFG2	TAS2562_REG(2, 0x0d)
@@ -49,7 +53,6 @@
 
 #define TAS2562_TDM_CFG1_RX_EDGE_MASK	BIT(0)
 #define TAS2562_TDM_CFG1_RX_FALLING	1
-#define TAS2562_TDM_CFG1_RX_OFFSET_MASK	GENMASK(4, 0)
 
 #define TAS2562_TDM_CFG0_RAMPRATE_MASK		BIT(5)
 #define TAS2562_TDM_CFG0_RAMPRATE_44_1		BIT(5)
-- 
2.26.2


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

* [PATCH 2/4] dt-bindings: tas2562: Add voltage sense slot property
  2020-06-26 15:41 [PATCH 1/4] ASoC: tas2562: Add right and left channel slot programming Dan Murphy
@ 2020-06-26 15:41 ` Dan Murphy
  2020-06-26 15:41 ` [PATCH 3/4] ASoC: tas2562: Add voltage sense slot configuration Dan Murphy
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Dan Murphy @ 2020-06-26 15:41 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai
  Cc: alsa-devel, linux-kernel, robh, devicetree, Dan Murphy

Add a property to configure the slot for the voltage sense monitoring of
the device. Vsense data will be sent to the processor via the slot
defined by the property

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 Documentation/devicetree/bindings/sound/tas2562.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/tas2562.txt b/Documentation/devicetree/bindings/sound/tas2562.txt
index fd0ac8636c01..dc6d7362ded7 100644
--- a/Documentation/devicetree/bindings/sound/tas2562.txt
+++ b/Documentation/devicetree/bindings/sound/tas2562.txt
@@ -11,6 +11,8 @@ Required properties:
  - 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.
+ - ti,vmon-slot-no:- TDM TX voltage sense time slot. This slot must always be
+		     greater then ti,imon-slot-no.
 
 Optional properties:
 - interrupt-parent: phandle to the interrupt controller which provides
@@ -30,5 +32,6 @@ tas2562@4c {
 
 	shut-down-gpio = <&gpio1 15 0>;
         ti,imon-slot-no = <0>;
+        ti,vmon-slot-no = <1>;
 };
 
-- 
2.26.2


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

* [PATCH 3/4] ASoC: tas2562: Add voltage sense slot configuration
  2020-06-26 15:41 [PATCH 1/4] ASoC: tas2562: Add right and left channel slot programming Dan Murphy
  2020-06-26 15:41 ` [PATCH 2/4] dt-bindings: tas2562: Add voltage sense slot property Dan Murphy
@ 2020-06-26 15:41 ` Dan Murphy
  2020-06-26 15:41 ` [PATCH 4/4] dt-bindings: tas2562: Convert the tas2562 binding to yaml Dan Murphy
  2020-06-29 18:15 ` [PATCH 1/4] ASoC: tas2562: Add right and left channel slot programming Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Dan Murphy @ 2020-06-26 15:41 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai
  Cc: alsa-devel, linux-kernel, robh, devicetree, Dan Murphy

Add Vsense slot configuration based on the device tree.  Adding this
property enables the slot programming to be moved to the tdm_set_slot
callback.  This in affect sets the slots for the Isense and Vsense and
enabling this these modes are now based on whether these features were
powered on or not.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 sound/soc/codecs/tas2562.c | 65 ++++++++++++++++++++++++++++++--------
 1 file changed, 51 insertions(+), 14 deletions(-)

diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c
index 1d3c381aeefe..5c28af370bd4 100644
--- a/sound/soc/codecs/tas2562.c
+++ b/sound/soc/codecs/tas2562.c
@@ -250,12 +250,26 @@ static int tas2562_set_dai_tdm_slot(struct snd_soc_dai *dai,
 	if (ret < 0)
 		return ret;
 
+	ret = snd_soc_component_update_bits(component, TAS2562_TDM_CFG5,
+					    TAS2562_TDM_CFG5_VSNS_SLOT_MASK,
+					    tas2562->v_sense_slot);
+	if (ret < 0)
+		return ret;
+
+	ret = snd_soc_component_update_bits(component, TAS2562_TDM_CFG6,
+					    TAS2562_TDM_CFG6_ISNS_SLOT_MASK,
+					    tas2562->i_sense_slot);
+	if (ret < 0)
+		return ret;
+
 	return 0;
 }
 
 static int tas2562_set_bitwidth(struct tas2562_data *tas2562, int bitwidth)
 {
 	int ret;
+	int val;
+	int sense_en;
 
 	switch (bitwidth) {
 	case SNDRV_PCM_FORMAT_S16_LE:
@@ -263,21 +277,18 @@ static int tas2562_set_bitwidth(struct tas2562_data *tas2562, int bitwidth)
 					      TAS2562_TDM_CFG2,
 					      TAS2562_TDM_CFG2_RXWLEN_MASK,
 					      TAS2562_TDM_CFG2_RXWLEN_16B);
-		tas2562->v_sense_slot = tas2562->i_sense_slot + 2;
 		break;
 	case SNDRV_PCM_FORMAT_S24_LE:
 		snd_soc_component_update_bits(tas2562->component,
 					      TAS2562_TDM_CFG2,
 					      TAS2562_TDM_CFG2_RXWLEN_MASK,
 					      TAS2562_TDM_CFG2_RXWLEN_24B);
-		tas2562->v_sense_slot = tas2562->i_sense_slot + 4;
 		break;
 	case SNDRV_PCM_FORMAT_S32_LE:
 		snd_soc_component_update_bits(tas2562->component,
 					      TAS2562_TDM_CFG2,
 					      TAS2562_TDM_CFG2_RXWLEN_MASK,
 					      TAS2562_TDM_CFG2_RXWLEN_32B);
-		tas2562->v_sense_slot = tas2562->i_sense_slot + 4;
 		break;
 
 	default:
@@ -285,17 +296,27 @@ static int tas2562_set_bitwidth(struct tas2562_data *tas2562, int bitwidth)
 		return -EINVAL;
 	}
 
-	ret = snd_soc_component_update_bits(tas2562->component,
-		TAS2562_TDM_CFG5,
-		TAS2562_TDM_CFG5_VSNS_EN | TAS2562_TDM_CFG5_VSNS_SLOT_MASK,
-		TAS2562_TDM_CFG5_VSNS_EN | tas2562->v_sense_slot);
+	val = snd_soc_component_read(tas2562->component, TAS2562_PWR_CTRL);
+	if (val < 0)
+		return val;
+
+	if (val & (1 << TAS2562_VSENSE_POWER_EN))
+		sense_en = 0;
+	else
+		sense_en = TAS2562_TDM_CFG5_VSNS_EN;
+
+	ret = snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG5,
+		TAS2562_TDM_CFG5_VSNS_EN, sense_en);
 	if (ret < 0)
 		return ret;
 
-	ret = snd_soc_component_update_bits(tas2562->component,
-		TAS2562_TDM_CFG6,
-		TAS2562_TDM_CFG6_ISNS_EN | TAS2562_TDM_CFG6_ISNS_SLOT_MASK,
-		TAS2562_TDM_CFG6_ISNS_EN | tas2562->i_sense_slot);
+	if (val & (1 << TAS2562_ISENSE_POWER_EN))
+		sense_en = 0;
+	else
+		sense_en = TAS2562_TDM_CFG6_ISNS_EN;
+
+	ret = snd_soc_component_update_bits(tas2562->component, TAS2562_TDM_CFG6,
+		TAS2562_TDM_CFG6_ISNS_EN, sense_en);
 	if (ret < 0)
 		return ret;
 
@@ -669,9 +690,25 @@ static int tas2562_parse_dt(struct tas2562_data *tas2562)
 
 	ret = fwnode_property_read_u32(dev->fwnode, "ti,imon-slot-no",
 			&tas2562->i_sense_slot);
-	if (ret)
-		dev_err(dev, "Looking up %s property failed %d\n",
-			"ti,imon-slot-no", ret);
+	if (ret) {
+		dev_err(dev, "Property %s is missing setting default slot\n",
+			"ti,imon-slot-no");
+		tas2562->i_sense_slot = 0;
+	}
+
+
+	ret = fwnode_property_read_u32(dev->fwnode, "ti,vmon-slot-no",
+			&tas2562->v_sense_slot);
+	if (ret) {
+		dev_info(dev, "Property %s is missing setting default slot\n",
+			"ti,vmon-slot-no");
+		tas2562->v_sense_slot = 2;
+	}
+
+	if (tas2562->v_sense_slot < tas2562->i_sense_slot) {
+		dev_err(dev, "Vsense slot must be greater than Isense slot\n");
+		return -EINVAL;
+	}
 
 	return ret;
 }
-- 
2.26.2


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

* [PATCH 4/4] dt-bindings: tas2562: Convert the tas2562 binding to yaml
  2020-06-26 15:41 [PATCH 1/4] ASoC: tas2562: Add right and left channel slot programming Dan Murphy
  2020-06-26 15:41 ` [PATCH 2/4] dt-bindings: tas2562: Add voltage sense slot property Dan Murphy
  2020-06-26 15:41 ` [PATCH 3/4] ASoC: tas2562: Add voltage sense slot configuration Dan Murphy
@ 2020-06-26 15:41 ` Dan Murphy
  2020-07-15 20:15   ` Rob Herring
  2020-06-29 18:15 ` [PATCH 1/4] ASoC: tas2562: Add right and left channel slot programming Mark Brown
  3 siblings, 1 reply; 8+ messages in thread
From: Dan Murphy @ 2020-06-26 15:41 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai
  Cc: alsa-devel, linux-kernel, robh, devicetree, Dan Murphy

Convert the TAS2562 text file to yaml format.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 .../devicetree/bindings/sound/tas2562.txt     | 37 ---------
 .../devicetree/bindings/sound/tas2562.yaml    | 77 +++++++++++++++++++
 2 files changed, 77 insertions(+), 37 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 dc6d7362ded7..000000000000
--- a/Documentation/devicetree/bindings/sound/tas2562.txt
+++ /dev/null
@@ -1,37 +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.
- - ti,vmon-slot-no:- TDM TX voltage sense time slot. This slot must always be
-		     greater then ti,imon-slot-no.
-
-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: 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-gpio = <&gpio1 15 0>;
-        ti,imon-slot-no = <0>;
-        ti,vmon-slot-no = <1>;
-};
-
diff --git a/Documentation/devicetree/bindings/sound/tas2562.yaml b/Documentation/devicetree/bindings/sound/tas2562.yaml
new file mode 100644
index 000000000000..1fb467e14d4c
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/tas2562.yaml
@@ -0,0 +1,77 @@
+# 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
+
+  shut-down-gpio:
+    description: GPIO used to control the state of the device.
+    deprecated: true
+
+  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.
+
+  ti,vmon-slot-no:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      TDM TX voltage sense time slot.  This slot must always be greater then
+      ti,imon-slot-no.
+
+  '#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>;
+       ti,vmon-slot-no = <2>;
+     };
+   };
+
+...
-- 
2.26.2


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

* Re: [PATCH 1/4] ASoC: tas2562: Add right and left channel slot programming
  2020-06-26 15:41 [PATCH 1/4] ASoC: tas2562: Add right and left channel slot programming Dan Murphy
                   ` (2 preceding siblings ...)
  2020-06-26 15:41 ` [PATCH 4/4] dt-bindings: tas2562: Convert the tas2562 binding to yaml Dan Murphy
@ 2020-06-29 18:15 ` Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2020-06-29 18:15 UTC (permalink / raw)
  To: Dan Murphy, perex, tiwai, lgirdwood
  Cc: robh, alsa-devel, devicetree, linux-kernel

On Fri, 26 Jun 2020 10:41:40 -0500, Dan Murphy wrote:
> Add programming for the tdm slots for the right and left. This also
> requires configuring the RX/TX offsets for the DAI format type.

Applied to

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

Thanks!

[1/3] ASoC: tas2562: Add right and left channel slot programming
      commit: d7bd40ae55ce339a3c9be7fc2087c671d3d80894
[2/3] ASoC: tas2562: Add voltage sense slot property
      commit: f10b6c99c08433861d1ed62267fa57ced7dbdf50
[3/3] ASoC: tas2562: Add voltage sense slot configuration
      commit: 09ed395b05feb7d0f77ab52c48d2f77c1b44d2ab

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] 8+ messages in thread

* Re: [PATCH 4/4] dt-bindings: tas2562: Convert the tas2562 binding to yaml
  2020-06-26 15:41 ` [PATCH 4/4] dt-bindings: tas2562: Convert the tas2562 binding to yaml Dan Murphy
@ 2020-07-15 20:15   ` Rob Herring
  2020-07-20 18:22     ` Dan Murphy
  0 siblings, 1 reply; 8+ messages in thread
From: Rob Herring @ 2020-07-15 20:15 UTC (permalink / raw)
  To: Dan Murphy
  Cc: lgirdwood, broonie, perex, tiwai, alsa-devel, linux-kernel, devicetree

On Fri, Jun 26, 2020 at 10:41:43AM -0500, Dan Murphy wrote:
> Convert the TAS2562 text file to yaml format.
> 
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
>  .../devicetree/bindings/sound/tas2562.txt     | 37 ---------
>  .../devicetree/bindings/sound/tas2562.yaml    | 77 +++++++++++++++++++
>  2 files changed, 77 insertions(+), 37 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 dc6d7362ded7..000000000000
> --- a/Documentation/devicetree/bindings/sound/tas2562.txt
> +++ /dev/null
> @@ -1,37 +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.
> - - ti,vmon-slot-no:- TDM TX voltage sense time slot. This slot must always be
> -		     greater then ti,imon-slot-no.
> -
> -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: 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-gpio = <&gpio1 15 0>;
> -        ti,imon-slot-no = <0>;
> -        ti,vmon-slot-no = <1>;
> -};
> -
> diff --git a/Documentation/devicetree/bindings/sound/tas2562.yaml b/Documentation/devicetree/bindings/sound/tas2562.yaml
> new file mode 100644
> index 000000000000..1fb467e14d4c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/tas2562.yaml
> @@ -0,0 +1,77 @@
> +# SPDX-License-Identifier: (GPL-2.0+ OR BSD-2-Clause)

Same licensing comment here as tas2770

> +# 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
> +
> +  shut-down-gpio:
> +    description: GPIO used to control the state of the device.
> +    deprecated: true

Why do we need this as the driver never worked?

> +
> +  shutdown-gpio:
> +    description: GPIO used to control the state of the device.

-gpios is the preferred form: shutdown-gpios

> +
> +  interrupts:
> +    maxItems: 1
> +
> +  ti,imon-slot-no:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: TDM TX current sense time slot.
> +
> +  ti,vmon-slot-no:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: |
> +      TDM TX voltage sense time slot.  This slot must always be greater then
> +      ti,imon-slot-no.
> +
> +  '#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>;
> +       ti,vmon-slot-no = <2>;
> +     };
> +   };
> +
> +...
> -- 
> 2.26.2
> 

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

* Re: [PATCH 4/4] dt-bindings: tas2562: Convert the tas2562 binding to yaml
  2020-07-15 20:15   ` Rob Herring
@ 2020-07-20 18:22     ` Dan Murphy
  2020-07-23 20:16       ` Rob Herring
  0 siblings, 1 reply; 8+ messages in thread
From: Dan Murphy @ 2020-07-20 18:22 UTC (permalink / raw)
  To: Rob Herring
  Cc: lgirdwood, broonie, perex, tiwai, alsa-devel, linux-kernel, devicetree

Rob

On 7/15/20 3:15 PM, Rob Herring wrote:
> On Fri, Jun 26, 2020 at 10:41:43AM -0500, Dan Murphy wrote:
>> Convert the TAS2562 text file to yaml format.
>>
>> Signed-off-by: Dan Murphy <dmurphy@ti.com>
>> ---
>>   .../devicetree/bindings/sound/tas2562.txt     | 37 ---------
>>   .../devicetree/bindings/sound/tas2562.yaml    | 77 +++++++++++++++++++
>>   2 files changed, 77 insertions(+), 37 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 dc6d7362ded7..000000000000
>> --- a/Documentation/devicetree/bindings/sound/tas2562.txt
>> +++ /dev/null
>> @@ -1,37 +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.
>> - - ti,vmon-slot-no:- TDM TX voltage sense time slot. This slot must always be
>> -		     greater then ti,imon-slot-no.
>> -
>> -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: 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-gpio = <&gpio1 15 0>;
>> -        ti,imon-slot-no = <0>;
>> -        ti,vmon-slot-no = <1>;
>> -};
>> -
>> diff --git a/Documentation/devicetree/bindings/sound/tas2562.yaml b/Documentation/devicetree/bindings/sound/tas2562.yaml
>> new file mode 100644
>> index 000000000000..1fb467e14d4c
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/sound/tas2562.yaml
>> @@ -0,0 +1,77 @@
>> +# SPDX-License-Identifier: (GPL-2.0+ OR BSD-2-Clause)
> Same licensing comment here as tas2770

OK I will fix it like I did with the other TAS2770 patches


>> +# 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
>> +
>> +  shut-down-gpio:
>> +    description: GPIO used to control the state of the device.
>> +    deprecated: true
> Why do we need this as the driver never worked?

Not sure what you are asking.

Driver has been fixed for this specific binding in sound for-next.

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/commit/sound/soc/codecs/tas2562.c?h=for-next&id=bc07b54459cbb3a572a78b5c200ff79ef11b8158

>
>> +
>> +  shutdown-gpio:
>> +    description: GPIO used to control the state of the device.
> -gpios is the preferred form: shutdown-gpios

So the plural form of gpio is preferred even if the gpio is singular?  I 
would think gpio would be plural if this was an array of gpios.

I am waiting for the yaml to be accepted before adding this shutdown 
property to the driver.

Dan


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

* Re: [PATCH 4/4] dt-bindings: tas2562: Convert the tas2562 binding to yaml
  2020-07-20 18:22     ` Dan Murphy
@ 2020-07-23 20:16       ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2020-07-23 20:16 UTC (permalink / raw)
  To: Dan Murphy
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Linux-ALSA, linux-kernel, devicetree

On Mon, Jul 20, 2020 at 12:22 PM Dan Murphy <dmurphy@ti.com> wrote:
>
> Rob
>
> On 7/15/20 3:15 PM, Rob Herring wrote:
> > On Fri, Jun 26, 2020 at 10:41:43AM -0500, Dan Murphy wrote:
> >> Convert the TAS2562 text file to yaml format.
> >>
> >> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> >> ---
> >>   .../devicetree/bindings/sound/tas2562.txt     | 37 ---------
> >>   .../devicetree/bindings/sound/tas2562.yaml    | 77 +++++++++++++++++++
> >>   2 files changed, 77 insertions(+), 37 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 dc6d7362ded7..000000000000
> >> --- a/Documentation/devicetree/bindings/sound/tas2562.txt
> >> +++ /dev/null
> >> @@ -1,37 +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.
> >> - - ti,vmon-slot-no:- TDM TX voltage sense time slot. This slot must always be
> >> -                 greater then ti,imon-slot-no.
> >> -
> >> -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: 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-gpio = <&gpio1 15 0>;
> >> -        ti,imon-slot-no = <0>;
> >> -        ti,vmon-slot-no = <1>;
> >> -};
> >> -
> >> diff --git a/Documentation/devicetree/bindings/sound/tas2562.yaml b/Documentation/devicetree/bindings/sound/tas2562.yaml
> >> new file mode 100644
> >> index 000000000000..1fb467e14d4c
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/sound/tas2562.yaml
> >> @@ -0,0 +1,77 @@
> >> +# SPDX-License-Identifier: (GPL-2.0+ OR BSD-2-Clause)
> > Same licensing comment here as tas2770
>
> OK I will fix it like I did with the other TAS2770 patches
>
>
> >> +# 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
> >> +
> >> +  shut-down-gpio:
> >> +    description: GPIO used to control the state of the device.
> >> +    deprecated: true
> > Why do we need this as the driver never worked?
>
> Not sure what you are asking.
>
> Driver has been fixed for this specific binding in sound for-next.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/commit/sound/soc/codecs/tas2562.c?h=for-next&id=bc07b54459cbb3a572a78b5c200ff79ef11b8158

Why fix the driver and then have to maintain compatibility? Just
update everything to use 'shutdown-gpios' and move on.

Rob

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-26 15:41 [PATCH 1/4] ASoC: tas2562: Add right and left channel slot programming Dan Murphy
2020-06-26 15:41 ` [PATCH 2/4] dt-bindings: tas2562: Add voltage sense slot property Dan Murphy
2020-06-26 15:41 ` [PATCH 3/4] ASoC: tas2562: Add voltage sense slot configuration Dan Murphy
2020-06-26 15:41 ` [PATCH 4/4] dt-bindings: tas2562: Convert the tas2562 binding to yaml Dan Murphy
2020-07-15 20:15   ` Rob Herring
2020-07-20 18:22     ` Dan Murphy
2020-07-23 20:16       ` Rob Herring
2020-06-29 18:15 ` [PATCH 1/4] ASoC: tas2562: Add right and left channel slot programming Mark Brown

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