From 71e47ae39efacad90ff04d83f9c9191f575c0ab3 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Fri, 13 Jul 2018 16:34:56 +0100 Subject: [PATCH] ASoC: tegra-alt: Add support for FE-PI audio Z V2 board Add support for the FE-PI audio Z V2 board which includes the NXP SGTL5000 audio codec. The FE-PI audio Z V2 board is an audio hat for Raspberry-PI and is compatible with the Jetson 40-pin header. Bug 1654376 Change-Id: I7b16b38acb91ac18c00cabc98c9e2dbe1eb9e94e Signed-off-by: Jon Hunter (cherry picked from commit 0b303ebc3efc77b4e7a8bca1d62ef412873c336b) Reviewed-on: https://git-master.nvidia.com/r/1779054 Reviewed-by: svc-mobile-coverity Reviewed-by: Sameer Pujar Reviewed-by: Mohan Kumar D GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu Reviewed-by: mobile promotions Tested-by: mobile promotions --- sound/soc/tegra-alt/Kconfig | 2 + .../tegra_machine_driver_mobile.c | 37 +++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/sound/soc/tegra-alt/Kconfig b/sound/soc/tegra-alt/Kconfig index 2d559708..0bd8c124 100644 --- a/sound/soc/tegra-alt/Kconfig +++ b/sound/soc/tegra-alt/Kconfig @@ -186,6 +186,7 @@ config SND_SOC_TEGRA_T210REF_MOBILE_ALT select SND_SOC_SPDIF select SND_SOC_RT5640 select SND_SOC_RT5659 + select SND_SOC_SGTL5000 select SND_SOC_TEGRA_ASOC_MACHINE_ALT help Say Y or M here. @@ -247,6 +248,7 @@ config SND_SOC_TEGRA_T186REF_MOBILE_ALT tristate "SoC Audio support for T186Ref Mobile" depends on SND_SOC_TEGRA_T186REF_ALT select SND_SOC_RT5659 + select SND_SOC_SGTL5000 help Say Y or M here. diff --git a/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c b/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c index e3428a66..46ce2bfd 100644 --- a/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c +++ b/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c @@ -32,6 +32,7 @@ #include #include #include "rt5659.h" +#include "sgtl5000.h" #include "tegra_asoc_utils_alt.h" #include "tegra_asoc_machine_alt.h" #include "tegra210_xbar_alt.h" @@ -640,6 +641,16 @@ static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime, } } + rtd = snd_soc_get_pcm_runtime(card, "fe-pi-audio-z-v2"); + if (rtd) { + dai_params = + (struct snd_soc_pcm_stream *)rtd->dai_link->params; + + dai_params->rate_min = clk_rate; + dai_params->channels_min = channels; + dai_params->formats = formats; + } + return 0; } @@ -782,6 +793,21 @@ static int tegra_machine_compr_set_params(struct snd_compr_stream *cstream) } #endif +static int tegra_machine_fepi_init(struct snd_soc_pcm_runtime *rtd) +{ + struct device *dev = rtd->card->dev; + int err; + + err = snd_soc_dai_set_sysclk(rtd->codec_dai, SGTL5000_SYSCLK, 12288000, + SND_SOC_CLOCK_IN); + if (err) { + dev_err(dev, "failed to set sgtl5000 sysclk!\n"); + return err; + } + + return 0; +} + static int tegra_machine_rt565x_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_card *card = rtd->card; @@ -885,13 +911,18 @@ static void dai_link_setup(struct platform_device *pdev) tegra_machine_rt565x_init; } } else if (strstr(tegra_machine_codec_links[i].name, - "dspk-playback-r")) + "dspk-playback-r")) { tegra_machine_codec_links[i].init = tegra_machine_dspk_init; - else if (strstr(tegra_machine_codec_links[i].name, - "dspk-playback-l")) + } else if (strstr(tegra_machine_codec_links[i].name, + "dspk-playback-l")) { tegra_machine_codec_links[i].init = tegra_machine_dspk_init; + } else if (strstr(tegra_machine_codec_links[i].name, + "fe-pi-audio-z-v2")) { + tegra_machine_codec_links[i].init = + tegra_machine_fepi_init; + } } }