From nobody Wed Dec 17 20:48:52 2025 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E894201013 for ; Fri, 14 Mar 2025 14:33:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741962807; cv=none; b=sb6uL3mSm3xT8Uu9CPHKf2Eh3NInlmYrhjd+HzhtIeJfG9hkYIPhSaYB/MaVP3TbOtMiSEk8XTzCoeMcNeDswrIcwJ2B90tKo5SlIZOFHzeCc4R0r6mimYKreNJbqcTAmL6HXkL9gYKFS+aGftliiaJEEUkEoq9ri15B8dxqEUs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741962807; c=relaxed/simple; bh=TAw1EHr+KGLgB3XkicmeA88VvxQqIZ56YNyuSffOm+E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ox9IcyN/uuJfEaI/q0xNaP5EZclUM6oaOi16q8UfPwOWHaB4LoI0ZuPpPKz2jfpOOv0o6LaxFEmKd4Yjd0VoKUVDSQwKqzfA5L7bFAG0J9MdEKulJ5PUlALMCnLkaYQWQLNf0hx2RORBzV7vdnlmvfqdLKNwEcbguw1kWWofTeY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=QtHpDldG; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QtHpDldG" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-43d07ca6a80so14978945e9.1 for ; Fri, 14 Mar 2025 07:33:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741962803; x=1742567603; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=chruVzlaUTkKurouBS2LcxGafUPd4GyPtKSm8NIC0fw=; b=QtHpDldGuK5JIGP+WKBGAsKCb0hEg3CiR33mzhwg4kIPGga5JT5dy5bjsS2pfPRXtc dgQ1VAkGd0PpjgryNzWOL69fqO38K9Fq5WalSzvNSSWtUQZJWaa7c+itaoy5accQkADY zR3H12QiIsDvmw3lAlZzVNc1orNRBgUnMCnv29sOt2fh6JxHbOEPiu6Ig9E6r/HDRj/f q3hAzOkIMEzo3WsAVAARWjrPlor8hbo+d2H0c1spiPaeIFUFqoCOTxXdJnW+GRkruX3a 5VRTNiIEeu5T7YIfR0Cmf5l0u8Lxjo+/g8lSKhNIw/D/zXGuDweyTfQ6n+gHJBEShodt 0FRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741962803; x=1742567603; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=chruVzlaUTkKurouBS2LcxGafUPd4GyPtKSm8NIC0fw=; b=AItFxFSj0u9czO4Lv+1x8dmFKxGQEy+ESrDJHLiRSpBuoQx4GOmj9+0WNl/ms5ElS+ 6MU8XHU6XBxpJoTqKqOY4zd7LHDP3wvwzhyjlW3MtT4Gc0JAKlTP2y5ZXnU/IqLe+SvV lwRV2D4XSEOiTThCnrTovBW0B1BeKKcOlfdNHxWGSjgoSf/9tBb7tKmFpuDJFNfW1QMp OHBs3YHLp0qmVvAtoz+JMXfelYZSRla0sp/48gp+H/WvrFdPPGmeFn2XbioU8UzniESL HNxCkL4uKiCoxPjgGzMntGdg4Wfok+EcmQuiPeezxSZHEg166/xS1tPWOHL8OB4OhRVO wxOQ== X-Forwarded-Encrypted: i=1; AJvYcCXIlUmyIA3tcFFlGvpN3ksJ42SThHSggfgBLc4G3hLs2l4YbIl3vG0JT0cBo1X8QHVieX2PFkFN6rfNwgs=@vger.kernel.org X-Gm-Message-State: AOJu0YxD3gQlq5Kb8m8EF21DMk5shb4DNEIJKtAUWYQLJkm8nFBUryEP OdqROEuBQVLYnTuPeeBIL9QBdMit4xLpNcPWxRtZfYstGm+LUPf/0voPleBU70Y= X-Gm-Gg: ASbGncu4WK0WnIdOW7BrvYcq6JcBCKuZkzMvvcC6FywmsbITnqgMXRzhH8OneTwwTxf 23wUmf6oL+umRC0+mk2rOBIL02Kn15Dkze4JXuZzgstzHZZ0+iwbWe/LOy+UuchsERpyGINYrSQ nY5En7MwYPVCyjBmSWM84I3MplTCxX5Jo2JDcjBb5mcfIj8NtY9xe5TNOK3jDA9qFhisXvQglCm hz3vgkkC6qFFb3o9OpYLmqSiHRSysEx3KUPARJsSMsMh2Ow8D/fWu6gEzDCr50vdklKwliMcf0F iCSuiHzyML/5IKhHeuvYfVdM4ApXzPutxEJgIl7YZcrH6ZjhXXdPT3fpDdTh7QrDD+FVuw== X-Google-Smtp-Source: AGHT+IGkZEYytxBtdjySKaiItrRdrarx/PaGm+R/Jm71H8ErDxLmtWHVS1w8bgjGtTokv5oSf194nw== X-Received: by 2002:a5d:47c6:0:b0:391:ccf:2d1b with SMTP id ffacd0b85a97d-3971ffb36a4mr3785197f8f.49.1741962803514; Fri, 14 Mar 2025 07:33:23 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-395c82c2690sm5699168f8f.25.2025.03.14.07.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Mar 2025 07:33:22 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, krzysztof.kozlowski@linaro.org, linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dmitry.baryshkov@linaro.org, johan+linaro@kernel.org, Srinivas Kandagatla Subject: [PATCH v4 1/5] ASoC: q6apm-dai: schedule all available frames to avoid dsp under-runs Date: Fri, 14 Mar 2025 14:32:16 +0000 Message-Id: <20250314143220.6215-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250314143220.6215-1-srinivas.kandagatla@linaro.org> References: <20250314143220.6215-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Srinivas Kandagatla With the existing code, we are only setting up one period at a time, in a ping-pong buffer style. This triggers lot of underruns in the dsp leading to jitter noise during audio playback. Fix this by scheduling all available periods, this will ensure that the dsp has enough buffer feed and ultimatley fixing the underruns and audio distortion. Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support") Reported-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla Tested-by: Krzysztof Kozlowski Tested-by: Johan Hovold --- sound/soc/qcom/qdsp6/q6apm-dai.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-= dai.c index c9404b5934c7..9d8e8e37c6de 100644 --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -70,6 +70,7 @@ struct q6apm_dai_rtd { unsigned int bytes_received; unsigned int copied_total; uint16_t bits_per_sample; + snd_pcm_uframes_t queue_ptr; bool next_track; enum stream_state state; struct q6apm_graph *graph; @@ -134,8 +135,6 @@ static void event_handler(uint32_t opcode, uint32_t tok= en, void *payload, void * prtd->pos +=3D prtd->pcm_count; spin_unlock_irqrestore(&prtd->lock, flags); snd_pcm_period_elapsed(substream); - if (prtd->state =3D=3D Q6APM_STREAM_RUNNING) - q6apm_write_async(prtd->graph, prtd->pcm_count, 0, 0, 0); =20 break; case APM_CLIENT_EVENT_DATA_READ_DONE: @@ -294,6 +293,27 @@ static int q6apm_dai_prepare(struct snd_soc_component = *component, return 0; } =20 +static int q6apm_dai_ack(struct snd_soc_component *component, struct snd_p= cm_substream *substream) +{ + struct snd_pcm_runtime *runtime =3D substream->runtime; + struct q6apm_dai_rtd *prtd =3D runtime->private_data; + int i, ret =3D 0, avail_periods; + + if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK) { + avail_periods =3D (runtime->control->appl_ptr - prtd->queue_ptr)/runtime= ->period_size; + for (i =3D 0; i < avail_periods; i++) { + ret =3D q6apm_write_async(prtd->graph, prtd->pcm_count, 0, 0, NO_TIMEST= AMP); + if (ret < 0) { + dev_err(component->dev, "Error queuing playback buffer %d\n", ret); + return ret; + } + prtd->queue_ptr +=3D runtime->period_size; + } + } + + return ret; +} + static int q6apm_dai_trigger(struct snd_soc_component *component, struct snd_pcm_substream *substream, int cmd) { @@ -305,9 +325,6 @@ static int q6apm_dai_trigger(struct snd_soc_component *= component, case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - /* start writing buffers for playback only as we already queued capture= buffers */ - if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK) - ret =3D q6apm_write_async(prtd->graph, prtd->pcm_count, 0, 0, 0); break; case SNDRV_PCM_TRIGGER_STOP: /* TODO support be handled via SoftPause Module */ @@ -836,6 +853,7 @@ static const struct snd_soc_component_driver q6apm_fe_d= ai_component =3D { .hw_params =3D q6apm_dai_hw_params, .pointer =3D q6apm_dai_pointer, .trigger =3D q6apm_dai_trigger, + .ack =3D q6apm_dai_ack, .compress_ops =3D &q6apm_dai_compress_ops, .use_dai_pcm_id =3D true, }; --=20 2.39.2 From nobody Wed Dec 17 20:48:52 2025 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 603C9200BAA for ; Fri, 14 Mar 2025 14:33:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741962808; cv=none; b=YM3hMdkXARmAm+iwFZ6RIAgf751Z5drGJgLvgSaU+X73dE/Lju9nTSRWljHNy+CadJJhK9s/jLBCDik7w7FGMyaJJde9PakBVbBB9E5kibEgPpkP3gWj0Vlb52yFMqcgSMlDnNdeY6++4ifEvH1sG6PJquXf73Is5WBlmJfQexA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741962808; c=relaxed/simple; bh=/LrrjZsf1j7u5P5XbpBRADHJ1z3hQDnG5asCYJAEi6w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RoBMIc9r4KegrSYA/n/6u+hw4e+OUDwplliETcKt5DbIrfPDvei5QmVwGs8oqG/B+MCtSCC7e/KsgOALS4Fyy6wPGnTaTbbgyE7MrDnodRWe93mxmBVqGvX5TmJYfbJPPcq/8BQdypifGHBXcV7BCrkkBYgy5OGoYTBcxTdPiz4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=LtR/nbu4; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LtR/nbu4" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-38f403edb4eso1230470f8f.3 for ; Fri, 14 Mar 2025 07:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741962805; x=1742567605; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TFTzpqhJXhYVh1FwE3WUgch0eP/UhlF6Ae6PLQps0b8=; b=LtR/nbu4hwNy8hFvF3CRpJFtL+tFExuaBN0e2cQBkgVeAe276ZkhluQIVo8z3kBW2w aOr9kpANZa6lgbgMndUqiFRz/cE6Xtn8naP26oJoErxLr4iVvUPwFW3EHjyRqIAriSWg xUx6M5YGwoZxbLBNoBsPGqwBTambFdd9Vl9txE3X9WlygRIDpN4eyhRTCOCt1ysU5lgv LB/13OsHZP9Mdw4ak9M5aypIEJwbMqd8Fq/IEVPMf/DE+W8F7lcDLUGnC+uViYJK/8Vw RbpqJR8C0IM3281Nu7yKUYSDmLuUxhx43RjJCzVQLXq+xSUrzlIq8jDP2lqRdkZniybc HD/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741962805; x=1742567605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TFTzpqhJXhYVh1FwE3WUgch0eP/UhlF6Ae6PLQps0b8=; b=CmhvZl6vMuMkOzvoRuQhqB4Upa3gQ5I0Q6vjmOrB/8rmesIb7hWGmcbPpRVbeKGhxE nkoXkMm0WzzCkPKqgK+q1iQP9Jd68Ft2jfOfEeXQA+Yl1VuML/fynTTd3Fwyv9ITt2LG aPSZ/vkwFLNg32f7dO3zqIyV7DImRV3y75xrZFaZeSGzk3Rpr9EzIicavthvK3tKqYuI 2voHk6er7wf+f3rcee+vItbX0PsC17uLSejGHwtDmKxLsFylVCX05IdFQZg/SgrSn/FL aBEOme4x1+6nz9wrwkSm3IZPgj8pyWZKIyoKn7vUDteHC7W7C6EhR3K4r941FxxSOmKa 8QEg== X-Forwarded-Encrypted: i=1; AJvYcCUXtLi4ewTrvIfFmcdoRNHiEtqEruMeTSvRRgBIGkKKbga1c6xKllS81YtrkbOgUrBkiosu9TvdtDKoMQA=@vger.kernel.org X-Gm-Message-State: AOJu0Yxo2NyYG07RSe8zHNDIQ9LrhzoVycQkXcFeitUfT29EVCvhvSPd iL04v4AUAmFaVik553eV+oWlJzcQdBbckkfzcwm2c8GaJZOe6H1U559AnRCtBgM= X-Gm-Gg: ASbGncvFxvvxLEV6GzrrkkI2qG+N75y1+BA44xMnT6fCchKx+xekwe7QjQAUVl4dXom 7S8ahY5qu92fd6otUGk2Wy3bioYBMRBlKpVUbstQjMVS3Hb4cuDMdRMgVX896jmRLBPyWZKuESz MHe+lkJ1WBH4jZ2/HOMyGogXhTvdIrX6A3VSuug/sbRoee994OMMASeicHpY2VlUH8Rt2vhjd5l xSbFHi1R8ZFK/pqzfT3MKd2+adIG6uE85QQzH35W9iazaeCmJsdVaKJPuSiDvvnDJANOj8bXvCD YuMlHxTunGtKu/x0kLPwSqtPKrZSbYMQy7wJp9ZNh98aHdVu8zeu5XJO9XQGx21bdEY6Lw== X-Google-Smtp-Source: AGHT+IHeVYGxOJDDlfj6XFCcAFIk+y7PwJ4y20IgMQAQHLR/ud0eLQcjKFi54dZxDg4z7NiRfEtE2g== X-Received: by 2002:a05:6000:2ac:b0:390:e853:85bd with SMTP id ffacd0b85a97d-3971ffb22c0mr3946467f8f.48.1741962804718; Fri, 14 Mar 2025 07:33:24 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-395c82c2690sm5699168f8f.25.2025.03.14.07.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Mar 2025 07:33:23 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, krzysztof.kozlowski@linaro.org, linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dmitry.baryshkov@linaro.org, johan+linaro@kernel.org, Srinivas Kandagatla Subject: [PATCH v4 2/5] ASoC: q6apm: add q6apm_get_hw_pointer helper Date: Fri, 14 Mar 2025 14:32:17 +0000 Message-Id: <20250314143220.6215-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250314143220.6215-1-srinivas.kandagatla@linaro.org> References: <20250314143220.6215-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Srinivas Kandagatla Implement an helper function in q6apm to be able to read the current hardware pointer for both read and write buffers. This should help q6apm-dai to get the hardware pointer consistently without it doing manual calculation, which could go wrong in some race conditions. Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support") Signed-off-by: Srinivas Kandagatla Tested-by: Krzysztof Kozlowski Tested-by: Johan Hovold --- sound/soc/qcom/qdsp6/q6apm.c | 18 +++++++++++++++++- sound/soc/qcom/qdsp6/q6apm.h | 3 +++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c index 2a2a5bd98110..ca57413cb784 100644 --- a/sound/soc/qcom/qdsp6/q6apm.c +++ b/sound/soc/qcom/qdsp6/q6apm.c @@ -494,6 +494,19 @@ int q6apm_read(struct q6apm_graph *graph) } EXPORT_SYMBOL_GPL(q6apm_read); =20 +int q6apm_get_hw_pointer(struct q6apm_graph *graph, int dir) +{ + struct audioreach_graph_data *data; + + if (dir =3D=3D SNDRV_PCM_STREAM_PLAYBACK) + data =3D &graph->rx_data; + else + data =3D &graph->tx_data; + + return (int)atomic_read(&data->hw_ptr); +} +EXPORT_SYMBOL_GPL(q6apm_get_hw_pointer); + static int graph_callback(struct gpr_resp_pkt *data, void *priv, int op) { struct data_cmd_rsp_rd_sh_mem_ep_data_buffer_done_v2 *rd_done; @@ -520,7 +533,8 @@ static int graph_callback(struct gpr_resp_pkt *data, vo= id *priv, int op) done =3D data->payload; phys =3D graph->rx_data.buf[token].phys; mutex_unlock(&graph->lock); - + /* token numbering starts at 0 */ + atomic_set(&graph->rx_data.hw_ptr, token + 1); if (lower_32_bits(phys) =3D=3D done->buf_addr_lsw && upper_32_bits(phys) =3D=3D done->buf_addr_msw) { graph->result.opcode =3D hdr->opcode; @@ -553,6 +567,8 @@ static int graph_callback(struct gpr_resp_pkt *data, vo= id *priv, int op) rd_done =3D data->payload; phys =3D graph->tx_data.buf[hdr->token].phys; mutex_unlock(&graph->lock); + /* token numbering starts at 0 */ + atomic_set(&graph->tx_data.hw_ptr, hdr->token + 1); =20 if (upper_32_bits(phys) =3D=3D rd_done->buf_addr_msw && lower_32_bits(phys) =3D=3D rd_done->buf_addr_lsw) { diff --git a/sound/soc/qcom/qdsp6/q6apm.h b/sound/soc/qcom/qdsp6/q6apm.h index c248c8d2b1ab..7ce08b401e31 100644 --- a/sound/soc/qcom/qdsp6/q6apm.h +++ b/sound/soc/qcom/qdsp6/q6apm.h @@ -2,6 +2,7 @@ #ifndef __Q6APM_H__ #define __Q6APM_H__ #include +#include #include #include #include @@ -77,6 +78,7 @@ struct audioreach_graph_data { uint32_t num_periods; uint32_t dsp_buf; uint32_t mem_map_handle; + atomic_t hw_ptr; }; =20 struct audioreach_graph { @@ -150,4 +152,5 @@ int q6apm_enable_compress_module(struct device *dev, st= ruct q6apm_graph *graph, int q6apm_remove_initial_silence(struct device *dev, struct q6apm_graph *g= raph, uint32_t samples); int q6apm_remove_trailing_silence(struct device *dev, struct q6apm_graph *= graph, uint32_t samples); int q6apm_set_real_module_id(struct device *dev, struct q6apm_graph *graph= , uint32_t codec_id); +int q6apm_get_hw_pointer(struct q6apm_graph *graph, int dir); #endif /* __APM_GRAPH_ */ --=20 2.39.2 From nobody Wed Dec 17 20:48:52 2025 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0914320126A for ; Fri, 14 Mar 2025 14:33:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741962809; cv=none; b=j7jCaBXc3JLMUCddSqkYveic/NRB1DQluw8GhE6Nekd9FzgqmyASdpj8Fdetwuft1RRvktUxDoPq+GVz75A2Ym/hKdPldBBu7jFb674ZJ5Gg4x68UfdEcg13CbmRTJ+SfRFrWqELH/Ia7o6No4aS60BRpnFOkPl5Vu1efcxhF4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741962809; c=relaxed/simple; bh=rl1JUAbzuHruCH71rfySFM7KQHZ8STkXFPVIDYURSF0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=X3uOdr1Cv43JsdPKcDIeGKjqFCBotK21C86PngOg+ABeA66WBVUVmRDh8tIKQN541bQMGVGOSWbg8xwS54gk3Nx3l4kEI0aGr9Pw7Z81UI9zAqewU+Q7qA1m7+V0RG712rImqPC817BGKx0VrvUkocaMeGL8yfyVQTqYhMTjJBA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=UlrVHwKQ; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UlrVHwKQ" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-43d0618746bso15088215e9.2 for ; Fri, 14 Mar 2025 07:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741962806; x=1742567606; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m7r265E8NIQTLThxcAbd4dtQS3El8DVfLuvsTAa+XKw=; b=UlrVHwKQK+fpgNNXNiUJ2Z2aO/JsVlG23OaxaPfxm94E8CyXihZM2F+TbBxtZa0X09 R6tsSxpjyLE8Q3esMWiYxR3Py9upeIh3ArYeTevgtAsEbSkG8qzW4nKT9PWwrHCoK4uP fMnaAHre291zLFYsN+bAF7kweBTOc5R5afPZIxAvRud+TNsFBseJfnj/kt11YZeMp2UY +AqAqU8wYeQpoe+NQORNsL1xnHhyR/pS0JH2NomLoeRYt+KHdbzZeDc+LbSuV5mCC3BF /3D9s1DwD35mkLGjQ3PesnaMoj9PqlVcS8tN4IlBTy3LPpACYeWRLdt1mvRMO6ZML9hw MggA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741962806; x=1742567606; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m7r265E8NIQTLThxcAbd4dtQS3El8DVfLuvsTAa+XKw=; b=Vrl0/xHV2GGR1R/XJ573NOM5UrGXvG2uHFyFO0Q51T/s0NJfgU20cBByTxs4i1i9// 80yWKSgm2z51T+3wEuHahrnxmq5ffVuIsRdk1j9dNCeEDg7xNjfkkn6RqjjKBDZk7G3o rdZcCoO7QSmYkWzlD2EwG6Cnea3r9aeeicQXBB43N8PnPzrxrhHoQn+ELuoO1RrYxxZV XeBLJtytRiTBDInTDx9we/GiySzg+5/+PQ67XYVLi2JThsCKxFd+LK9oiW00Mfej/abt 9/Sx2xO9MSvRD4hFup2R1aiOkyduA3Yrw8dw/JxxZXZpO9dZ9zPZhsNOs0v/YOwkuDou LfaA== X-Forwarded-Encrypted: i=1; AJvYcCXJNP65+gVPZhVZFDFJHgIWQwuHMqF3XVHIY7jbq1D0zS6VdF2D0rPB+L7GM5CBHOxZa2ZyLlAPW54YwdA=@vger.kernel.org X-Gm-Message-State: AOJu0YwV4ZhfBVNmWOHGEj4+pB58+vcXtLoErT7lK7RjafO0Gq6sWq3J TFZsxpM7+r8ryMOQD/DbJIHNr0of53cXd90WaKnjxCYiDTCas6qVjQU50L0vLqE= X-Gm-Gg: ASbGncv8WRvDqcnf0JmxI7iD3ed1h+qA0lbxCqjiyJO5TlhdDB6YY65bO9OoZd/XNOx KeRYLWaiVfQyQq4smH197j0MkjurbowpbXviKUZlDNCFAxbvfjj8kxeVQdWHbFqGlgIqlnGOGjv DSAB6FHbDnl4EYNlBTWOStCnEoNObXwfX0vMUTqKVfTwGkm64OX6dG62m7OO+oeH/J9nCC1JXxO 1D5ngOtl6bqzfjNZjF+Kl4iA562yTcUp4n6GeVxN2kZCM5nRk+RbbH0BsOIQixfmsOMXUSJ/9V/ ZeRg1+chGfAFtjGk6eJCX9Q3JsTU3n9BftAbS6Zh/9wzu+JL8/18MpGv85lx1mwcwFNzY6HxS/Z 8GBMK X-Google-Smtp-Source: AGHT+IHHvG7zpgRF/biasWJacaE8BgqYA/+Tzt9Ba1i6MJmKfz1aq1nD3PLvd4Da03+ceLCK/JoXgw== X-Received: by 2002:a5d:5f84:0:b0:391:4095:49b7 with SMTP id ffacd0b85a97d-3971f12e65amr4834829f8f.25.1741962806395; Fri, 14 Mar 2025 07:33:26 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-395c82c2690sm5699168f8f.25.2025.03.14.07.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Mar 2025 07:33:25 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, krzysztof.kozlowski@linaro.org, linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dmitry.baryshkov@linaro.org, johan+linaro@kernel.org, Srinivas Kandagatla Subject: [PATCH v4 3/5] ASoC: q6apm-dai: make use of q6apm_get_hw_pointer Date: Fri, 14 Mar 2025 14:32:18 +0000 Message-Id: <20250314143220.6215-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250314143220.6215-1-srinivas.kandagatla@linaro.org> References: <20250314143220.6215-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Srinivas Kandagatla With the existing code, the buffer position is only reset in pointer callback, which leaves the possiblity of it going over the size of buffer size and reporting incorrect position to userspace. Without this patch, its possible to see errors like: snd-x1e80100 sound: invalid position: pcmC0D0p:0, pos =3D 12288, buffer siz= e =3D 12288, period size =3D 1536 snd-x1e80100 sound: invalid position: pcmC0D0p:0, pos =3D 12288, buffer siz= e =3D 12288, period size =3D 1536 Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support") Signed-off-by: Srinivas Kandagatla Tested-by: Krzysztof Kozlowski Tested-by: Johan Hovold --- sound/soc/qcom/qdsp6/q6apm-dai.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-= dai.c index 9d8e8e37c6de..90cb24947f31 100644 --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -64,7 +64,6 @@ struct q6apm_dai_rtd { phys_addr_t phys; unsigned int pcm_size; unsigned int pcm_count; - unsigned int pos; /* Buffer position */ unsigned int periods; unsigned int bytes_sent; unsigned int bytes_received; @@ -124,23 +123,16 @@ static void event_handler(uint32_t opcode, uint32_t t= oken, void *payload, void * { struct q6apm_dai_rtd *prtd =3D priv; struct snd_pcm_substream *substream =3D prtd->substream; - unsigned long flags; =20 switch (opcode) { case APM_CLIENT_EVENT_CMD_EOS_DONE: prtd->state =3D Q6APM_STREAM_STOPPED; break; case APM_CLIENT_EVENT_DATA_WRITE_DONE: - spin_lock_irqsave(&prtd->lock, flags); - prtd->pos +=3D prtd->pcm_count; - spin_unlock_irqrestore(&prtd->lock, flags); snd_pcm_period_elapsed(substream); =20 break; case APM_CLIENT_EVENT_DATA_READ_DONE: - spin_lock_irqsave(&prtd->lock, flags); - prtd->pos +=3D prtd->pcm_count; - spin_unlock_irqrestore(&prtd->lock, flags); snd_pcm_period_elapsed(substream); if (prtd->state =3D=3D Q6APM_STREAM_RUNNING) q6apm_read(prtd->graph); @@ -247,7 +239,6 @@ static int q6apm_dai_prepare(struct snd_soc_component *= component, } =20 prtd->pcm_count =3D snd_pcm_lib_period_bytes(substream); - prtd->pos =3D 0; /* rate and channels are sent to audio driver */ ret =3D q6apm_graph_media_format_shmem(prtd->graph, &cfg); if (ret < 0) { @@ -445,16 +436,12 @@ static snd_pcm_uframes_t q6apm_dai_pointer(struct snd= _soc_component *component, struct snd_pcm_runtime *runtime =3D substream->runtime; struct q6apm_dai_rtd *prtd =3D runtime->private_data; snd_pcm_uframes_t ptr; - unsigned long flags; =20 - spin_lock_irqsave(&prtd->lock, flags); - if (prtd->pos =3D=3D prtd->pcm_size) - prtd->pos =3D 0; - - ptr =3D bytes_to_frames(runtime, prtd->pos); - spin_unlock_irqrestore(&prtd->lock, flags); + ptr =3D q6apm_get_hw_pointer(prtd->graph, substream->stream) * runtime->p= eriod_size; + if (ptr) + return ptr - 1; =20 - return ptr; + return 0; } =20 static int q6apm_dai_hw_params(struct snd_soc_component *component, @@ -669,8 +656,6 @@ static int q6apm_dai_compr_set_params(struct snd_soc_co= mponent *component, prtd->pcm_size =3D runtime->fragments * runtime->fragment_size; prtd->bits_per_sample =3D 16; =20 - prtd->pos =3D 0; - if (prtd->next_track !=3D true) { memcpy(&prtd->codec, codec, sizeof(*codec)); =20 --=20 2.39.2 From nobody Wed Dec 17 20:48:52 2025 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA4B720299B for ; Fri, 14 Mar 2025 14:33:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741962813; cv=none; b=TXML4MCyQofTPolPPNEPXDSBPxLJOgEY7zgJcYr7Y/jKLMNTneCOmvrDCjwYCuGM2Gl44erFtxMrw1uQ0KiYa7G/Nk4+SsXW122xkmbL53vaz7DVwdfw/fUYaDU/toFZ6H2wLjhKYglOPcboxSBLXkeA8+Cm3+4JRZq+K3f6tl4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741962813; c=relaxed/simple; bh=etID88XhArSgmvosEDMawlWfvyYiW3vHyBAqplbUD90=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DJBt6UcKZXIfLnPnGKcA5GKQyw2JmIXqdsUYdxb2KhQxNfme0wreWeyzQNwqCqDvnfKJp0q6vqYoROkuvrXq95O9+Qd2WBe5Qhlfp/Hw/bSEyZ6konZWFQ1O/AolS9mkNANMrmrDS/h/UvrfbecA7EBMBkYZrUZNCZaOonYLOt0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=g73ymznm; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="g73ymznm" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-39133f709f5so1346800f8f.0 for ; Fri, 14 Mar 2025 07:33:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741962808; x=1742567608; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=86CJK2fc0cAvOYyDOyHTA5kr0QOMsZ602Wh5UOHhaX0=; b=g73ymznmPQ+l3wbZ7nChZLt9j0OptWwba7Z+ES3NZLj5jSpgMHRSXdKPx65IdCppwo hmHl6K/wxkd0h6QoI8+lfuRbXvSMuFnfvwSujBaIz4EnvYxLOcm5jBPZrC4d8rwkhEAP kCk2lVBl0fMl2KlqemjvJl7aD0zmK/NYdpGsXS8RLE7rglT/2MGmiNeBVpToubITKxv0 begNQiuZ01/ZmYJ0et3CiksswTp7dKSgLK55bs7OJBcO47bxR5ALGYeqIDWXZgVjoM3d +j26oZjTfmadrVxLENrDOA2z7uXEu/CyZ7+loLUGa7Ng0HXX1kGToU4lUQsHM4eEblHY aD5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741962808; x=1742567608; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=86CJK2fc0cAvOYyDOyHTA5kr0QOMsZ602Wh5UOHhaX0=; b=ABms8HxA3hx4jZuhqZWjtruW7Ponmddip5Ac4bL9RW7G58SBfoiNN/4FAqT5RA+rnG s9hojPbLJuHzLob9vwXfRSuLF0Nod3HIOEJhk3CHX5Fqwsgv2iH//kuNVr1X7Ops/3Ln 5ul7eWuNphYcZAxXuvMjmPjUhZHZE31haR/gxsX0Wpp9w3Z4jIM9KEza1rckAt6OixOk YxYwBIWtBZhXqNbw1POVaVJuF8vCU58QbPaYvqu3LMXGTZ922xUeWZsObtJpbU+qJ8xA KJvwR04Bg88hsFk5ebpKUsvKM7QQikfhjSq+AcQtLze5YPPY1v3McA5trfPi/U3lJVjt v2NQ== X-Forwarded-Encrypted: i=1; AJvYcCUw0so3vbx58KMElUWQno2QmcPrbOFigRwELnWrDvedZdEiuyqrbzzXpm1FcOgD54tJMAxZDjO6RvIAbT0=@vger.kernel.org X-Gm-Message-State: AOJu0YzyYwwz2Up3Nma+tJzPQGbJ85o+YeOv3EMTFypRelyPfiQ7DaJo xyOsmOOXYevARFncWJN97iz2rsaL9TCSXQSMXAL39V8bwuXbPPR3ppiWx9MxdSU= X-Gm-Gg: ASbGncuVZt2OqYipBOPrj4pz3JFWnm679i1L/N8PBjbAnhoqRaeR+x7te42D6GqoCOj 5zHs3540ZfxPeGVIIRsmJMVJg3m+l3qEMOolyFSNW121AZsFPaU4DUh1A1keriKDdcrZIlaREJh UMCBdHn6S2o0XuDjFQxGpeLd0b/H0M8vjarUmj2R2VQ/SGh6LrAwC+ZUl8H1GQ4H9f+kyi8W6aw JLUtaDhae1ohIHh+kg/yw2SMGKRSOGAG3PpFYadwMpKrryGTnZuo0+59oA2d+f90+LBCIzzOj8k BDiJiD87T+t8pqQlOFZ+XDqEzDfZhPUyEmLZ88z0qkMsLUb/S3V4E6pDAEhzFhSgMbWi9w== X-Google-Smtp-Source: AGHT+IHVs9aqh53jMw+jTNDbDhOzV9r2dswK8/QSdrxt12hvlpFw9Rs059AvnN5+zk17YnDOTrO2nA== X-Received: by 2002:a5d:47cf:0:b0:391:31c8:ba58 with SMTP id ffacd0b85a97d-3971d03ee20mr3210099f8f.10.1741962808009; Fri, 14 Mar 2025 07:33:28 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-395c82c2690sm5699168f8f.25.2025.03.14.07.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Mar 2025 07:33:26 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, krzysztof.kozlowski@linaro.org, linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dmitry.baryshkov@linaro.org, johan+linaro@kernel.org, Srinivas Kandagatla Subject: [PATCH v4 4/5] ASoC: qdsp6: q6apm-dai: set 10 ms period and buffer alignment. Date: Fri, 14 Mar 2025 14:32:19 +0000 Message-Id: <20250314143220.6215-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250314143220.6215-1-srinivas.kandagatla@linaro.org> References: <20250314143220.6215-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Srinivas Kandagatla DSP expects the periods to be aligned to fragment sizes, currently setting up to hw constriants on periods bytes is not going to work correctly as we can endup with periods sizes aligned to 32 bytes however not aligned to fragment size. Update the constriants to use fragment size, and also set at step of 10ms for period size to accommodate DSP requirements of 10ms latency. Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support") Signed-off-by: Srinivas Kandagatla Tested-by: Johan Hovold --- sound/soc/qcom/qdsp6/q6apm-dai.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-= dai.c index 90cb24947f31..a636f9280645 100644 --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -231,7 +231,6 @@ static int q6apm_dai_prepare(struct snd_soc_component *= component, cfg.bit_width =3D prtd->bits_per_sample; cfg.fmt =3D SND_AUDIOCODEC_PCM; audioreach_set_default_channel_mapping(cfg.channel_map, runtime->channels= ); - if (prtd->state) { /* clear the previous setup if any */ q6apm_graph_stop(prtd->graph); @@ -385,13 +384,14 @@ static int q6apm_dai_open(struct snd_soc_component *c= omponent, } } =20 - ret =3D snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_= BYTES, 32); + /* setup 10ms latency to accommodate DSP restrictions */ + ret =3D snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_= SIZE, 480); if (ret < 0) { dev_err(dev, "constraint for period bytes step ret =3D %d\n", ret); goto err; } =20 - ret =3D snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_= BYTES, 32); + ret =3D snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_= SIZE, 480); if (ret < 0) { dev_err(dev, "constraint for buffer bytes step ret =3D %d\n", ret); goto err; --=20 2.39.2 From nobody Wed Dec 17 20:48:52 2025 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25EF6200BB8 for ; Fri, 14 Mar 2025 14:33:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741962812; cv=none; b=CkvJwURd/IzDQX/RLUayXSMc8jrTtYLqde/wFN8m662mZCJMlxvL7/lBDw/pd5fVM9OqY6tVpIb5n5nhom2M4rBgjDpi9u6uLG3dSWrngovPCzII5KDPzFqaHL5zTYuOj64PRZOUEvyPL8/QtMOr3fdHf/BFBfVf51z5QeEDwQ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741962812; c=relaxed/simple; bh=49SQFDPVrfSgd5vzQ59y3EoTLS1r9SAAvEbV2EPsJ2Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UlgSzZ2t5I7wbO86O+MpJyo2iPmwZNFxp9JMJC6WIkam9MmhTxZ4z4KW2a15S4Zog6d4yutQH656Q+SollnBRvvbpvqmOt+B9lzxlM73932XwnAoc4f/G5ijAqra4Kraim0tYkO+I/hrTjxe/wRtu42+pXFOJOw2BmcmW0DnDLM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=rzc3tv3K; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rzc3tv3K" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-39149bccb69so1966057f8f.2 for ; Fri, 14 Mar 2025 07:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741962809; x=1742567609; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BmrpnnLM0D4kCXujXrwrPhEB5OgiMQcaOkuo+01fN7M=; b=rzc3tv3Kd0ou7jNF7JWL+FlHnqVTYsD4DERINfn7Y7TPYu81vwaJ4gydWITQiL8Let pvI0/ihYKeViKibewSdmS37Vvsjtxx2lapsfoqUi+Cd6gMLPL5UAT5ZXPSarezmuvstH CI+8+/GuUsL4yoQr5PlpSsS8mZl0d06+9H+LfE0ikYeqYihUMqFxwa6LcYRnJ1x+Ss6x lQHNTWHP88aGohRijSwAPe5DZETw8BbeTpaDrI3icP9nziG5+AVwN68J2yJBrHPWuzUK iQsEsnmjLVVPMzok406CjcHssduRztpP9eUp+D2AA6ap6ZpsRvMkKmKVqVoZiF+vzj4I 4/bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741962809; x=1742567609; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BmrpnnLM0D4kCXujXrwrPhEB5OgiMQcaOkuo+01fN7M=; b=Ll+SCqwHNw6gWGV1xEfPPm8tLTEoMUlsClTv8lM80nLjBnLsjGU6kUsgNGxF/m+fvT IJyHeaOZMl7tSTApk9KM87yXcRnYa4x+BXqYGYAIyQn3ar/+THR1huYMVXbfOGABxsgD /m6nQsnonYtdw1mYii4jpa9hPVnRBTPoTjGTSSJsoZ2DArbfD7CeJ6PMlvK7cEu5Kyju 411o2UvDX8+fkdUkW2yg4vUUALE4aBm1epg3AmjQy90M3Xx8GSM7YNd/r4rGabUxv9Fm uQGPjaS/3ynwYpSAioh0EgcdG5/UAx/LJKF2s7bdIzbxQz0Ahzdd120AWLeqoCXoKLiL su5Q== X-Forwarded-Encrypted: i=1; AJvYcCVLYh0XMSJTNp76A0YzVJzFs6b6hNSahOH4dV6oy6LC2p8mxwNzGg4zY8FuuKrDaNLe4JPFNJ3V/GcgFUI=@vger.kernel.org X-Gm-Message-State: AOJu0YykJpaHhEFGDjFQvHg9XvbSg6nBVTpLctXOhqfNyJOua+mLImqY exox3HlxD2MBHVOCYJIw55wCXSennDLdwHd2nqc9kZGIxRRJDlzOBLRp/O/es0Y= X-Gm-Gg: ASbGnctPMJ5ef63ifG9OBchfa+fd6FdxclwqwMd+qMn7tRR0AXRFSWzcEQ5PNURsyhH Fk5U3McX7SYARw0UavfgybABaX8UMQfqGZqgBtrqdZn1p3hqBnA6U07a7RxUeNClg4o4a04+eBr 5cQf4j0wL6vvnp2lvGgIEsAk2MQbBxdG04LOHgpSoSWsZgCr3l3YCndIJa8QOM/nlEZinWyaFOf 1eBbzwkXH5wXxcj0J1pFZgeK2/EPz73as2fdWJj++Y+joYSaQsuvZUUBH1y1NkZd5KBchZGuCbo WOyUxyBDa/H2W6HeyY8EVAmoisQCSNArthbhduv7C16g14DKtudvAuu0BOus5eHRXeZsWA== X-Google-Smtp-Source: AGHT+IHv9cZ7VMEGzbxjDU272hTTPtgC2UDh1G+FUstyJcGJxM6GpRj97dHRlcSdi5ciiW0phluAww== X-Received: by 2002:a5d:64a1:0:b0:390:e8e4:7e3e with SMTP id ffacd0b85a97d-3971cd573fbmr3738351f8f.6.1741962809334; Fri, 14 Mar 2025 07:33:29 -0700 (PDT) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-395c82c2690sm5699168f8f.25.2025.03.14.07.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Mar 2025 07:33:28 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, krzysztof.kozlowski@linaro.org, linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dmitry.baryshkov@linaro.org, johan+linaro@kernel.org, Srinivas Kandagatla Subject: [PATCH v4 5/5] ASoC: qdsp6: q6apm-dai: fix capture pipeline overruns. Date: Fri, 14 Mar 2025 14:32:20 +0000 Message-Id: <20250314143220.6215-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250314143220.6215-1-srinivas.kandagatla@linaro.org> References: <20250314143220.6215-1-srinivas.kandagatla@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Srinivas Kandagatla Period sizes less than 6k for capture path triggers overruns in the dsp capture pipeline. Change the period size and number of periods to value which DSP is happy wi= th. Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support") Signed-off-by: Srinivas Kandagatla Tested-by: Krzysztof Kozlowski Tested-by: Johan Hovold --- sound/soc/qcom/qdsp6/q6apm-dai.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-= dai.c index a636f9280645..292cab61831c 100644 --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -24,8 +24,8 @@ #define PLAYBACK_MIN_PERIOD_SIZE 128 #define CAPTURE_MIN_NUM_PERIODS 2 #define CAPTURE_MAX_NUM_PERIODS 8 -#define CAPTURE_MAX_PERIOD_SIZE 4096 -#define CAPTURE_MIN_PERIOD_SIZE 320 +#define CAPTURE_MAX_PERIOD_SIZE 65536 +#define CAPTURE_MIN_PERIOD_SIZE 6144 #define BUFFER_BYTES_MAX (PLAYBACK_MAX_NUM_PERIODS * PLAYBACK_MAX_PERIOD_S= IZE) #define BUFFER_BYTES_MIN (PLAYBACK_MIN_NUM_PERIODS * PLAYBACK_MIN_PERIOD_S= IZE) #define COMPR_PLAYBACK_MAX_FRAGMENT_SIZE (128 * 1024) --=20 2.39.2