From patchwork Wed Aug 2 17:09:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 9877173 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 0344360390 for ; Wed, 2 Aug 2017 17:11:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8D1C2880F for ; Wed, 2 Aug 2017 17:11:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCE9728823; Wed, 2 Aug 2017 17:11:06 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,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 0B19F28818 for ; Wed, 2 Aug 2017 17:11:05 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7402D26737F; Wed, 2 Aug 2017 19:09:56 +0200 (CEST) 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 D716D26736D; Wed, 2 Aug 2017 19:09:52 +0200 (CEST) Received: from mail-it0-f44.google.com (mail-it0-f44.google.com [209.85.214.44]) by alsa0.perex.cz (Postfix) with ESMTP id 382FC267368 for ; Wed, 2 Aug 2017 19:09:47 +0200 (CEST) Received: by mail-it0-f44.google.com with SMTP id h199so26982976ith.0 for ; Wed, 02 Aug 2017 10:09:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rzJ+Kw/zRYblLQFImq9J6g0NCbrJhB8KZmALwtHa2K4=; b=Al2RPOqiW5ADX9V9cSNSlFAsz8UIkJBoPC+wCxcaqDoaqm4wP5Brm+qInw5tPqMWOe bSZF3j/3EjGfNZEzZmoeqyYsdMx30x4wGKZmGgr38zdQEKKFu07tah2Jc2RpSCp9TIEf 3IQ4kRumG+ZfTIM6xz8D+nKWLQX+5OBZ+YryQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rzJ+Kw/zRYblLQFImq9J6g0NCbrJhB8KZmALwtHa2K4=; b=i9xnUiK+BVeQp+R0gnwt4NidBUQ0xY17aMvkTUMK5CHDySVcdP/tXqIRDk9UaDfq3I pybeINz6gFK5766nD+DT7L4+8JR318nyfE+shbr1ShUHYXD1qMZnwHt5pIxh2kZN2d86 WA4or4gf8FaRRYy8FMGJ/DaAYL4li3NBXAPEz9DWbxmTyYZTOYiXvo0WeXjQTCiUwZRS wXbMgqPbohUb0TL85OhN0YbtlDNvgtoopNe255RFQIDOxMUu2jyjFATByVUqYZkROKao qet1bsW5Tb/tfEnE/p9gvzLk1Wc9b48h8ik47Ov3sSq6s9Minspl6OsoJxj+HCsNwvCT iNyw== X-Gm-Message-State: AIVw1108DeQLHmEibSnp6ZLC+e6R2WzUc/Iqcybu+EvgXkF5TTcKRsQq B68yINDqNkSUF8seUaFtyg== X-Received: by 10.36.185.88 with SMTP id k24mr6588828iti.163.1501693786423; Wed, 02 Aug 2017 10:09:46 -0700 (PDT) Received: from localhost.localdomain (static.8.26.4.46.clients.your-server.de. [46.4.26.8]) by smtp.gmail.com with ESMTPSA id u79sm2291222ita.24.2017.08.02.10.09.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Aug 2017 10:09:45 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: Mark Brown , Banajit Goswami , alsa-devel@alsa-project.org Date: Wed, 2 Aug 2017 19:09:26 +0200 Message-Id: <20170802170930.26083-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170802170930.26083-1-srinivas.kandagatla@linaro.org> References: <20170802170930.26083-1-srinivas.kandagatla@linaro.org> Cc: damien.riegel@savoirfairelinux.com, Patrick Lai , linux-kernel@vger.kernel.org, Takashi Iwai , Srinivas Kandagatla Subject: [alsa-devel] [PATCH v2 2/6] ASoC: codecs: msm8916-wcd-analog: move codec reset to probe 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Srinivas Kandagatla This patch move the codec reset code from dai ops to codec probe, so that the codec is not held in reset when headset detection block is still active. Without this patch the codec block will be in reset as long as its not actively used, which means headset events will not be functional if the codec dai is not actively used. Point to note is that the headset detection blocks will work in low power when there is no active audio usecase and switch to micbias source when audio usecase is active. Existing dapms should put the codec in low power state anyway when there is no audio usecase. Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/msm8916-wcd-analog.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c index 5710fd4..6606954 100644 --- a/sound/soc/codecs/msm8916-wcd-analog.c +++ b/sound/soc/codecs/msm8916-wcd-analog.c @@ -536,6 +536,9 @@ static int pm8916_wcd_analog_probe(struct snd_soc_codec *codec) snd_soc_write(codec, wcd_reg_defaults_2_0[reg].reg, wcd_reg_defaults_2_0[reg].def); + snd_soc_update_bits(codec, CDC_D_CDC_RST_CTL, + RST_CTL_DIG_SW_RST_N_MASK, + RST_CTL_DIG_SW_RST_N_REMOVE_RESET); return 0; } @@ -543,6 +546,9 @@ static int pm8916_wcd_analog_remove(struct snd_soc_codec *codec) { struct pm8916_wcd_analog_priv *priv = dev_get_drvdata(codec->dev); + snd_soc_update_bits(codec, CDC_D_CDC_RST_CTL, + RST_CTL_DIG_SW_RST_N_MASK, 0); + return regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies); } @@ -736,28 +742,6 @@ static struct regmap *pm8916_get_regmap(struct device *dev) return dev_get_regmap(dev->parent, NULL); } -static int pm8916_wcd_analog_startup(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) -{ - snd_soc_update_bits(dai->codec, CDC_D_CDC_RST_CTL, - RST_CTL_DIG_SW_RST_N_MASK, - RST_CTL_DIG_SW_RST_N_REMOVE_RESET); - - return 0; -} - -static void pm8916_wcd_analog_shutdown(struct snd_pcm_substream *substream, - struct snd_soc_dai *dai) -{ - snd_soc_update_bits(dai->codec, CDC_D_CDC_RST_CTL, - RST_CTL_DIG_SW_RST_N_MASK, 0); -} - -static struct snd_soc_dai_ops pm8916_wcd_analog_dai_ops = { - .startup = pm8916_wcd_analog_startup, - .shutdown = pm8916_wcd_analog_shutdown, -}; - static struct snd_soc_dai_driver pm8916_wcd_analog_dai[] = { [0] = { .name = "pm8916_wcd_analog_pdm_rx", @@ -769,7 +753,6 @@ static struct snd_soc_dai_driver pm8916_wcd_analog_dai[] = { .channels_min = 1, .channels_max = 3, }, - .ops = &pm8916_wcd_analog_dai_ops, }, [1] = { .name = "pm8916_wcd_analog_pdm_tx", @@ -781,7 +764,6 @@ static struct snd_soc_dai_driver pm8916_wcd_analog_dai[] = { .channels_min = 1, .channels_max = 4, }, - .ops = &pm8916_wcd_analog_dai_ops, }, };