Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1469804iol; Fri, 10 Jun 2022 08:07:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsLojDsDL5ilR2yHu4Wf1M7JXzdePg7kY1kNKUsy5zdiq0Ary75fZXIDiuoycqCAO1bbCd X-Received: by 2002:a63:d008:0:b0:3fc:f8bb:4ed9 with SMTP id z8-20020a63d008000000b003fcf8bb4ed9mr37985996pgf.215.1654873676279; Fri, 10 Jun 2022 08:07:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654873676; cv=none; d=google.com; s=arc-20160816; b=LlQeSBYrBFiknsrFkacIMe3hAf3HAbIxusStFWAAqIZ/KXKAPKlNI3YgfZu4W1UEkm X/EUcDUYfXLCs5qYI5WAPAqUxj2YNORyFNvx+Rg7Fb+URpvE15Ioptqi1QxrAJTPt7Dl b88HfKJChTVQfcAJecrVbsE09uIseDZ5BIJu7nYvsiVZKcmj1E3Ior4/dlnmDh/sAVvn zi3pRJb+A0/hozCxPwMHKk7k9QyCDNIl/q5Qz6vhGF0UuWz3yf0nBeKEyWf4cgm+cZZM kAE7vNEGRloBLYa2y2J8jFzYRx1pjSH/OZRlQbRq2DV4r4vX8sWRn9/vB1Pa2kErBV2+ g/LA== 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:dkim-signature; bh=dASImwNQ4lKnjqAZylKMyljkWPUewrzG4+oBeRN/mDc=; b=sjG/BcahpnLTcAUPqzbEjkw1ExsoYaGm0tYvmN7vThek4QiGsdhTuogSNi9vuXdevX mWNFQaq/2mqM4QMjaz+4z8bVJAcuq7gtB386U+j/jJKQ1RRxgmAFXEM4VvY6o8+POmAZ U2MexbOIWWdEkp88EaygvLJnzcJYMY5iK2IEsYooQ3nlvwVsgMnfEXim329GkGFkP2oN SkfFsAKtamW/dB0+YY0GyKwIiJ6Qo5V2CN3DHAbl3t0JhyNnH42Y0W37LWHiOqaEtPM8 DzmaYZ1RI1JgLoU5U9AEI+7xREUZLAskc4nkHIsYVG5bR9hv8xBEREOLxVxfAU+dlqJK Ia4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G+cIdmS8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q2-20020a17090aa00200b001d285255f40si3016155pjp.32.2022.06.10.08.07.39; Fri, 10 Jun 2022 08:07:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G+cIdmS8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1345899AbiFJOth (ORCPT + 99 others); Fri, 10 Jun 2022 10:49:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238613AbiFJOss (ORCPT ); Fri, 10 Jun 2022 10:48:48 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26EC612FB09 for ; Fri, 10 Jun 2022 07:48:24 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id h5so36893912wrb.0 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=BG2gQNCQRQvNLUnQrbwDLyDneOkYuPnBgBNxya0Tb7lssUw7In6ohVeAoPPb/gTV+Q 2pXR8JYQyE0ybRII+j36PrvTTvxLt62kHZVMk0zTiTRRTqGTUVxW3nSJRtN7Eazr9krZ qTmXPESoHduL9OLfAjP3ATYeuxx39EoMIQtOrs50i5d/0EQzTaMDFiKbfMDb+hZLES2o Z76BxQAd0vKWncFYzFPrA010I+3rki8qVuF/3x3XoIw8RTu1+DSFF6zJCRxtdFlWnTJI z2ZZTUPAA5bw8W1OsCCeTZxFWXZ+f6VVozI1U++ExoUlPGTbE18kZIACwToyMN96NtQ8 6Rvg== X-Gm-Message-State: AOAM531/mO0zhiEXqxqrpZivMnCKoYknxERPb7wmQirTFKjMAHvdYveV ExXf6xBcEKEwjYBs2UvLXis1WQ== 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 Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, linux-kernel@vger.kernel.org, Srinivas Kandagatla , Srinivasa Rao Mandadapu 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 */ -- 2.25.1