From patchwork Tue Mar 13 06:07:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10277831 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 787F1601A0 for ; Tue, 13 Mar 2018 06:23:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 883E328AA5 for ; Tue, 13 Mar 2018 06:23:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CBDC28B00; Tue, 13 Mar 2018 06:23:11 +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.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID 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 9E89928AA5 for ; Tue, 13 Mar 2018 06:23:10 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DE384267172; Tue, 13 Mar 2018 07:23:01 +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 3D37F266F0F; Tue, 13 Mar 2018 07:22:58 +0100 (CET) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0073.outbound.protection.outlook.com [104.47.34.73]) by alsa0.perex.cz (Postfix) with ESMTP id 0F5D32670A1 for ; Tue, 13 Mar 2018 07:22:56 +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; bh=2tf+GH9V75LrvNIQai0gdxTSeLnuVuLaqC+vv1EE3KA=; b=M+5+535ytVgLW5JEUaaPCmluI8asT2xWhbatHQEufNxdU5/nnxP12oEPn4xfVYtOMaUNCA878OBa8EZQjx/hqovV7un1GqKLcTSA7mQ+dVzsYPA+tRPdsH/xBnyvkreens14TmoAY/N3Dvl/1MBvLt1dCxoxoYdCqW5zeGtBqeo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; Received: from akshu-HP-EliteBook-745-G2.amd.com (202.56.249.162) by MWHPR1201MB0192.namprd12.prod.outlook.com (2603:10b6:301:56::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.14; Tue, 13 Mar 2018 06:22:51 +0000 From: Akshu Agrawal To: broonie@kernel.org, alsa-devel@alsa-project.org Date: Tue, 13 Mar 2018 11:37:30 +0530 Message-Id: <1520921250-30124-2-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520921250-30124-1-git-send-email-akshu.agrawal@amd.com> References: <1520921250-30124-1-git-send-email-akshu.agrawal@amd.com> MIME-Version: 1.0 X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: BMXPR01CA0029.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::15) To MWHPR1201MB0192.namprd12.prod.outlook.com (2603:10b6:301:56::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1f6bbd14-6f62-424c-b3e3-08d588aada2e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:MWHPR1201MB0192; X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0192; 3:t1h8d3YG0IpdEOisbtprMStqWzV57czwi2M37Ee//wkpSXa1JW2kQb5jIpauPOlVg1Uha2rN55XGDmqurj8f4KAI7LM6cvYDfnviu6jSaguUlqrbIvNp17phW0eh9PwKDZuGlFzbxzbEHgsucdKzq6MungMHSrAf9Y5tcxUkLx6d6NPfoNfyGCPhK1GeHLDEAa+vw1ZQ6E9i8WymCStYMKclDD9YsJrAVH1hJj3WAOpoYynFwVgyJjFIlNuiSwmH; 25:j1tEuCMv/pjRb8VAutNQsPCjgxxt6A2SjjTJoktPEV9jx7zg/yxozRa5VXLWXznZDhx06MWBaGgYnnXdLXeta7xzxMtb+agMXtrW3t2YZxpRuq/hIYe1ikkAOgeQNH1bjmRtQf7/IARAb1GMPHJvobWtfXe6Ea13Yc0BQMosq9jKWpXgLv5Y8FtYf4wM177qjPOjS0iQ8diAvl12PUSW9bbwOqcwGr2dnlEDFmSg+PiPWg9KmfmfpkuJi3fwtNay9ogk7xs2Hujg8x/DTraeX4YSF+UIVm3bLXnFv3beQMUO+Oiy/pzTWas6/KenRVcIj4wZkuyi8CPodMzxldUdbw==; 31:zwWWNotQ7HMFc7Zp5c5BpPhyYaje9mBxfBBQANdau69vGod89dYZvy5iAc/U0Qm1up2B6+WW89L4fFMpHEe958EQPuIi9vTw3PKLSww2X5+1spkhYRXl9co3i0br1waRDCrVavROVMsGHh0xdajlg+72PgvfzVaKMwhkMl+Tds1ic/hhW6ZX5UUIrMkr+IlK8vQ6aZ+/MbkeP8h5DC1li8HY+72wVY6C53ZWMjWgVlw= X-MS-TrafficTypeDiagnostic: MWHPR1201MB0192: X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0192; 20:nM+NLKx7YEIwWS81kLyg0+XQqGhhBjNbhzqmXUiG/cW8uVzI9S84J5IcV9YUu03589CMHy9Q8+x7eZbbcwR9/+nj2Hxbgn2yVU+op1qnxPBEmaAZ0sepxC3/JCxu0vtLDgO9UBQ5A8DOHwfzSccG6fA7OKQ742z5xmPkZYSOh1tB+Pzisu97OSjM0diKWojrak7hR2q4k1hQQcfWZZGHA7MLObw03olGM92ld8YdPSV+7HeYvv9OB7nB7dLtCbDd1QAOHlMmQLAtlH1wEr07KmwO18dMwwRlqyYsU5oMFNQ31j6AejCUQCEb3GfxVQW3q/hGx874dS8aWkpefhbAqXErvHyTANA7TjzOrq/BtQLMMkdBq4HH+RgX0uDK19PxBI3HY5rUthG+gK9nrzdDNMGiA8+uerNJvAt4W1k5f31xP014XHGQ+wzOGMPLTni61LtnPIKh4HEEeJQsjvhD9Cct1zb2Djps+EQ6gyl4ZAiSC+bWFAf02FlqGalZwPwL; 4:3ji2OeibRh17kzJ/OOYopNv2Pwp9owqTML8wm46xOpXYW9rwuqsZ092544fcmvI/8iqfYSuzdhfpq34VdA+XVZ2LBsINwTZZ0D8/dNinj3MHNyvM6TWumvr14cmxYPctoxAquRE7/UNRgAXj+AhRMZaNuqq6MbJUuabr8CG04WhobHZsSRx9cAD5LPfGETcNGxbmXkpy9jHmp+qwqHRpCSpIjfO1H6nOvEBoiAju/Xbbh8ddqfmcmmxdSve8Cxjig3Nof5zKnj6k82dy7UBj5nMdFp5FmGGAD1thLVvkTi5C48Pn2/ZMy07y5V6dz1O4 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231221)(944501244)(52105095)(6055026)(6041310)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:MWHPR1201MB0192; BCL:0; PCL:0; RULEID:; SRVR:MWHPR1201MB0192; X-Forefront-PRVS: 0610D16BBE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(366004)(39860400002)(346002)(376002)(39380400002)(199004)(189003)(3846002)(8936002)(5660300001)(25786009)(81166006)(81156014)(316002)(8676002)(68736007)(86362001)(6116002)(97736004)(106356001)(6486002)(16586007)(305945005)(2906002)(50466002)(386003)(53936002)(51416003)(53416004)(36756003)(39060400002)(76176011)(105586002)(16526019)(52116002)(7696005)(59450400001)(478600001)(7736002)(186003)(2950100002)(6666003)(72206003)(47776003)(50226002)(66066001)(26005)(48376002)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR1201MB0192; H:akshu-HP-EliteBook-745-G2.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR1201MB0192; 23:Zmd7rGrLdOjNg45pSZyDwfjNguJzxv+ISf7KJ//?= =?us-ascii?Q?4GlGgJ8bqdW//ObAR9fiWnMjo8iWosGx+9GqfYtIw17neUwFnUh3v0Hs7fhN?= =?us-ascii?Q?K3JSRj4E1obr7fyhXLXhgkbTZcBaYLhdkuKJHNwrNnX+YqGIgU+q5ljmXyXH?= =?us-ascii?Q?BHWJ/FvtMSha2/zzvFsGoA+HW7M9TNIKAaheHAy4oGi9gtQw1v4xo5NMmXEl?= =?us-ascii?Q?a9KOKE6CFiS8u1sRRKE+ouaBxLghAOhbnKjcN7G6waPcSdAaZJXX+r3tpyMQ?= =?us-ascii?Q?phBRaI8o9C3gIqZ5yu1YOom7M/TzuwwCU/APCjOgFVMo2+9g8Jk/kuMrPBWj?= =?us-ascii?Q?mwjrpa2apcQRz7dANgSmcdPxAVUflj+PPH709eq9FJnF8EHNNXtfx5g6TYGZ?= =?us-ascii?Q?tAW7nA3jKLz/ZcWYLBA7hbkoNtS4W7PyzZ5zNQUuQRnHGdKqxVEUakajanck?= =?us-ascii?Q?IVZaR5L957h4B/GllCmSgk2ojZbOLADqxbzZ5HJkoG1s1KQ4Xqf2Rb+6vnrW?= =?us-ascii?Q?BzVQI7CWwY1HM6dbbhgMVe7S9+9NDgGGL7e3HLHD802tzdOPfy+5C1aggXd0?= =?us-ascii?Q?r4d3cbm/ywWnYdGkqO5YzkFmRuc5cLQ8RGh57OaJ58LKwICGtPFhL0bNv3tQ?= =?us-ascii?Q?KBrPYBGqis0mThrc88ebWFS4q6oKaXvnEt8+lAgNq6ZFkgPkixERlVM8mmJU?= =?us-ascii?Q?fF6m/me/TvdLecfV0zIAepDCneHLuNYgpzWIajp3TP52uoH+Gl96ANGsP9Uw?= =?us-ascii?Q?z5WBLvH9oOQjgaQftzTsGsD/MafUockkLTb9IgOtPAvzX6vZcfF/1nzx9ZuI?= =?us-ascii?Q?gV98T2mkR03EAnLeHCg8jh8Nil7MdcLTzZ18Suq6+FxZgguvaTi0CLLGpR2m?= =?us-ascii?Q?15udRLARoJvTkDkYF/e30O/xz68vWPzBM/8DG1uT2fi5HaNDbBXC3oGIK1G0?= =?us-ascii?Q?5CZ2wyJfajuk+HQK/FXfmVhcAYJxA2fud0vVdQnnel/kfFsk+MQ0DDUGDsqZ?= =?us-ascii?Q?DsPG8JtlBaL+xWSHCIRF6bDbOYRuKvmcbnBOW3+8Lwil1HyZVdtSHDTPR7lo?= =?us-ascii?Q?MuHwQOy2AZIY2pjzfkGlRYBbHXxOcQO8ETL90EqcwbzSJiOqy5uATweeM26l?= =?us-ascii?Q?G2+irKiFO+4sIJskK9dumvqTdqaEbu3/vYze4fuKL66+gu+yMs3k3Tg=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Antispam-Message-Info: fPpYGuMLigOY1Zxe5gka/dO4JzlotLGcODM8ZHkp2yTLXw+Jhh1E2ywnzcV28TKL5sANi0Vp49I56XvRgTzYG603L5s/Ypkc1nkz6sNzp2Qxoa9ZcINW8DU2mHSnniZZRGH5VWheh4lPDHPJ6kkT/fJF5OwNsXOQDKVtyG2L8P1mKWAPCIgtN1+gxaNdrCCY X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0192; 6:PXHqqJhvpphwpCqAFu5o8FGO3ZBOstg7OUK1AioWx4tyFlJJu1AosmKzzXBreFTG7CZoPIlw52jZic3pCTUhOsoidp80j54wLgxLH4UF4sS0DH2l1U9KghrCXsrdFtu4Tewn0gr2DGbvAP2dxAEmSMAw+JzfjmX6B8LTBa04j3+qSvZUAYamxyvWshmnnV4MkjFUhZR/ZA9oP9ukm2PyuBgHj40RahUP2LIVNUltg7T5yTQW2k9ssiiuQeXUJ4HlR7gQ1084KC/h2bOhYJ0OGKOiUgfCKjbOAh+B92vjOZQiKE5iEzvIJnhUN24PZ09CyRJAaCaXuSdhlH7Ceb5vZNMjEOH56X2OOOMUpB8r5jE=; 5:HsOcAiXWE1fpS1oRRh66mf/VFhOGswJxjL2jVRekGf3PuAFmVfW9OWCFP9aUCKk/1Yxxltid1fcC8N5JIo+eRkxsWjQz0gavkHYt8q20NmidmyajHgqg00luycKfY3day+/JQo3lWNahFZJ8CyANFe1fA16YA2/fTADURfYugPg=; 24:LvER2F9QB35YbVb49P2bdX+NJZjI2brMQ+6dqAUZ/WYplAEBWbv+gp83x2cZLysuUMVFTJhIk/Po5aBUn0ozubnNDpgtL76wxwMgshoRrQw=; 7:ZRv6I549Ffhq7HgaJJV6pIjWfP9doFD/ljIm8yvha5SHYpUQwxOtK2jRzgZeS+iaGia21hBEmbCp3wLVxMfCJBMJKMJSlPJaeCmW5b4qo7UbI33TTNk5cjnV9j3OLDAInkP00h9dWxR+D4bf2gdhcUsjpRGBIx3E7WbKS7+3PgcKU7oYpEjlNwKGuOz8WZGjxR8N998bldAaSRKJROIGQ438TrCXW0fQJr3cD1khOKrvmMOFW3sJihny+f0u6Zgs SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0192; 20:0hu3WB9y+7Rar5vnPFcR466+tavCCyR4gZDnEa6ZN26VhTVzhlc0Ug4bUAAa5xJIIkJTJkhoo6czrfQ6cSosyAxs6n2njx7rbAl2j6+ttCE24DYV0taZzrHptvulQRQ4z5PyZ1LNWBPP2kN66w0VC+zjdzaTdDSfg8PEyEcLEF53FcRPoS1r9VQDiep8zy+oWYJtqhg9AlVy+0K1lLWiC/sRk9hBm4HKm9I4fd8C4ffYb4TVx+pEEjqmHItVWTws X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2018 06:22:51.1129 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f6bbd14-6f62-424c-b3e3-08d588aada2e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0192 Cc: tiwai@suse.de, lgirdwood@gmail.com, akshu.agrawal@amd.com Subject: [alsa-devel] [PATCH v2 2/2] ASoC: AMD: Enable da7219 master clock using common clock framework 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 DA7219 is clock master for other codecs. DA7219 has exposed clock control by using common clock framework and same is used to enable and disable clock for all codecs in the system. V2: Removed compiler errors and warning. TEST=aplay -D hw:0,0 -vv arecord -D hw:0,0 -f dat -d 5 -vv aplay -D hw:0,1 -vv Signed-off-by: Akshu Agrawal --- sound/soc/amd/acp-da7219-max98357a.c | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c index d07c2a1..99c6b5c 100644 --- a/sound/soc/amd/acp-da7219-max98357a.c +++ b/sound/soc/amd/acp-da7219-max98357a.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -42,11 +43,13 @@ #define DUAL_CHANNEL 2 static struct snd_soc_jack cz_jack; +struct clk *da7219_dai_clk; static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) { int ret; struct snd_soc_card *card = rtd->card; + struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_component *component = codec_dai->component; @@ -66,6 +69,8 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) return ret; } + da7219_dai_clk = clk_get(codec->dev, "da7219-dai-clks"); + ret = snd_soc_card_jack_new(card, "Headset Jack", SND_JACK_HEADPHONE | SND_JACK_MICROPHONE | SND_JACK_BTN_0 | SND_JACK_BTN_1 | @@ -81,6 +86,28 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) return 0; } +static int cz_da7219_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + int ret = 0; + struct snd_soc_pcm_runtime *rtd = substream->private_data; + + ret = clk_prepare_enable(da7219_dai_clk); + if (ret < 0) { + dev_err(rtd->dev, "can't enable master clock %d\n", ret); + return ret; + } + + return ret; +} + +static int cz_da7219_hw_free(struct snd_pcm_substream *substream) +{ + clk_disable_unprepare(da7219_dai_clk); + + return 0; +} + static const unsigned int channels[] = { DUAL_CHANNEL, }; @@ -119,9 +146,21 @@ static int cz_fe_startup(struct snd_pcm_substream *substream) } static struct snd_soc_ops cz_da7219_cap_ops = { + .hw_params = cz_da7219_hw_params, + .hw_free = cz_da7219_hw_free, .startup = cz_fe_startup, }; +static struct snd_soc_ops cz_max_play_ops = { + .hw_params = cz_da7219_hw_params, + .hw_free = cz_da7219_hw_free, +}; + +static struct snd_soc_ops cz_dmic_cap_ops = { + .hw_params = cz_da7219_hw_params, + .hw_free = cz_da7219_hw_free, +}; + static struct snd_soc_dai_link cz_dai_7219_98357[] = { { .name = "amd-da7219-play-cap", @@ -147,6 +186,7 @@ static int cz_fe_startup(struct snd_pcm_substream *substream) .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM, .dpcm_playback = 1, + .ops = &cz_max_play_ops, }, { .name = "dmic", @@ -158,6 +198,7 @@ static int cz_fe_startup(struct snd_pcm_substream *substream) .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM, .dpcm_capture = 1, + .ops = &cz_dmic_cap_ops, }, };