From patchwork Wed Aug 9 16:49:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 109742 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1130721qge; Wed, 9 Aug 2017 09:49:44 -0700 (PDT) X-Received: by 10.84.131.9 with SMTP id 9mr9658057pld.452.1502297384741; Wed, 09 Aug 2017 09:49:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502297384; cv=none; d=google.com; s=arc-20160816; b=m4F0TpNa3+a9ee8eeUeAlfuyvyOSZPq2Xsv0GzFH4dRVsSbbK35W9IB/rDgaw765Dy LsgVUsOQFE1s6hCLD0uGLEPr22Y/fFT29WdpwPpyr8cdDzOdnhYZlNGpt7Ouag48Kend V06fk7rHn+/agkjKS3ygBePeLOLZ6TWmmwTbyP+b4NzSytLZdiqY089i0EnNpVy7iiIY LPPGfkLYGgIKOGZzH6S6Ay0/NGnDgaOL89lhis05+svo91P48Sdrsb9kjkwVOuOnkdPI Gzl8c3SQ0cR2ix8Olx1s7T649eik47pnBE7aP+a+dc6B3AuK8DqnHx3LT4oglP1znzfb OFpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=rzJ+Kw/zRYblLQFImq9J6g0NCbrJhB8KZmALwtHa2K4=; b=wR1KIosxCL6hm28AeTEESM41YvmwQxHEvyrMjfz2OInfxpeoHGAd53wpMR9HJKl79f LDHZ7hCTBwPe6c6wY5+j9fl0QqVev6k4h6asDv+9R/DrHfwgIiqVEM/9QQZOHeDBOg9x EqkYOuwuu43TRx3ev63Wv8/thc8K0TY9kDFVL8spv79tBm00gKIoxze2H/0M1H2YpPfr nWz+jJF+zY1YBfdcsGrJwmqj8L1WTGN+06g4RMHe6BwSuuP4oKFPBakIbJYd8g1cYAFw PhcULkDiuQkXEhFOHWXO183hGQi2KWkG/td80wZp7+6Q6ZBFmEkfyTMNK1SQibxk26kW n5TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GpxDGCwT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 17si1037364pgh.435.2017.08.09.09.49.44; Wed, 09 Aug 2017 09:49:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GpxDGCwT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752963AbdHIQtm (ORCPT + 25 others); Wed, 9 Aug 2017 12:49:42 -0400 Received: from mail-io0-f172.google.com ([209.85.223.172]:36535 "EHLO mail-io0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752047AbdHIQtf (ORCPT ); Wed, 9 Aug 2017 12:49:35 -0400 Received: by mail-io0-f172.google.com with SMTP id g35so464865ioi.3 for ; Wed, 09 Aug 2017 09:49:35 -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=GpxDGCwTQG70QTxzMXBuVquUz5fILMkg9nvGbJPY/Pnvw1dxw/UtjXcralQLy1Acnt KINovoe9wJ4IQKgTlhV307Ob4rvNdv7NGuTcqWd8MomZ9NARRFuZZ/8NhkkQjOADEpB7 ZSOQUbvJTEILUzJ08pR+HyvkSKBScuCOabM0s= 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=EnCsa/ZtGc9Y+HGz8iC/Z7liedgQGT5iabcaBw7i84RwA3yW+TAITU8zIq6GihwiTz skmfZS6/DOrkk3P40FJrnl4l5OwuHFcbKgEUf1+1+rvOcdRzjwFCL3zAxhnjJYeGvgSl hnCjs0h0y5zNezApcuYos4IRnQ+SyNBtWU0ZfAuyhcLzRPkkkLPbfEjSYkQNu+Wxuvxf HgI7Htcq2vBXSHLwr2EZPs0hzhUx/9PXkp6krIALRSieuBxaWnvnodTMKOIUg1wTul9c 94LxeihcbRi3WB5FEDaH0W+VWfCrv0WEvk3KAc3JuG1/NHJd3D9a+vNLsVQwL0jWNnrQ u/LQ== X-Gm-Message-State: AIVw111U8qoXg7lXO2E/9Vc1MA+MGyAc7d8pYWO1FiyzofjyQtKFDLOa NidqhyMad+XSWoqI X-Received: by 10.107.7.227 with SMTP id g96mr7560742ioi.265.1502297374723; Wed, 09 Aug 2017 09:49:34 -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 r20sm2246012itb.19.2017.08.09.09.49.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 Aug 2017 09:49:34 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: Mark Brown , Banajit Goswami , alsa-devel@alsa-project.org Cc: damien.riegel@savoirfairelinux.com, Jaroslav Kysela , Takashi Iwai , Patrick Lai , linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v3 1/5] ASoC: codecs: msm8916-wcd-analog: move codec reset to probe Date: Wed, 9 Aug 2017 18:49:23 +0200 Message-Id: <20170809164927.19663-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170809164927.19663-1-srinivas.kandagatla@linaro.org> References: <20170809164927.19663-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.9.3 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, }, };