devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] ASoC: tlv320adcx140: Idle the device while writing registers
@ 2020-09-15 19:06 Dan Murphy
  2020-09-15 19:06 ` [PATCH 2/6] ASoC: tlv320adcx140: Fix BCLK inversion for DSP modes Dan Murphy
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Dan Murphy @ 2020-09-15 19:06 UTC (permalink / raw)
  To: lgirdwood, broonie, tiwai, robh+dt
  Cc: devicetree, camel.guo, alsa-devel, linux-kernel, Dan Murphy

It was observed that if the device was active and register writes were
performed there were some unwanted behaviors particularly when writing
the word length and some filter options. So when writing to the device
the device should be placed in sleep mode and then exit sleep mode once
the register update is complete.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 sound/soc/codecs/tlv320adcx140.c | 43 ++++++++++++++++++++++++--------
 sound/soc/codecs/tlv320adcx140.h |  2 ++
 2 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c
index 8efe20605f9b..3909c1cf52be 100644
--- a/sound/soc/codecs/tlv320adcx140.c
+++ b/sound/soc/codecs/tlv320adcx140.c
@@ -30,7 +30,7 @@ struct adcx140_priv {
 	struct regmap *regmap;
 	struct device *dev;
 
-	int micbias_vg;
+	bool micbias_vg;
 
 	unsigned int dai_fmt;
 	unsigned int tdm_delay;
@@ -614,11 +614,26 @@ static int adcx140_reset(struct adcx140_priv *adcx140)
 	return ret;
 }
 
+static void adcx140_pwr_ctrl(struct adcx140_priv *adcx140, bool power_state)
+{
+	int pwr_ctrl = 0;
+
+	if (power_state)
+		pwr_ctrl = ADCX140_PWR_CFG_ADC_PDZ | ADCX140_PWR_CFG_PLL_PDZ;
+
+	if (adcx140->micbias_vg && power_state)
+		pwr_ctrl |= ADCX140_PWR_CFG_BIAS_PDZ;
+
+	regmap_update_bits(adcx140->regmap, ADCX140_PWR_CFG,
+			   ADCX140_PWR_CTRL_MSK, pwr_ctrl);
+}
+
 static int adcx140_hw_params(struct snd_pcm_substream *substream,
 			     struct snd_pcm_hw_params *params,
 			     struct snd_soc_dai *dai)
 {
 	struct snd_soc_component *component = dai->component;
+	struct adcx140_priv *adcx140 = snd_soc_component_get_drvdata(component);
 	u8 data = 0;
 
 	switch (params_width(params)) {
@@ -640,9 +655,13 @@ static int adcx140_hw_params(struct snd_pcm_substream *substream,
 		return -EINVAL;
 	}
 
+	adcx140_pwr_ctrl(adcx140, false);
+
 	snd_soc_component_update_bits(component, ADCX140_ASI_CFG0,
 			    ADCX140_WORD_LEN_MSK, data);
 
+	adcx140_pwr_ctrl(adcx140, true);
+
 	return 0;
 }
 
@@ -709,6 +728,8 @@ static int adcx140_set_dai_fmt(struct snd_soc_dai *codec_dai,
 
 	adcx140->dai_fmt = fmt & SND_SOC_DAIFMT_FORMAT_MASK;
 
+	adcx140_pwr_ctrl(adcx140, false);
+
 	snd_soc_component_update_bits(component, ADCX140_ASI_CFG0,
 				      ADCX140_FSYNCINV_BIT |
 				      ADCX140_BCLKINV_BIT |
@@ -721,6 +742,7 @@ static int adcx140_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	snd_soc_component_update_bits(component, ADCX140_ASI_CFG1,
 				      ADCX140_TX_OFFSET_MASK, offset);
 
+	adcx140_pwr_ctrl(adcx140, true);
 
 	return 0;
 }
@@ -818,12 +840,11 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
 
 	ret = device_property_read_u32(adcx140->dev, "ti,mic-bias-source",
 				      &bias_source);
-	if (ret)
+	if (ret || bias_source > ADCX140_MIC_BIAS_VAL_AVDD) {
 		bias_source = ADCX140_MIC_BIAS_VAL_VREF;
-
-	if (bias_source > ADCX140_MIC_BIAS_VAL_AVDD) {
-		dev_err(adcx140->dev, "Mic Bias source value is invalid\n");
-		return -EINVAL;
+		adcx140->micbias_vg = false;
+	} else {
+		adcx140->micbias_vg = true;
 	}
 
 	ret = device_property_read_u32(adcx140->dev, "ti,vref-source",
@@ -906,6 +927,8 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
 				ADCX140_MIC_BIAS_VREF_MSK, bias_cfg);
 	if (ret)
 		dev_err(adcx140->dev, "setting MIC bias failed %d\n", ret);
+
+	adcx140_pwr_ctrl(adcx140, true);
 out:
 	return ret;
 }
@@ -914,21 +937,19 @@ static int adcx140_set_bias_level(struct snd_soc_component *component,
 				  enum snd_soc_bias_level level)
 {
 	struct adcx140_priv *adcx140 = snd_soc_component_get_drvdata(component);
-	int pwr_cfg = 0;
 
 	switch (level) {
 	case SND_SOC_BIAS_ON:
 	case SND_SOC_BIAS_PREPARE:
 	case SND_SOC_BIAS_STANDBY:
-		pwr_cfg = ADCX140_PWR_CFG_BIAS_PDZ | ADCX140_PWR_CFG_PLL_PDZ |
-			  ADCX140_PWR_CFG_ADC_PDZ;
+		adcx140_pwr_ctrl(adcx140, true);
 		break;
 	case SND_SOC_BIAS_OFF:
-		pwr_cfg = 0x0;
+		adcx140_pwr_ctrl(adcx140, false);
 		break;
 	}
 
-	return regmap_write(adcx140->regmap, ADCX140_PWR_CFG, pwr_cfg);
+	return 0;
 }
 
 static const struct snd_soc_component_driver soc_codec_driver_adcx140 = {
diff --git a/sound/soc/codecs/tlv320adcx140.h b/sound/soc/codecs/tlv320adcx140.h
index eedbc1d7221f..94c6d1fd2977 100644
--- a/sound/soc/codecs/tlv320adcx140.h
+++ b/sound/soc/codecs/tlv320adcx140.h
@@ -123,6 +123,7 @@
 #define ADCX140_MIC_BIAS_VREF_1375V	2
 #define ADCX140_MIC_BIAS_VREF_MSK GENMASK(1, 0)
 
+#define ADCX140_PWR_CTRL_MSK    GENMASK(7, 5)
 #define ADCX140_PWR_CFG_BIAS_PDZ	BIT(7)
 #define ADCX140_PWR_CFG_ADC_PDZ		BIT(6)
 #define ADCX140_PWR_CFG_PLL_PDZ		BIT(5)
@@ -145,4 +146,5 @@
 #define ADCX140_GPO_CFG_MAX		4
 #define ADCX140_GPO_DRV_MAX		5
 
+
 #endif /* _TLV320ADCX140_ */
-- 
2.28.0


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

* [PATCH 2/6] ASoC: tlv320adcx140: Fix BCLK inversion for DSP modes
  2020-09-15 19:06 [PATCH 1/6] ASoC: tlv320adcx140: Idle the device while writing registers Dan Murphy
@ 2020-09-15 19:06 ` Dan Murphy
  2020-09-15 19:06 ` [PATCH 3/6] dt-bindings: tlv320adcx140: Add ASI Tx drive Dan Murphy
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Dan Murphy @ 2020-09-15 19:06 UTC (permalink / raw)
  To: lgirdwood, broonie, tiwai, robh+dt
  Cc: devicetree, camel.guo, alsa-devel, linux-kernel, Dan Murphy

Fix the BCLK inversion for DSP modes
This is how it is defined by ASoC:
 * BCLK:
 * - "normal" polarity means signal is available at rising edge of BCLK
 * - "inverted" polarity means signal is available at falling edge of BCLK

The adcx140 defines the BCLK edge based on coding type.
The PCM (DSP_A/B) should drive on rising and sample on falling edge, so
from ASoC pov, it is IB_NF. But from the codec pov if it is configured in
DSP mode, then the BCLK should not be inverted, defaults to the coding
standard.

For i2s, it is NB_NF from ASoC pov (drive on falling, sample on rising).
From the codec's pov BCLK should not invert either, as this is the default
for the coding.

So, inversion must take the format into account:
IB_NF + DSP_A/B == the codec bclk inversion should be disabled
NB_NF + DSP_A/B == the codec bclk inversion should be enabled
NB_NF + I2S == the codec bclk inversion should be disabled

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 sound/soc/codecs/tlv320adcx140.c | 44 +++++++++++++++++---------------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c
index 3909c1cf52be..73d18e8002e4 100644
--- a/sound/soc/codecs/tlv320adcx140.c
+++ b/sound/soc/codecs/tlv320adcx140.c
@@ -673,7 +673,7 @@ static int adcx140_set_dai_fmt(struct snd_soc_dai *codec_dai,
 	u8 iface_reg1 = 0;
 	u8 iface_reg2 = 0;
 	int offset = 0;
-	int width = adcx140->slot_width;
+	bool inverted_bclk = false;
 
 	/* set master/slave audio interface */
 	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
@@ -689,24 +689,6 @@ static int adcx140_set_dai_fmt(struct snd_soc_dai *codec_dai,
 		return -EINVAL;
 	}
 
-	/* signal polarity */
-	switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
-	case SND_SOC_DAIFMT_NB_IF:
-		iface_reg1 |= ADCX140_FSYNCINV_BIT;
-		break;
-	case SND_SOC_DAIFMT_IB_IF:
-		iface_reg1 |= ADCX140_BCLKINV_BIT | ADCX140_FSYNCINV_BIT;
-		break;
-	case SND_SOC_DAIFMT_IB_NF:
-		iface_reg1 |= ADCX140_BCLKINV_BIT;
-		break;
-	case SND_SOC_DAIFMT_NB_NF:
-		break;
-	default:
-		dev_err(component->dev, "Invalid DAI clock signal polarity\n");
-		return -EINVAL;
-	}
-
 	/* interface format */
 	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
 	case SND_SOC_DAIFMT_I2S:
@@ -716,16 +698,36 @@ static int adcx140_set_dai_fmt(struct snd_soc_dai *codec_dai,
 		iface_reg1 |= ADCX140_LEFT_JUST_BIT;
 		break;
 	case SND_SOC_DAIFMT_DSP_A:
-		offset += (adcx140->tdm_delay * width + 1);
+		offset = 1;
+		inverted_bclk = true;
 		break;
 	case SND_SOC_DAIFMT_DSP_B:
-		offset += adcx140->tdm_delay * width;
+		inverted_bclk = true;
 		break;
 	default:
 		dev_err(component->dev, "Invalid DAI interface format\n");
 		return -EINVAL;
 	}
 
+	/* signal polarity */
+	switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
+	case SND_SOC_DAIFMT_IB_NF:
+	case SND_SOC_DAIFMT_IB_IF:
+		inverted_bclk = !inverted_bclk;
+		break;
+	case SND_SOC_DAIFMT_NB_IF:
+		iface_reg1 |= ADCX140_FSYNCINV_BIT;
+		break;
+	case SND_SOC_DAIFMT_NB_NF:
+		break;
+	default:
+		dev_err(component->dev, "Invalid DAI clock signal polarity\n");
+		return -EINVAL;
+	}
+
+	if (inverted_bclk)
+		iface_reg1 |= ADCX140_BCLKINV_BIT;
+
 	adcx140->dai_fmt = fmt & SND_SOC_DAIFMT_FORMAT_MASK;
 
 	adcx140_pwr_ctrl(adcx140, false);
-- 
2.28.0


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

* [PATCH 3/6] dt-bindings: tlv320adcx140: Add ASI Tx drive
  2020-09-15 19:06 [PATCH 1/6] ASoC: tlv320adcx140: Idle the device while writing registers Dan Murphy
  2020-09-15 19:06 ` [PATCH 2/6] ASoC: tlv320adcx140: Fix BCLK inversion for DSP modes Dan Murphy
