From patchwork Fri Feb 15 07:06:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10814261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 479F813BF for ; Fri, 15 Feb 2019 07:06:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A3902E7E5 for ; Fri, 15 Feb 2019 07:06:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C09F2E801; Fri, 15 Feb 2019 07:06:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,MISSING_HEADERS,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEC4E2E7E5 for ; Fri, 15 Feb 2019 07:06:26 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 8E4C426752C; Fri, 15 Feb 2019 08:06:24 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8D7872675CD; Fri, 15 Feb 2019 08:06:22 +0100 (CET) Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-eopbgr680053.outbound.protection.outlook.com [40.107.68.53]) by alsa0.perex.cz (Postfix) with ESMTP id B979C2674E8 for ; Fri, 15 Feb 2019 08:06:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ykoB92EpoeAAhBmHWeO3CXuJvMPMfXhcQi9ie4g2ruo=; b=Qm5bWbsKrbs3dl10Xjrol8CMc7FJSP535TjCaYRCjFxZ0xC0co0clMA/9523QhfzfbgeXtA92NtpLk9gNVxBb7XKj9cqK0gNbuYZhA7GVFmG9DHXc180M97biHIjy+LGoPpmWvofOjUGphj94e1V7Wj0AzUbadH6g1zj1/SiaI4= Received: from MN2PR12MB3088.namprd12.prod.outlook.com (20.178.241.29) by MN2PR12MB3472.namprd12.prod.outlook.com (20.178.244.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.16; Fri, 15 Feb 2019 07:06:16 +0000 Received: from MN2PR12MB3088.namprd12.prod.outlook.com ([fe80::5ae:a47d:20e0:1e67]) by MN2PR12MB3088.namprd12.prod.outlook.com ([fe80::5ae:a47d:20e0:1e67%2]) with mapi id 15.20.1622.018; Fri, 15 Feb 2019 07:06:16 +0000 From: "Agrawal, Akshu" Thread-Topic: [PATCH] ASoC: AMD: Configure master codec on all playback/capture cases Thread-Index: AQHUxPzxizQmdrGlv0Oz0EPwJ2D5pw== Date: Fri, 15 Feb 2019 07:06:15 +0000 Message-ID: <20190215070539.22150-1-akshu.agrawal@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0018.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:c::28) To MN2PR12MB3088.namprd12.prod.outlook.com (2603:10b6:208:c4::29) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [165.204.156.251] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ae1ded90-5df7-40f9-e86f-08d693141377 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:MN2PR12MB3472; x-ms-traffictypediagnostic: MN2PR12MB3472: x-microsoft-exchange-diagnostics: 1; MN2PR12MB3472; 20:cC8ISdbZRUfQI2dL0YFtxuTtpM9p82O/65yeC0w01jLvNjspi1OpU8Vl/MFikoF6hTRbegxXAZNIz6nLrUV49Ah3XTJzLbL/oy0Af0BKi+IS2Yob61j+ZqKiXtrwj5YuehQYtX380JbN5TAn194pfFnRwdXnBQ6Gq8DMHeCPyNkFOKQfu92IRr4AwXB9Vn0NdSzf7rFHDabaEkAX9sdUDEkKmXRfS1aNnLNo7ib7Gv4b2tiWxk0J1ZON+8pIyqmE x-microsoft-antispam-prvs: x-forefront-prvs: 09497C15EB x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(376002)(396003)(366004)(136003)(189003)(199004)(36756003)(6512007)(68736007)(105586002)(6486002)(86362001)(6436002)(106356001)(3846002)(99286004)(6116002)(478600001)(71200400001)(72206003)(71190400001)(316002)(52116002)(97736004)(386003)(102836004)(66066001)(50226002)(186003)(26005)(81156014)(2616005)(476003)(6506007)(59246006)(486006)(7736002)(54906003)(14454004)(8936002)(2906002)(305945005)(8676002)(1671002)(7416002)(256004)(109986005)(25786009)(4326008)(1076003)(81166006)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB3472; H:MN2PR12MB3088.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 3VmNVlcmK075QJdWujmweR/eUsFiIl+NBpOIvXv7p4Mu9O9Ls0he2o2M9hbPgaqhCDCXzfLaGuNTZFQqoVwDzEbfvejt1lrhs96PlnJnjhBNqCDN01j9eAVwt/IQfHcDthSJfwRTP1YRxhSReirzEGQOTSm1MsmrVrk2Wp0/NXnIktlgO/blXQoz1DJJ3ep3++Mni9fQSSlSunWCOINurmE3A+HJY8VwPs++06LTlpgIoT1/VANBHZK1pZEpPcW2o2Xx31q1cBqegOF16KzM4Lhy7hnWCcIw5ox9kEOrDbhVU4zrkxs0efSjNrC2ZuPGJ+uGaVL+TZJH1+T8w6tqNFVSQALNfwIdR0Vhj6eXlTQuXJkcQg6ac7XCE+/gWVExDuO7COOov8v/MNyLrXUBylk2ll8Q2x1qukQwaQsdwe8= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae1ded90-5df7-40f9-e86f-08d693141377 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Feb 2019 07:06:11.9793 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3472 Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , Kuninori Morimoto , open list , Takashi Iwai , Liam Girdwood , "djkurtz@chromium.org" , "Agrawal, Akshu" , Mark Brown , Wei Yongjun , "Mukunda, Vijendar" , "Deucher, Alexander" , "Adam.Thomson.Opensource@diasemi.com" Subject: [alsa-devel] [PATCH] ASoC: AMD: Configure master codec on all playback/capture cases X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Adam Thomson --- 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[] = {