From patchwork Mon Mar 12 09:11:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10275713 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 5A9866038F for ; Mon, 12 Mar 2018 09:26:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E95C28B10 for ; Mon, 12 Mar 2018 09:26:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5338A28CB5; Mon, 12 Mar 2018 09:26:58 +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 A327828B10 for ; Mon, 12 Mar 2018 09:26:57 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 532CB2676A2; Mon, 12 Mar 2018 10:26:49 +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 D52D62675C9; Mon, 12 Mar 2018 10:26:44 +0100 (CET) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0042.outbound.protection.outlook.com [104.47.37.42]) by alsa0.perex.cz (Postfix) with ESMTP id 6E322267332 for ; Mon, 12 Mar 2018 10:26:42 +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=X+dCDhjkDB+BFHMMS9oqOQp31DycLf4JNyc9i5fBKYI=; b=Z62V98UA+FxcevkN4mWbxfwfFeU1s4qXrKbW9JmmQvcZT+16Iu4IRxaPBzosJSbYX+i4jLPBaHrj2iw/Ag3QbZ9h5vN6oHLhGRNww746JzyTkyJphls//i+3/v3KjJdvNXbLzVM9tVoCsPwNPFe4R+mhP/Nb41P76Amy7booQdg= 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 BN6PR1201MB0180.namprd12.prod.outlook.com (10.174.115.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.14; Mon, 12 Mar 2018 09:26:38 +0000 From: Akshu Agrawal To: broonie@kernel.org, alsa-devel@alsa-project.org Date: Mon, 12 Mar 2018 14:41:23 +0530 Message-Id: <1520845883-24062-2-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520845883-24062-1-git-send-email-akshu.agrawal@amd.com> References: <1520845883-24062-1-git-send-email-akshu.agrawal@amd.com> MIME-Version: 1.0 X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: MA1PR01CA0076.INDPRD01.PROD.OUTLOOK.COM (10.174.56.16) To BN6PR1201MB0180.namprd12.prod.outlook.com (10.174.115.12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 17b42235-b59f-4686-292b-08d587fb5cd8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BN6PR1201MB0180; X-Microsoft-Exchange-Diagnostics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Dt9UMzifMC1fqftLoApbm9pgfJ/j3mqlwy5lfvcR03onnMlVTyl4XUHyERepSsKPbCwdTV5a5VkFtQEBuYc1Nvxv9sEaSkEoDGll/llHvYdJx4+cR26ngYU4Q19gQtbEKNdpP5gaU630Yo+ALadQs4z8Y3jejW6fIGvlRNxNCEHqV9/2n2BXFVbhKgZn+lhsb68s0FsJtL7NCUxswYeZBBKR5hViSSqjPR2iPgzZ4daB+DXu32gJZy9I5izSxBSWSvqRAn/MNCUBKbXizlL3zkhWCcRlsMBDxbF2TXxMt52h7G5ZeuNLACURiwD53swOpi8rdq2iSqDJ4hSJkqeOwAwNEAzaVjyjuIDY+ZtWH2JqXhe9; 4:fTp8e/ThZ/3bwCYQFeJtlJkSY8Stg+tQNUgi+/mulxal9sKGeTKNnVlslleluG5TefBPIJYYLtK235474amtM0+0rzJGvXMLxk2YwJVBUSke30MK1LzO63XftZePr86PCRRL177sCv0bYF5lVvhSB9WivqxkJ1vHDHkYJ60KcQjpwgVpn3xLl82Q/5T34b6qOSn0iochr7IdxEiyEu2IVHD9FGGpiWw8zPRvEufm/eZf58q8t5nVUxw7spIqZ9vAInwtfKBjhqOgxk209aj8yRsXzVr4tdn/vuhTRMf3fMv6k/p8ob6XnYXqNTyupbaC 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)(3231220)(944501244)(52105095)(6055026)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:BN6PR1201MB0180; BCL:0; PCL:0; RULEID:; SRVR:BN6PR1201MB0180; X-Forefront-PRVS: 06098A2863 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(376002)(366004)(346002)(396003)(199004)(189003)(7696005)(36756003)(6666003)(386003)(8936002)(305945005)(186003)(16586007)(8676002)(26005)(316002)(81156014)(81166006)(7736002)(6116002)(51416003)(48376002)(50226002)(97736004)(2950100002)(16526019)(105586002)(39060400002)(52116002)(68736007)(72206003)(86362001)(53416004)(478600001)(76176011)(53936002)(106356001)(3846002)(6486002)(25786009)(47776003)(66066001)(50466002)(5660300001)(4326008)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR1201MB0180; 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; BN6PR1201MB0180; 23:/ImQauIJCfpLbNxx4LlZSsUPO4c+CjlKU7UySfO?= =?us-ascii?Q?ImZgeK/kWNfAL6kla2PQTwH+NMul/O84pN8xV1bBdOlPPrzOksIeRKoMpdsd?= =?us-ascii?Q?WRVcKeben8LS3HnHmY6TD21e+Mq6aAcceK8DIYMdVZDFJWCPDQHoqiLW8Sh1?= =?us-ascii?Q?2lblkQ+bYgRbm3GGah8NVWipdpCHP4x+7CUu0rYXlC9gFIwtvYF36DWd9aZF?= =?us-ascii?Q?CSKJZ9urNPAHQd5J3n+wIhzNGNtmctvw0xSwZdBkV2zaSNm02QZC81MPHIE2?= =?us-ascii?Q?ujJPu+HFquRsIcqz2o5TdcGUBWlrKSvuRTpnZ0QvCXfP79lkKqjtbVdx4sqM?= =?us-ascii?Q?8MzwdpKqHlPiQarfejwWRIegBFBjr5kl18Qup7WxOZtzW0pP3xWV6dbgI2Hg?= =?us-ascii?Q?L3B7LkyYpVWRD6T/RtIxK+q4PXl179wZ1hYlcFGPh0z+TsYXtZjJrs2RdWay?= =?us-ascii?Q?p/NnZLGecd+RPRwpWA6pMb4Qf7ncMW6OyzLpHbbrG9+gP87U1ZgQWg3411yn?= =?us-ascii?Q?HQz96lqwIzCD+ts4IONh6TAOb0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ieei3koLogkflnMvTOoBAqQ6JQb3fBjAK6srcnMYt+7JmXRtXlgkF8EoAGzA26DJBM957/IdhOvmEQTrE/6adxHSbgKwVcIT/JLlLKrLi/2pJZvnpOlU6 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2018 09:26:38.9035 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 17b42235-b59f-4686-292b-08d587fb5cd8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0180 Cc: tiwai@suse.de, lgirdwood@gmail.com, akshu.agrawal@amd.com Subject: [alsa-devel] [PATCH 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. TEST=Build, apply grunt_mixer_settings: iotools mmio_write32 0xfed80e40 0x040c40c0 iotools mmio_write32 0xfed80e28 0x10000 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..1441be3 100644 --- a/sound/soc/amd/acp-da7219-max98357a.c +++ b/sound/soc/amd/acp-da7219-max98357a.c @@ -42,6 +42,7 @@ #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) { @@ -66,6 +67,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 +84,30 @@ 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) +{ + int ret = 0; + + clk_disable_unprepare(da7219_dai_clk); + + return ret; +} + 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, }, };