@ 2020-09-15 19:06 ` Dan Murphy
  2020-09-15 19:06 ` [PATCH 4/6] ASoC: tlv320adcx140: Add the config to configure Tx ASI output Dan Murphy
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Dan Murphy @ 2020-09-15 19:06 UTC (permalink / raw)
  To: lgirdwood, broonie, tiwai, robh+dt
  Cc: devicetree, camel.guo, alsa-devel, linux-kernel, Dan Murphy

Add a property to indicate if the device is to go into a High-z state on
the Tx ASI output pins when the device is idle.

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

diff --git a/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml b/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml
index f578f17f3e04..e79f8d1891e4 100644
--- a/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml
+++ b/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml
@@ -108,6 +108,12 @@ properties:
       maximum: 7
     default: [0, 0, 0, 0]
 
+  ti,asi-tx-drive:
+    type: boolean
+    description: |
+      When set the device will set the Tx ASI output to a Hi-Z state for unused
+      data cycles. Default is to drive the output low on unused ASI cycles.
+
 patternProperties:
   '^ti,gpo-config-[1-4]$':
     $ref: /schemas/types.yaml#/definitions/uint32-array
-- 
2.28.0


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

* [PATCH 4/6] ASoC: tlv320adcx140: Add the config to configure Tx ASI output
  2020-09-15 19:06 [PATCH 1/6] ASoC: tlv320adcx140: Idle the device while writing registers Dan Murphy
  2020-09-15 19:06 ` [PATCH 2/6] ASoC: tlv320adcx140: Fix BCLK inversion for DSP modes Dan Murphy
  2020-09-15 19:06 ` [PATCH 3/6] dt-bindings: tlv320adcx140: Add ASI Tx drive Dan Murphy
