Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp525837pxb; Wed, 27 Jan 2021 13:55:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLBiau8D6KaYWyUYQCa5IwT68BuVtL4wAKWipbVCj+IJSEUacNrrNs7SrxfgkqkMqw9zGk X-Received: by 2002:a17:906:b757:: with SMTP id fx23mr6914504ejb.273.1611784550951; Wed, 27 Jan 2021 13:55:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611784550; cv=none; d=google.com; s=arc-20160816; b=XK2heY0kB25tYcQYBfau2K+wF3THAH0ly/c7fSphItQj6fqw5zcGqJY3582NAen+KQ F0NCHtUMOzsbNEYoWDFHhG6pWoRDdUUiNw6faI1id3G8/f1LyLdXYW/mqF0ZMH26fIR9 p3M5q+LtmjH42ToHPu38Hz0OsLMRpu+I5UNMUGrZ3USf7MK9go+g2vYi5So49o8MhmAX A8viBvfK8PAvncKFvOgnt5kLRrqMntR7t/PWhUgBfiO62eu+Ev/hvRPrMzn3CvKM3A/c URQNATjWiUNEumteusuYQ9g3tDlg8v7N24vFY69kXzAEefu6pJkphafnH6nkAWrhtSkQ Jw/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:dkim-signature; bh=ZsyXSLBpqyoZDJLOwz36YTbFMR5XUsNbF337fUqt2Cg=; b=wvlRYTr/kLHbOIkHYRj7Px5ztYAfQtq4vtUWpe1VoKuMDEDfyZl9pFncbXLPmSJgFJ ouTZg1OoK3jVwJNmiYyFzF/7EbtgUARKhaVtD3mqSQSSQ9TfdJc104lLEK2hUPZ1LM87 9Pu26REtq6WdhYKwcJqo+VPa2fNqlRiJ00UEBU6IuzeqR4pdPifVPOL/CX0PyTbsDXG3 LTxAJEYAdGgQ/udWfJXpH3LQ3TmnJVdNKIwwt0O0gh9nFwXdVChjHQqV5X/0s8wGAmTU QiZCgO/Ttr5gr0216H86TgRJBZVb6UQsiiC/5s2oN95N5RYd0hWrn6UTWL68iHbyuIFg ZZTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XM+7AUuC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id r9si1722499edm.110.2021.01.27.13.55.24; Wed, 27 Jan 2021 13:55:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XM+7AUuC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S234762AbhA0JzO (ORCPT + 99 others); Wed, 27 Jan 2021 04:55:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235629AbhA0JwT (ORCPT ); Wed, 27 Jan 2021 04:52:19 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F7A4C0613D6 for ; Wed, 27 Jan 2021 01:51:39 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id c128so1048218wme.2 for ; Wed, 27 Jan 2021 01:51:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=ZsyXSLBpqyoZDJLOwz36YTbFMR5XUsNbF337fUqt2Cg=; b=XM+7AUuC9pRqUpcQ44jgThIg1R06D5+ODzaBzxFVy6O64Bfu3YlokaUj/qZWDDalUp H1tJpg6SXSRIcUkpK8HTmhqT1G6g0LpQNcjyvtx05XkcUMVACa4uGoKORoO9VkYU6F67 XfJHrUU6dlCoDYzyHoGyp4Nd+ZobKt/vswc5d+m3eg9Ru/wvjBAKxow2DqBRLn4pD8T/ CZCnXmjCH8jTugGpZVNvAV8VELYQhbTLew1vPcjbYx+fP36sZYMuFhhQCB52lR0c0zbo fpVdMahWflCeMErqu01wEo9kvYnyiiG4V7dKhoMB40f6EakwJIJnqz/mr/g3O7bMqNce bbdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ZsyXSLBpqyoZDJLOwz36YTbFMR5XUsNbF337fUqt2Cg=; b=f1PvdluhO1+h8KozPQr+ry/v1j7Q0IKxSw2I9JpMrVm5f9AQ8bXaRj6kuQU4wmZbOn Z/0QJVmOtKJDDgWvVmT0U1CHbqURq2auya9kTAkqwBNHCcxacHacWDB1KqVXGRm6LQve +P8kBWZX7OcxHpFNResUN8NpzVP5VQGYfW746v96E1p2iZN+TknwjYlHu6alpH9DL+4m v0dNH5NjwDyVWCg8wt6rcbrx2YP6tfhoqMY0vJNUFweqQ8t47kt5j8scEVvbZ9NeVxF/ EV6SUDWTD6z9sbegHhlqYdVFPsaHO9CE/X2AmFiNPbYOa1nnSjezvIg1gGEmBOMOVw2A AXSA== X-Gm-Message-State: AOAM532badlBs7dOdmMe96HRFF59SOOzsr7Mu33p5UuYcCapSAUSXdiQ AF6TaHgsbhB5nenrTw178TBQxipjKnXSqQ== X-Received: by 2002:a7b:cb8a:: with SMTP id m10mr3359497wmi.127.1611741097661; Wed, 27 Jan 2021 01:51:37 -0800 (PST) Received: from [192.168.86.34] (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.googlemail.com with ESMTPSA id o17sm2213535wrm.52.2021.01.27.01.51.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jan 2021 01:51:36 -0800 (PST) Subject: Re: [PATCH] ASoC: qcom: lpass-cpu: Remove bit clock state check To: Srinivasa Rao Mandadapu , agross@kernel.org, bjorn.andersson@linaro.org, lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, plai@codeaurora.org, bgoswami@codeaurora.org, perex@perex.cz, tiwai@suse.com, rohitkr@codeaurora.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210127063038.1399-1-srivasam@codeaurora.org> From: Srinivas Kandagatla Message-ID: <16199fa8-7a87-6e7f-9db6-1d5cd8493d4c@linaro.org> Date: Wed, 27 Jan 2021 09:51:35 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20210127063038.1399-1-srivasam@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/01/2021 06:30, Srinivasa Rao Mandadapu wrote: > No need of BCLK state maintenance from driver side as > clock_enable and clk_disable API's maintaing state counter. > > One of the major issue was spotted when Headset jack inserted > while playback continues, due to same PCM device node opens twice > for playaback/capture and closes once for capture and playback continues. > > It can resolve the errors in such scenarios. > > Signed-off-by: Srinivasa Rao Mandadapu Thanks for the cleanup, yes clk core will take care of this by enable_count check! You should add Fixes: b1824968221c ("ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF invalid state") > --- > sound/soc/qcom/lpass-cpu.c | 22 ++++++++-------------- > sound/soc/qcom/lpass-lpaif-reg.h | 3 --- > sound/soc/qcom/lpass.h | 1 - > 3 files changed, 8 insertions(+), 18 deletions(-) > > diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c > index ae8efbc89af2..a669202e0001 100644 > --- a/sound/soc/qcom/lpass-cpu.c > +++ b/sound/soc/qcom/lpass-cpu.c > @@ -286,16 +286,12 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, > dev_err(dai->dev, "error writing to i2sctl reg: %d\n", > ret); > > - if (drvdata->bit_clk_state[id] == LPAIF_BIT_CLK_DISABLE) { > - ret = clk_enable(drvdata->mi2s_bit_clk[id]); > - if (ret) { > - dev_err(dai->dev, "error in enabling mi2s bit clk: %d\n", ret); > - clk_disable(drvdata->mi2s_osr_clk[id]); > - return ret; > - } > - drvdata->bit_clk_state[id] = LPAIF_BIT_CLK_ENABLE; > + ret = clk_enable(drvdata->mi2s_bit_clk[id]); > + if (ret) { > + dev_err(dai->dev, "error in enabling mi2s bit clk: %d\n", ret); > + clk_disable(drvdata->mi2s_osr_clk[id]); Can you also remove this unnecessary disable here! -srini > + return ret; > } > - > break; > case SNDRV_PCM_TRIGGER_STOP: > case SNDRV_PCM_TRIGGER_SUSPEND: > @@ -310,10 +306,9 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, > if (ret) > dev_err(dai->dev, "error writing to i2sctl reg: %d\n", > ret); > - if (drvdata->bit_clk_state[id] == LPAIF_BIT_CLK_ENABLE) { > - clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]); > - drvdata->bit_clk_state[id] = LPAIF_BIT_CLK_DISABLE; > - } > + > + clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]); > + > break; > } > > @@ -861,7 +856,6 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) > PTR_ERR(drvdata->mi2s_bit_clk[dai_id])); > return PTR_ERR(drvdata->mi2s_bit_clk[dai_id]); > } > - drvdata->bit_clk_state[dai_id] = LPAIF_BIT_CLK_DISABLE; > } > > /* Allocation for i2sctl regmap fields */ > diff --git a/sound/soc/qcom/lpass-lpaif-reg.h b/sound/soc/qcom/lpass-lpaif-reg.h > index 405542832e99..c8e1d75340b2 100644 > --- a/sound/soc/qcom/lpass-lpaif-reg.h > +++ b/sound/soc/qcom/lpass-lpaif-reg.h > @@ -60,9 +60,6 @@ > #define LPAIF_I2SCTL_BITWIDTH_24 1 > #define LPAIF_I2SCTL_BITWIDTH_32 2 > > -#define LPAIF_BIT_CLK_DISABLE 0 > -#define LPAIF_BIT_CLK_ENABLE 1 > - > #define LPAIF_I2SCTL_RESET_STATE 0x003C0004 > #define LPAIF_DMACTL_RESET_STATE 0x00200000 > > diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h > index 2d68af0da34d..83b2e08ade06 100644 > --- a/sound/soc/qcom/lpass.h > +++ b/sound/soc/qcom/lpass.h > @@ -68,7 +68,6 @@ struct lpass_data { > unsigned int mi2s_playback_sd_mode[LPASS_MAX_MI2S_PORTS]; > unsigned int mi2s_capture_sd_mode[LPASS_MAX_MI2S_PORTS]; > int hdmi_port_enable; > - int bit_clk_state[LPASS_MAX_MI2S_PORTS]; > > /* low-power audio interface (LPAIF) registers */ > void __iomem *lpaif; >