From patchwork Thu Jun 5 10:19:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bo Shen X-Patchwork-Id: 4304341 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8F7C2BEEA7 for ; Thu, 5 Jun 2014 10:22:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A5F6220120 for ; Thu, 5 Jun 2014 10:22:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C00BF20306 for ; Thu, 5 Jun 2014 10:22:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WsUn3-0006Gs-8P; Thu, 05 Jun 2014 10:20:57 +0000 Received: from nasmtp01.atmel.com ([192.199.1.245] helo=DVREDG01.corp.atmel.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WsUmv-0006Ep-Rr for linux-arm-kernel@lists.infradead.org; Thu, 05 Jun 2014 10:20:50 +0000 Received: from sjogate2.atmel.com (10.42.103.223) by DVREDG01.corp.atmel.com (10.42.103.30) with Microsoft SMTP Server id 14.2.347.0; Thu, 5 Jun 2014 04:20:35 -0600 Received: from Dev4Android.corp.atmel.com ([10.217.2.46]) by sjogate2.atmel.com (8.13.6/8.13.6) with ESMTP id s55ACJXH026171; Thu, 5 Jun 2014 03:13:01 -0700 (PDT) From: Bo Shen To: Subject: [PATCH 2/5] ASoC: wm8904: switch to CCF Date: Thu, 5 Jun 2014 18:19:29 +0800 Message-ID: <1401963572-10953-3-git-send-email-voice.shen@atmel.com> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1401963572-10953-1-git-send-email-voice.shen@atmel.com> References: <1401963572-10953-1-git-send-email-voice.shen@atmel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140605_032049_926333_3F01E815 X-CRM114-Status: GOOD ( 11.73 ) X-Spam-Score: -0.7 (/) Cc: boris.brezillon@free-electrons.com, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, nicolas.ferre@atmel.com, linux-sound@vger.kernel.org, Bo Shen , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Enable WM8904 to support common clock framework. Signed-off-by: Bo Shen --- sound/soc/codecs/wm8904.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index f7c5499..af28cc6 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c @@ -11,6 +11,7 @@ * published by the Free Software Foundation. */ +#include #include #include #include @@ -49,6 +50,7 @@ static const char *wm8904_supply_names[WM8904_NUM_SUPPLIES] = { /* codec private data */ struct wm8904_priv { struct regmap *regmap; + struct clk *mclk; enum wm8904_type devtype; @@ -1828,6 +1830,8 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec, switch (level) { case SND_SOC_BIAS_ON: + if (wm8904->mclk) + clk_prepare_enable(wm8904->mclk); break; case SND_SOC_BIAS_PREPARE: @@ -1894,6 +1898,8 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec, regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies), wm8904->supplies); + if (wm8904->mclk) + clk_disable_unprepare(wm8904->mclk); break; } codec->dapm.bias_level = level; @@ -2110,6 +2116,13 @@ static int wm8904_i2c_probe(struct i2c_client *i2c, if (wm8904 == NULL) return -ENOMEM; + wm8904->mclk = devm_clk_get(&i2c->dev, "mclk"); + if (IS_ERR(wm8904->mclk)) { + ret = PTR_ERR(wm8904->mclk); + dev_err(&i2c->dev, "Failed to get MCLK\n"); + return ret; + } + wm8904->regmap = devm_regmap_init_i2c(i2c, &wm8904_regmap); if (IS_ERR(wm8904->regmap)) { ret = PTR_ERR(wm8904->regmap);