@ 2020-09-15 19:06 ` Dan Murphy
  2020-09-15 19:06 ` [PATCH 5/6] dt-bindings: tlv320adcx140: Add slot programming property Dan Murphy
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Dan Murphy @ 2020-09-15 19:06 UTC (permalink / raw)
  To: lgirdwood, broonie, tiwai, robh+dt
  Cc: devicetree, camel.guo, alsa-devel, linux-kernel, Dan Murphy

Add code to allow the ASI Tx output to be placed into High-z mode
during unused ASI cycles.  This allows for other devices that may be on
the bus to drive the ASI out. By default the 320adcx140 sends 0's for
unused cycles.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 sound/soc/codecs/tlv320adcx140.c | 11 +++++++++++
 sound/soc/codecs/tlv320adcx140.h |  1 +
 2 files changed, 12 insertions(+)

diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c
index 73d18e8002e4..7fa5c8682c51 100644
--- a/sound/soc/codecs/tlv320adcx140.c
+++ b/sound/soc/codecs/tlv320adcx140.c
@@ -839,6 +839,7 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
 	u32 gpi_input_val = 0;
 	int i;
 	int ret;
+	bool tx_high_z;
 
 	ret = device_property_read_u32(adcx140->dev, "ti,mic-bias-source",
 				      &bias_source);
