Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3333052pxj; Mon, 7 Jun 2021 08:09:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJ4Gtszp/vsdwBYssixQyaPbFZog16nuZcFiI+sk+EwGKB6PwUImThk1EKtZuMLBh9D/7F X-Received: by 2002:a05:6402:344:: with SMTP id r4mr20209739edw.226.1623078564690; Mon, 07 Jun 2021 08:09:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623078564; cv=none; d=google.com; s=arc-20160816; b=pAlUvblq4O1yTu8wgQhafTxC1HpZbVJqyka6Oso1hBkLehh/Gi8EGUwNSNLGz4zYaR dKreGnhdkJlRlP3dsfc21htyHHAfwDme9aiHO2Hbz+bdv8hD9gfeiuzeNLMOrgpV9OLF EQjx8w+SY2SuXmKXkqbBRXmwTpwaS9Pi9ZSS3QbxNQbthNfu99dS/TTuhOAPZpkYYgrl Sfmjwz/4VGFRtjb5x+8aR/GmNFzSdmSeZJTbTPQYe0wpL0ej4Ti8+9qStV48LddoOwqI hh+ZWzJYsetraoEeZ5ie0bNHnw7WqRc7K4YjdCdxBg5GG9FiDADfqHcAvNmryMh2Yk4f DJcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:to:subject:dmarc-filter:sender:dkim-signature; bh=6OL88XHWl9ozHCq99izlFd+FKI5s0/oTrciQ/ohCW7A=; b=bhehpYW9NQIl6hCUJNPcpGToyWWPJOb+vBIDvfpmUTktA9HiFEgrgrbP1qj1f7JuvB Ho40q6jzIy6ygbc+zp/8Rs6Vfw4AVrE0gOwF/1hn9rfrSA3FVboJwlrDzmhO+2n5oCk6 fNObmQ5pWZALQgDeWwVjFAdPADAT6574eI1Q5QWUxe/V1GmQYPEYtOeMAjG2j2Rwu9ZM ImThXpSdhrNMih0ah9RghzCxeru+TBL4GCQNFDt+G8L/AeFPA8oWwFQ5r5hNG64k0Iv2 UR2a1swura6Yp1StRJo6DMyxJeZ1dN7oEREGeT6kNnOdVsF8ovNKJb2WuUBryyfr+dON M60Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=lrxkYFLc; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kq12si4724921ejb.451.2021.06.07.08.08.49; Mon, 07 Jun 2021 08:09:24 -0700 (PDT) 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=@mg.codeaurora.org header.s=smtp header.b=lrxkYFLc; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230395AbhFGPGv (ORCPT + 99 others); Mon, 7 Jun 2021 11:06:51 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:12205 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230226AbhFGPGu (ORCPT ); Mon, 7 Jun 2021 11:06:50 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1623078298; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: To: Subject: Sender; bh=6OL88XHWl9ozHCq99izlFd+FKI5s0/oTrciQ/ohCW7A=; b=lrxkYFLcKX2c0tesuau33z2tRLi0WxoAbUEBJi5kEKA3R8i1Bx8M46HVM6r/XjkZmz1hLsx7 0I79x6GudDRt4Kk8zqVmZrHa9vG6a1PWsozkskkv781Bm5bZswgpwyI1ytFH1mit6Bo+YnUy 7qh6sh+2yEpdcUVJNpa/kk4756g= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-west-2.postgun.com with SMTP id 60be356fed59bf69ccad05d9 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 07 Jun 2021 15:04:15 GMT Sender: srivasam=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 5DF88C43148; Mon, 7 Jun 2021 15:04:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from [192.168.29.24] (unknown [49.37.144.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: srivasam) by smtp.codeaurora.org (Postfix) with ESMTPSA id 37A76C433D3; Mon, 7 Jun 2021 15:04:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 37A76C433D3 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=srivasam@codeaurora.org Subject: Re: [PATCH v2] ASoC: qcom: Fix for DMA interrupt clear reg overwriting To: Srinivas Kandagatla , 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, swboyd@chromium.org, judyhsiao@chromium.org References: <20210605113809.26584-1-srivasam@codeaurora.org> From: Srinivasa Rao Mandadapu Organization: Qualcomm India Private Limited. Message-ID: <8028139e-fe25-bb9e-3038-5180bc5f8ca3@codeaurora.org> Date: Mon, 7 Jun 2021 20:34:06 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Srini, Thanks for your review comments!!! On 6/7/2021 8:20 PM, Srinivas Kandagatla wrote: > > > On 05/06/2021 12:38, Srinivasa Rao Mandadapu wrote: >> The DMA interrupt clear register overwritten during >> simultaneous playback and capture in lpass platform >> interrupt handler. It's causing playback or capture stuck >> in similtaneous plaback on speaker and capture on dmic test. >> Update appropriate reg fields of corresponding channel instead >> of entire register write. >> >> Fixes: commit c5c8635a04711 ("ASoC: qcom: Add LPASS platform driver") >> >> Signed-off-by: Srinivasa Rao Mandadapu >> --- >>   sound/soc/qcom/lpass-platform.c | 17 +++++++++++------ >>   1 file changed, 11 insertions(+), 6 deletions(-) >> >> diff --git a/sound/soc/qcom/lpass-platform.c >> b/sound/soc/qcom/lpass-platform.c >> index 0df9481ea4c6..f220a2739ac3 100644 >> --- a/sound/soc/qcom/lpass-platform.c >> +++ b/sound/soc/qcom/lpass-platform.c >> @@ -526,7 +526,7 @@ static int lpass_platform_pcmops_trigger(struct >> snd_soc_component *component, >>               return -EINVAL; >>           } >>   -        ret = regmap_write(map, reg_irqclr, val_irqclr); >> +        ret = regmap_update_bits(map, reg_irqclr, val_irqclr, >> val_irqclr); >>           if (ret) { >>               dev_err(soc_runtime->dev, "error writing to irqclear >> reg: %d\n", ret); >>               return ret; >> @@ -650,7 +650,7 @@ static irqreturn_t lpass_dma_interrupt_handler( >>       struct lpass_variant *v = drvdata->variant; >>       irqreturn_t ret = IRQ_NONE; >>       int rv; >> -    unsigned int reg = 0, val = 0; >> +    unsigned int reg, val, val_clr, val_mask; > > minor nit here, variable name val_clr is pretty confusing to readers, > It might be okay for irq clr register but we are using the same name > of writing to other registers. So can I suggest you to reuse val > variable. > > other thing is val_mask, please rename this to mask and just set it in > the start of function so you can avoid 3 extra lines below. Ok will do accordingly and repost patch. > > Other than that patch looks good to me! > > --srini >>       struct regmap *map; >>       unsigned int dai_id = cpu_dai->driver->id; >>   @@ -676,8 +676,9 @@ static irqreturn_t lpass_dma_interrupt_handler( >>       return -EINVAL; >>       } >>       if (interrupts & LPAIF_IRQ_PER(chan)) { >> - >> -        rv = regmap_write(map, reg, LPAIF_IRQ_PER(chan) | val); >> +        val_clr = LPAIF_IRQ_PER(chan) | val; >> +        val_mask = LPAIF_IRQ_ALL(chan); >> +        rv = regmap_update_bits(map, reg, val_mask, val_clr); >>           if (rv) { >>               dev_err(soc_runtime->dev, >>                   "error writing to irqclear reg: %d\n", rv); >> @@ -688,7 +689,9 @@ static irqreturn_t lpass_dma_interrupt_handler( >>       } >>         if (interrupts & LPAIF_IRQ_XRUN(chan)) { >> -        rv = regmap_write(map, reg, LPAIF_IRQ_XRUN(chan) | val); >> +        val_clr = (LPAIF_IRQ_XRUN(chan) | val); >> +        val_mask = LPAIF_IRQ_ALL(chan); >> +        rv = regmap_update_bits(map, reg, val_mask, val_clr); >>           if (rv) { >>               dev_err(soc_runtime->dev, >>                   "error writing to irqclear reg: %d\n", rv); >> @@ -700,7 +703,9 @@ static irqreturn_t lpass_dma_interrupt_handler( >>       } >>         if (interrupts & LPAIF_IRQ_ERR(chan)) { >> -        rv = regmap_write(map, reg, LPAIF_IRQ_ERR(chan) | val); >> +        val_clr = (LPAIF_IRQ_ERR(chan) | val); >> +        val_mask = LPAIF_IRQ_ALL(chan); >> +        rv = regmap_update_bits(map, reg, val_mask, val_clr); >>           if (rv) { >>               dev_err(soc_runtime->dev, >>                   "error writing to irqclear reg: %d\n", rv); >> -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.