Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1125693pxj; Wed, 2 Jun 2021 22:08:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyA9Vfcraxg9Ea5SGpsCYQOX5KS4F5NV/O5pjWXXOjx3BPZqKFQANz45X+HOAgqR3i/CTg3 X-Received: by 2002:a17:906:274d:: with SMTP id a13mr37955022ejd.51.1622696908616; Wed, 02 Jun 2021 22:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622696908; cv=none; d=google.com; s=arc-20160816; b=rkIF3nYuBgxipyup4p1KBIlSDF0rbHe9IMB5eNM5b0WtSLElmCcdn9ih3wOmpVLbyL LupoCG4Ywk+cmtBpj3dg3N8yVE4tzlpKK1GkzCxihtiKya1T10otzY8NclWhqH1Lf6JP a8BjzdFC4gLf/kXEVpc3lRRVIWNRq0NUnAvNaRiBie7hhCCQhXCaDo+GUScqj0B/zYk6 J11Cw0tx2F2yWUnAk5K0KImYTe63kVKrpxcBeAQrKICC4u3t4B1pdhgomguh9g5Eoxzv YBvr8yU/QcXjD/XJgLBMpkBF5fqz0PqCXcnxRoPu+6zSmRN95Z/y4+i6Y4dAK7Q0HqLp hckg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dmarc-filter:sender :dkim-signature; bh=yjEmiZ7jjHZMO1rvh/z4s+iEoOvJbPXaLOM9FC5ynDg=; b=0/NTnPoeWdIyqnOs6fVrqHPV/dY9sSJXeD5MyI2vk22pERis4leLDHgDFZo4MPXNTH uCd5fdsH2jfIrlES8UUEhimKT7o1UboYP1Ld9HrQI6uRYEf1UrV7IzDmV6qveZN8/FSa +YCO/j8mF+MZg0ai+GnXW1p8l2SR3K7CuqYeC6/fxrlct1fwPkDMS7P8oYJQC4oJq0GY jXs0ukY9tXQtZeafuau1dzSa+T5xWOhen2L3BXo9CqQFxtuG2OdwNEk+ZB5VyX2UsPL4 Hr2lVK64PZOtZZ8UhTjx5oNvNGFx5NxJvm2Cqr+6l/J9LjCiUFFmzRZ373/oRv8H0dIW yi/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=DE2IYMtW; 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 j6si1523176edv.294.2021.06.02.22.08.02; Wed, 02 Jun 2021 22:08:28 -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=DE2IYMtW; 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 S229710AbhFCFHx (ORCPT + 99 others); Thu, 3 Jun 2021 01:07:53 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:24619 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229695AbhFCFHw (ORCPT ); Thu, 3 Jun 2021 01:07:52 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1622696768; h=Content-Transfer-Encoding: MIME-Version: Message-Id: Date: Subject: Cc: To: From: Sender; bh=yjEmiZ7jjHZMO1rvh/z4s+iEoOvJbPXaLOM9FC5ynDg=; b=DE2IYMtWEeadyJcnWNOxrHZ5iA1d8EsYdWmE+0lz5V8fy2v+bzy3ubx927A6etTTpK26t7Qu lxVKeoMhU5vROgrX7AUV1cUyFvwpt8xIQxD/fYoeEyj0vXt4t6YLw6h9LMy2xb9wv/aMSOh5 dREiChd9HNCzQUoTloU884p8pK4= 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-n02.prod.us-west-2.postgun.com with SMTP id 60b8632b2eaeb98b5ecf4065 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 03 Jun 2021 05:05:47 GMT Sender: srivasam=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 0F8F1C4323A; Thu, 3 Jun 2021 05:05:47 +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,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from hyd-lnxbld210.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: srivasam) by smtp.codeaurora.org (Postfix) with ESMTPSA id 05F97C433F1; Thu, 3 Jun 2021 05:05:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 05F97C433F1 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 From: Srinivasa Rao Mandadapu To: 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, srinivas.kandagatla@linaro.org, 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 Cc: Srinivasa Rao Mandadapu Subject: [PATCH] ASoC: qcom: Fix for DMA interrupt clear reg overwriting Date: Thu, 3 Jun 2021 10:35:30 +0530 Message-Id: <20210603050530.15898-1-srivasam@codeaurora.org> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch fixes the DMA interrupt registers overwriting issue in lpass platform interrupt handler. 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..e02caa121fa4 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 = 0, val = 0, val_clr = 0, val_mask = 0; 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.