@@ -930,6 +931,16 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
 	if (ret)
 		dev_err(adcx140->dev, "setting MIC bias failed %d\n", ret);
 
+	tx_high_z = device_property_read_bool(adcx140->dev, "ti,asi-tx-drive");
+	if (tx_high_z) {
+		ret = regmap_update_bits(adcx140->regmap, ADCX140_ASI_CFG0,
+				 ADCX140_TX_FILL, ADCX140_TX_FILL);
+		if (ret) {
+			dev_err(adcx140->dev, "Setting Tx drive failed %d\n", ret);
+			goto out;
+		}
+	}
+
 	adcx140_pwr_ctrl(adcx140, true);
 out:
 	return ret;
diff --git a/sound/soc/codecs/tlv320adcx140.h b/sound/soc/codecs/tlv320adcx140.h
index 94c6d1fd2977..107bd7927d9c 100644
--- a/sound/soc/codecs/tlv320adcx140.h
+++ b/sound/soc/codecs/tlv320adcx140.h
@@ -146,5 +146,6 @@
 #define ADCX140_GPO_CFG_MAX		4
 #define ADCX140_GPO_DRV_MAX		5
 
+#define ADCX140_TX_FILL    BIT(0)
 
 #endif /* _TLV320ADCX140_ */
-- 
2.28.0


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

* [PATCH 5/6] dt-bindings: tlv320adcx140: Add slot programming property
  2020-09-15 19:06 [PATCH 1/6] ASoC: tlv320adcx140: Idle the device while writing registers Dan Murphy
                   ` (2 preceding siblings ...)
  2020-09-15 19:06 ` [PATCH 4/6] ASoC: tlv320adcx140: Add the config to configure Tx ASI output Dan Murphy
