ASoC: fsl-asoc-card: Add optional dt property for setting mclk-id

Merge series from Ariel D'Alessandro <ariel.dalessandro@collabora.com>:

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.
This commit is contained in:
Mark Brown 2022-01-25 10:17:37 +00:00
commit e6ec5a3936
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0
7 changed files with 24 additions and 13 deletions

View file

@ -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:

View file

@ -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";

View file

@ -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";

View file

@ -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 */

View file

@ -0,0 +1,14 @@
/* 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
#define PLL_CLKIN_MCLK 0x00
#define PLL_CLKIN_BCLK 0x01
#define PLL_CLKIN_GPIO1 0x02
#define PLL_CLKIN_DIN 0x03
#endif /* __DT_TLV320AIC31XX_H */

View file

@ -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"

View file

@ -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")) {
@ -693,6 +692,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) {