From patchwork Mon Mar 19 05:37:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10291667 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 A5367602BD for ; Mon, 19 Mar 2018 05:53:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F90B29121 for ; Mon, 19 Mar 2018 05:53:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8159D29125; Mon, 19 Mar 2018 05:53:46 +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 D424129121 for ; Mon, 19 Mar 2018 05:53:45 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7F453267372; Mon, 19 Mar 2018 06:53:37 +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 300692672BA; Mon, 19 Mar 2018 06:53:31 +0100 (CET) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0064.outbound.protection.outlook.com [104.47.34.64]) by alsa0.perex.cz (Postfix) with ESMTP id E1AC1267299 for ; Mon, 19 Mar 2018 06:53:28 +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=vDjKEd7RU/stXLq8yDmW1kc1jOQFNvFLHm+4ov/cxG2aMzgBGYQOfiWtzVpBrgpRcqWtH41KMPneMVFDi9fpLu5qH2nl7YRxA2ERYXM6KS8Row7g/KrRWq+uhIlq39qIYTgArHGsb04RkOJHkPTtgCcuHsP61jjg8VUDOg8Axyo= 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 DM5PR1201MB0185.namprd12.prod.outlook.com (2603:10b6:4:56::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Mon, 19 Mar 2018 05:53:24 +0000 From: Akshu Agrawal To: broonie@kernel.org, alsa-devel@alsa-project.org Date: Mon, 19 Mar 2018 11:07:42 +0530 Message-Id: <1521437863-12389-2-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521437863-12389-1-git-send-email-akshu.agrawal@amd.com> References: <1521437863-12389-1-git-send-email-akshu.agrawal@amd.com> MIME-Version: 1.0 X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: MAXPR0101CA0031.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:d::17) To DM5PR1201MB0185.namprd12.prod.outlook.com (2603:10b6:4:56::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 65f99ea5-ce7a-4e7b-8aa0-08d58d5dbb94 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM5PR1201MB0185; X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0185; 3:NG3YSTu+aY89QxX9baApNjueSgOQYOxbrp6sBMNWmoNuKnR/vxfB7rH031uluchf4yOgQtfnJjclXW37UTYtdUQSPuwzakNcORzS7epJfuou4eAXEacrbQPnoqcVwcpgGxNIYiNtaw0bMkSLxVdjDwJNdeSqJ+Qy+T1MMPcEvsMm2HqvR4i4rMg+wlRFtUiqetNLH2wSH++LoOt1XuLIdVIUTsvXTWoyEsTy4mSH1g+Ak94k+KnMdo14bOOhSdil; 25:ndjgFxWAZn0BDHGAKNsDXzPj579gNJLLzmoo8aH8TPhOAHohhREGH7pB3jZIXK66i4x30OwmbKt0fjWpi8qyll3LYR/0uSDqVmATxjrlMBJyZtiUY/ylIh0hJ165IpWW9w9T4FzfRhx2SVbJFodqfhhkP+8DaY8lHtDxwR2TC2Z+9/6Gy3eFaM07rA8UmN4xykQO0l8xbgSh2L7I5xIiHYjfnPe9vuCUskmhPm8JYTOhRGTad9xWQMkovRQnlyGmavIgz6dux6RagAwjUMX40THdrU6t2+6nzanwbXDK8a4F83qYY2nnGcZZHlteTQGntNrBOtoeZN0E2k17V9dedw==; 31:M53UoX+JwSQSi5UJasR0ksH5kNdc56cnVIIzQSszy4Xa8wXsQxec1xU4YTvWO/GAgmCW3vWh4K7xY7J7lAOtK27B+eHkzG4qDvIaTl7kziLxmrzPVoHQJxUxKClYsdLv8Lr1ZftRYeyBUqcSrRq8yNxNo5DlYx4fUUtQpvC79VlmVW2BzoxX/oEoOSqBCWBzJhyZl5ZgLZGnlQLMGa7TbwoC3t6PM4NvnmsV011bMJY= X-MS-TrafficTypeDiagnostic: DM5PR1201MB0185: X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0185; 20:NRV7/BNFVUjZBD1sCXvcS56HOVuOcT5ThwK/QqmDXXdKzfX3+CnlqsDBYrspVz5fTQiCY3QYvTPTW8Q2RstCEC/PdlpHDfZLYQjr6iHcBaLwI+iJm86ckGo1z6Ic4ZyyHyDk9x9hvU7s77+8jY9vtESfyFtBAV4gDJ3vWu3+Y0iMY7pasQLB7/A0AQ9r3AizFaEM785zgtMwVJxn2nlEVMMB+9sAoEWcgQTyvoTn96Zf+DFJsZ6dCc6FCxsc0nkQzXWpFo9T3Fd/nIlRA/HE/0W5SWs4gelQRbT4a2Jec0O/7yeY1CQ87NT0ABZ9iaspjoUxOO9B8FhDu9W9Rb1CsXnN9FtrdIEskBzRfdYu2NtwqlMxWoIdhW1nGxRX1V38TeSoEcO28Fd3QC9FfugQvLzKVWrMyiiXhqpknhyMCGXnsqzn+pPavumHAwHmGjBCJQvH5qT2ydWJAhTIviA5GM6x1rIMJTCE9PP6ZS/7oSp0iXLgNwYsx05tHtFBXGxu; 4:RmTWOadKwWEpXDo7LXhqWLGXIGxNM5u4C2m4D3zaesLqUInivYfcxWJkTQJaqzPY4DLZUYCle69lZQzN9OUgvUt9ELzwpwBi0QaPE9C9V3Q003n2t7ZtOyMgBj6G2nZe9DE0VxN+Tc8olFhJpkpqrX/Ix7EIA/s4UXUB8F92NvzGX/aQJtrKruV5C4WYE+6UnV5IU7/7+f20o4SRxu7tH3y3F0k77T0t8430NCf1GXBJCXwn6UMVWRo49N8edHEH0FM6OedZH5nkKGVShjy5aA/r1U5bocKqeGFh7PR7Ewb3NPKIGa/FmL3jxOGRBn+n 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)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR1201MB0185; BCL:0; PCL:0; RULEID:; SRVR:DM5PR1201MB0185; X-Forefront-PRVS: 06167FAD59 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(376002)(39380400002)(346002)(396003)(189003)(199004)(66066001)(47776003)(53416004)(2950100002)(8676002)(81156014)(6666003)(81166006)(68736007)(97736004)(53936002)(106356001)(48376002)(50466002)(16526019)(26005)(316002)(305945005)(16586007)(39060400002)(4326008)(478600001)(5660300001)(186003)(52116002)(7696005)(51416003)(76176011)(36756003)(7736002)(72206003)(59450400001)(386003)(50226002)(6116002)(86362001)(2906002)(25786009)(8936002)(3846002)(6486002)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0185; H:akshu-HP-EliteBook-745-G2.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; DM5PR1201MB0185; 23:eI4Se7pKdyJZuwcyzapxVVNth1g/HWDtT5Oag61?= =?us-ascii?Q?yHD4mUXTgZG/D6YG2UGZfHgg3erA3Xhdc5Wky6lkjbW4ugd3Y4cGbRlZqZf2?= =?us-ascii?Q?rbrPvQF+bIotq/vgQ4gw9Oby4WY3Zj99vYfnUF+jM6BFzoirFevUIUE9JCnA?= =?us-ascii?Q?TwdG2USssmtpSauKauPyju4n5C28FHfHdqXglQ1/Jd/Yh9ppyeejBwKGxAt7?= =?us-ascii?Q?SFXUbAWvw5ONHOXTf7fRY4RwPkE2duCXwFt1dP6dI7mTDMr3AdKAGsw0e2S3?= =?us-ascii?Q?vvHmdiMYuFPGT8BGkq3NMhYg0vdjALH6S80LDRiQwLJjEO+nmJmvuh0/yVAU?= =?us-ascii?Q?b0pIAVr2vOYe2f9Oz/gHrL1gu2eEmFV/IbWPBX4xneCKwCBv+YWHxI4Lnq0C?= =?us-ascii?Q?/x7r+G1D0JB/NIlbygNx9NJgVk17yl2Iwv42QUwwgvCuM2TnQphtBbZKiRA+?= =?us-ascii?Q?Upa1v81N+yUlcirPyKiEhlyffW9smRWhBZ1a1Wt+LGvkrtrA7sYLN8tGciLd?= =?us-ascii?Q?DObspyHuob7UXhj9526L/zI9F5ltgVPV/f1sAaxhSMsGTuSgHaq/VAaeqvRD?= =?us-ascii?Q?kne155aQAMksJDAIgTX/hujKa9KTFP43hmMHiJ3JtabXcduhqowN01azY4qV?= =?us-ascii?Q?wGtSiz1gqCyvD/XB56pG8i5GY80mlEqe8hzHbKjfif82glY+x/0cYNaCntZ0?= =?us-ascii?Q?YCoZbQo84SiTtGuklGg1GRHnkUTYkcCDTX38xs76QAuB2tcVAnXgIOHGcZmp?= =?us-ascii?Q?hv87apVyxfipd8DNT8uMOpnY0BDXeFawb6VBqfOzwTBVJyVC4gGXpzlqzmKz?= =?us-ascii?Q?GBS6zEqk2qz7lJeFBkhicthfxUCCQE2Mi8DalNYfrX7KI0eRU5Hvv4RIPxF3?= =?us-ascii?Q?+rETDVdte9LiCbjVMH4tQRDTwHEAG9eonL40ErKDBduezU21YTzeA7UKr4Xn?= =?us-ascii?Q?7NzHe3LVP39uVTh1cyQMBt5kwkoapgjWTyZ/MLDeVeHPNzgo9P1llea4xLob?= =?us-ascii?Q?HPJOhiLlWg8xalbXqawxbVVN4N8XMM14dVMWFpXmaKVYvVQyzsDS6Lsf2VV0?= =?us-ascii?Q?ljH01gliNzvUSjw8ZASv9Nz6/+1k2d26NtG18Ba+8lN0oXPGTKNO7SUJCfUQ?= =?us-ascii?Q?UJ5REhtKulfbMXAt+w8chyjRdVrD+6MdH9TKybzGprLlm0rRgip/ZrQ=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Antispam-Message-Info: 61AxnOL95BIGKha75AJIXBmDw9tMwhJsf8hVC0xwnnm4NYPL4weQ7gl0xO1q9fmVGbl6JbvHz/zgCWhmehC97b4xehpCzA9ptpDHHqEJHzYH5C9xxWRGbEyHkGO9cO6D1nk6Jle3BS9lGZ3TF7amYHaqm5Jc5smkrKK+QWVvogfP1qK0z0yzRmdFEhNGTG1o X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201M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11WCqXcrLvT/EbHkEsF3teDMYF0DmPYzZGLXdZI6X+vG7kdGrGHM/P4HMJfSTGkYQDJTQaza+Bikf5sZ86kv9xfVoAQhrptFErJUJOJYqdWdRWQR0yrVdHX64DGa9WJ/uBoErAI3y7nEv8rLjp/bSqf4/mjfc2b0HvLZro/Y/n X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2018 05:53:24.0334 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 65f99ea5-ce7a-4e7b-8aa0-08d58d5dbb94 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0185 Cc: tiwai@suse.de, lgirdwood@gmail.com, djkurtz@chromium.org, akshu.agrawal@amd.com Subject: [alsa-devel] [PATCH v2 2/3] 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, }, };