@ 2020-09-15 19:06 ` Dan Murphy
  2020-09-17 13:02   ` Mark Brown
  2020-09-15 19:06 ` [PATCH 6/6] ASoC: tlv320adcx140: Add channel slot programming Dan Murphy
  2020-09-17 18:57 ` [PATCH 1/6] ASoC: tlv320adcx140: Idle the device while writing registers Mark Brown
  5 siblings, 1 reply; 10+ messages in thread
From: Dan Murphy @ 2020-09-15 19:06 UTC (permalink / raw)
  To: lgirdwood, broonie, tiwai, robh+dt
  Cc: devicetree, camel.guo, alsa-devel, linux-kernel, Dan Murphy

Add a property to configure the each channel to a specific TDM slot.

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

diff --git a/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml b/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml
index e79f8d1891e4..dfc00308da94 100644
--- a/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml
+++ b/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml
@@ -114,6 +114,24 @@ properties:
       When set the device will set the Tx ASI output to a Hi-Z state for unused
       data cycles. Default is to drive the output low on unused ASI cycles.
 
+  ti,slot-mapping:
+    type: boolean
+    description: |
+      Each channel can be assigned a specific TDM slot for either a left or
+      right channel. The left channel values are from 0-31d and the right
+      channel values are from 32-63d. If the right channel value is 32 then the
+      right channel slot will be slot 31.
+      The array index is sequential audio channel to be set.
+      [ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8]
+      If the channel is not to be used then the channel should be set to it's
+      default value.
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    maxItems: 8
+    items:
+      maximum: 63
+    default: [0, 1, 2, 3, 4, 5, 6, 7]
+
 patternProperties:
   '^ti,gpo-config-[1-4]$':
     $ref: /schemas/types.yaml#/definitions/uint32-array
-- 
2.28.0


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

* [PATCH 6/6] ASoC: tlv320adcx140: Add channel slot programming
  2020-09-15 19:06 [PATCH 1/6] ASoC: tlv320adcx140: Idle the device while writing registers Dan Murphy
                   ` (3 preceding siblings ...)
  2020-09-15 19:06 ` [PATCH 5/6] dt-bindings: tlv320adcx140: Add slot programming property Dan Murphy
@ 2020-09-15 19:06 ` Dan Murphy
  2020-09-17 18:57 ` [PATCH 1/6] ASoC: tlv320adcx140: Idle the device while writing registers Mark Brown
  5 siblings, 0 replies; 10+ messages in thread
From: Dan Murphy @ 2020-09-15 19:06 UTC (permalink / raw)
  To: lgirdwood, broonie, tiwai, robh+dt
  Cc: devicetree, camel.guo, alsa-devel, linux-kernel, Dan Murphy

Each channel can be assigned a specific slot to transmit data. This
assignment is done in the device tree.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 sound/soc/codecs/tlv320adcx140.c | 17 +++++++++++++++++
 sound/soc/codecs/tlv320adcx140.h |  3 +++
 2 files changed, 20 insertions(+)

diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c
index 7fa5c8682c51..666b8f3091d0 100644
--- a/sound/soc/codecs/tlv320adcx140.c
+++ b/sound/soc/codecs/tlv320adcx140.c
@@ -837,6 +837,8 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
 	int gpi_count;
 	u32 gpi_inputs[ADCX140_NUM_GPI_PINS];
 	u32 gpi_input_val = 0;
+	int slot_count;
+	u32 slot_assignment[ADCX140_NUM_CH];
 	int i;
 	int ret;
 	bool tx_high_z;
@@ -941,6 +943,21 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
 		}
 	}
 
+	slot_count = device_property_count_u32(adcx140->dev, "ti,slot-mapping");
+	if ((slot_count <= ADCX140_NUM_CH) && (slot_count > 0)) {
+		ret = device_property_read_u32_array(adcx140->dev, "ti,slot-mapping",
+						     slot_assignment, slot_count);
+		if (ret)
+			return ret;
+
+		for (i = 0; i < slot_count; i++) {
+			ret = regmap_update_bits(adcx140->regmap, ADCX140_ASI_CH1 + i,
+						 ADCX140_SLOT_MSK, slot_assignment[i]);
+			if (ret)
+				return ret;
+		}
+	}
+
 	adcx140_pwr_ctrl(adcx140, true);
 out:
 	return ret;
