From patchwork Wed Jul 26 00:35:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 108726 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp199383qge; Tue, 25 Jul 2017 17:36:53 -0700 (PDT) X-Received: by 10.101.85.14 with SMTP id f14mr21540839pgr.45.1501029413697; Tue, 25 Jul 2017 17:36:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501029413; cv=none; d=google.com; s=arc-20160816; b=fUTJYorzlOE/IFRyK/YnmXmpteMXxhYcWBR9l40fToKSmHj3pvdEXWaosb0KvWvzeX ArFGA+6jCyZaxulm0x60xE4fIDfvuyg/Vja/iEm34+x43QpzTeXeZTybBBYaaZfeRaRT OxfTShWkshjqLlMnlrqPembKCuZzvl5y4qf2i+srp3P5WEyI62uxs0T1gSI5doZJlhxT rRRRunUNB1tVeS+LMmhd7qr0cUXdCbWZ82NWjOMlwshbfmjRC9OlLqAD4wMTvdfRreHS Qm64e3NRG1zjMG8JQ1JL14vZu8JQtPLADddFcL80R7YmUrJGtNcdQrDkrGwWKV1NH7zv zpLw== 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=mfGaft69n+criO1Q5biwXmSJRMtJB6GBLBsprFxzyVo=; b=FmjOopL2W1z9ddYQYWMjwdJnQXprpefh/ls6gtzwYZDWmEpqa/e67yCgnp3iKtQ33Y NHMqA1iqjt2TKt7XRBtOei3dxzWohHlQgdwf58z4o5ECriA7KV3QnbIi3CohpW+v9LUQ o9vxlm4h5NeRxNeutAN2ZPxGxp2RmsJXOarLaIwrwD2TZlo9NjInj5daqyFn5wvHz3nf Ycb44wx69zSpciI2rzHd1LcPLK19vEAS48elkdG3af/mE00omP0kJWS4GB6lluSvke6F WGv4M96rVCHejB1yy5Gr7pTS5LANBKDUHbb1RwaJlpd8E/DnxFpXVIO2PJ+xAhWk8hJ8 wVoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=DKZmPnJJ; 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 3si7178459plt.612.2017.07.25.17.36.53; Tue, 25 Jul 2017 17:36:53 -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.b=DKZmPnJJ; 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 S1751717AbdGZAgv (ORCPT + 26 others); Tue, 25 Jul 2017 20:36:51 -0400 Received: from mail-io0-f180.google.com ([209.85.223.180]:38813 "EHLO mail-io0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751758AbdGZAfa (ORCPT ); Tue, 25 Jul 2017 20:35:30 -0400 Received: by mail-io0-f180.google.com with SMTP id g13so61994871ioj.5 for ; Tue, 25 Jul 2017 17:35:29 -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=mfGaft69n+criO1Q5biwXmSJRMtJB6GBLBsprFxzyVo=; b=DKZmPnJJYyIi64DKw3CmmFMVweUhVT+FL2/inoCe7jHsWdkOVMtqBfwBHf4CBlH2Cs rchd+bmrbIPm0zAdK5Jr8zXG8Jqn/IcrC4U+8L6Knu6lc8ijO1aeRrH1LbdPi/d04BkC LErmEYWIbPChufGWAIEgAi6YMY2vKYMxdpXP0= 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=mfGaft69n+criO1Q5biwXmSJRMtJB6GBLBsprFxzyVo=; b=Fx6f4gzHP7QH0VXHCnD+Ye9lq0ZtFaOCxRxtWYs1ERv9sC8jJicSY5/QdHgogxN3Nm BIW/8sVaB2Ovq25ZkKOstJOS9uZBc78pfgyWzSigX5lps2VrIGHsSojCz1MIf6FN07eE jDIDjhE3+RNd4LRhAhsjIvZ0d29XoqH7D8Z4LjyYfHl+HOBoi6opPPkMT19OK7gvypTj JRTjp7GZUzf6DxSqkhu2M2DopxhUI2riqrJt6dbuzqUVEFVwJtsBGn1atl1gQ1/4zUfd DYD1sdiQGD+mM2k/JN7Z8+4gHEk+4x2pMRnaBZ1ta5Q2hiQ15chppdoHXizjAwIWtdkj Q/+Q== X-Gm-Message-State: AIVw111+hMBQt15u9OYvA0p4HzNrePUbnF5/Qbw0bQItORV95EL/jMqF qlQclAud6/1V2PziZXKMIw== X-Received: by 10.107.5.72 with SMTP id 69mr20380591iof.153.1501029329531; Tue, 25 Jul 2017 17:35:29 -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 l69sm5097373ioi.49.2017.07.25.17.35.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 17:35:29 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: Mark Brown , Banajit Goswami , alsa-devel@alsa-project.org Cc: Jaroslav Kysela , Takashi Iwai , Patrick Lai , linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH v1 3/6] ASoC: codecs: msm8916-wcd-analog: move codec reset to probe Date: Wed, 26 Jul 2017 02:35:09 +0200 Message-Id: <20170726003512.18965-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170726003512.18965-1-srinivas.kandagatla@linaro.org> References: <20170726003512.18965-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. 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, }, };