Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp273572lqp; Mon, 10 Jun 2024 03:57:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUsM+AE3uUBO3NY4eLGoZH4VqDeKRD/03knclfAgyX6jHIJkJydwDBwe9xRoxSayW6OgWXqwRf/Wa1GYp4HsDt/TDQA0trS4PCwwwb8cw== X-Google-Smtp-Source: AGHT+IGdIXVcM19b7nfP1bgdRetvdY0QTrWPZYu2RRND+BZvVSZOCVlNzt8L/Hx7vKh3m+7eSp5G X-Received: by 2002:a54:4e97:0:b0:3c9:c2bc:6939 with SMTP id 5614622812f47-3d210f7b949mr8101902b6e.57.1718017029661; Mon, 10 Jun 2024 03:57:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718017029; cv=pass; d=google.com; s=arc-20160816; b=YYYQ5roFkNAQLlNnOu1MZz6vgD2q4KtZSVNB3eDFTZqrMcxyRrl9bzG95zUGRPneud 7gJj2KuJ/7PKY4F2yt5mZNLXd2dV0pcBQhDRg4HECTgWqIGy9SZ4np+esTw/AkndLiAL 3kHP6r/ruwiXGg8OqKpwEyyIRmrAIP+PVrPkTnugE6gVvZU81bfCot1xJ/jxWxkSnFap 2/IQBHm1IhlUBxAys40XZ0tQBu6Z/dPPem4g+wQbTxcyFnApmITOQeIn6e4GWkJ8ortU Hm9xOMsxl/d9/U0EefaIKgNa5dYS++ms0H14UHNtmQ3mRcct2H0B4wA6pJfph/Z+nYy6 zVXg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=m28Tjms8EG/D+LF08iHzhc9HsItx6aYa/0oUcN3SEgw=; fh=6R20zZXuG0cNqfqg/WdO4vcBsAgu/3wm9qfjTUIuc/s=; b=d+JZuS5mqKEcfdh3OPuuR24nDwt5svThaGHv2lTz5yqVItMVhw2JtU3Vrw6ogdqqaf qQ6mRN+5oHhvvwELt96SCpVrHc2PEH5aJI7bf4YmrnbUu7nJ4RMRRbwuzjqQ4GqeErFw cfM8ezWffkhIKkWSVu7/m0u7mQECFP2QSPm6x18WSSXezIujm1kG/YMqTFgep15R65Me Mcmw8htllqHdNbw5IftVsxDotSmyPLgZs8WNaIV6Z0T/E3TYi6VKM/+62Jx1jBAglMXK MtfTYwW0AlSOu+LTTan2wAgXfb/jVCQVF4gN7riolTiIaxYJ+ZxQGbXF/La3ZA8HIoo5 S/MQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="glvYyz/W"; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-208056-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208056-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-79788e61d43si110272385a.176.2024.06.10.03.57.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 03:57:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208056-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="glvYyz/W"; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-208056-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208056-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5DF4D1C21C39 for ; Mon, 10 Jun 2024 10:57:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD4407A724; Mon, 10 Jun 2024 10:56:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="glvYyz/W" Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (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 16CAC38DEC; Mon, 10 Jun 2024 10:56:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718017017; cv=none; b=qzNx8HbnzXz3NLsTXvi60XgiMUfcnD3ec0ij/xsGkua/MPAsQhrk/mURNCm14a5N7HjPy8piAQzB6IFfxons9hVzJ9hdiyz8mc79QL5ucRQXKGs/GfSiRCnf74G/EMwNAcJhcOUGvuzN7N91kcrqvZDLtBHvLgo+J87EjzX8BP8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718017017; c=relaxed/simple; bh=WPF2iC1SV8AsqNd6SPxTttV/JMzPbLAHKzCU/mAhLq0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=hYaVfoDLCZIQDZjhJcxAVuVpftnPK3ktuK+dXi24PxoazoHO01v48+Dvw4C7U4bmsi+W4Vh9fumo498WAc/OOuxB1kUFGR6PUjx4X2lrGDoDbCbP5ggVJKVHUrJxNXcSGDMfm3xEYX1SlQefTyLa7drT2ACKb8YDDCT6lRsSgGo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=glvYyz/W; arc=none smtp.client-ip=198.47.23.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 45AAuTbW009009; Mon, 10 Jun 2024 05:56:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1718016989; bh=m28Tjms8EG/D+LF08iHzhc9HsItx6aYa/0oUcN3SEgw=; h=From:Date:Subject:References:In-Reply-To:To:CC; b=glvYyz/WsEiU2YwVpFf87uAP78t6GUf9L2Se+jmkDNr4kQo/ZCFeOrJxsKFI89JUV DxtbIKX0l8c5qpbDycH5aBWq/mjFRGNQjewNkvy7hagW8zzHZvcc7Gj418jJREIRT7 rteukvMIe6O5cRAT6kKlTBAtSamQwF6C2J/LFlqc= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 45AAuTil004949 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 Jun 2024 05:56:29 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 10 Jun 2024 05:56:29 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 10 Jun 2024 05:56:29 -0500 Received: from localhost (jluthra.dhcp.ti.com [172.24.227.116]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 45AAuSlc110545; Mon, 10 Jun 2024 05:56:28 -0500 From: Jai Luthra Date: Mon, 10 Jun 2024 16:26:01 +0530 Subject: [PATCH v2 2/2] ASoC: ti: davinci-mcasp: Set min period size using FIFO config Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20240610-asoc_next-v2-2-b52aaf5d67c4@ti.com> References: <20240610-asoc_next-v2-0-b52aaf5d67c4@ti.com> In-Reply-To: <20240610-asoc_next-v2-0-b52aaf5d67c4@ti.com> To: Lars-Peter Clausen , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Peter Ujfalusi CC: , , , Devarsh Thakkar , Vignesh Raghavendra , Jayesh Choudhary , Jai Luthra X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1960; i=j-luthra@ti.com; h=from:subject:message-id; bh=WPF2iC1SV8AsqNd6SPxTttV/JMzPbLAHKzCU/mAhLq0=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBmZtvYRZUS1YnZ7wXULBNwFYahVxcCh5M0cRfMj OW3gz+xT/mJAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZmbb2AAKCRBD3pH5JJpx RSYnD/9/UHlozo/st4AN88B7W06HOUrbfDOElMmFCyGwQhRUERSoD1E2xe2iv2HlZERyxH6qOZx qc0y3ynQllWf22HxB/v0xGVUk0IVEcDKpx+jHP8/cjeOHdB3gCd/Qbpu3LCFZxGb7P4AFE1qgWW y/7RDNYKXnSTb6fhMNLPEeweIGu7T9kxY5Awp6bXAyzoV3KxAtZ4dp4YzfZUOxnUbHgaIxjmb6I Sc7sIayOVVg32WbWPElFNlN3ZWPK0dhfXWWVem1Vs+iy9plJ5CW9R9VW/3+lfFS0L7Tvv+Rdegx 0VQYg05UCkEt38uAgJpSiJV7+x758nQmnI21Th6eGaWS8QN5aiK5fNdpjCbtuc0Opuy+QBQyfqE BpoUsTCZK6uK9heI4BU+rrHHa7+TXYeoz9b4EUGJs4sX882Z3ViB4gx+VFIdBkX5WFpY8owP/L/ Vu8nSk8vnp2BN8djvj5Gwp6AHqIf3b3Ninue++dyi06rNK9xp/oSHnEFYztNU7OVFBF+nbuDhut f+vcCRT2nTB9eQowOLFAMUPMoMKNOjx2ePNGyZpixgTuQdgaswm1KPaPzA7K+eV+Jnro3fNb6Z6 KP6hz9b2I8UXOsAMfRstRUSkxt44is9Vv/DeydzFataw14QLjiXCoxWfn1FHuUnR+91Tw81Vgn+ CNDOd3qHWIqvCSA== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 The minimum period size was enforced to 64 as older devices integrating McASP with EDMA used an internal FIFO of 64 samples. With UDMA based platforms this internal McASP FIFO is optional, as the DMA engine internally does some buffering which is already accounted for when registering the platform. So we should read the actual FIFO configuration (txnumevt/rxnumevt) instead of hardcoding frames.min to 64. Signed-off-by: Jai Luthra --- sound/soc/ti/davinci-mcasp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c index 1e760c315521..2b1ed91a736c 100644 --- a/sound/soc/ti/davinci-mcasp.c +++ b/sound/soc/ti/davinci-mcasp.c @@ -1472,10 +1472,11 @@ static int davinci_mcasp_hw_rule_min_periodsize( { struct snd_interval *period_size = hw_param_interval(params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); + u8 numevt = *((u8 *)rule->private); struct snd_interval frames; snd_interval_any(&frames); - frames.min = 64; + frames.min = numevt; frames.integer = 1; return snd_interval_refine(period_size, &frames); @@ -1490,6 +1491,7 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, u32 max_channels = 0; int i, dir, ret; int tdm_slots = mcasp->tdm_slots; + u8 *numevt; /* Do not allow more then one stream per direction */ if (mcasp->substreams[substream->stream]) @@ -1589,9 +1591,12 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, return ret; } + numevt = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? + &mcasp->txnumevt : + &mcasp->rxnumevt; snd_pcm_hw_rule_add(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, - davinci_mcasp_hw_rule_min_periodsize, NULL, + davinci_mcasp_hw_rule_min_periodsize, numevt, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1); return 0; -- 2.43.0