diff --git a/sound/soc/codecs/tlv320adcx140.h b/sound/soc/codecs/tlv320adcx140.h
index 107bd7927d9c..5eb27b94aa0a 100644
--- a/sound/soc/codecs/tlv320adcx140.h
+++ b/sound/soc/codecs/tlv320adcx140.h
@@ -147,5 +147,8 @@
 #define ADCX140_GPO_DRV_MAX		5
 
 #define ADCX140_TX_FILL    BIT(0)
+#define ADCX140_NUM_CH        8
+
+#define ADCX140_SLOT_MSK	GENMASK(5, 0)
 
 #endif /* _TLV320ADCX140_ */
-- 
2.28.0


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

* Re: [PATCH 5/6] dt-bindings: tlv320adcx140: Add slot programming property
  2020-09-15 19:06 ` [PATCH 5/6] dt-bindings: tlv320adcx140: Add slot programming property Dan Murphy
@ 2020-09-17 13:02   ` Mark Brown
  2020-09-17 15:15     ` Dan Murphy
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2020-09-17 13:02 UTC (permalink / raw)
  To: Dan Murphy
  Cc: lgirdwood, tiwai, robh+dt, devicetree, alsa-devel, linux-kernel,
	camel.guo

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

On Tue, Sep 15, 2020 at 02:06:05PM -0500, Dan Murphy wrote:

> +  ti,slot-mapping:
> +    type: boolean
> +    description: |
> +      Each channel can be assigned a specific TDM slot for either a left or
> +      right channel. The left channel values are from 0-31d and the right
> +      channel values are from 32-63d. If the right channel value is 32 then the
> +      right channel slot will be slot 31.
> +      The array index is sequential audio channel to be set.
> +      [ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8]
> +      If the channel is not to be used then the channel should be set to it's
> +      default value.

This is something I'd expect to be done by the machine driver rather
than in the CODEC specific DT bindings, and apart from anything else
everything involved in the DAI will need to agree on the mapping so this
doesn't look like something that should be done in a device specific
binding.

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

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

* Re: [PATCH 5/6] dt-bindings: tlv320adcx140: Add slot programming property
  2020-09-17 13:02   ` Mark Brown
@ 2020-09-17 15:15     ` Dan Murphy
  2020-09-17 15:56       ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Dan Murphy @ 2020-09-17 15:15 UTC (permalink / raw)
  To: Mark Brown
  Cc: lgirdwood, tiwai, robh+dt, devicetree, alsa-devel, linux-kernel,
	camel.guo

Mark

On 9/17/20 8:02 AM, Mark Brown wrote:
> On Tue, Sep 15, 2020 at 02:06:05PM -0500, Dan Murphy wrote:
>
>> +  ti,slot-mapping:
>> +    type: boolean
>> +    description: |
>> +      Each channel can be assigned a specific TDM slot for either a left or
>> +      right channel. The left channel values are from 0-31d and the right
>> +      channel values are from 32-63d. If the right channel value is 32 then the
>> +      right channel slot will be slot 31.
>> +      The array index is sequential audio channel to be set.
>> +      [ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8]
>> +      If the channel is not to be used then the channel should be set to it's
>> +      default value.
> This is something I'd expect to be done by the machine driver rather
> than in the CODEC specific DT bindings, and apart from anything else
> everything involved in the DAI will need to agree on the mapping so this
> doesn't look like something that should be done in a device specific
> binding.

Here is the use case from our customers

Customers need the ability to not transmit on a TDM slot, since another 
device could be using the slot.
For example, the customer has an amp and dig microphone sharing one TDM 
bus. The amp uses slot 0 while dig microphone use slots 1-3.
In another example, customers use 2 dig microphones. One device 
transmits on slots 0-3, the second device transmits on slots 4-7.
In a third example, customers use 4 dig microphones. Device 1 uses Slots 
0-3, Device 2 uses Slots 4-7, Device 3 uses Slots 8-11, and Device 4 
uses Slots 12-15.

The dai-tdm-slot-num would be a good candidate to add to the sound card 
to define the slot number but it's definition is "Number of slots in 
use." So it is not really setting the needed slot.
I am not finding any good way to assign specific slots to specific channels.

I can add DAI slot numbering parameter for specific codecs.

Dan

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

* Re: [PATCH 5/6] dt-bindings: tlv320adcx140: Add slot programming property
  2020-09-17 15:15     ` Dan Murphy
