From nobody Sun Feb 8 22:39:50 2026 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 E67631FFC6C for ; Thu, 20 Feb 2025 16:29:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740068965; cv=none; b=fg/vJnqtLcfaBpOBQAUomFn/TiK4+uNa+a5LF4wZvRdwMfXYJJm4ZC4duAMI+TKeTtUMGeespzITDBY0O8ArzFqdRuprP6auKZbZvytZ2qvkRjRdBK0GBn+8BS45NcxaTwwdDaaL7s4w9+0+2xjgNGmi1SxkeohLeh9SwN01yrE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740068965; c=relaxed/simple; bh=KxZTxc4fxRw7OMyGGA5HOYd9rCClNlteupN9ItslzT8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=t62p+URaJMIWeqJFM0Mbo6fv3Gu517XjDCTErH1WP1KqpVzo6eVtC+IddaR6ACZ1JkmmJE++91u00WlqdF0p9y52jAguWqndjreujU+Gq502XF5jOluNiYuthVGo/VfyZi3CCnKOGxP6wa8Y0wFvRk9gi2+h/mkVqJ8e79TI4xg= 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=qNoIsMas; arc=none smtp.client-ip=209.85.221.52 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="qNoIsMas" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-38f29a1a93bso973448f8f.1 for ; Thu, 20 Feb 2025 08:29:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1740068962; x=1740673762; 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=xe1FIG0EUV5vtEiip0bMJp8pcyFVOy9gW9Da1yY8B3U=; b=qNoIsMas+gv+WiFlcDibu9VvIfGI5+xGsSynwJ2esMJlNBuWtmvlH1VfpLsa65IePJ 7H4RULnC4Kk4paev3IEV07W738cDLenZO3kAxAe0ls9hwnZ9jS3yf5rFvGFa8jYCpruR rRtmcuJ+71snKr2dvjDMhqj9W+Ifm+MC8wmPDAc1/YdaylvvKF/fGIWdSaoWXtV0uAHt Zbe1YL8yK5Q1nESMwEEuFsVibcwe8ufyuKBGQvwfOvmmz3U+CfbJYwEdS1f/CWfmqMQY 7crhOIXdZtuiIMmXrU3vjiXN7m4Rxln/Lr32G5xW6UchnCXzhZ2fOPninufdycYZcWI9 x+jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740068962; x=1740673762; 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=xe1FIG0EUV5vtEiip0bMJp8pcyFVOy9gW9Da1yY8B3U=; b=XqRoCvN6ZY8W/AGtmkCW/NtP91/sVme8Za7AqFFavWLNu9eVsxqyCVJvm6y7wC9RVU Ztfwy1o+9dwVpj5+mqgo4rNjolSWnvbZrV4iskCMDBycEbZCUBnNGI0mJtyFK0AYAjgW jkuWhIYfN8oyM0Wq7vcOHOPVOmD1NYeGGyAoDpiETJzVQ5FiNug3V42PVtFsaisVin6Y a3Yf9yZaELEEovqNkBb872+xix/8fhzTWopjQYar5EANwje9AjaOmHyL2a+qQC8h34hB zc6n86mjrHvzm7TLQm8crAW+1Vj5hjM1Gb0ACNOozpp4NmvoET3CF1eaLkAAXqutH9Ir O3oQ== X-Forwarded-Encrypted: i=1; AJvYcCVCJ9B2KiZyOFWGLQXhv5L+1JC8JJyfYa55SvZXubA/WhHxvgGOK1aDvwj9voT4HIzo17gP+T+3iUt4oNs=@vger.kernel.org X-Gm-Message-State: AOJu0YxU3/9McogLvW8DZ1Kw/EcGrWWAoy8PTlwX1AQYwMkRONwiUhdG EV65kua0bL07vORmABlgxT0N10cWiYLj+c0P6PbsN0KMqxiwB48PLhRe6DSJhLM= X-Gm-Gg: ASbGncsZqvxNhGVb4CkBk6sBcxWyMTK+7mLq6+wy3WdBOhUyfLcE3HLAuviATqjy9ar 2BBr0t7DQNwaE87ZRlZF8L4M4GJ/1Qj9P8AmMpxURwhh6IztC1FjFqm8hRlzdQlkYBaP3WRJC/q aUffZbh0mGWVu7eCmBu9QLfQjE9L07SaA8lovQlQjxc1Ci9FqB2kUmxJoqv/LAlEdm28nGG32ZB Phqk8bd+xTvN989p3Sejkq5zePWhxKVgQhP7/0U0flJ3RUwtFxxyPYlnYJWps2VcL09wUQvSX1l mzc3WE2ZQ9Se6eroYsV82Mj+axLyrQX33rzuSzVk X-Google-Smtp-Source: AGHT+IFeFUNS6+fpxgZcJiw03GQfFy8Cu2R2NlAoQdwczmUQmL/WjMlMRJlHB4Ht882oa1KtvLVMLA== X-Received: by 2002:a05:6000:1866:b0:38d:d223:f8e6 with SMTP id ffacd0b85a97d-38f585ea6cfmr7098326f8f.0.1740068962219; Thu, 20 Feb 2025 08:29:22 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f258f5fabsm20813753f8f.45.2025.02.20.08.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2025 08:29:21 -0800 (PST) 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 v2 1/5] ASoC: q6apm-dai: schedule all available frames to avoid dsp under-runs Date: Thu, 20 Feb 2025 16:28:43 +0000 Message-Id: <20250220162847.11994-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250220162847.11994-1-srinivas.kandagatla@linaro.org> References: <20250220162847.11994-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: Johan Hovold --- sound/soc/qcom/qdsp6/q6apm-dai.c | 33 +++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-= dai.c index c9404b5934c7..eba51e88a297 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; + unsigned int pb_tail; 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,31 @@ 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_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime =3D substream->runtime; + struct q6apm_dai_rtd *prtd =3D runtime->private_data; + unsigned int tail; + int i, ret =3D 0, avail_periods; + + tail =3D runtime->control->appl_ptr/runtime->period_size; + + if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK) { + avail_periods =3D tail - prtd->pb_tail; + for (i =3D 0; i < avail_periods; i++) { + ret =3D q6apm_write_async(prtd->graph, prtd->pcm_count, 0, 0, 0); + if (ret < 0) { + dev_err(component->dev, "Error queuing playback buffer %d\n", ret); + return ret; + } + prtd->pb_tail++; + } + } + + return ret; +} + static int q6apm_dai_trigger(struct snd_soc_component *component, struct snd_pcm_substream *substream, int cmd) { @@ -305,13 +329,11 @@ 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 */ prtd->state =3D Q6APM_STREAM_STOPPED; + prtd->pb_tail =3D 0; break; case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: @@ -836,6 +858,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.5 From nobody Sun Feb 8 22:39:50 2026 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.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 50CED20B211 for ; Thu, 20 Feb 2025 16:29:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740068967; cv=none; b=JN2cfZPv55hMcte7Y5CgA+cDjPNPyvIrrxuN21g1DUfd/tWIfSRyGylm4Zl9DqGP/bDwByigUKEi6dPAmD215UlgjFbGtWC/ksPMGGvzcUG19UHoDAZvUcwcYC+HbzWqPhclqBB3Qe+fND7kan1cxdS/KatN9cGQ5RZQikkoTV8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740068967; c=relaxed/simple; bh=jtgmyAUl97OttcegIr//hFBjAziiMMMYiBD7pE3sZEI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PMB7a0feiIF5YBgc2RUoisNHxQ0+GnXzfqRUm3nfiYjgaBZ0NQsMQwUyK3UJxc+84Ar1UBKGstcwqcMqwQfbCLOZjtfZgjnSlRFqoveorAY8peAqgkXgkkJV03luAYP6fZuNSK99iwGtxfjEwXArGWRz7PXUEKkTFqNx0N24V1I= 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=GMVOe6X+; arc=none smtp.client-ip=209.85.128.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="GMVOe6X+" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4398e839cd4so13872595e9.0 for ; Thu, 20 Feb 2025 08:29:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1740068963; x=1740673763; 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=uMzT+jdHxkf1ujL8A9tZIPDjBjm8GU3C3qT78yn8Ois=; b=GMVOe6X+ksfb2KYw3ulfKjCkKKED2gn/IKcnwOz228HCTzUSw0kU9an9K76kl3UD8Q pva4IsqFLhIahIgFBi2wvBWy9L38D6CT+jLH+Jfyb3cZ96Wu+H2vgZYn0/hYtkAdzvPy zj7vMolV2mYQJdEhremHjCgUgtmBgX7nO7KxAjIldqMDw5vDvdLYB6mbbs192tTQYvQv fr6k90811m8dPN21Lzce46Hj5t8T8oWNjotBNHwQrCnceLmqSNLiTEIx+4qfr1NIuONI L8amp1/tyfHQSjNMAe+zQU1pcUU4Nd0dJHPKRGwLF/gzJ9vVrLaq87G0pGhFsnkTaHBR iM9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740068963; x=1740673763; 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=uMzT+jdHxkf1ujL8A9tZIPDjBjm8GU3C3qT78yn8Ois=; b=A7sKQmz9agFjRp7SHmhOjgdOAe51lkbYmUUdc3F7VkEG0FL1NbFUpOC6cNFRqV0ZYg SqKXD70ES8X7OVD91tJWweXNHgbxockkbUvaAZLsJYDGa2ACKmfje1vxs1Lh9j3zVpC1 GNamkCzJyEh00+fOaFhOE1JF25QQR4IOD3WzpRNEqjXAtXxG/5HxmN5vWKts4e3a2Jq7 dGRgiX74ctuhPXPBOD2wpE21HBnZpT8o7gzPCWF8fugFWRYmYbPCZbL2s8oGy6piy/8K C3Pu5lsJbcg6A72GCNaM2jpVTsSsF/i6kx6VKg3sZRHjRp0s+Ij/0/SIYg/vWEpkY0nE A9fg== X-Forwarded-Encrypted: i=1; AJvYcCXDqwhA+RZTTcThYgXCJQ1NfjCoqg1VtHtXrenyL+6hij2IcAMcigd0PEcHWEmrZpD4sf61X6UM5sy/gZE=@vger.kernel.org X-Gm-Message-State: AOJu0YwMsT8TE6f7LQM+bb1iHWQv4qqW0/kmvTDjaqWrz9qut7jPzTyP YPRvzESCQhONiwebicMw0K9WS/XRk0UxpOM1Wp0pjtyr/CyZliq73nqSrgl3SkY= X-Gm-Gg: ASbGnctoZXeojwboeDny2F2lx1DRxi7IIahDMB6HYFupwA1Iv9FgnDCCPNynh0p+GBC sWa5i2uvDcDRVF77rGDtkoomcrZrjQbuzEHl0B37N6Kd7P/quBPP0wFXPo0yhB3J/pjcq/gqm53 jzOFR0C4lKm/srLJ0ehRByY8EvOZYPyKFZ6K/a4Zp93/7X10kGI4iFYN0GYkWSyJLO9/Lf5jZ4I mBp+RHQtvsMoTBwisTggQEs4Wtd4oxxKqwE5yTAwV6A/Ocu3bCEsfvo4Ppf+stPkIU/LwVwRUkh BOByz/PViGslejriOWgT5fZ0aupRNaPoJuYqfJZk X-Google-Smtp-Source: AGHT+IFEwnzc4gMpLn2JhX4tSeUOi2UNl4o8mWNSCnBzMlPANfjpmZejT80sXvTiQRWgRNzSUA2rHg== X-Received: by 2002:a5d:4f0d:0:b0:38d:fede:54f8 with SMTP id ffacd0b85a97d-38f615d2048mr3025832f8f.16.1740068963497; Thu, 20 Feb 2025 08:29:23 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f258f5fabsm20813753f8f.45.2025.02.20.08.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2025 08:29:22 -0800 (PST) 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 v2 2/5] ASoC: q6apm: add q6apm_get_hw_pointer helper Date: Thu, 20 Feb 2025 16:28:44 +0000 Message-Id: <20250220162847.11994-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250220162847.11994-1-srinivas.kandagatla@linaro.org> References: <20250220162847.11994-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. Signed-off-by: Srinivas Kandagatla 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.5 From nobody Sun Feb 8 22:39:50 2026 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 E894420DD45 for ; Thu, 20 Feb 2025 16:29:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740068969; cv=none; b=J355JcZijy3/EO6Og+0fmWYvXEptf94Ca1uRDX017fYsKEMod+i6ZSEMi+qIkr4ICsCH7IR5anbYkv3021HuvJ/6QM6yLMGoHMn1c5GEN/TSZ4pik3cdEChrz786Tz1kY6pqwwwXXl9mc/7gro8bkZNUKm0XHgeYsjwN9xvLRbU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740068969; c=relaxed/simple; bh=Dr8Rk5o8L7NeOZgA3IT4ksHpO16HjBDqWkL7REEjaPg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=b1nTjPgUgmNpJbfEs0fL1m3kFi8nQazYC3IZT2p9jpm5eqxzr8i2N+GSxl442jTdI4PGPAYWpPVQgpXQySOUidcKcwImGvFdYCSRVkU/sT+25vsYy5FqYy1oiqTqR6v/VgCkhmFdGYI/vGM7oZFa7WLDFrZVB/qTpa8QkO1DxjQ= 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=DNWw/fR9; arc=none smtp.client-ip=209.85.221.47 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="DNWw/fR9" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-38f2b7ce2f3so916295f8f.0 for ; Thu, 20 Feb 2025 08:29:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1740068965; x=1740673765; 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=wWH0fM1NieugYkKcNBWP1cXDL8AX1zdkriiAZTiM3tI=; b=DNWw/fR9h7YMhL+7ngqVD5BHacs5CcUYj2W4UrzJHYdPugU8YEElWgIHNKVzmtNn41 kTA9KLkP4LA7wRY1frSI1O3Q4qAwVvl4orM9fdjZG83hk0lQz64a9xG7MnklpHoXrhuD nnEbs6YmtMEYp8+GWYQCJAtAEjS/isHpvcCpxsKDHrnb7+gJV1g+o3yvPsM/GYna+Iuu DpMX+dj2QU+jvKDshaWTu9P51dhtbs8ijStVrH1ihcavm1VYKJG/sTV7zJEUyAzj35rh P8QOSQuRUkgeNYzgL7Nue0D6sT99oCRfI2rpWsmW3Zrrg/odAXTw58AF1d0u+XfRcd9T mFwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740068965; x=1740673765; 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=wWH0fM1NieugYkKcNBWP1cXDL8AX1zdkriiAZTiM3tI=; b=lQKa0epfAVJpirCfuUIUH6pEvlkbx0dMgGNmXTDVVD+GADftMnhbimvuxolUpYnP1d 9NlFtRXH3gGcGdtZcb4RrPB00HaNTzEbzUE0x51zGH7YoQc4CErSYfW7jN7xu7HdmGeb FOzUsPxsRLAI41gi7Lh1VbZz6onuhmgRBJZWZu7tX2GuM6wRS1nkDmfPMqllnN3dCXHl 0/inbeo792p8eteyKIzTzF2wqZKb1W4Aujhw7alFPvA3gEQ5sN9+w6BT7lTEFNitN5uK haklB5ekvAHmSN8Sj2Oxo3xxHZHAD56pTpnCtnGG7ymttteRiBnWM7Bv4O0Zah/TsYcR Peag== X-Forwarded-Encrypted: i=1; AJvYcCWbeNOQ1uNwLxuLdLe7HJgDdbaI0NfEvtlbDBiXTFeMWpcouf45rYHesnBbyYQjstBP14ILU/qbiu9CZ+M=@vger.kernel.org X-Gm-Message-State: AOJu0Yz8+ewI13q+RyA2r+XlUC+SJP1r6WtZ2MGiYpWFam2wYGllGrrN CRkkgB+OLK7A09ujLqvfuOhxhmNdm7A7NzBcXzgfP+C0hgLhiPYjv+MyXlYbhzk= X-Gm-Gg: ASbGncunIN5BPzo1wUNfOvARN9Yz6cjwZVvAFPqUqYDwdtsk4layIBmdgy67ERJXoVM pqcHau2KORWmukT/pALipqig+f8FjaXY85MtjuM9xGL3Mv9Ncen49hPgRMznpTUtV1S5BsDkksF UumDb4u2xUMFAGBRcU1nrlH7N1VlpUnmgzAmzacKGvfq3DNEN45B1ohsQbCy9YmaPQuba++CxZd AvSG4qNNejl/wtH+cFIBAR8b04HkfzPvVdPNNPSmMuEF3YEiEZRPh9TjPoH6S7Vf31S/AHvVuC3 0oAeOqnVhY36atvox8dULFYUZgtSRAYWdZ4XmtoD X-Google-Smtp-Source: AGHT+IHdOwtU9xb0WEouusC4CcaJUMhnzC1yLBW1Y1gMidwn7Gg10mbC9aK40VRIc2odT8xSgLfmSw== X-Received: by 2002:a5d:4641:0:b0:38d:e304:7470 with SMTP id ffacd0b85a97d-38f33f44f3emr20248336f8f.25.1740068965221; Thu, 20 Feb 2025 08:29:25 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f258f5fabsm20813753f8f.45.2025.02.20.08.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2025 08:29:23 -0800 (PST) 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 v2 3/5] ASoC: q6apm-dai: make use of q6apm_get_hw_pointer Date: Thu, 20 Feb 2025 16:28:45 +0000 Message-Id: <20250220162847.11994-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250220162847.11994-1-srinivas.kandagatla@linaro.org> References: <20250220162847.11994-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 Signed-off-by: Srinivas Kandagatla 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 eba51e88a297..7466fe0c661a 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) { @@ -450,16 +441,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, @@ -674,8 +661,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.5 From nobody Sun Feb 8 22:39:50 2026 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 B0AC0212B14 for ; Thu, 20 Feb 2025 16:29:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740068970; cv=none; b=J2tkBWKxD4QEhuqyF37+UWhH0oBuGeZwaxV3qzyzgwFEmiIY1MqpmJ7LbKA9o+Lo8dtW0eAvZuhT97dGTLzKzqXK/OvpjzkLYrdT2k7aIVBzx+oy9Najw2KuLF2hciQkoBsKJPR9oJsMwSym0Dd70MA392a5IU9pttSo3xJ3zCw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740068970; c=relaxed/simple; bh=/VfHNWugQzZOouS7hKpPuUUlotDhboVqpoBQsz75KJI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Air8OE04yyt9uJeBeH2akCfN75qYSKFFa5xmB8rppLmXBGWFRxSwuFGsif10t8POl8QCYN7OD6ZG1g2gpsrNaM6sRHeKwkDvq6e8kV2lWdwesw7bXq7YD6AF3IpOFXC5ElGuQ7aV/PNDh7CEhl47PuteVqN8zW0xFhbSLAypOrU= 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=n5mN0vFR; arc=none smtp.client-ip=209.85.221.49 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="n5mN0vFR" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-38f2b7ce2f3so916331f8f.0 for ; Thu, 20 Feb 2025 08:29:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1740068967; x=1740673767; 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=kNs8W2h+NxjkcVzoJNbEyvvCSIIo8azfvztr8o7DSmU=; b=n5mN0vFR1IPe65oQy+wbhA8osJ7mkeTeTJNjdDqudAuPm0weqIAeqMdiHBajOO5MVw BkJjvqaJeoDf7/zHNNLBzavmWK0x/uk+aB7vvoFr/TFssJLg0eYd6I4aRD9SO5xGmrKy LAumR0Q9NgNst1iJckuJLQj2jG1ckbcn7IyXXQG1ZBbujCN3g8er2BcHJog7tXAjI5tq c0Do7BFknFGODU2dp6+ObO8PE0HFD1xeJHQEA+lj/HNZJW2TkcILX6voJkE+nIOY5wxo wvzma5b4pTErJhKIAIRTo9NqZ368DWp67wCQL9/C9PhNLoQ3xmu5wMa2DY8Qbn5rq2Ap c63g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740068967; x=1740673767; 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=kNs8W2h+NxjkcVzoJNbEyvvCSIIo8azfvztr8o7DSmU=; b=BVelCvhAXXxh6C4nggt1o2t3/4CENFus1yT9GYDRAxFixKXMXSUn/66I6s4Z1dH1hq BufWibGTKIDVo1C5jHC7HGHWmT33/zRVihEFr7rLK3dmOWTTMFSGVx+riX33GiMQjcAR 7Yv7GBWRnxdUi3951UiaqgQIaBUmstyagaHQJKJw0PgwAybFdhezIZ/UBcTNnCpQcM2y R1XYunQe1IO+S4hUq/52MIsypSlnigDdcyfcITGz8zcDvrBCBNM6V1Wtfzn0mmWWb7wT ALIkyz8faQh1s5ni+nMC80P4N+XgmSG0lFPO4Q2i7RA98gdUi/HsgHfoVt1+/RCMEwye F0PQ== X-Forwarded-Encrypted: i=1; AJvYcCURSn1ChPG5efpgsuvZDQlOMDebun4NDSmE4S7cCTZL127UxBId9VCcsWrUEp/TbGRlulTJD2tEDQRYSXI=@vger.kernel.org X-Gm-Message-State: AOJu0Yyo4lplBDk2zeqJU51OqL+wa/6KAduwuU1gguiNpWUStn40Jmwn 9pCfn/Sp0rGbLazPQDsO+lOkTlaHX2e5th6PR+DngHxM1OBWlCDvQlEJGrNKYm4= X-Gm-Gg: ASbGncvJFMV86MUkSXYq8en+vszJ9qVLyy2EcxAKUXpjNJ0gnipeJhMS4ZsGN65UeAh KpFxgtR3umLaR3XUfOdvT7szv5ZuW5IdQOrzx9BodJbvbdLJ59PtZEBQmHIB5A43QMc9mzs4uMM XDa3j0w8ftxUt74ilc940K+0L4K0oxt4aMihAnYvh14gBhaEn/nOyU5of2i2dxHiRAye7Yy7EXN gj9GomZ6VMTwh55Ko8lSBpV2sBj28pBH4N4gIyP5ykdmGaFJdMtGUC4YHojrQpxRPe05n52ouws wwFN1cLPFfMFfC+DMsXBkGTEw9YtwC/V8fp5lYBQ X-Google-Smtp-Source: AGHT+IHjLSNxeifF/38VMi7dEG8R8mOoiltOqfkJG6DXGhVBYkNfwPD9ab3HxUNuKUZ0XFxpl43IYA== X-Received: by 2002:adf:f3cb:0:b0:38f:2a7f:b6cd with SMTP id ffacd0b85a97d-38f33f3dba5mr15018331f8f.20.1740068966979; Thu, 20 Feb 2025 08:29:26 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f258f5fabsm20813753f8f.45.2025.02.20.08.29.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2025 08:29:25 -0800 (PST) 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 v2 4/5] ASoC: qdsp6: q6apm-dai: set correct period size Date: Thu, 20 Feb 2025 16:28:46 +0000 Message-Id: <20250220162847.11994-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250220162847.11994-1-srinivas.kandagatla@linaro.org> References: <20250220162847.11994-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 For some reason we ended up with a period size which is less than 1ms, DSP does not support such a small fragment size. Adjust this to be in the range of 16ms to 32ms. Signed-off-by: Srinivas Kandagatla Tested-by: Johan Hovold --- sound/soc/qcom/qdsp6/q6apm-dai.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-= dai.c index 7466fe0c661a..049b91fd7a23 100644 --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -21,11 +21,11 @@ #define PLAYBACK_MIN_NUM_PERIODS 2 #define PLAYBACK_MAX_NUM_PERIODS 8 #define PLAYBACK_MAX_PERIOD_SIZE 65536 -#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 PLAYBACK_MIN_PERIOD_SIZE 6144 +#define CAPTURE_MIN_NUM_PERIODS PLAYBACK_MIN_NUM_PERIODS +#define CAPTURE_MAX_NUM_PERIODS PLAYBACK_MAX_NUM_PERIODS +#define CAPTURE_MAX_PERIOD_SIZE PLAYBACK_MAX_PERIOD_SIZE +#define CAPTURE_MIN_PERIOD_SIZE PLAYBACK_MIN_PERIOD_SIZE #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.5 From nobody Sun Feb 8 22:39:50 2026 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 59FA8212FBF for ; Thu, 20 Feb 2025 16:29:30 +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=1740068972; cv=none; b=pyUc/dE+RHDbI1VxXAVyH8C8iIvBOaqnJS2PENvvMBFX8V/bBsXLDK41D6lmCJmrpM2TeAYMvR5vsuVkudzcnFgad0Yb2hzHsjM/rA/FQDlC0avEVFFTPv6AV236XYYuFGQoqp6cWakUnWpeoxNPIJLgO3777+F85sCm+KjJ+zw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740068972; c=relaxed/simple; bh=G44mzomd17zjRW176IaSow82CVHdPVhJq52qbX/krTc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F38bwPUnr5KczahMsiDwx2AfhRJCeluAEpld0NVbAOfVbZE+aox2WqgkE+kU4hPqMK2EA/mAFSwQ/jT7w7x1EMPbCfb+VwpeIgOWUsukcTXIodWXILAinL6adGQZIhAPmr9KTsvyWqwRWT1Um1PqFDFkatgDTrM6ndlqzq+pprs= 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=zE1N0M+m; 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="zE1N0M+m" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-38f504f087eso1050825f8f.1 for ; Thu, 20 Feb 2025 08:29:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1740068969; x=1740673769; 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=7m/CTzgrh0AA9xzhVYZwH6Z/AB9cMb21X+WgCPYE0r0=; b=zE1N0M+mcG6yeCVrShQIusxoURBJlTD5R/+EL5iJJCd42rO9aXh8QlISKn09oAZlS8 cfuZOZ46FL/dKy0jV2g1yq01U1RDQD/zt4t843n0+SdmkNtrT08e0aHKh7zGTPJtXwLX L1wJYAhc5cHI+csGZirsREJBWUDOSoGIhB/90u0PnS+w6Lubjz0TZ28u/3YncEB+r1aI ay9GT5GmWW5hhn6loUsx9pvBRrEyUzrA943X9GWhdrLgK3N6tGOQSaCT4lYNFY0XvCAR OaX98jS8UX0PYG0L/nvQLWfi0bU7lj//ommHFy9MpbMyjLJjCG85ifjpu0Ujr9UAgcEV wz8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740068969; x=1740673769; 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=7m/CTzgrh0AA9xzhVYZwH6Z/AB9cMb21X+WgCPYE0r0=; b=Q0NUhKE1/QeEqGwlT6T8W//uGvuCuEIS7TEHNC/uNVrzRgmlkTBHLR8xxufn0NuBtn qF+I8JQXQQuPaylr2ajklVNbi6OsB84yueD3UhQ0pmBzQXjpHtWgZDHJfvEiULh6HQeh v5ndiZ1lcEIH5p7aRG1MsL2Li5xHJr6gOsETbeYu9IMy3734uL5j3sr0DJoVaIinSzX1 F4jkdEdC/UnIHyBHnBeL5fNFN+nZ2epAaLwUztgwpizEwn50dZGzkzixaDExdfOtbU0I 8GbAzNalJLuv8LdPU2Qt9DnMkO6R1XO/CD3lMu/F3sB8xdVcM1iJHtjcjfskfLYKt7Ha k2iw== X-Forwarded-Encrypted: i=1; AJvYcCVuhxZXZ05BWgh3LkHu64RxVshRGSFj4FA4ENw5hK/5ZnHL0oH6jFY/74QTUnQZb4t5GLWdWssIemfoasc=@vger.kernel.org X-Gm-Message-State: AOJu0YwYMNjPw1TOcFN8IlcS0EOmWfz11J6rp4CfyY4f37qkFZAgbWT8 Zyu9GOAqN4ikakpOqQjeH6D2e10NvOwHTjzGL64PU3NfJFY1SvQ1pqGe7f2m8Pk= X-Gm-Gg: ASbGncu6I7/sM+i4G4Mxf13vb4xKkvmZM3htKDhHKkBddWyatzZ7rF1cwamKZ63rdH2 TCyyxF5xmIt9ntiQXbZhgrgbP+gGADUhRwDMkvYrwpnr3G5Lg992x1+9QIF9XzdtazB1d1kTXNW Nwt6mCFsTtDgwRzst/MOJ62pFkJROgVHPKKStDpxgh2skxJn+IsVUFcsTmTcMyPaVM06il1kM3m yRLJZO0kUA69cEIIisJr2TvHWlXmh5/2pWH/2PImm6pQJSOPQn2yG/xYLUzbEqaFexSBfv46NQx nsbrtiNzOaPqQb1qV/cmNbv1gKgcrq8RRWkAvPao X-Google-Smtp-Source: AGHT+IErNAEoXnEuPGcHDzaI4u+qesPWr2oJ8v0KPpx1eLR4SBNS7L5XLR9zDyZbvaRrA+qYm3ZYUA== X-Received: by 2002:adf:fa86:0:b0:38d:dffc:c144 with SMTP id ffacd0b85a97d-38f587e73a2mr5603019f8f.55.1740068968673; Thu, 20 Feb 2025 08:29:28 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f258f5fabsm20813753f8f.45.2025.02.20.08.29.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2025 08:29:27 -0800 (PST) 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 v2 5/5] ASoC: q6apm-dai: remove redundant hw_constraints setup Date: Thu, 20 Feb 2025 16:28:47 +0000 Message-Id: <20250220162847.11994-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250220162847.11994-1-srinivas.kandagatla@linaro.org> References: <20250220162847.11994-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 pcm core already does setup the hw_constraints from struct snd_pcm_hardware values, setting this in q6apm-dai is redundant. Remove the code that sets this. Signed-off-by: Srinivas Kandagatla Tested-by: Johan Hovold --- sound/soc/qcom/qdsp6/q6apm-dai.c | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-= dai.c index 049b91fd7a23..b644ce7d394b 100644 --- a/sound/soc/qcom/qdsp6/q6apm-dai.c +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c @@ -374,34 +374,6 @@ static int q6apm_dai_open(struct snd_soc_component *co= mponent, else if (substream->stream =3D=3D SNDRV_PCM_STREAM_CAPTURE) runtime->hw =3D q6apm_dai_hardware_capture; =20 - /* Ensure that buffer size is a multiple of period size */ - ret =3D snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS= ); - if (ret < 0) { - dev_err(dev, "snd_pcm_hw_constraint_integer failed\n"); - goto err; - } - - if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK) { - ret =3D snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_= BYTES, - BUFFER_BYTES_MIN, BUFFER_BYTES_MAX); - if (ret < 0) { - dev_err(dev, "constraint for buffer bytes min max ret =3D %d\n", ret); - goto err; - } - } - - ret =3D snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_= BYTES, 32); - if (ret < 0) { - dev_err(dev, "constraint for period bytes step ret =3D %d\n", ret); - goto err; - } - - ret =3D snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_= BYTES, 32); - if (ret < 0) { - dev_err(dev, "constraint for buffer bytes step ret =3D %d\n", ret); - goto err; - } - runtime->private_data =3D prtd; runtime->dma_bytes =3D BUFFER_BYTES_MAX; if (pdata->sid < 0) --=20 2.39.5