From patchwork Fri Jun 10 14:48:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 12877681 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05C81C43334 for ; Fri, 10 Jun 2022 14:49:24 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2BF7C1A93; Fri, 10 Jun 2022 16:48:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2BF7C1A93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654872563; bh=ktoYggIgOADZFGUTDTFpQrUEz+y4qRUO/+npNaFgmac=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=gX8L4ouxKICJ3gkMVrDT+Ox4C1uULIPPeZi/Dz3NrPRTXEPsRAOPZQttabEMoaE12 Q9LkSCbaNsK7NB4ez414L3MssiSKW80858blfZln/kBOpRhiulWVwFkJFkFYIBe4rg 3Xpl2meeoPTWuFG3lMp2bPlzihvaQuwyQFg/BqI0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CE8E9F804CF; Fri, 10 Jun 2022 16:48:32 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BD856F804D2; Fri, 10 Jun 2022 16:48:30 +0200 (CEST) Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A88B3F800E5 for ; Fri, 10 Jun 2022 16:48:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A88B3F800E5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="G+cIdmS8" Received: by mail-wr1-x42d.google.com with SMTP id x17so36848292wrg.6 for ; Fri, 10 Jun 2022 07:48:24 -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:mime-version :content-transfer-encoding; bh=dASImwNQ4lKnjqAZylKMyljkWPUewrzG4+oBeRN/mDc=; b=G+cIdmS8P0uX6K17wjNEk8gIw4CPGyMbc1Vy7LEPlgztd6qDiUMW08DkEQjsDqbJ28 LVWqoWg7nksaLKwJgJ5/xal4EvO21pdjfiHcl6eXcp9CrE7loaFrxmqV+VEZ7uaz6y+d hRC7gtUQJBkuFR2WlkHLh/JFwrxlg8xev2EosiExx/O2/GpSqz9cLih4hqpmrgXNRi1g fT34CbHd9lcn6kclIdpG5vnTHWyvXztwR4yc7x8QWVi7sPTd4sc8k/F1XfX/Om6uTiwG 50zHG0fCLJ4vly4DUCC9V4/i94fkuMbvl7rv+I5D1NO70xmGEQ/OygcWXcSMGDqLQIe5 9kMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dASImwNQ4lKnjqAZylKMyljkWPUewrzG4+oBeRN/mDc=; b=GHm/PbtpO+CgYVVXEI43o98lmFCMEHzfhzS70tBTrseI4AdV6F75Mi9H+jJdrCYWqs e4anUP3nyfQlKnK3ijfXxYMRrTs6ygLYA41ezBbti0ylaJbdR8t1U3pSLWA4pCSgLLbG 6IbSmBDj+ASgN9idfxgp5mu7LNTHrPF40U4zDAHmYTj/H/Ewx/ionKZLPq6Q9bTL9emi deKVJXScmCxxc0YYegLc8N2wI4EJ9jeYmygC9Aa5IViy+JnkdWq4Gq69cX7vCUTTi9aa CUCIS+fZhvXaFHe7FENLhnARwOUJe5ahVvkDI5MZLyOWidS8kaOqLhgNDWTjKaIpSJRm sdTw== X-Gm-Message-State: AOAM530oYrgA+ZoNdn/E5CutZcfx9jBlozL0k5/Qb7zfdwtU80hZvVu1 2AilBQcpUIyPMrlgsvlbHkYEXA== X-Google-Smtp-Source: ABdhPJwwor12U+NJ1Y3A97V4xBrTDNSS2pCfrcUD+2ZelNq8m/l02RTsCwtRkBE0U0SK1UFNnjqSvw== X-Received: by 2002:a05:6000:1567:b0:217:abea:6a67 with SMTP id 7-20020a056000156700b00217abea6a67mr31203490wrz.305.1654872502733; Fri, 10 Jun 2022 07:48:22 -0700 (PDT) Received: from srini-hackbase.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id bp3-20020a5d5a83000000b0020cff559b1dsm27212085wrb.47.2022.06.10.07.48.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 07:48:21 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Subject: [PATCH] ASoC: qdsp6: q6apm-dai: unprepare stream if its already prepared Date: Fri, 10 Jun 2022 15:48:18 +0100 Message-Id: <20220610144818.511797-1-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, tiwai@suse.com, Srinivas Kandagatla , Srinivasa Rao Mandadapu X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" prepare callback can be called multiple times, so unprepare the stream if its already prepared. Without this DSP is not happy to setting the params on a already prepared graph. Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support") Reported-by: Srinivasa Rao Mandadapu Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6apm-dai.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c index 19c4a90ec1ea..ee59ef36b85a 100644 --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -147,6 +147,12 @@ static int q6apm_dai_prepare(struct snd_soc_component *component, cfg.num_channels = runtime->channels; cfg.bit_width = prtd->bits_per_sample; + if (prtd->state) { + /* clear the previous setup if any */ + q6apm_graph_stop(prtd->graph); + q6apm_unmap_memory_regions(prtd->graph, substream->stream); + } + prtd->pcm_count = snd_pcm_lib_period_bytes(substream); prtd->pos = 0; /* rate and channels are sent to audio driver */