lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190215070539.22150-1-akshu.agrawal@amd.com>
Date:   Fri, 15 Feb 2019 07:06:15 +0000
From:   "Agrawal, Akshu" <Akshu.Agrawal@....com>
To:     unlisted-recipients:; (no To-header on input)
CC:     "Agrawal, Akshu" <Akshu.Agrawal@....com>,
        "djkurtz@...omium.org" <djkurtz@...omium.org>,
        "Deucher, Alexander" <Alexander.Deucher@....com>,
        "Adam.Thomson.Opensource@...semi.com" 
        <Adam.Thomson.Opensource@...semi.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>,
        "Mukunda, Vijendar" <Vijendar.Mukunda@....com>,
        Wei Yongjun <weiyongjun1@...wei.com>,
        Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
        "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." 
        <alsa-devel@...a-project.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: [PATCH] ASoC: AMD: Configure master codec on all playback/capture
 cases

In the system design da7219 is the master codec and clocks are
generated by it.
Bclk is to be generated at the required rate for other codecs used when
da7219 is acting only as clock master. For this call hw_params of da7219
during playback/capture on non da7219 codecs.

Being able to set bclk at lower rate also fixes noise issue observed on
some dmics.

Signed-off-by: Akshu Agrawal <akshu.agrawal@....com>
---
 sound/soc/amd/acp-da7219-max98357a.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c
index a5daad973ce5..ad327415290a 100644
--- a/sound/soc/amd/acp-da7219-max98357a.c
+++ b/sound/soc/amd/acp-da7219-max98357a.c
@@ -45,6 +45,7 @@
 #define CZ_PLAT_CLK 48000000
 #define DUAL_CHANNEL		2
 
+static struct snd_soc_dai *codec_dai;
 static struct snd_soc_jack cz_jack;
 static struct clk *da7219_dai_clk;
 extern int bt_uart_enable;
@@ -53,8 +54,10 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
 {
 	int ret;
 	struct snd_soc_card *card = rtd->card;
-	struct snd_soc_dai *codec_dai = rtd->codec_dai;
-	struct snd_soc_component *component = codec_dai->component;
+	struct snd_soc_component *component;
+
+	codec_dai = rtd->codec_dai;
+	component = codec_dai->component;
 
 	dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
 
@@ -255,6 +258,16 @@ static void cz_dmic_shutdown(struct snd_pcm_substream *substream)
 	da7219_clk_disable();
 }
 
+static static int cz_da7219_hw_params(struct snd_pcm_substream *substream,
+				    struct snd_pcm_hw_params *params)
+{
+	/* da7219 Codec is clock master so setup as per the needs */
+	if (codec_dai->driver->ops->hw_params)
+		return codec_dai->driver->ops->hw_params(substream, params,
+							 codec_dai);
+	return 0;
+}
+
 static const struct snd_soc_ops cz_da7219_play_ops = {
 	.startup = cz_da7219_play_startup,
 	.shutdown = cz_da7219_shutdown,
@@ -268,16 +281,19 @@ static const struct snd_soc_ops cz_da7219_cap_ops = {
 static const struct snd_soc_ops cz_max_play_ops = {
 	.startup = cz_max_startup,
 	.shutdown = cz_max_shutdown,
+	.hw_params = cz_da7219_hw_params,
 };
 
 static const struct snd_soc_ops cz_dmic0_cap_ops = {
 	.startup = cz_dmic0_startup,
 	.shutdown = cz_dmic_shutdown,
+	.hw_params = cz_da7219_hw_params,
 };
 
 static const struct snd_soc_ops cz_dmic1_cap_ops = {
 	.startup = cz_dmic1_startup,
 	.shutdown = cz_dmic_shutdown,
+	.hw_params = cz_da7219_hw_params,
 };
 
 static struct snd_soc_dai_link cz_dai_7219_98357[] = {
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