From patchwork Thu Dec 7 15:38:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 10099567 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 D738F6063B for ; Thu, 7 Dec 2017 15:51:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C54D326785 for ; Thu, 7 Dec 2017 15:51:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9E4620683; Thu, 7 Dec 2017 15:51:20 +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=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 C357120683 for ; Thu, 7 Dec 2017 15:51:19 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E00AD267B35; Thu, 7 Dec 2017 16:39:32 +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 855EB267B39; Thu, 7 Dec 2017 16:39:31 +0100 (CET) Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by alsa0.perex.cz (Postfix) with ESMTP id E664D266B67 for ; Thu, 7 Dec 2017 16:39:23 +0100 (CET) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id vB7Fd7fv016601; Thu, 7 Dec 2017 09:39:07 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1512661147; bh=MwBxJ/OCmv7r8ePlcZqViviP/V3wNPpKAgndDOl2ZA8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=qsDJcL+38uFfioyMDt2wAOMxEA9F9f9Qy1uZwYec7VytIRSn+R+InnsMb9cgN70PJ vFT1/285gSuZYd0j2wZ+DKZje/0h7vmu4BRAbGgcWigGDSmi4hNKPQZN6iJAci8DES NiqXidA8JNevKuvnIvpUtV7DqYyJnFqeJ2LFf6W8= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id vB7Fd2cG002075; Thu, 7 Dec 2017 09:39:02 -0600 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Thu, 7 Dec 2017 09:39:01 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Thu, 7 Dec 2017 09:39:01 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id vB7Fd1vS029911; Thu, 7 Dec 2017 09:39:01 -0600 Received: from localhost (uda0226330.dhcp.ti.com [128.247.58.246]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id vB7Fd1329013; Thu, 7 Dec 2017 09:39:01 -0600 (CST) From: "Andrew F. Davis" To: Liam Girdwood , Mark Brown Date: Thu, 7 Dec 2017 09:38:55 -0600 Message-ID: <20171207153900.9831-6-afd@ti.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171207153900.9831-1-afd@ti.com> References: <20171207153900.9831-1-afd@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, "Andrew F . Davis" Subject: [alsa-devel] [PATCH v3 05/10] ASoC: tlv320aic31xx: Remove regulator notification handling 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 A regulator being forcefully disabled is a catastrophic event that should never happen to most devices, especially not sound CODECs. In addition, our handler sets the reset line but never disables it as no one is listening for an enable event, this is certainly broken and was mosy likely just copied from other CODECs, lets just remove this code. Signed-off-by: Andrew F. Davis --- sound/soc/codecs/tlv320aic31xx.c | 57 +--------------------------------------- 1 file changed, 1 insertion(+), 56 deletions(-) diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c index 44950c1f2532..e2bb78188b61 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c @@ -147,11 +147,6 @@ static const char * const aic31xx_supply_names[] = { #define AIC31XX_NUM_SUPPLIES ARRAY_SIZE(aic31xx_supply_names) -struct aic31xx_disable_nb { - struct notifier_block nb; - struct aic31xx_priv *aic31xx; -}; - struct aic31xx_priv { struct snd_soc_codec *codec; u8 i2c_regs_status; @@ -161,7 +156,6 @@ struct aic31xx_priv { struct gpio_desc *gpio_reset; int micbias_vg; struct regulator_bulk_data supplies[AIC31XX_NUM_SUPPLIES]; - struct aic31xx_disable_nb disable_nb[AIC31XX_NUM_SUPPLIES]; unsigned int sysclk; u8 p_div; int rate_div_line; @@ -1032,28 +1026,6 @@ static int aic31xx_set_dai_sysclk(struct snd_soc_dai *codec_dai, return 0; } -static int aic31xx_regulator_event(struct notifier_block *nb, - unsigned long event, void *data) -{ - struct aic31xx_disable_nb *disable_nb = - container_of(nb, struct aic31xx_disable_nb, nb); - struct aic31xx_priv *aic31xx = disable_nb->aic31xx; - - if (event & REGULATOR_EVENT_DISABLE) { - /* - * Put codec to reset and as at least one of the - * supplies was disabled. - */ - if (aic31xx->gpio_reset) - gpiod_set_value(aic31xx->gpio_reset, 1); - - regcache_mark_dirty(aic31xx->regmap); - dev_dbg(aic31xx->dev, "## %s: DISABLE received\n", __func__); - } - - return 0; -} - static void aic31xx_clk_on(struct snd_soc_codec *codec) { struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); @@ -1161,26 +1133,12 @@ static int aic31xx_set_bias_level(struct snd_soc_codec *codec, static int aic31xx_codec_probe(struct snd_soc_codec *codec) { struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); - int i, ret; + int ret; dev_dbg(aic31xx->dev, "## %s\n", __func__); aic31xx->codec = codec; - for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++) { - aic31xx->disable_nb[i].nb.notifier_call = - aic31xx_regulator_event; - aic31xx->disable_nb[i].aic31xx = aic31xx; - ret = regulator_register_notifier(aic31xx->supplies[i].consumer, - &aic31xx->disable_nb[i].nb); - if (ret) { - dev_err(codec->dev, - "Failed to request regulator notifier: %d\n", - ret); - return ret; - } - } - regcache_cache_only(aic31xx->regmap, true); regcache_mark_dirty(aic31xx->regmap); @@ -1195,21 +1153,8 @@ static int aic31xx_codec_probe(struct snd_soc_codec *codec) return 0; } -static int aic31xx_codec_remove(struct snd_soc_codec *codec) -{ - struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); - int i; - - for (i = 0; i < ARRAY_SIZE(aic31xx->supplies); i++) - regulator_unregister_notifier(aic31xx->supplies[i].consumer, - &aic31xx->disable_nb[i].nb); - - return 0; -} - static const struct snd_soc_codec_driver soc_codec_driver_aic31xx = { .probe = aic31xx_codec_probe, - .remove = aic31xx_codec_remove, .set_bias_level = aic31xx_set_bias_level, .suspend_bias_off = true,