From patchwork Mon Mar 19 08:26:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshu Agrawal X-Patchwork-Id: 10291873 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 BD84760349 for ; Mon, 19 Mar 2018 08:42:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEB9729163 for ; Mon, 19 Mar 2018 08:42:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A37F5291C1; Mon, 19 Mar 2018 08:42:37 +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 C562929163 for ; Mon, 19 Mar 2018 08:42:36 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id A41722674D2; Mon, 19 Mar 2018 09:42:28 +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 0511A2673C4; Mon, 19 Mar 2018 09:42:24 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0088.outbound.protection.outlook.com [104.47.36.88]) by alsa0.perex.cz (Postfix) with ESMTP id BBB6F26731A for ; Mon, 19 Mar 2018 09:42:22 +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=IMEUbmAMSgtApAovp9bEe99/6W8+2aR/gEJTPyBzO6eN/2CFGrkVTfr2cCDJYrDgW1EPamibKlU6V0lI2jgZFR8BfUwjzTQX10wEIc+tXtueIrEfatrcQglK1WqnqmtbloZwxnxH4+k/yKz4p3iMFFOzjLl0+f/B7P9slJF88nc= 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 BN6PR1201MB0177.namprd12.prod.outlook.com (10.174.115.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.14; Mon, 19 Mar 2018 08:42:18 +0000 From: Akshu Agrawal To: broonie@kernel.org, alsa-devel@alsa-project.org Date: Mon, 19 Mar 2018 13:56:38 +0530 Message-Id: <1521447999-24120-2-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521447999-24120-1-git-send-email-akshu.agrawal@amd.com> References: <1521447999-24120-1-git-send-email-akshu.agrawal@amd.com> MIME-Version: 1.0 X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: PN1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM (10.174.144.157) To BN6PR1201MB0177.namprd12.prod.outlook.com (10.174.115.9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6ac92b83-b2fe-438d-a6b3-08d58d755402 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:BN6PR1201MB0177; X-Microsoft-Exchange-Diagnostics: 1; BN6P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bLCJQkd66Gykh8Czqn0bUn9P100i9x09kZ3cCoFWVobbe3noRhzDd6FEskfAHFMQlub0BB7jQvNJywT1RRLJ2LdEvLcbyZz+j1gU+hJsQGc/D8sGJPpLSWuE6yCmRiqxFI7HnmlPUyP/+Ml9W04MxaFaMNWinQxh1MuaVniMFRINsz9k5cEq2a9XtjtiVbXTvUu4dGEtkTjlaPtAatN/CwcWdK9UvXSzqvFXiDlZEleLoOrE9cDXqsUQvQcxgklkvqOuVT+5GZneZ979rddm3onNMacHewF/SC4ZC+a856lBXj3N2p+ND7wHiURDvQag2N+7BEQtWjglOpLewVkL6+gBhpO0fTMn53SYFPCWIt7hWR94v; 4:5WVI9JhTfGc2HyIs9XcMhkIM9zjJTfr85PK4c3QCtyz5DhR4Itd6ZcxCMrZCFC2DQ2vkkBIjtwSbLBGjFNrRabFExpsW+sBX4/gtgeABMfOLk4b24f57dbVxRJnaTUw8Z+0MeecH9jUKoZI4wcx7aOdxtV1Nvv2RwJ6fPyE5tQ19rZDDPXbRbI4qK+JgsuA830Ak2uLAhtIWLvGkt1LmvZj3bxcJsu4Oi4FpQPrLAHD+d7WBaJ8cFq1WRREl5STrTp6M6l8XkDz9Zvomwg/Pa0UP18Bq1usbXKzruRfuY3SCaolc5GSl+u5CdFp4FoZo 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)(944501244)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:BN6PR1201MB0177; BCL:0; PCL:0; RULEID:; SRVR:BN6PR1201MB0177; X-Forefront-PRVS: 06167FAD59 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(366004)(396003)(39860400002)(346002)(376002)(199004)(189003)(36756003)(2950100002)(66066001)(6666003)(25786009)(47776003)(305945005)(8676002)(6486002)(68736007)(316002)(7736002)(16586007)(50466002)(48376002)(53416004)(39060400002)(97736004)(76176011)(52116002)(86362001)(53936002)(7696005)(4326008)(72206003)(105586002)(478600001)(5660300001)(106356001)(2906002)(26005)(386003)(3846002)(50226002)(81156014)(59450400001)(6116002)(8936002)(186003)(81166006)(51416003)(16526019); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR1201MB0177; 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; BN6PR1201MB0177; 23:6pM00CaNst64tiOa86oKl/y/63ly266lxQ0eLQK?= =?us-ascii?Q?Aup+leSBwUb1m2A4gXJevrF4RMptHprr/hAHICqYTkLTLlrixYs5GGsIVkk3?= =?us-ascii?Q?SwacSsMjEoEqvGCZwDuLeKr39x7zpvHl1bhZbXgKQac+IqzJTm4Xk5RjB4CV?= =?us-ascii?Q?l/V9AYLn6WzgdcNv9d6HxKcoSnX5S/kxSraHwRaMcnPh9dJeDUk7I6+1+wtX?= =?us-ascii?Q?ozW+JIJQxakHcptENDJBzdXIQI0wW67YYDByUCtHNsHsBimuggVg+EMKlPS5?= =?us-ascii?Q?nXCDGkH1rcpNsWFno2VbAQIgZBRMdfnawwRquMcbxJH7u7sRSKK7aVO/6ywl?= =?us-ascii?Q?lUEbZlIgzJq726GAFzqrQkoTkHLhfllLf9yq4CupCAkbPMzbUbCjmIBB6gJT?= =?us-ascii?Q?p415XMgOt74Th1mGnE79Pj86xdxisrzbN+cDyGkpwb9S6+oK+ssw/OpqHD1z?= =?us-ascii?Q?0oS83kxtoGKktRsCZEHBrUdVGoy0C/zPTBN2nrmPGbJKf7OJueEuxuxI76pS?= =?us-ascii?Q?iLq8s1n0N3cogLd3qiYQ1iP1flLiETTPMzpx84lcO2B0IeVGtjPI1IY57QXA?= =?us-ascii?Q?mfrH1jenI56aCwg8umIl5h9T008gCzVjKrRYj6sTPIT9/H0vH2yXRqeD7cy5?= =?us-ascii?Q?lMqNebRN/zhd4HSI7dVEzFxTCTAVqP4T+yALgOnQxf0Y1/XCnLfWVwT6bHlE?= =?us-ascii?Q?w3fbLxJIeai/oC8f0juHEKLs1c1Ih7tn8WnK9gGWYFI3EK3TGcgqqvdkau1D?= =?us-ascii?Q?Le/suOLGnZSf7SOPw4HtAG1pWNMA1QjkIRdXgNOattvPn2BDf1FstJW8ON+0?= =?us-ascii?Q?x8/1+Ahd7x8qfZejrmZrD3FIuZmDUaxO6csuDWWjT0c57T/TApWouhZ+Socz?= =?us-ascii?Q?uVOxuLbLQN3yVDSE6uRBW3g62cjvyzoK5ZgkTQKE/ygCdP0xSRYlZjDyWAiX?= =?us-ascii?Q?Sf50pMPlD2mGnIx1+7ecpK5ByofWvN05eN/3pJerbMlejpd2n1M6/MaGYHwe?= =?us-ascii?Q?A2IW01z9+1UHDzIIist9nZE8Fpcmy6EgbVZuP8NeHkjBtWJ2/cc6DMfKoCzT?= =?us-ascii?Q?y2/wPiof+GjzkrFOFZPx1YsGPs2uaIRiDRM1eTxyJEc/hTDBK5oLfg0LUb5d?= =?us-ascii?Q?5ydxN218eRUhXhTXY+yY2aZtGrACaMIZNBE+lBVXXTO99RTW+VDYfVQ=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Antispam-Message-Info: DKA+oIT0UEg2r2uHyRwuwdQsig/2TKa01HGnQY799qLJBy+0iA6wWYl59xmaN1ohf8X6lrTxF52e6LHASNIIqNrJGPO+NJGsZOuZ1xVpZVT3a5lks5HSE7KefalH5Bx8QDDwhvdmlez3o+MNDAwi8iVxgS4yMsOm4UqQdhnrsDCvOZKN6ja+pdgsaAgdIyGh X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0177; 6:a+0tnnuwemv8c8jZXMoqTHIuWU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aFSbY2+EAby/dM/l0zdL98gOM8N0qFbQqtMPsOKzlyjE37gSVCXHr/EDsIRMetPDd2s16xLqn1BNdptRvbEkPWvrT+Khn2Zh85zIG4Yw+fkXO6c+LAnkDtjKVvyXA98xTGjwAaNtAbP3kj4S/jvQdrM8WtT X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2018 08:42:18.4267 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6ac92b83-b2fe-438d-a6b3-08d58d755402 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0177 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, }, };