[PATCH 0/4] fsl-asoc-card: Add optional dt property for setting mclk-id
This is a follow up of patchset:
[RFC patch 0/5] Support BCLK input clock in tlv320aic31xx
Sound cards may allow using different main clock inputs. In the generic fsl-asoc-card driver, these values are hardcoded for each specific card configuration.
Let's make it more flexible, allowing setting mclk-id from the device-tree node.
Ariel D'Alessandro (4): dt-bindings: sound: Rename tlv320aic31xx-micbias as tlv320aic31xx dt-bindings: tlv320aic31xx: Define PLL clock inputs ASoC: fsl-asoc-card: Add optional dt property for setting mclk-id ASoC: fsl-asoc-card: Remove BCLK default value for tlv320aic31xx card
.../devicetree/bindings/sound/fsl-asoc-card.txt | 1 + .../devicetree/bindings/sound/tlv320aic31xx.txt | 2 +- arch/arm/boot/dts/am43x-epos-evm.dts | 2 +- include/dt-bindings/sound/tlv320aic31xx-micbias.h | 9 --------- include/dt-bindings/sound/tlv320aic31xx.h | 14 ++++++++++++++ sound/soc/codecs/tlv320aic31xx.c | 2 +- sound/soc/fsl/fsl-asoc-card.c | 7 ++++++- 7 files changed, 24 insertions(+), 13 deletions(-) delete mode 100644 include/dt-bindings/sound/tlv320aic31xx-micbias.h create mode 100644 include/dt-bindings/sound/tlv320aic31xx.h
Let's use a more generic name, so other definitions for tlv320aic31xx can be included.
Signed-off-by: Ariel D'Alessandro ariel.dalessandro@collabora.com --- .../devicetree/bindings/sound/tlv320aic31xx.txt | 2 +- arch/arm/boot/dts/am43x-epos-evm.dts | 2 +- include/dt-bindings/sound/tlv320aic31xx-micbias.h | 9 --------- include/dt-bindings/sound/tlv320aic31xx.h | 9 +++++++++ sound/soc/codecs/tlv320aic31xx.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 include/dt-bindings/sound/tlv320aic31xx-micbias.h create mode 100644 include/dt-bindings/sound/tlv320aic31xx.h
diff --git a/Documentation/devicetree/bindings/sound/tlv320aic31xx.txt b/Documentation/devicetree/bindings/sound/tlv320aic31xx.txt index e372303697dc..bbad98d5b986 100644 --- a/Documentation/devicetree/bindings/sound/tlv320aic31xx.txt +++ b/Documentation/devicetree/bindings/sound/tlv320aic31xx.txt @@ -58,7 +58,7 @@ The pins can be used in referring sound node's audio-routing property.
Example: #include <dt-bindings/gpio/gpio.h> -#include <dt-bindings/sound/tlv320aic31xx-micbias.h> +#include <dt-bindings/sound/tlv320aic31xx.h>
tlv320aic31xx: tlv320aic31xx@18 { compatible = "ti,tlv320aic311x"; diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts index 2f4d2e4e9b3e..4f9a7251a107 100644 --- a/arch/arm/boot/dts/am43x-epos-evm.dts +++ b/arch/arm/boot/dts/am43x-epos-evm.dts @@ -11,7 +11,7 @@ #include <dt-bindings/pinctrl/am43xx.h> #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/pwm/pwm.h> -#include <dt-bindings/sound/tlv320aic31xx-micbias.h> +#include <dt-bindings/sound/tlv320aic31xx.h>
/ { model = "TI AM43x EPOS EVM"; diff --git a/include/dt-bindings/sound/tlv320aic31xx-micbias.h b/include/dt-bindings/sound/tlv320aic31xx-micbias.h deleted file mode 100644 index c6895a18a455..000000000000 --- a/include/dt-bindings/sound/tlv320aic31xx-micbias.h +++ /dev/null @@ -1,9 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __DT_TLV320AIC31XX_MICBIAS_H -#define __DT_TLV320AIC31XX_MICBIAS_H - -#define MICBIAS_2_0V 1 -#define MICBIAS_2_5V 2 -#define MICBIAS_AVDDV 3 - -#endif /* __DT_TLV320AIC31XX_MICBIAS_H */ diff --git a/include/dt-bindings/sound/tlv320aic31xx.h b/include/dt-bindings/sound/tlv320aic31xx.h new file mode 100644 index 000000000000..3a845fbba992 --- /dev/null +++ b/include/dt-bindings/sound/tlv320aic31xx.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __DT_TLV320AIC31XX_H +#define __DT_TLV320AIC31XX_H + +#define MICBIAS_2_0V 1 +#define MICBIAS_2_5V 2 +#define MICBIAS_AVDDV 3 + +#endif /* __DT_TLV320AIC31XX_H */ diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c index 4224b4b3cae6..f2222c37913e 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c @@ -32,7 +32,7 @@ #include <sound/soc.h> #include <sound/initval.h> #include <sound/tlv.h> -#include <dt-bindings/sound/tlv320aic31xx-micbias.h> +#include <dt-bindings/sound/tlv320aic31xx.h>
#include "tlv320aic31xx.h"
On Fri, 03 Dec 2021 10:49:27 -0300, Ariel D'Alessandro wrote:
Let's use a more generic name, so other definitions for tlv320aic31xx can be included.
Signed-off-by: Ariel D'Alessandro ariel.dalessandro@collabora.com
.../devicetree/bindings/sound/tlv320aic31xx.txt | 2 +- arch/arm/boot/dts/am43x-epos-evm.dts | 2 +- include/dt-bindings/sound/tlv320aic31xx-micbias.h | 9 --------- include/dt-bindings/sound/tlv320aic31xx.h | 9 +++++++++ sound/soc/codecs/tlv320aic31xx.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 include/dt-bindings/sound/tlv320aic31xx-micbias.h create mode 100644 include/dt-bindings/sound/tlv320aic31xx.h
Acked-by: Rob Herring robh@kernel.org
Add constants for the different PLL clock inputs in tlv320aic31xx.
Signed-off-by: Ariel D'Alessandro ariel.dalessandro@collabora.com --- include/dt-bindings/sound/tlv320aic31xx.h | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/include/dt-bindings/sound/tlv320aic31xx.h b/include/dt-bindings/sound/tlv320aic31xx.h index 3a845fbba992..4a80238ab250 100644 --- a/include/dt-bindings/sound/tlv320aic31xx.h +++ b/include/dt-bindings/sound/tlv320aic31xx.h @@ -6,4 +6,9 @@ #define MICBIAS_2_5V 2 #define MICBIAS_AVDDV 3
+#define PLL_CLKIN_MCLK 0x00 +#define PLL_CLKIN_BCLK 0x01 +#define PLL_CLKIN_GPIO1 0x02 +#define PLL_CLKIN_DIN 0x03 + #endif /* __DT_TLV320AIC31XX_H */
Sound cards may allow using different main clock inputs. In the generic fsl-asoc-card driver, these values are hardcoded for each specific card configuration.
Let's make it more flexible, allowing setting mclk-id from the device-tree node. Otherwise, the default value for each card configuration is used.
Signed-off-by: Ariel D'Alessandro ariel.dalessandro@collabora.com --- Documentation/devicetree/bindings/sound/fsl-asoc-card.txt | 1 + sound/soc/fsl/fsl-asoc-card.c | 6 ++++++ 2 files changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt index 23d83fa7609f..b219626a5403 100644 --- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt +++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt @@ -82,6 +82,7 @@ Optional properties: - dai-format : audio format, for details see simple-card.yaml. - frame-inversion : dai-link uses frame clock inversion, for details see simple-card.yaml. - bitclock-inversion : dai-link uses bit clock inversion, for details see simple-card.yaml. + - mclk-id : main clock id, specific for each card configuration.
Optional unless SSI is selected as a CPU DAI:
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 90cbed496f98..bb962e04d40b 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -693,6 +693,12 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) goto asrc_fail; }
+ /* + * Allow setting mclk-id from the device-tree node. Otherwise, the + * default value for each card configuration is used. + */ + of_property_read_u32(np, "mclk-id", &priv->codec_priv.mclk_id); + /* Format info from DT is optional. */ snd_soc_daifmt_parse_clock_provider_as_phandle(np, NULL, &bitclkprovider, &frameprovider); if (bitclkprovider || frameprovider) {
On Fri, Dec 03, 2021 at 10:49:29AM -0300, Ariel D'Alessandro wrote:
Sound cards may allow using different main clock inputs. In the generic fsl-asoc-card driver, these values are hardcoded for each specific card configuration.
Let's make it more flexible, allowing setting mclk-id from the device-tree node. Otherwise, the default value for each card configuration is used.
Signed-off-by: Ariel D'Alessandro ariel.dalessandro@collabora.com
Documentation/devicetree/bindings/sound/fsl-asoc-card.txt | 1 + sound/soc/fsl/fsl-asoc-card.c | 6 ++++++ 2 files changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt index 23d83fa7609f..b219626a5403 100644 --- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt +++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt @@ -82,6 +82,7 @@ Optional properties:
- dai-format : audio format, for details see simple-card.yaml.
- frame-inversion : dai-link uses frame clock inversion, for details see simple-card.yaml.
- bitclock-inversion : dai-link uses bit clock inversion, for details see simple-card.yaml.
- mclk-id : main clock id, specific for each card configuration.
Ahh, there it is. This change and the header defines should be 1 patch and driver changes another.
Optional unless SSI is selected as a CPU DAI:
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 90cbed496f98..bb962e04d40b 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -693,6 +693,12 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) goto asrc_fail; }
- /*
* Allow setting mclk-id from the device-tree node. Otherwise, the
* default value for each card configuration is used.
*/
- of_property_read_u32(np, "mclk-id", &priv->codec_priv.mclk_id);
- /* Format info from DT is optional. */ snd_soc_daifmt_parse_clock_provider_as_phandle(np, NULL, &bitclkprovider, &frameprovider); if (bitclkprovider || frameprovider) {
-- 2.30.2
Hi Rob,
On 12/13/21 5:37 PM, Rob Herring wrote:
On Fri, Dec 03, 2021 at 10:49:29AM -0300, Ariel D'Alessandro wrote:
Sound cards may allow using different main clock inputs. In the generic fsl-asoc-card driver, these values are hardcoded for each specific card configuration.
Let's make it more flexible, allowing setting mclk-id from the device-tree node. Otherwise, the default value for each card configuration is used.
Signed-off-by: Ariel D'Alessandro ariel.dalessandro@collabora.com
Documentation/devicetree/bindings/sound/fsl-asoc-card.txt | 1 + sound/soc/fsl/fsl-asoc-card.c | 6 ++++++ 2 files changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt index 23d83fa7609f..b219626a5403 100644 --- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt +++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt @@ -82,6 +82,7 @@ Optional properties:
- dai-format : audio format, for details see simple-card.yaml.
- frame-inversion : dai-link uses frame clock inversion, for details see simple-card.yaml.
- bitclock-inversion : dai-link uses bit clock inversion, for details see simple-card.yaml.
- mclk-id : main clock id, specific for each card configuration.
Ahh, there it is. This change and the header defines should be 1 patch and driver changes another.
Ah, I see. I'll split it and send a patchset v2 for this.
Thanks, Ariel
Now that fsl-asoc-card support setting mclk-id through the device-tree mclk-id property, let's remove the default BCLK configuration for this card.
Signed-off-by: Ariel D'Alessandro ariel.dalessandro@collabora.com --- sound/soc/fsl/fsl-asoc-card.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index bb962e04d40b..e92d90010d45 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -637,7 +637,6 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->dai_link[2].dpcm_capture = 0; priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT; priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_OUT; - priv->codec_priv.mclk_id = AIC31XX_PLL_CLKIN_BCLK; priv->card.dapm_routes = audio_map_tx; priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx); } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8962")) {
On Fri, Dec 03, 2021 at 10:49:26AM -0300, Ariel D'Alessandro wrote:
This is a follow up of patchset:
[RFC patch 0/5] Support BCLK input clock in tlv320aic31xx
Link?
Sound cards may allow using different main clock inputs. In the generic fsl-asoc-card driver, these values are hardcoded for each specific card configuration.
Let's make it more flexible, allowing setting mclk-id from the device-tree node.
Ariel D'Alessandro (4): dt-bindings: sound: Rename tlv320aic31xx-micbias as tlv320aic31xx dt-bindings: tlv320aic31xx: Define PLL clock inputs ASoC: fsl-asoc-card: Add optional dt property for setting mclk-id
'mclk-id' is not documented.
ASoC: fsl-asoc-card: Remove BCLK default value for tlv320aic31xx card
.../devicetree/bindings/sound/fsl-asoc-card.txt | 1 + .../devicetree/bindings/sound/tlv320aic31xx.txt | 2 +- arch/arm/boot/dts/am43x-epos-evm.dts | 2 +- include/dt-bindings/sound/tlv320aic31xx-micbias.h | 9 --------- include/dt-bindings/sound/tlv320aic31xx.h | 14 ++++++++++++++ sound/soc/codecs/tlv320aic31xx.c | 2 +- sound/soc/fsl/fsl-asoc-card.c | 7 ++++++- 7 files changed, 24 insertions(+), 13 deletions(-) delete mode 100644 include/dt-bindings/sound/tlv320aic31xx-micbias.h create mode 100644 include/dt-bindings/sound/tlv320aic31xx.h
-- 2.30.2
Hi Rob,
Thanks for the review.
On 12/13/21 5:35 PM, Rob Herring wrote:
On Fri, Dec 03, 2021 at 10:49:26AM -0300, Ariel D'Alessandro wrote:
This is a follow up of patchset:
[RFC patch 0/5] Support BCLK input clock in tlv320aic31xx
Link?
Link to the datasheet?
http://www.ti.com/lit/ds/symlink/tlv320aic3100.pdf
Sound cards may allow using different main clock inputs. In the generic fsl-asoc-card driver, these values are hardcoded for each specific card configuration.
Let's make it more flexible, allowing setting mclk-id from the device-tree node.
Ariel D'Alessandro (4): dt-bindings: sound: Rename tlv320aic31xx-micbias as tlv320aic31xx dt-bindings: tlv320aic31xx: Define PLL clock inputs ASoC: fsl-asoc-card: Add optional dt property for setting mclk-id
'mclk-id' is not documented.
ASoC: fsl-asoc-card: Remove BCLK default value for tlv320aic31xx card
.../devicetree/bindings/sound/fsl-asoc-card.txt | 1 + .../devicetree/bindings/sound/tlv320aic31xx.txt | 2 +- arch/arm/boot/dts/am43x-epos-evm.dts | 2 +- include/dt-bindings/sound/tlv320aic31xx-micbias.h | 9 --------- include/dt-bindings/sound/tlv320aic31xx.h | 14 ++++++++++++++ sound/soc/codecs/tlv320aic31xx.c | 2 +- sound/soc/fsl/fsl-asoc-card.c | 7 ++++++- 7 files changed, 24 insertions(+), 13 deletions(-) delete mode 100644 include/dt-bindings/sound/tlv320aic31xx-micbias.h create mode 100644 include/dt-bindings/sound/tlv320aic31xx.h
-- 2.30.2
Regards, Ariel
participants (2)
-
Ariel D'Alessandro
-
Rob Herring