From patchwork Wed Sep 11 15:32:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 2873291 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 A8B41BF43F for ; Wed, 11 Sep 2013 15:40:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E782620284 for ; Wed, 11 Sep 2013 15:39:55 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6CD642025D for ; Wed, 11 Sep 2013 15:39:54 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJmVF-0005Pj-EL; Wed, 11 Sep 2013 15:38:49 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJmQM-0000ia-2X; Wed, 11 Sep 2013 15:33:46 +0000 Received: from mga03.intel.com ([143.182.124.21]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJmPp-0000bo-LR for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2013 15:33:15 +0000 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 11 Sep 2013 08:32:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.90,885,1371106800"; d="scan'208";a="293584922" Received: from blue.fi.intel.com ([10.237.72.156]) by AZSMGA002.ch.intel.com with ESMTP; 11 Sep 2013 08:32:46 -0700 Received: by blue.fi.intel.com (Postfix, from userid 1004) id 19B91E0097; Wed, 11 Sep 2013 18:32:41 +0300 (EEST) From: Mika Westerberg To: linux-i2c@vger.kernel.org Subject: [PATCH v2 7/9] ASoC: codecs: convert existing I2C client drivers to use I2C core runtime PM Date: Wed, 11 Sep 2013 18:32:38 +0300 Message-Id: <1378913560-2752-8-git-send-email-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 1.8.4.rc3 In-Reply-To: <1378913560-2752-1-git-send-email-mika.westerberg@linux.intel.com> References: <1378913560-2752-1-git-send-email-mika.westerberg@linux.intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130911_113313_837563_EC08367F X-CRM114-Status: GOOD ( 12.00 ) X-Spam-Score: -7.7 (-------) Cc: Aaron Lu , Dmitry Torokhov , Mika Westerberg , Samuel Ortiz , Arnd Bergmann , Wolfram Sang , Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Liam Girdwood , linux-acpi@vger.kernel.org, Kyungmin Park , Mark Brown , Lv Zheng , Lee Jones , linux-arm-kernel@lists.infradead.org, Mauro Carvalho Chehab 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 The I2C core now prepares runtime PM on behalf of the I2C client device, so only thing the driver needs to do is to call pm_runtime_put() at the end of its ->probe(). This patch converts ASoC codec drivers to use this model. Signed-off-by: Mika Westerberg Acked-by: Mark Brown --- sound/soc/codecs/wm2200.c | 12 +++++------- sound/soc/codecs/wm5100.c | 8 ++++---- sound/soc/codecs/wm8962.c | 5 ++--- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c index 57ba315..469b67f 100644 --- a/sound/soc/codecs/wm2200.c +++ b/sound/soc/codecs/wm2200.c @@ -2407,21 +2407,17 @@ static int wm2200_i2c_probe(struct i2c_client *i2c, i2c->irq, ret); } - pm_runtime_set_active(&i2c->dev); - pm_runtime_enable(&i2c->dev); - pm_request_idle(&i2c->dev); - ret = snd_soc_register_codec(&i2c->dev, &soc_codec_wm2200, &wm2200_dai, 1); if (ret != 0) { dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); - goto err_pm_runtime; + goto err_reset; } + pm_runtime_put(&i2c->dev); + return 0; -err_pm_runtime: - pm_runtime_disable(&i2c->dev); err_reset: if (wm2200->pdata.reset) gpio_set_value_cansleep(wm2200->pdata.reset, 0); @@ -2438,6 +2434,8 @@ static int wm2200_i2c_remove(struct i2c_client *i2c) { struct wm2200_priv *wm2200 = i2c_get_clientdata(i2c); + pm_runtime_get(&i2c->dev); + snd_soc_unregister_codec(&i2c->dev); if (i2c->irq) free_irq(i2c->irq, wm2200); diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index ac1745d..5d3b22e 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c @@ -2612,10 +2612,6 @@ static int wm5100_i2c_probe(struct i2c_client *i2c, } } - pm_runtime_set_active(&i2c->dev); - pm_runtime_enable(&i2c->dev); - pm_request_idle(&i2c->dev); - ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm5100, wm5100_dai, ARRAY_SIZE(wm5100_dai)); @@ -2624,6 +2620,8 @@ static int wm5100_i2c_probe(struct i2c_client *i2c, goto err_reset; } + pm_runtime_put(&i2c->dev); + return ret; err_reset: @@ -2650,6 +2648,8 @@ static int wm5100_i2c_remove(struct i2c_client *i2c) { struct wm5100_priv *wm5100 = i2c_get_clientdata(i2c); + pm_runtime_get(&i2c->dev); + snd_soc_unregister_codec(&i2c->dev); if (i2c->irq) free_irq(i2c->irq, wm5100); diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index e2de9ec..4fcf7db 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -3715,9 +3715,6 @@ static int wm8962_i2c_probe(struct i2c_client *i2c, ret); } - pm_runtime_enable(&i2c->dev); - pm_request_idle(&i2c->dev); - ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8962, &wm8962_dai, 1); if (ret < 0) @@ -3725,6 +3722,7 @@ static int wm8962_i2c_probe(struct i2c_client *i2c, /* The drivers should power up as needed */ regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); + pm_runtime_put(&i2c->dev); return 0; @@ -3736,6 +3734,7 @@ err: static int wm8962_i2c_remove(struct i2c_client *client) { + pm_runtime_get(&client->dev); snd_soc_unregister_codec(&client->dev); return 0; }