Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3279129rdb; Wed, 27 Dec 2023 02:09:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHs3tzc3Xr92zlRQV/AuNPhtgz/oEvas8CW/7/fDHyHAJVitwuL4jtXZEeWraRF4XL9SnEt X-Received: by 2002:a17:902:fe0c:b0:1d0:a720:1fbc with SMTP id g12-20020a170902fe0c00b001d0a7201fbcmr9496771plj.102.1703671792358; Wed, 27 Dec 2023 02:09:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703671792; cv=none; d=google.com; s=arc-20160816; b=eOEdBZNCeDkdXa0UYwlFOdnO2R8MrsEzp/KiB2s7KCzk7hEYXZD3c4Ra+xOHy7VZG2 xMVl7OlHV8xQ3toPoHVeSnf/J086B1F92P3vJkgxo49qXKrcJGKdTWOBSEgt80AK3MuL 5Gfw98Ddqb4dZwfWhCcq6WI/lzFHkU/vSe9m3/CiF5U8muLsmVRv1vcLn2fLmkOJvoda KQiB1dPJ7ZmrnEE0Ni9qGyjjKD1oY1kYxdHQICg4zk13ASuMl4TULfZ4oYyHmxAFFwMu iiZxfuExZ3tvdnwVXUFES9KwI4qELME2PeoWatzD335alh0RGN9/bsrQLvy+wOL4YE5o 4dHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:to:from; bh=XzFSWyfckC8lO5B6qNY5XUinIh/l40r9WB1qFdC9pR0=; fh=CRZ0oPJiR8QqpzeFZMPJlYBnh/I5QRR41BKbxUyaY8o=; b=ORAG2m0XhknSIpIlbmqzoW0O5Sgag5DtvhlnauHosLYVYIb4fTFsAIQzJYiL2Xtw3B aVII4tq5QcPQBDsx77emrIU9wBiCQRKIzbd+26epqL1/nkA8KeJNYees7IIVbozD+xeT 8ipe/LJMNT4SUWQfG1KD2cbw0gUq8KArizl2uojPhfQkGdw4w5pIB1VnSbCsrTLO/Ghl cWUNFhmNZzpiccbRe/2ajxREz1XIjesCUYZCWZJw2kG+6RDAhRP8Vln6SUz1VWRsf3Jr +/vWJVXSomoVorixGhAgDk41dhc4BiShRUIjqMls4hGJaAwM+LHzC5OBVxx/JA8Z7qvV XgjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-11947-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11947-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id r2-20020a170902be0200b001d4208ea8a6si8366492pls.169.2023.12.27.02.09.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 02:09:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11947-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-11947-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11947-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EEEFC282858 for ; Wed, 27 Dec 2023 10:09:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A9A4A2C87A; Wed, 27 Dec 2023 10:09:46 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E1552C688; Wed, 27 Dec 2023 10:09:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 7350E1A0FC8; Wed, 27 Dec 2023 11:09:37 +0100 (CET) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 39E1B1A06E1; Wed, 27 Dec 2023 11:09:37 +0100 (CET) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 72BF4181D0E5; Wed, 27 Dec 2023 18:09:35 +0800 (+08) From: Shengjiu Wang To: pierre-louis.bossart@linux.intel.com, lgirdwood@gmail.com, peter.ujfalusi@linux.intel.com, yung-chuan.liao@linux.intel.com, ranjani.sridharan@linux.intel.com, daniel.baluta@nxp.com, kai.vehmanen@linux.intel.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, sound-open-firmware@alsa-project.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, shengjiu.wang@gmail.com Subject: [PATCH] ASoC: SOF: imx: Add SNDRV_PCM_INFO_BATCH flag Date: Wed, 27 Dec 2023 17:27:43 +0800 Message-Id: <1703669263-13832-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The sof imx pcm device is a device which should support double buffering. Found this issue with pipewire. When there is no SNDRV_PCM_INFO_BATCH flag in driver, the pipewire will set headroom to be zero, and because sof pcm device don't support residue report, when the latency setting is small, the "delay" always larger than "target" in alsa-pcm.c, that reading next period data is not scheduled on time. With SNDRV_PCM_INFO_BATCH flag in driver, the pipewire will select a smaller period size for device, then the task of reading next period data will be scheduled on time. Signed-off-by: Shengjiu Wang --- sound/soc/sof/imx/imx8.c | 1 + sound/soc/sof/imx/imx8m.c | 1 + sound/soc/sof/imx/imx8ulp.c | 1 + 3 files changed, 3 insertions(+) diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c index 170740bce839..d777e70250ef 100644 --- a/sound/soc/sof/imx/imx8.c +++ b/sound/soc/sof/imx/imx8.c @@ -603,6 +603,7 @@ static struct snd_sof_dsp_ops sof_imx8x_ops = { SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_PAUSE | + SNDRV_PCM_INFO_BATCH | SNDRV_PCM_INFO_NO_PERIOD_WAKEUP }; diff --git a/sound/soc/sof/imx/imx8m.c b/sound/soc/sof/imx/imx8m.c index f088fd1a672b..1b976fa500aa 100644 --- a/sound/soc/sof/imx/imx8m.c +++ b/sound/soc/sof/imx/imx8m.c @@ -472,6 +472,7 @@ static struct snd_sof_dsp_ops sof_imx8m_ops = { SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_PAUSE | + SNDRV_PCM_INFO_BATCH | SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, }; diff --git a/sound/soc/sof/imx/imx8ulp.c b/sound/soc/sof/imx/imx8ulp.c index ca6edb85ff71..2badca75782b 100644 --- a/sound/soc/sof/imx/imx8ulp.c +++ b/sound/soc/sof/imx/imx8ulp.c @@ -463,6 +463,7 @@ static struct snd_sof_dsp_ops sof_imx8ulp_ops = { SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_PAUSE | + SNDRV_PCM_INFO_BATCH | SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, /* PM */ -- 2.34.1