From patchwork Fri Feb 23 17:51:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 775538 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A7FB3C54798 for ; Fri, 23 Feb 2024 17:52:44 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D68B6B6A; Fri, 23 Feb 2024 18:52:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D68B6B6A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1708710762; bh=cyobtDdfcGLm9EgpUOeJh0auXLdMupXD09HbMz5DS7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=HE82md4fmaQxFYE5MyH3Fmks58lAi+Tv7p7M1NtDNdx4PH28sLG5pMMs1CCvfoZuh ibHIOnh/XrVA8dxdtcpIGUOGkfq2YuCVZrH1604sM/Fo3DVi4ZjA35YWqJxxemfoRj PNHJRbH1L3sGkB2glrQTPbszYWvlum6DDjErG2ig= Received: by alsa1.perex.cz (Postfix, from userid 50401) id F2B57F805E2; Fri, 23 Feb 2024 18:51:46 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 1EF3CF805F3; Fri, 23 Feb 2024 18:51:46 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C4CD7F80568; Fri, 23 Feb 2024 18:51:35 +0100 (CET) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C6C5AF800EE for ; Fri, 23 Feb 2024 18:51:24 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C6C5AF800EE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=qTjQF6RH Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-33d36736d4eso452034f8f.1 for ; Fri, 23 Feb 2024 09:51:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1708710682; x=1709315482; darn=alsa-project.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=x5asXBXhtOZ8krhmeWknGrfpLZd9XvhtRWxv+IOZLPY=; b=qTjQF6RH3WdraZCVoqNem0dImnGSvO4y3H6wyXC7UWgpOPUMfNXPL5ge6mtVZNed7i bYsF2MYbWd17cbrTvaSnHtya8wOZ42jib/ejtQ2kzR8woQRa8wA2q5X/5RZ4sK6oYcfD puPYJvvrY2x/fsXEuLqinCv3fgcAq9mtAqtk0n6JMJJU+lRkc0dvLzBthRVSubIm6JpY 0KO98BicIfCDJApQJXVybZQaFDnhWZWcs+qUInWklC2DuTlYfLRoN2x/KzO5lUkAXsRC am9AdrU7ApNHdhq9TNrujZtmimpto5EE/7IjGqodFov1X51JiEJt6dpC1ZFigFEKqCMv TuUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708710682; x=1709315482; 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=x5asXBXhtOZ8krhmeWknGrfpLZd9XvhtRWxv+IOZLPY=; b=uhWkpwWCJUZ9uV4furw2uDNAkNE/7UGxty55fFnBwiZon32Devefzb088/0tJKwPR0 vbLqx+F7aMJrOS3b77K1ZqYehsJt9J4RwDuS3dSPbLK/F9p5IQuM9jaVcCSL2QCTyraZ ct8XIZNOBpqSJAmeFVDuBIOL4jyG164em+1l7mEOs4Cd10cFe++lq6Z387nbxK9g4gWg fOU/5TLFnP5rgU7AdV8T4510FHnJaM+V4vaWbRWtqRcGu0Uqg3UfRMPWBcmP1OVEgnZH 7SroAmathju3M6YWO1y700877wBz8iu8idAGa8KiZ7lI+XcMD0ADVfLEyWCxMnxf+fjf AtfQ== X-Forwarded-Encrypted: i=1; AJvYcCWNuX3YdcAJTnUAgS8pmhWdaNNxNM8tqQ+iJc6LQNmbfZraCh1keWn5RUfgbHyoJEGFhtQImxZVzc1rd8WwxoTblU3ZuPbI6CZfQdU= X-Gm-Message-State: AOJu0YylkRNsMd1cf1WHRIZWM50XhORz/C5r9bmy4xa29Aw0Uhdbxhrp 53nxxEVXmMZl0U+63qNaYOcCCQe5IQqjeVol+SFBOvMqDILhoby5AxMKNc4wAnM= X-Google-Smtp-Source: AGHT+IF55hUqrzLd0OS4Msf5Z4g1J7M8Fx2otOvbUPa75llthqZMYU+z/HGqcEn63wo2SAVnVI/2FQ== X-Received: by 2002:a5d:6445:0:b0:33d:a440:636c with SMTP id d5-20020a5d6445000000b0033da440636cmr343739wrw.49.1708710682467; Fri, 23 Feb 2024 09:51:22 -0800 (PST) Received: from toaster.lan ([2a01:e0a:3c5:5fb1:e8a0:25a6:d4ec:a7ff]) by smtp.googlemail.com with ESMTPSA id bo10-20020a056000068a00b0033cddadde6esm3711524wrb.80.2024.02.23.09.51.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:51:22 -0800 (PST) From: Jerome Brunet To: Mark Brown , Liam Girdwood Cc: Jerome Brunet , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH 1/6] ASoC: meson: axg-tdm-interface: fix mclk setup without mclk-fs Date: Fri, 23 Feb 2024 18:51:07 +0100 Message-ID: <20240223175116.2005407-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223175116.2005407-1-jbrunet@baylibre.com> References: <20240223175116.2005407-1-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify Message-ID-Hash: ITRSFI7UVHCA2JYYWHMVJLXQWOFPLTY2 X-Message-ID-Hash: ITRSFI7UVHCA2JYYWHMVJLXQWOFPLTY2 X-MailFrom: jbrunet@baylibre.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: By default, when mclk-fs is not provided, the tdm-interface driver requests an MCLK that is 4x the bit clock, SCLK. However there is no justification for this: * If the codec needs MCLK for its operation, mclk-fs is expected to be set according to the codec requirements. * If the codec does not need MCLK the minimum is 2 * SCLK, because this is minimum the divider between SCLK and MCLK can do. Multiplying by 4 may cause problems because the PLL limit may be reached sooner than it should, so use 2x instead. Fixes: d60e4f1e4be5 ("ASoC: meson: add tdm interface driver") Signed-off-by: Jerome Brunet --- sound/soc/meson/axg-tdm-interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/meson/axg-tdm-interface.c b/sound/soc/meson/axg-tdm-interface.c index 1c3d433cefd2..cd5168e826df 100644 --- a/sound/soc/meson/axg-tdm-interface.c +++ b/sound/soc/meson/axg-tdm-interface.c @@ -264,8 +264,8 @@ static int axg_tdm_iface_set_sclk(struct snd_soc_dai *dai, srate = iface->slots * iface->slot_width * params_rate(params); if (!iface->mclk_rate) { - /* If no specific mclk is requested, default to bit clock * 4 */ - clk_set_rate(iface->mclk, 4 * srate); + /* If no specific mclk is requested, default to bit clock * 2 */ + clk_set_rate(iface->mclk, 2 * srate); } else { /* Check if we can actually get the bit clock from mclk */ if (iface->mclk_rate % srate) { From patchwork Fri Feb 23 17:51:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 775171 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2667C54798 for ; Fri, 23 Feb 2024 17:52:32 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 642C9826; Fri, 23 Feb 2024 18:52:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 642C9826 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1708710750; bh=j16zsMD+HTWYyVy/k1AZwAJ7XoBtLsYNzq4+rvXeU68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Y3nJq2SjbhImphIHwC8PlHPtEFShvVVfO/a1D2xFxVaUQt33018PGOAlz9AOyPacU e8RXW3F10GVn9p18WKNxGMHdA2fKFr2hXYP/AxkS011PIwuYpN0LhbMvKv0nu/hCIe TfQ2bRAIPDNhAz/5n7YSWEAM6+Wokq+bCIIq/8Oc= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 409FFF805C9; Fri, 23 Feb 2024 18:51:42 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E8FDCF805CB; Fri, 23 Feb 2024 18:51:41 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7841AF8056F; Fri, 23 Feb 2024 18:51:34 +0100 (CET) Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E8917F8047D for ; Fri, 23 Feb 2024 18:51:24 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E8917F8047D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=ZNbbe4sG Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-41294021cd8so4588185e9.2 for ; Fri, 23 Feb 2024 09:51:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1708710683; x=1709315483; darn=alsa-project.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=n2ahiTP/lW6MiTpxUmavX+y9bbyFd7JEgWLGkKtHM5s=; b=ZNbbe4sGHE+newfhDnDEt4+lrYgV5CuR17Ux54r56LNqBdATPvRs1pSLtEAgXU4kGg Ba9nlWN7VzLCfWDJ7wuNB/yh3i2t5Z3qV134HTcmDEGxZPrFL4nrRaZFEeY2qDr+VAWp v8K0xIzRBD5mpw/wZDdL6KZ52rZL6Yz1oGKjndUl7x5MdTHZP2K/zbNsb8Mcc7XbRrsb EoS5Etf3bxOfXAer1HNSKUJsFk5M6kQTtRoZZP/jr5Z9s8QU3uMCrQ/Lnqysi0fUOs9f caDoLUZTfe/2TKkgrT/bcDaxVStrBo1Kz893RA1zDHsmQ9w1DWC7+l6Zts1PFvKXctfR XQ/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708710683; x=1709315483; 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=n2ahiTP/lW6MiTpxUmavX+y9bbyFd7JEgWLGkKtHM5s=; b=Br3RAdd77CsuJv0Rx+p+wSKC5Iha4+uRczfME/MI1DSHLJEaI02DfpmxN6GsJGIrt1 auxnm4v0vNUffY1sdm4ftwZxnkExIWkBNEnwZYqqZMYgdUReQ5xCXkOLHqvaMxJxnylh Tifu4I29TzTzXvfWhOCi8UvCaZY4ulxCssIfarhDZIBmU/tIONsIgrlOmTM0+VYqOGaP cE7rOzHs9pw7uwTngUhV3KERpKpnof5H4/mws9U0CUVHLv5wDZTgbdsXx/xTPC4SrjhU uu1YJuvvETo8LV/7ZrZxvnWUJDKt9qzwOYc/IbbBnweO+h9QrNuS4zkGR1uegxvkctez BwMA== X-Forwarded-Encrypted: i=1; AJvYcCUQw0SwPtxqM8goBMfOBdC23LPZTUI3ePEdvvuQStOQJEf1i87Gbivwfp08FWuvTIlFxCnoJuvdHYwDx0ztJmkCfPfx/pu3L2AI+50= X-Gm-Message-State: AOJu0Yz4lwYawbb9QVwr1tXbWwo79hyXLRV0rVLpsVUyZPKAdM5y0Vxw 22/03P8qwjUOxf0xO8zw340qxqc6FMy//HxtPdXRTj1zobfsz7jEoXtV8QmcCgQ= X-Google-Smtp-Source: AGHT+IGqnoqMSxnWyvarUuiuXtt8jg0EPFcrolAZQBwRrHQk3pPFoxvi/xtJ821ZsNJVMnK4y5tzhw== X-Received: by 2002:a05:600c:5114:b0:412:9830:a259 with SMTP id o20-20020a05600c511400b004129830a259mr383837wms.25.1708710683406; Fri, 23 Feb 2024 09:51:23 -0800 (PST) Received: from toaster.lan ([2a01:e0a:3c5:5fb1:e8a0:25a6:d4ec:a7ff]) by smtp.googlemail.com with ESMTPSA id bo10-20020a056000068a00b0033cddadde6esm3711524wrb.80.2024.02.23.09.51.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:51:22 -0800 (PST) From: Jerome Brunet To: Mark Brown , Liam Girdwood Cc: Jerome Brunet , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH 2/6] ASoC: meson: axg-tdm-interface: add frame rate constraint Date: Fri, 23 Feb 2024 18:51:08 +0100 Message-ID: <20240223175116.2005407-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223175116.2005407-1-jbrunet@baylibre.com> References: <20240223175116.2005407-1-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify Message-ID-Hash: CHV6V6RSO3HQ5H4HKTN4FJ66HZZYGTAL X-Message-ID-Hash: CHV6V6RSO3HQ5H4HKTN4FJ66HZZYGTAL X-MailFrom: jbrunet@baylibre.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: <> List-Archive: <> List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: According to Amlogic datasheets for the SoCs supported by this driver, the maximum bit clock rate is 100MHz. The tdm interface allows the rates listed by the DAI driver, regardless of the number slots or their width. However, these will impact the bit clock rate. Hitting the 100MHz limit is very unlikely for most use cases but it is possible. For example with 32 slots / 32 bits wide, the maximum rate is no longer 384kHz but ~96kHz. Add the constraint accordingly if the component is not already active. If it is active, the rate is already constrained by the first stream rate. Fixes: d60e4f1e4be5 ("ASoC: meson: add tdm interface driver") Signed-off-by: Jerome Brunet --- sound/soc/meson/axg-tdm-interface.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/sound/soc/meson/axg-tdm-interface.c b/sound/soc/meson/axg-tdm-interface.c index cd5168e826df..2cedbce73837 100644 --- a/sound/soc/meson/axg-tdm-interface.c +++ b/sound/soc/meson/axg-tdm-interface.c @@ -12,6 +12,9 @@ #include "axg-tdm.h" +/* Maximum bit clock frequency according the datasheets */ +#define MAX_SCLK 100000000 /* Hz */ + enum { TDM_IFACE_PAD, TDM_IFACE_LOOPBACK, @@ -153,19 +156,27 @@ static int axg_tdm_iface_startup(struct snd_pcm_substream *substream, return -EINVAL; } - /* Apply component wide rate symmetry */ if (snd_soc_component_active(dai->component)) { + /* Apply component wide rate symmetry */ ret = snd_pcm_hw_constraint_single(substream->runtime, SNDRV_PCM_HW_PARAM_RATE, iface->rate); - if (ret < 0) { - dev_err(dai->dev, - "can't set iface rate constraint\n"); - return ret; - } + + } else { + /* Limit rate according to the slot number and width */ + unsigned int max_rate = + MAX_SCLK / (iface->slots * iface->slot_width); + ret = snd_pcm_hw_constraint_minmax(substream->runtime, + SNDRV_PCM_HW_PARAM_RATE, + 0, max_rate); } - return 0; + if (ret < 0) + dev_err(dai->dev, "can't set iface rate constraint\n"); + else + ret = 0; + + return ret; } static int axg_tdm_iface_set_stream(struct snd_pcm_substream *substream, From patchwork Fri Feb 23 17:51:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 775537 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C32EC5478C for ; Fri, 23 Feb 2024 17:53:09 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DA9A5827; Fri, 23 Feb 2024 18:52:56 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DA9A5827 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1708710786; bh=9ZZxPk/a7pO8ytzdAHohcBFzs6TPeMkP0Go5hItHYIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Eel3tEJ9BG8vALC6awoMUAR5ksGmQWvoB0JosxC/YBzBIIQuQKfHOSgUAk0ODQvuA Oc5kHCYYvXBg0MGBxANjUexOBU2xqN64JoVV1RFDQ+qGZKvCZgEaEPxj0VNrqzVbUj c695jX1VXxUC5PcvcDzGavK9PBGSUDH0YdTjyNUI= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D4726F8063B; Fri, 23 Feb 2024 18:51:53 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 32768F80631; Fri, 23 Feb 2024 18:51:53 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8F604F805B0; Fri, 23 Feb 2024 18:51:39 +0100 (CET) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 02013F804CC for ; Fri, 23 Feb 2024 18:51:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 02013F804CC Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=taDJnTid Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-41241f64c6bso8675225e9.0 for ; Fri, 23 Feb 2024 09:51:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1708710684; x=1709315484; darn=alsa-project.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=VeCmmTR4nL1DWlLTvSXW5V8GjozKprjftrRX3BjbH5I=; b=taDJnTidGsOPCqnBIOGVvxlugw7oqoDJwrmGgiXfoxSge57GGPtNA+91BfYe2hDpFz pqhp0pz6qOA2EAUmB00r0fIylPiyIYXahML2igLA9+85f0fkmdj0cPNejDnIPWS6tTs1 pKdGq5GWHLjiJbpiF1+bz8SyzTqjt9M8ojRipZlXOys3+SeTJz/TM96RcmEUnxIjujCp jBh4ry9IEPiIIdqrWKxAOgotVe9Uditi8Yxgc8ku18xy52E5gdt+cOvUbQcOaLRI1OBJ smDyV66xEZAG6t7PJRsg/WYAyE2jXFE12LLbCAoPVU/FBL8XoCJmP9Bv5Fsvi9CU7XH4 shbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708710684; x=1709315484; 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=VeCmmTR4nL1DWlLTvSXW5V8GjozKprjftrRX3BjbH5I=; b=L98GaNtyZMkb5hjdozw0dkFy4Eqd1xeczH/5+J9G1qkfLqD+L8LOeWU/B5r6pdPs9y eYFvPWtYG10ToZcCdMkGhWJSxH97XE7q3j9NNAievYJjiFJn+mHjrSvsv/u5UvJI8N5Z kNRpHVe5dPmYeKv9GKwR9zD0mTse2hRhwi/SwiD0sKOO338X6O30vAI0+hyIBWdlrB/G oOHaB3sbvSp+brIWn6Lkihs2L9xSjVoWPAANTy95oYFKUDFxAs9Q4tXWRuKK03vjI2RG bKayz4p636h8wtCIcQcGp2uSYx7ysilRWMw4VP+rTl7kAScuo56T5IgmrkBzzAW/4acL MZGQ== X-Forwarded-Encrypted: i=1; AJvYcCU4x8h13BbUwh0cZWS7BKblL5iFgeP07gKzIpJ9K4APLA796P77dVWEtIPyhSieoNFvwfqCZQNxYolFHZlBtKfKrblDHBCneKh+EzE= X-Gm-Message-State: AOJu0YyOhLRF6xz+0xUyoDy4obpa8AlJQNJpCCKVFnD4IpRFq/eb5HrN auWyXjhCbfdES8FmRorpgL2pk1SadJfGkzV2Wb4DyAGl32W7iNY4QQgSkcdhmhM= X-Google-Smtp-Source: AGHT+IFFxDXAmiB4835JX0wNsSNqu2+o3xJ9l2em0tk9z8iXrduKI7NKlIlcZPE8y6hU/3jd20iOCA== X-Received: by 2002:a05:600c:4f53:b0:412:96f2:2df9 with SMTP id m19-20020a05600c4f5300b0041296f22df9mr323815wmq.26.1708710684136; Fri, 23 Feb 2024 09:51:24 -0800 (PST) Received: from toaster.lan ([2a01:e0a:3c5:5fb1:e8a0:25a6:d4ec:a7ff]) by smtp.googlemail.com with ESMTPSA id bo10-20020a056000068a00b0033cddadde6esm3711524wrb.80.2024.02.23.09.51.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:51:23 -0800 (PST) From: Jerome Brunet To: Mark Brown , Liam Girdwood Cc: Jerome Brunet , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH 3/6] ASoC: meson: axg-tdm-interface: update error format error traces Date: Fri, 23 Feb 2024 18:51:09 +0100 Message-ID: <20240223175116.2005407-4-jbrunet@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223175116.2005407-1-jbrunet@baylibre.com> References: <20240223175116.2005407-1-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify Message-ID-Hash: 7BGAYJUXMDEPEQPANMJLM4ITAOKWQYJU X-Message-ID-Hash: 7BGAYJUXMDEPEQPANMJLM4ITAOKWQYJU X-MailFrom: jbrunet@baylibre.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: ASoC stopped using CBS_CFS and CBM_CFM a few years ago but the traces in the amlogic tdm interface driver did not follow. Update this to match the new format names Signed-off-by: Jerome Brunet --- sound/soc/meson/axg-tdm-interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/meson/axg-tdm-interface.c b/sound/soc/meson/axg-tdm-interface.c index 2cedbce73837..bf708717635b 100644 --- a/sound/soc/meson/axg-tdm-interface.c +++ b/sound/soc/meson/axg-tdm-interface.c @@ -133,7 +133,7 @@ static int axg_tdm_iface_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) case SND_SOC_DAIFMT_BP_FC: case SND_SOC_DAIFMT_BC_FP: - dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n"); + dev_err(dai->dev, "only BP_FP and BC_FC are supported\n"); fallthrough; default: return -EINVAL; From patchwork Fri Feb 23 17:51:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 775169 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 69B0BC54798 for ; Fri, 23 Feb 2024 17:53:43 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7000982A; Fri, 23 Feb 2024 18:53:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7000982A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1708710816; bh=YbwFPjo6ccRVq4UzuSvS6LZFtetWcxbtqaMWTpTxTyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=eyIb5U4FPdWHNAfyvBipXzpRdj/OZKrJ4+pjmkd7LthcA8tP0ciB5TSK+vynPxVD8 bwX7sPfgQhXJB6UNbFuSdfvY25lNIlR7cEI7TTGFOvWbfmgs8LmKcNmAzTxxWN+Kt5 U05EpaKiDQGOm1G/FVgJ4xdCcaHOd/wJbSSFFJJM= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 18C32F80680; Fri, 23 Feb 2024 18:51:56 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 73CDDF80651; Fri, 23 Feb 2024 18:51:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8D755F805D2; Fri, 23 Feb 2024 18:51:43 +0100 (CET) Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id ED044F80496 for ; Fri, 23 Feb 2024 18:51:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ED044F80496 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=ai4KZX/+ Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-33da51fd636so603688f8f.3 for ; Fri, 23 Feb 2024 09:51:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1708710685; x=1709315485; darn=alsa-project.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=E5onlIQPMa8EU8sK1NqJS82W4yBogcW0MtBFux+iSL0=; b=ai4KZX/+PO0ouOx0uYeCRZb4IDQ8+jOVnHCkqwdn7JSx8ihoqmkMTmd2VZHOx8TOqP uR6k+y0nPS7XhhkCWBQE/tYzPxicSk9xvZnSeNO6kJmUew0DHaatgiVhGd30LpaiKRj0 dtoL4DxmP19818pgHrdljGf6rx4EVfkpfOieGNQiA3A8Wyw/xlLIvP5Inpb9lcrgVgyk 5radEyRyoJMbiqNDzeXJkVk31WOdgcdo07IwMeUdiN2hGceWQL5gcF/fhppNMHN+iP1A x599Qg/CCpDS5UeWk0KRBvHT0nLn7kRQDe0VSvuTXxdfbPxGXF79QGgiLk/mhsVUnD6J zxSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708710685; x=1709315485; 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=E5onlIQPMa8EU8sK1NqJS82W4yBogcW0MtBFux+iSL0=; b=lZy2Xq8em4yH4OFaDEFVhRjvy8lsNJrb3SK/wyF2sbm57n8Sfzr8CE5d+jv3doyw3H 3tj1XxX6/eWAzxwj5kcIwxetytDnw98mINnmpHeNfXVIyOe9JHToALNwPhgyUb8PPqhx FKX28diapUKV+QlNjKIYLgj0BDWQeUZbN7+steNqZlkFi0rTvJ9/AUduarVbhx9Lyqll 2y5lsPCTLVWlTwZl4v6b03bRVuZf3qfBf//Lh8JoDqI9TYd1SgXX1ddd31lOGMwXxYxc EQR66CsrLDE8LjqicvsN21D95ly0Q/dU/FCEMsRZ8PsrtF0K4YvuHr7tZqP23EjQCtz7 NbZA== X-Forwarded-Encrypted: i=1; AJvYcCUD3rDI+fAKa4Otw/t8I6vFqLIJ4pNN/gQmFNSOmZ75AB6cjJDlRsOeDLpM2CudT2qB1uai+lAfADVgf3vFF5IdMPFEvGL/2HCGrKg= X-Gm-Message-State: AOJu0YwXW2n7Xkrb8boFxXfYhdl1R1GE130Qm3AhCbaXCIOk0wEkWbUJ vioj2SiABIKLgrWs13fXOrwcTghRDzulc3ggVbGon6vLfSBVGYNvdFeh0HThTPjF/WczNIylM9V f X-Google-Smtp-Source: AGHT+IGbVheYYWSnBsZMt7MWcRfxMQjAjkyXcfMrBJ55mpI+QDGAkuDrALH5oqVlvASElX3LNqQCRA== X-Received: by 2002:adf:fcc6:0:b0:33d:9283:93b with SMTP id f6-20020adffcc6000000b0033d9283093bmr329883wrs.47.1708710684884; Fri, 23 Feb 2024 09:51:24 -0800 (PST) Received: from toaster.lan ([2a01:e0a:3c5:5fb1:e8a0:25a6:d4ec:a7ff]) by smtp.googlemail.com with ESMTPSA id bo10-20020a056000068a00b0033cddadde6esm3711524wrb.80.2024.02.23.09.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:51:24 -0800 (PST) From: Jerome Brunet To: Mark Brown , Liam Girdwood Cc: Jerome Brunet , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH 4/6] ASoC: meson: axg-spdifin: use max width for rate detection Date: Fri, 23 Feb 2024 18:51:10 +0100 Message-ID: <20240223175116.2005407-5-jbrunet@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223175116.2005407-1-jbrunet@baylibre.com> References: <20240223175116.2005407-1-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify Message-ID-Hash: YNPSPGE3RSZTX5LOBEBNYQTISWUO4BI5 X-Message-ID-Hash: YNPSPGE3RSZTX5LOBEBNYQTISWUO4BI5 X-MailFrom: jbrunet@baylibre.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Use maximum width between 2 edges to setup spdifin thresholds and detect the input sample rate. This comes from Amlogic SDK and seems to be marginally more reliable than minimum width. This is done to align with a future eARC support. No issue was reported with minimum width so far, this is considered to be an update so no Fixes tag is set. Signed-off-by: Jerome Brunet --- sound/soc/meson/axg-spdifin.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/meson/axg-spdifin.c b/sound/soc/meson/axg-spdifin.c index bc2f2849ecfb..e721f579321e 100644 --- a/sound/soc/meson/axg-spdifin.c +++ b/sound/soc/meson/axg-spdifin.c @@ -179,9 +179,9 @@ static int axg_spdifin_sample_mode_config(struct snd_soc_dai *dai, SPDIFIN_CTRL1_BASE_TIMER, FIELD_PREP(SPDIFIN_CTRL1_BASE_TIMER, rate / 1000)); - /* Threshold based on the minimum width between two edges */ + /* Threshold based on the maximum width between two edges */ regmap_update_bits(priv->map, SPDIFIN_CTRL0, - SPDIFIN_CTRL0_WIDTH_SEL, SPDIFIN_CTRL0_WIDTH_SEL); + SPDIFIN_CTRL0_WIDTH_SEL, 0); /* Calculate the last timer which has no threshold */ t_next = axg_spdifin_mode_timer(priv, i, rate); @@ -199,7 +199,7 @@ static int axg_spdifin_sample_mode_config(struct snd_soc_dai *dai, axg_spdifin_write_timer(priv->map, i, t); /* Set the threshold value */ - axg_spdifin_write_threshold(priv->map, i, t + t_next); + axg_spdifin_write_threshold(priv->map, i, 3 * (t + t_next)); /* Save the current timer for the next threshold calculation */ t_next = t; From patchwork Fri Feb 23 17:51:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 775170 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 546A5C5478C for ; Fri, 23 Feb 2024 17:53:05 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 493A8832; Fri, 23 Feb 2024 18:52:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 493A8832 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1708710782; bh=D6ZViuQxxu5LLhWeN+tNr7Qy788hI6Q6B6sgjHGd1ws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=gCUHBikuhkAEsdNQ+GhrkfCOi6P3GhweDU9wJbWFZ0WVzXw3i59Bm9qhY7ew1Vl6d kXzFUfDoEIvZI1APIodHvn6aCby/7CAlh6Bvn1pQkUFiI4H8nLSzhKGTAkT7hTwWS1 6TN8GRPG9jsfUviLLoHwcX4MSPY9qfM1fzRB9Prg= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C8A99F80611; Fri, 23 Feb 2024 18:51:50 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 161DFF80610; Fri, 23 Feb 2024 18:51:50 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D9FA6F80567; Fri, 23 Feb 2024 18:51:37 +0100 (CET) Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A8384F80567 for ; Fri, 23 Feb 2024 18:51:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A8384F80567 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=P/e1CXu3 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-33d6f26ff33so410217f8f.0 for ; Fri, 23 Feb 2024 09:51:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1708710686; x=1709315486; darn=alsa-project.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=CvElMeb2g6xpqhFWcI8ix09RRMkAlSO99O6608hvkMQ=; b=P/e1CXu3ZTRRRT8GETwyGhL83DLyS/pw1NrAhI58co/WCalNbEB+hY0wgnjG0Ya6zH oeQbqRX3e3I6LXW1zxzeIw77ZgkEHHQBX0QcACiUc+wnFkQNzIj+KnN3x1c5oe8iQbJb NbIgNoi5vLraaFrVjOGQAIwk5Kmi5+o+rSokCjBR4SxRQDuAVQujxnF7pLzwgwKIEEJb B0oJhRKpv6MxFsUZD6eIuW0YI7teslRyQ0fYwX88kVwX7myHii5vANJTcCFB2q/6IVU4 oQSAEZs00nLXX+9hbRvI9gIIQtruzUMLp7ltpvrpcngn9gWaFHuN7Q+qM5Z3lbw51vzw Hv5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708710686; x=1709315486; 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=CvElMeb2g6xpqhFWcI8ix09RRMkAlSO99O6608hvkMQ=; b=n4FpVn7gKzNEaMXp+RxkR3EX1Y8TbgmM78CbgTcmV+8gT5AiDmrj3rlqMhNHbXDwE5 Msc9lswEV+VvzsdCVqgMQABZHYh7NdN+1T/CYfZkLAE2Qpq6XB0cyBxGQwmJRtAbVKpa 6YH3ZeEkTDE6jsfpwCfnvF4xJ10mDljicDmkdgUpeQ8J01P/IkEbjGtXgXwcH5q6RUVE Y4uYCGoGdHb/HYf1FhzdRFOcinTnb7il8D1YlwV3K5/2JDedPsdccpJhMbTyw4ChqOUb 4HrUjYkPUHu4H8BdcbAaxbSQ+j75Wc/BdzGZWFRvaqCLnRU8YQkHVv4f0hkS0SW0a8IT xuxw== X-Forwarded-Encrypted: i=1; AJvYcCVureelRHHi2atzvsZw9sRfcEx8UNMbTniV8KYkSeg8VH5vYATZwD1/0wu2mV5OKwpqYDaRkbfyjpVps3buujw3U+trHlTKZqybztI= X-Gm-Message-State: AOJu0YwW/U4xYB/lTrwKYmSX9ZEyi3LsDD3JOTE/dqb236VNNIfHqHsk BG07vpcK6UsQuJXcvFmTmu00zF4N7vtMtd0zhlsrYDvk9UmHpNyyCo3FGsB/55Y= X-Google-Smtp-Source: AGHT+IGsZP6H+91NdmJ6i8soaEWmdRDIYCoyh52OhJZC6bOgqY/X/r4JhNQ6kUaz+Xc1LH/5RJoMXA== X-Received: by 2002:a5d:4a4a:0:b0:33d:3cf6:a2ca with SMTP id v10-20020a5d4a4a000000b0033d3cf6a2camr361594wrs.30.1708710685868; Fri, 23 Feb 2024 09:51:25 -0800 (PST) Received: from toaster.lan ([2a01:e0a:3c5:5fb1:e8a0:25a6:d4ec:a7ff]) by smtp.googlemail.com with ESMTPSA id bo10-20020a056000068a00b0033cddadde6esm3711524wrb.80.2024.02.23.09.51.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:51:25 -0800 (PST) From: Jerome Brunet To: Mark Brown , Liam Girdwood Cc: Jerome Brunet , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH 5/6] ASoC: meson: axg-fifo: take continuous rates Date: Fri, 23 Feb 2024 18:51:11 +0100 Message-ID: <20240223175116.2005407-6-jbrunet@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223175116.2005407-1-jbrunet@baylibre.com> References: <20240223175116.2005407-1-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify Message-ID-Hash: N2BPBUFVPV4KCOBTICJTE7BNJZ6EC6OI X-Message-ID-Hash: N2BPBUFVPV4KCOBTICJTE7BNJZ6EC6OI X-MailFrom: jbrunet@baylibre.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: <> List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The rate of the stream does not matter for the fifos of the axg family. Fifos will just push or pull data to/from the DDR according to consumption or production of the downstream element, which is the DPCM backend. Drop the rate list and allow continuous rates. The lower and upper rate are set according what is known to work with the different backends This allows the PDM input backend to also use continuous rates. Signed-off-by: Jerome Brunet --- sound/soc/meson/axg-fifo.h | 2 -- sound/soc/meson/axg-frddr.c | 8 ++++++-- sound/soc/meson/axg-toddr.c | 8 ++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/sound/soc/meson/axg-fifo.h b/sound/soc/meson/axg-fifo.h index df528e8cb7c9..a14c31eb06d8 100644 --- a/sound/soc/meson/axg-fifo.h +++ b/sound/soc/meson/axg-fifo.h @@ -21,8 +21,6 @@ struct snd_soc_dai_driver; struct snd_soc_pcm_runtime; #define AXG_FIFO_CH_MAX 128 -#define AXG_FIFO_RATES (SNDRV_PCM_RATE_5512 | \ - SNDRV_PCM_RATE_8000_384000) #define AXG_FIFO_FORMATS (SNDRV_PCM_FMTBIT_S8 | \ SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S20_LE | \ diff --git a/sound/soc/meson/axg-frddr.c b/sound/soc/meson/axg-frddr.c index 8c166a5f338c..98140f449eb3 100644 --- a/sound/soc/meson/axg-frddr.c +++ b/sound/soc/meson/axg-frddr.c @@ -109,7 +109,9 @@ static struct snd_soc_dai_driver axg_frddr_dai_drv = { .stream_name = "Playback", .channels_min = 1, .channels_max = AXG_FIFO_CH_MAX, - .rates = AXG_FIFO_RATES, + .rates = SNDRV_PCM_RATE_CONTINUOUS, + .rate_min = 5515, + .rate_max = 384000, .formats = AXG_FIFO_FORMATS, }, .ops = &axg_frddr_ops, @@ -184,7 +186,9 @@ static struct snd_soc_dai_driver g12a_frddr_dai_drv = { .stream_name = "Playback", .channels_min = 1, .channels_max = AXG_FIFO_CH_MAX, - .rates = AXG_FIFO_RATES, + .rates = SNDRV_PCM_RATE_CONTINUOUS, + .rate_min = 5515, + .rate_max = 384000, .formats = AXG_FIFO_FORMATS, }, .ops = &g12a_frddr_ops, diff --git a/sound/soc/meson/axg-toddr.c b/sound/soc/meson/axg-toddr.c index 1a0be177b8fe..32ee45cce7f8 100644 --- a/sound/soc/meson/axg-toddr.c +++ b/sound/soc/meson/axg-toddr.c @@ -131,7 +131,9 @@ static struct snd_soc_dai_driver axg_toddr_dai_drv = { .stream_name = "Capture", .channels_min = 1, .channels_max = AXG_FIFO_CH_MAX, - .rates = AXG_FIFO_RATES, + .rates = SNDRV_PCM_RATE_CONTINUOUS, + .rate_min = 5515, + .rate_max = 384000, .formats = AXG_FIFO_FORMATS, }, .ops = &axg_toddr_ops, @@ -226,7 +228,9 @@ static struct snd_soc_dai_driver g12a_toddr_dai_drv = { .stream_name = "Capture", .channels_min = 1, .channels_max = AXG_FIFO_CH_MAX, - .rates = AXG_FIFO_RATES, + .rates = SNDRV_PCM_RATE_CONTINUOUS, + .rate_min = 5515, + .rate_max = 384000, .formats = AXG_FIFO_FORMATS, }, .ops = &g12a_toddr_ops, From patchwork Fri Feb 23 17:51:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 775536 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2442BC5478C for ; Fri, 23 Feb 2024 17:53:52 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 47CAF828; Fri, 23 Feb 2024 18:53:40 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 47CAF828 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1708710830; bh=pW74uAnucYIjrEPj94jKbVgAMVavsh0mwkAjnRlWePk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=BAPouMZHSob0ZODWhEM2+z4osrXyK2bZFJVQ1i/VW8qlLHZZkKB04bbx6BXpci2q3 l/FouYx7/NtXVcRZNG7595gwEGEScCKdjKQceeRAoTVMo1nXJ13KShvceyW0/GYe/W VvZAlArXUthrjhA9S/vwBgi8pPdnIzeIZg/jQnss= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 36865F80699; Fri, 23 Feb 2024 18:51:59 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id B5F14F806A6; Fri, 23 Feb 2024 18:51:58 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7FE68F805DA; Fri, 23 Feb 2024 18:51:44 +0100 (CET) Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8CE19F804B0 for ; Fri, 23 Feb 2024 18:51:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8CE19F804B0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=gxyhoZun Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-33d01faf711so1021022f8f.1 for ; Fri, 23 Feb 2024 09:51:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1708710686; x=1709315486; darn=alsa-project.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=C1/AGt7uLQCyc0DA39X/n7sIWq1BnWpXSGWjqPrX0bo=; b=gxyhoZunqJxF+z9mpfpt47CN7UFHaJCpfK9wvM/S+h1pIdBc2hkl5CUeEBeJd2hB8t XOfhYDuxKXIdQXCmu304FWSdu6JZoDXQi3AGbtlxovuJ8S/+JBku2ulRIRMv6I9VIMJk b+tgkYkNGdsXhaU0aJr2/kMM9dH3vi0lYKvMb4DzMpa3NPHYHW3UGMsqP282GpXiGYjq iEmh/vs3kE7wU1MTs2YeiCminJtdHoB2krQ1ZT6sPbcjGYQPeVhqT6aQ861rCgkfrdO5 /NV9RqcTF+tvEgUy4xcuIJ4/wM2IVH0vD+bVHOstiFmZbCDcOLQI66nR1H7hvzbChfHW 4bBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708710686; x=1709315486; 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=C1/AGt7uLQCyc0DA39X/n7sIWq1BnWpXSGWjqPrX0bo=; b=e67t+t9gkc74BmS9IaLbxRDpTjhIzp1zG+KxfF6tYuopbDp6KbQkBptiCjgzPXFuHG scE8KUUO15jgj5HBfVV0w51EMa/bIA+6uzdpQam827+LX1WuDxG41yN6uoAQpT/uYJWh Cp7SXWpPqtoxz3n97Y/fHVBl5c2tT8Po8jfa42E1f+kuy20lO13vYCFFBk9AWn/cBNnj A8syDIkhjfF6qxMpSpdheqaLKClIxpwVH8QzVbC7e0dpoKBFxAOYHkdgm0ifK4LvapMW hBPsXR4Shi9DKXiyHjLIb6YDNwxsC7jd0cHn3uuI6zqMXVodbmTk31syPhJbuMcz+XEy krbA== X-Forwarded-Encrypted: i=1; AJvYcCV8l+KU6Ag0mHnP2jWiOaK05hWZVwpzkNZ8echWPik+A/xUSwhT9OGHwWiHjAZ+OXi+JEpbcqDslb3ZnTNmO3O3NhlH93KGukW6HYY= X-Gm-Message-State: AOJu0YzsldDyGx/XvFi1DxHn3zYYHYmNrUYw7hkwBn/2eaVQx3V2smLX V28wx73JHSmHfHf4DGP/59oQn77EGxVhwouSNJzSe9o2yJscQQWv8oI6O/oFw9s= X-Google-Smtp-Source: AGHT+IEPePMtPPf0gbB3B54/1cOa4I+uIJLCY5NUhl4hsQw9fY1wMXdm9tzTlTtsJfibzdZNlwi3Gw== X-Received: by 2002:adf:f984:0:b0:33d:b2d6:b3a6 with SMTP id f4-20020adff984000000b0033db2d6b3a6mr300283wrr.48.1708710686707; Fri, 23 Feb 2024 09:51:26 -0800 (PST) Received: from toaster.lan ([2a01:e0a:3c5:5fb1:e8a0:25a6:d4ec:a7ff]) by smtp.googlemail.com with ESMTPSA id bo10-20020a056000068a00b0033cddadde6esm3711524wrb.80.2024.02.23.09.51.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 09:51:26 -0800 (PST) From: Jerome Brunet To: Mark Brown , Liam Girdwood Cc: Jerome Brunet , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH 6/6] ASoC: meson: axg-fifo: use FIELD helpers Date: Fri, 23 Feb 2024 18:51:12 +0100 Message-ID: <20240223175116.2005407-7-jbrunet@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223175116.2005407-1-jbrunet@baylibre.com> References: <20240223175116.2005407-1-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify Message-ID-Hash: MQM3NAQP3BZARCQOYS3EKN4557GCMNJZ X-Message-ID-Hash: MQM3NAQP3BZARCQOYS3EKN4557GCMNJZ X-MailFrom: jbrunet@baylibre.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Use FIELD_GET() and FIELD_PREP() helpers instead of doing it manually. Signed-off-by: Jerome Brunet --- sound/soc/meson/axg-fifo.c | 24 ++++++++++++------------ sound/soc/meson/axg-fifo.h | 12 +++++------- sound/soc/meson/axg-frddr.c | 4 ++-- sound/soc/meson/axg-toddr.c | 21 +++++++++------------ 4 files changed, 28 insertions(+), 33 deletions(-) diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c index 65541fdb0038..597fd39e6e48 100644 --- a/sound/soc/meson/axg-fifo.c +++ b/sound/soc/meson/axg-fifo.c @@ -145,8 +145,8 @@ int axg_fifo_pcm_hw_params(struct snd_soc_component *component, /* Enable irq if necessary */ irq_en = runtime->no_period_wakeup ? 0 : FIFO_INT_COUNT_REPEAT; regmap_update_bits(fifo->map, FIFO_CTRL0, - CTRL0_INT_EN(FIFO_INT_COUNT_REPEAT), - CTRL0_INT_EN(irq_en)); + CTRL0_INT_EN, + FIELD_PREP(CTRL0_INT_EN, irq_en)); return 0; } @@ -176,9 +176,9 @@ int axg_fifo_pcm_hw_free(struct snd_soc_component *component, { struct axg_fifo *fifo = axg_fifo_data(ss); - /* Disable the block count irq */ + /* Disable irqs */ regmap_update_bits(fifo->map, FIFO_CTRL0, - CTRL0_INT_EN(FIFO_INT_COUNT_REPEAT), 0); + CTRL0_INT_EN, 0); return 0; } @@ -187,13 +187,13 @@ EXPORT_SYMBOL_GPL(axg_fifo_pcm_hw_free); static void axg_fifo_ack_irq(struct axg_fifo *fifo, u8 mask) { regmap_update_bits(fifo->map, FIFO_CTRL1, - CTRL1_INT_CLR(FIFO_INT_MASK), - CTRL1_INT_CLR(mask)); + CTRL1_INT_CLR, + FIELD_PREP(CTRL1_INT_CLR, mask)); /* Clear must also be cleared */ regmap_update_bits(fifo->map, FIFO_CTRL1, - CTRL1_INT_CLR(FIFO_INT_MASK), - 0); + CTRL1_INT_CLR, + FIELD_PREP(CTRL1_INT_CLR, 0)); } static irqreturn_t axg_fifo_pcm_irq_block(int irq, void *dev_id) @@ -204,7 +204,7 @@ static irqreturn_t axg_fifo_pcm_irq_block(int irq, void *dev_id) regmap_read(fifo->map, FIFO_STATUS1, &status); - status = STATUS1_INT_STS(status) & FIFO_INT_MASK; + status = FIELD_GET(STATUS1_INT_STS, status); if (status & FIFO_INT_COUNT_REPEAT) snd_pcm_period_elapsed(ss); else @@ -254,15 +254,15 @@ int axg_fifo_pcm_open(struct snd_soc_component *component, /* Setup status2 so it reports the memory pointer */ regmap_update_bits(fifo->map, FIFO_CTRL1, - CTRL1_STATUS2_SEL_MASK, - CTRL1_STATUS2_SEL(STATUS2_SEL_DDR_READ)); + CTRL1_STATUS2_SEL, + FIELD_PREP(CTRL1_STATUS2_SEL, STATUS2_SEL_DDR_READ)); /* Make sure the dma is initially disabled */ __dma_enable(fifo, false); /* Disable irqs until params are ready */ regmap_update_bits(fifo->map, FIFO_CTRL0, - CTRL0_INT_EN(FIFO_INT_MASK), 0); + CTRL0_INT_EN, 0); /* Clear any pending interrupt */ axg_fifo_ack_irq(fifo, FIFO_INT_MASK); diff --git a/sound/soc/meson/axg-fifo.h b/sound/soc/meson/axg-fifo.h index a14c31eb06d8..4c48c0a08481 100644 --- a/sound/soc/meson/axg-fifo.h +++ b/sound/soc/meson/axg-fifo.h @@ -40,21 +40,19 @@ struct snd_soc_pcm_runtime; #define FIFO_CTRL0 0x00 #define CTRL0_DMA_EN BIT(31) -#define CTRL0_INT_EN(x) ((x) << 16) +#define CTRL0_INT_EN GENMASK(23, 16) #define CTRL0_SEL_MASK GENMASK(2, 0) #define CTRL0_SEL_SHIFT 0 #define FIFO_CTRL1 0x04 -#define CTRL1_INT_CLR(x) ((x) << 0) -#define CTRL1_STATUS2_SEL_MASK GENMASK(11, 8) -#define CTRL1_STATUS2_SEL(x) ((x) << 8) +#define CTRL1_INT_CLR GENMASK(7, 0) +#define CTRL1_STATUS2_SEL GENMASK(11, 8) #define STATUS2_SEL_DDR_READ 0 -#define CTRL1_FRDDR_DEPTH_MASK GENMASK(31, 24) -#define CTRL1_FRDDR_DEPTH(x) ((x) << 24) +#define CTRL1_FRDDR_DEPTH GENMASK(31, 24) #define FIFO_START_ADDR 0x08 #define FIFO_FINISH_ADDR 0x0c #define FIFO_INT_ADDR 0x10 #define FIFO_STATUS1 0x14 -#define STATUS1_INT_STS(x) ((x) << 0) +#define STATUS1_INT_STS GENMASK(7, 0) #define FIFO_STATUS2 0x18 #define FIFO_INIT_ADDR 0x24 #define FIFO_CTRL2 0x28 diff --git a/sound/soc/meson/axg-frddr.c b/sound/soc/meson/axg-frddr.c index 98140f449eb3..97ca0ea5faa5 100644 --- a/sound/soc/meson/axg-frddr.c +++ b/sound/soc/meson/axg-frddr.c @@ -59,8 +59,8 @@ static int axg_frddr_dai_hw_params(struct snd_pcm_substream *substream, /* Trim the FIFO depth if the period is small to improve latency */ depth = min(period, fifo->depth); val = (depth / AXG_FIFO_BURST) - 1; - regmap_update_bits(fifo->map, FIFO_CTRL1, CTRL1_FRDDR_DEPTH_MASK, - CTRL1_FRDDR_DEPTH(val)); + regmap_update_bits(fifo->map, FIFO_CTRL1, CTRL1_FRDDR_DEPTH, + FIELD_PREP(CTRL1_FRDDR_DEPTH, val)); return 0; } diff --git a/sound/soc/meson/axg-toddr.c b/sound/soc/meson/axg-toddr.c index 32ee45cce7f8..5b08b4e841ad 100644 --- a/sound/soc/meson/axg-toddr.c +++ b/sound/soc/meson/axg-toddr.c @@ -19,12 +19,9 @@ #define CTRL0_TODDR_EXT_SIGNED BIT(29) #define CTRL0_TODDR_PP_MODE BIT(28) #define CTRL0_TODDR_SYNC_CH BIT(27) -#define CTRL0_TODDR_TYPE_MASK GENMASK(15, 13) -#define CTRL0_TODDR_TYPE(x) ((x) << 13) -#define CTRL0_TODDR_MSB_POS_MASK GENMASK(12, 8) -#define CTRL0_TODDR_MSB_POS(x) ((x) << 8) -#define CTRL0_TODDR_LSB_POS_MASK GENMASK(7, 3) -#define CTRL0_TODDR_LSB_POS(x) ((x) << 3) +#define CTRL0_TODDR_TYPE GENMASK(15, 13) +#define CTRL0_TODDR_MSB_POS GENMASK(12, 8) +#define CTRL0_TODDR_LSB_POS GENMASK(7, 3) #define CTRL1_TODDR_FORCE_FINISH BIT(25) #define CTRL1_SEL_SHIFT 28 @@ -76,12 +73,12 @@ static int axg_toddr_dai_hw_params(struct snd_pcm_substream *substream, width = params_width(params); regmap_update_bits(fifo->map, FIFO_CTRL0, - CTRL0_TODDR_TYPE_MASK | - CTRL0_TODDR_MSB_POS_MASK | - CTRL0_TODDR_LSB_POS_MASK, - CTRL0_TODDR_TYPE(type) | - CTRL0_TODDR_MSB_POS(TODDR_MSB_POS) | - CTRL0_TODDR_LSB_POS(TODDR_MSB_POS - (width - 1))); + CTRL0_TODDR_TYPE | + CTRL0_TODDR_MSB_POS | + CTRL0_TODDR_LSB_POS, + FIELD_PREP(CTRL0_TODDR_TYPE, type) | + FIELD_PREP(CTRL0_TODDR_MSB_POS, TODDR_MSB_POS) | + FIELD_PREP(CTRL0_TODDR_LSB_POS, TODDR_MSB_POS - (width - 1))); return 0; }