@ 2020-09-17 15:56       ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2020-09-17 15:56 UTC (permalink / raw)
  To: Dan Murphy
  Cc: lgirdwood, tiwai, robh+dt, devicetree, alsa-devel, linux-kernel,
	camel.guo

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

On Thu, Sep 17, 2020 at 10:15:27AM -0500, Dan Murphy wrote:
> On 9/17/20 8:02 AM, Mark Brown wrote:

> > This is something I'd expect to be done by the machine driver rather
> > than in the CODEC specific DT bindings, and apart from anything else

> Customers need the ability to not transmit on a TDM slot, since another
> device could be using the slot.

TDM is not an issue, we already have the set_tdm_slot() API.  The issue
is how you're configuring it.

> The dai-tdm-slot-num would be a good candidate to add to the sound card to
> define the slot number but it's definition is "Number of slots in use." So
> it is not really setting the needed slot.
> I am not finding any good way to assign specific slots to specific channels.

If the generic features are not sufficent then please extend the generic
features rather than bodging around them in individual drivers.

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

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

* Re: [PATCH 1/6] ASoC: tlv320adcx140: Idle the device while writing registers
  2020-09-15 19:06 [PATCH 1/6] ASoC: tlv320adcx140: Idle the device while writing registers Dan Murphy
                   ` (4 preceding siblings ...)
  2020-09-15 19:06 ` [PATCH 6/6] ASoC: tlv320adcx140: Add channel slot programming Dan Murphy
@ 2020-09-17 18:57 ` Mark Brown
  5 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2020-09-17 18:57 UTC (permalink / raw)
  To: tiwai, lgirdwood, robh+dt, Dan Murphy
  Cc: alsa-devel, linux-kernel, camel.guo, devicetree

On Tue, 15 Sep 2020 14:06:01 -0500, Dan Murphy wrote:
> It was observed that if the device was active and register writes were
> performed there were some unwanted behaviors particularly when writing
> the word length and some filter options. So when writing to the device
> the device should be placed in sleep mode and then exit sleep mode once
> the register update is complete.

Applied to

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

Thanks!

[1/6] ASoC: tlv320adcx140: Idle the device while writing registers
      commit: df16e2210454ca0b8a59caf364dd287fbb76a804
[2/6] ASoC: tlv320adcx140: Fix BCLK inversion for DSP modes
      commit: 244ac15de75ca62ed7a09c7291b67aeead9e12ac
[3/6] ASoC: tlv320adcx140: Add ASI Tx drive
      commit: 38b9b7ca6f08489f3065e081e71c743775ed50c8
[4/6] ASoC: tlv320adcx140: Add the config to configure Tx ASI output
      commit: 42d5031d3ee858bc14df704439eefdbf38b8f628
[5/6] dt-bindings: tlv320adcx140: Add slot programming property
      (no commit info)
[6/6] ASoC: tlv320adcx140: Add channel slot programming
      (no commit info)

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

end of thread, other threads:[~2020-09-17 19:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15 19:06 [PATCH 1/6] ASoC: tlv320adcx140: Idle the device while writing registers Dan Murphy
2020-09-15 19:06 ` [PATCH 2/6] ASoC: tlv320adcx140: Fix BCLK inversion for DSP modes Dan Murphy
2020-09-15 19:06 ` [PATCH 3/6] dt-bindings: tlv320adcx140: Add ASI Tx drive Dan Murphy
2020-09-15 19:06 ` [PATCH 4/6] ASoC: tlv320adcx140: Add the config to configure Tx ASI output Dan Murphy
2020-09-15 19:06 ` [PATCH 5/6] dt-bindings: tlv320adcx140: Add slot programming property Dan Murphy
2020-09-17 13:02   ` Mark Brown
2020-09-17 15:15     ` Dan Murphy
2020-09-17 15:56       ` Mark Brown
2020-09-15 19:06 ` [PATCH 6/6] ASoC: tlv320adcx140: Add channel slot programming Dan Murphy
2020-09-17 18:57 ` [PATCH 1/6] ASoC: tlv320adcx140: Idle the device while writing registers 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).