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: 13569812 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 9084EC54798 for ; Fri, 23 Feb 2024 17:52:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jc1ek3X769SywL7k8qAtubeSHU22ChYtMkjE+POoqq4=; b=KBA8RqeyxbG2cD FxNoWC8ri9Caqr8WXMEV9FdRpB36S//bGkKTO5IaAkEJL1/KsEhOSD8XASlqJWpJzdlUpAOcK2/5a gcFHxz5OhHWd1Rmj0loSlzL7be2gcaQcWKeLOpy8EE/adYiVwO2qRooh4hMGGh9VEsP+o/HA8n7a0 DIa1KseI0FWxqqpxyBuuNyhs+Gn1FmQU32bTAX4pDlNsIzKs1o03rkFqymZW9gmRHphOgD4ELO2XY rB0uzAeb0uhn32Me1fuY5quCuAdDyqkwWPoayB4LBVFIbHL9wYWLSaMgERTiiTIH0b2p5XhavJ1OY ufzg6ASuKxcjXrSBu8/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdZij-0000000Adzg-0wJX; Fri, 23 Feb 2024 17:52:25 +0000 Received: from mail-wm1-f51.google.com ([209.85.128.51]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdZht-0000000AdfU-3oRw for linux-amlogic@lists.infradead.org; Fri, 23 Feb 2024 17:51:38 +0000 Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-41282f05409so4541135e9.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=1708710682; x=1709315482; darn=lists.infradead.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=VC98c6ulb3jBl0L4g1GJCNVJx5+2XY8cpx2sPwZGQRwdaUNqMxRQCGLdbOk4WaUzSx BS+881rUVTepYsL7HXdoZ3A2B03iSzVfGfGFvAn/U8I2Tck2H/z7Kl8OWjBmOBcMUAcU Q92HM2IBabtbJ65HSP11435y3JJw0WxINfeaUkA2kH2XFWhzEpQ6X3qer37Mrq27eWP8 ydo8I/sn+cDGRwx+KG1ww9IBNrLCKmZTYrCE+/BpvqtXiVVfmqDnbqmBFqqyDq2nEPx+ 2BYVQSbNzyRKsvdb1WheEmSo4fPd+jxsM6nUP8V1giBNidPDD27vpjzmuAbCaMoIjSMs SKnQ== 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=NEr//q6IoZZOEWclnSioeGZWBr0hjNyz1nlU9+l/3CVuCFQH+2DDCAeGedfB0mo65a pkr757VVNpu+Dj8sO70modBsz19nqdfA6J0TEgr5pGPkkpqIi7wUDKn7JJvWnokdTs+7 qE6DCwhUyEuyvjdtP1si0eSoWCnakGuH50yiZWWR09eg6jkZ3oc15k2cT+a0cJshlWOo 5/GweV08iqO9Y5wdVH/2L0g9Mqg9ZNIeqvxgyhfvpfhi+kVn2BgozW8yOWTdv+PboPdC tR/ZVztKVWjhdAZ+OENvVprTptclkdF7Tyg0J7Loz/pz0stFheqFgurBwaUprNLTRbzp bZ/A== X-Forwarded-Encrypted: i=1; AJvYcCVujpN6+0tk8BlTmnUsz74XgLbscligHCLg0j/u+paj84rOXg4fTNgfcEl8FmvEK5a9AAfy+ISVQh9Kzg+WkzZrujGiW1Wfdz2KNJlOTXjPCBQ= X-Gm-Message-State: AOJu0Yy4whH+Yl9yREy18bVznEoACDHIXXw1Gv1y+bFEJ5PltB7PUTUH 69eU7YpbVruoqNJzYJY7TAXu1GoIWzQqEpl4Q+GcTDDCBUP22ZxGBbeAYeNJK4w= 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 X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org 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: 13569872 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 68F38C5478C for ; Fri, 23 Feb 2024 19:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JeqMotOJY1Crar3sigj0Ip4yXp+Cschcd+a+Jy/IPRM=; b=fqDavFRHik+4ni llG/gw+33t13icgtZzTBHF5gsNUcUzEMBnBUkFCUCKHO115qfmW5zcFEmhpw/G3j73V2hrLIbb9s4 dgI3FMQ6KPwNn8ewuFs2gSZNTPkA4Etf0EhowoQ3SG4AWqyBo4MU2yzaAyjq2HKUOqBMnh9CS17LQ gIyIEN/5HJDbjSjLp9OaUHthLZ0Jg9c4bUKbxLwM8KRfuQM/+6KU5Cu+fakUd6E1dg++5AB6vr1dR 3DCf0jJhAullFZIBSDScMVF71dNTYlZBLQaGNnuev0fEciEMq4aRJdftNqHsW5Or1rcT7JOwMBekz eXTq0Dc1WdgH22hahWXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdatN-0000000AxT0-3wVo; Fri, 23 Feb 2024 19:07:29 +0000 Received: from mail-wm1-f54.google.com ([209.85.128.54]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdZht-0000000AdfV-3tjh for linux-amlogic@lists.infradead.org; Fri, 23 Feb 2024 17:51:38 +0000 Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4125e435b38so4654375e9.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=1708710683; x=1709315483; darn=lists.infradead.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=RGuBGixiHUbBEEI6Lf0IXZnPDXn62RpknWn2RkWignUqrFCgTKbv6duzuFA4NR36v4 ow+cJEYsM3P4TfqsCh4OzZYoFUzLzS0WctRuxmp7ZDvhCne9KO1vFG90a4ZdPszTvl7c dL4VUou8OljDa/eCuspNNpdUutI3XKMopgJCZcrHCvk9+KK3NaTTQfSMk8UpChFuQgnZ /jgpCysadeyuRrHR1hxgO9ViRZCgvl3HHJDzDyFxTC00emOyjumoEpiBt4SI02RdufA2 aaRTvt4uXdFFkkLpcxpCh5Dtx5pE6NjELXO9j6FtTSnObf0qCIG1ur6m0RaYB+O5hv9+ oxgA== 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=rmeeTxhLDi7EEHKmjOfTEtz6mGf+noTn6+7iqOuQ1LO99xB9R0AvC5YzG+N9ciqWHt pbMaUJZy4DvYwfK+TsjXKXjW3/zDLLs4ACmEFFM4gW5VfM+tQ5S7PXpsm20wMYWd+QTN yPFkZfxxaUs5AtdLi2i0ChpwQYu4i0kuV8UU6KyI07o8y4eiaBjV9iuGDtg+Yjf0qZ5V SKSiSxILqukN5KiMXf89BWOnSioNsML5DCu3LS3Pf0P43Gslmo/7IiN3k16Crjh8vm7E KwJNzrvffogaEzw3pHvLP7rQNkRPAFgP/sMtAqP6M+CfQF8E8gNgVGmPToQ7cUOXMQbN dHNQ== X-Forwarded-Encrypted: i=1; AJvYcCXQU42WRDHNFGz6KosSdptxDvTGo5lWD/8JSRwOAbgPpP61qR03y38bYImm9SO1TskXJNJuWsCy/6wryRGWWTjZFZzSai+uBzvU4HvicHlyTn4= X-Gm-Message-State: AOJu0YwiTvP0SHmjebzgQ0J8+CnPsSvCSx8dtoxVNiVJHmdZns6rNj1s R8OoVS+JOMBXB6fx5v57wdmJuEL2rEVLercLRB0giQKL+Uf9t1QFMkwg/ow5E+k= 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 X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org 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: 13569811 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 89148C5478C for ; Fri, 23 Feb 2024 17:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Nb1+KS01X6ssM7aa2+1KsVDeb5c8FICQTL8djrw4iNM=; b=DreQuXjxj/toAq r0Ov9cgDBaxAmKOuNcLWlhUfhYBydRiQ/jmnAZ54Ls9NPtsfpW0oq0xyheChgVQ5uY7uEn8mKStQ4 LLCY1La6GZFdqJrp7Za2z4NLN1hAFdBiXkTKlrSu5Q89rGW5FyjtpCS9mwfvrFtJhFv2mu04l0pAS PMH3qkrRqpWJ2Oo0shCeYLj1RCuRvIHqF6wk77Ua7z977CX8amFZ7A8eSkuBMoUjuVed2HZveDNth tUl1SShhLGLRY09noGca5fCL15n8ILWFtIRxGaAVrxnAIySyMf8L2T5Jn4G3+XkRKMlAqx6WHzGZ0 8H6N+c0lMmnBj7pRMhCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdZiC-0000000Adt3-1pkQ; Fri, 23 Feb 2024 17:52:07 +0000 Received: from mail-wm1-f49.google.com ([209.85.128.49]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdZhu-0000000AdfW-05Vi for linux-amlogic@lists.infradead.org; Fri, 23 Feb 2024 17:51:38 +0000 Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-412934b98b8so6318725e9.3 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=1708710684; x=1709315484; darn=lists.infradead.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=X1x6pqDStYFozuoS9T+Xc8LCpR/MFFHDBeLSy6i+cLpDecAeIeEPr6kkjliEmu2KM/ hwsjxW4LHLh1VquhQNqwisOaHn3FO8RTv0PWvn4lZ1apKGjmYD3o6+mchqROpy25Sz9r xp+JSal7JaTPAncn6McaYY/HYTHjoxQ7sD9KsQFPVvoeW9W/I1WDRwN2pQT30yuObWgW UEnMlIb6HhJr6QpHOkqHnIRLL7oZQ5spvFTZkpK6My1v5XrWcJ8F4E+uQjKuC00xrN7A zfHsLEnhHngcDjPsgdJ4zRZJSJl7Y15/f6C2ijLpYp0hmrKuiGv35N9WGedr10L1qKaE TdxA== 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=IEIT2nYCP6K/VIHvVkpn6/NTvWxGD7VaZxkBmbpjS+A10I8ZBS8BAwyEdkp2CVwx5R l2O8lwcLryDjydmu/X0hVky5ajhhbbimYJgo+Fb4LRlE0w/YtRlBBiG1Hgh3aOHpqki7 ZNs6Q5qbR5bdUBJotnbRtqVxK/EHyiPYgce7HUxQ87zQCkLm1AfIHrpVAw1nE0EHV5+b krzrr2H4jCECh1LDoIyJ4oWS4OISox02bM5nrhBS7hdfGgxVQUoWlcZ1UyGXy2+NvhU9 ZV0VmNq/Phpb8rRfhc1WNK9YcReQSqSdg78HCKti8K+GUAg1g7aDIUtcj0lzDuIVeoyh dfhw== X-Forwarded-Encrypted: i=1; AJvYcCWdfbyCQfUAsiRLQAEv3HayNUGbsbcoKMLPfERmKdciz7Ee1/XVFvcVe/S+kGpaxfNxLNTw8qVqz0q7UBs+ceT+DZw7r48/dAXU3frQIzbZMao= X-Gm-Message-State: AOJu0Yz9ydANCxzqUdnrtZ0zhIJSAxTHkuN5OzD/VY6fRLf+dSEByoQR T1+OB8d6a6vSIhMcoewSbqwTYxXAZzIBKoKQN9XbWuzsHfNpxv4FjRI2KActxeVeRRyiwXONcsk k 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 X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org 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: 13569813 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 43EE2C5478C for ; Fri, 23 Feb 2024 17:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WWgx1JOp35O8JOH+cYGSEdliD5xbtZerAOrwJ2aw8As=; b=D2Wgm1YSIlty4R x5UqqDoLG8dmjU8Qn3iM67iUvrlOmxtCgDHUL5JLjL7wY/2HgjZdlJtGvvjLj13Wnh90nDDGDtuJW ADJjIadLaenqhbrrqbo8q9hKGI4/2ebL1OBxzucNtRhvqLTFT+m9Wtd/B+R0Xv2Z71Ail1ynq9jTZ E3yI9jIbnIt4vQZ9ZYAOBNf4JEiV1+Iv28/JKB9iOsQsWCbH3GsrHkDJuL15kdjMpWHaUZEHLSLmM 5jCVsJw+bZs4F4R9LfUJJ8+VW+sDhLP9uy8c+nZc1gNqvfd9SB4uJhg+zs8Q6/eyqorLtpbq4x6jY PvuiFms5va0jPfDH7gQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdZjD-0000000AeDv-2adc; Fri, 23 Feb 2024 17:52:56 +0000 Received: from mail-wm1-f50.google.com ([209.85.128.50]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdZht-0000000AdfX-3Kdd for linux-amlogic@lists.infradead.org; Fri, 23 Feb 2024 17:51:40 +0000 Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-412984360faso1702755e9.1 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=1708710685; x=1709315485; darn=lists.infradead.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=EInbHV5sQm+IMZp3+u2Chv3zcpCpu9azPtM1d8Js1Xpi4+Engmv1l0hcfW9+WCepv1 kuQtSs+gcT0Xqwna9Ex72VzzIC2J1BvcNhWfq2wsUrDr6yG0qfkl/Dg0xYhaeJTJdj2v 8anWP+Dlf+Q8N4CZ9Dq2Car0ybZ00ArzvygoOmeMjIRNWP4o4OqJOwl7aq+T7WD0cXvV T62iQtAGhqmiXhMoj6reOknu9mLpMkYQLCs1mrUxsMyYx5mAqegbp08cHvZaCDhnC6dp jl8egiLTw1mj1SWgIiiKFr9NpPKEOj6LU8IeJXT6XFxN+Q8a3cSSNJUAH4E3NbaiB4eG JS4g== 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=fx/4xq7YHJ9FfvOWoEqYE1z9mRXelpfQS0K4/hsi/fBUzIQ8e9SjHBH2YRIMzDvfok 1SReyMGwcMLZITc5SByEj5llsZTISCMOykUc9R75sYpz53eXePtEnCalSsqJyqNUo+bm Q9GOu3ogNZBxjsHddGN2016pRRbQzvt9bpY9qj0lmU0p65Z/rjcP8n32PmKTh8FQgsFc BBIkzUZS60QbUHw4AMgDOlm/jscTw1H3v+ffkzUltVYVi1cRp8ZDne959FOjHX8068tu 4gQ1JhuZtcJNYDtNHLX/Hf6ufB8nuglhApD9BbKyLBTPlfqnN7HwIkRRQaob3P3ovyAE y1Eg== X-Forwarded-Encrypted: i=1; AJvYcCVJpAX19oyWkH5EMI6Vap8cVbvK1Po4JOeAEYKlZafsfK63c8UPvHK2CSc5I87m/5lgJrc8VgTB7xU32wfeF+Vex3CtO0Qturf8PLsBoB8MlaU= X-Gm-Message-State: AOJu0YzxU6R2yg+0DhbrRSif0MbnyNXrfJVmXqgK9yrEY1PoNEzR2ldc BxAjL1JE7vtKUry/lIxGkaUQSN9R1vZ3/06Fl8yCfI5h1adcgrCIRje4YqNFS/w= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240223_095134_343646_6D3947A6 X-CRM114-Status: GOOD ( 12.33 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org 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: 13569809 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 25F7CC5478C for ; Fri, 23 Feb 2024 17:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t3GSHcb4sNYYNf9BEjk6S3pJizJM3cYqiabVPVXdFQ4=; b=VOzxd6cQCHYxqc JlhK0dyu8tJ62Kqz/XMPIxzGujVJ1QhJl/F0WJmmU4D6WTG8EZ+jq5h7iysrAMXERRV3hWPGE2tw+ 80dNsH8pHFG/DfivWfl7DY1dL2CYnJumVQBdXyeusiZUitfZTeTJ7/jb74FlVMjBsdwi3Eq9JIXxP csPzxjXTi7ff0OawR6594K6vIxGnOuWp22DBCew0ABt4w7nqKnUNs6ZqDv9UfVl+hFGpVh9h0mSb8 huLFL+DYcPC4GQwvoTcSII/zb+8SDQrjNGVqsCbebecPjPVYaVMhRiiMnt3DxVmOQptcTUOAL+peE zg8KjfY9++mdVo5InETQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdZi0-0000000AdpQ-0tTG; Fri, 23 Feb 2024 17:51:40 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdZhr-0000000Adft-24PP for linux-amlogic@bombadil.infradead.org; Fri, 23 Feb 2024 17:51:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=CvElMeb2g6xpqhFWcI8ix09RRMkAlSO99O6608hvkMQ=; b=IL2Zhwnp174Ctigm7i1L2vVGuE iTOmizsSivpWWwlaNEdXw8bh8lGe4nwyprmVF7/VezRbixFh7vHd1VPKft8NFCtrHKPOZi02t7U3R gjvBkMqU2F1rtx7SJ9FHmHnkbey2BfsAKxWWzj4BPl8lSEHJWyLKp898T4jeyxdav1ZL02HTzQhM3 5BB8iI3iGSTnx5hMJQ+aTiK4sUU+iJulJP8LIMdYrmPWePsis+V9qm2nrZk5ZZH/QyTAItI/kS74z C1w3Wgy7eWX2xh5bkT2BllTBoD1lB0Aco3OOILIEWGht5vhmWWeFjfxktUei6rnZh3hsxtcLhzR6t WgTcp4jw==; Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdZhn-000000003vn-0iYY for linux-amlogic@lists.infradead.org; Fri, 23 Feb 2024 17:51:30 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-33aeb088324so410426f8f.2 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=lists.infradead.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=dW9Ggraq2oLqyik7orjuHchtwWcUMuFizZB/5OZ00doFWi1cGVf4gVYHu9V/se3KHp FF+4PHalL94dsuu90Dl6kMlvDHLSYpekV0A8ZumphkOBcYTx/rFIQx46tPudXV49IwwW nKCcwi6OFihJz2JM1Kru3NFYMox/lOh0yRjOxaevY2cY2qf84ImRDuT9fN/tWfi+r7dD 1DYoWzUhIWnEk0UQyptm7egGKq2z6zGysnW5IstdneNMNafMhbcOVsMVkuyhx+ZO5CsQ 7CZYIfchIYQ8y3Wbh+rGonAlnQ96vnkF0rpakBBFdpkoGwrwJ2GaCU0vT6mddHaOENy2 njFA== 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=HagmScNytMkFMpNNljvOwqrm+OmgotzhpE4Mgao+CGQBowMlcvY5YuQd06rOs2VmI0 CrASK4liLnzAGzb68z8I90IY/Gk+q02s7x+ZW9MxfQIkbrq4aQOOnSys8gF0tCK5VKkt e270nnfI7lxIlea79QLFH4ykurxK76b5NsYsmtQP0/IpXhaPFapDLmInEwRudI01mtyq VjkAtvk+dswz5fOjmhyv7VeG45WMK/PGnpPXoRtfLfnaENXcq7dzuV4DO/M0xViTl7wJ XBpNXsBHDilMqnoaMCtluomFTjWR2GYKGV5Xv6w6CmYiWa0fT/DAyE+nwd4nvs3ponFr C/EA== X-Forwarded-Encrypted: i=1; AJvYcCVfCdxOa+17/oRiXJTpWfFW5qwi7Iwe9ByuR7FGsfHSYUqD8Pvm3dMG+0JXhlf66qzHMc68IvdlQoLUo7jXk/FkBexcOa83zEOC0JMWCItCSss= X-Gm-Message-State: AOJu0YzT+isAj1c+17YfzkgvfGRQ5J0RGr1ZJBWH+H438OaHFFgiU3HS 79jN0eoh3cIPhIgeV6uPRJufyCv6uhcFer2HWOsRSDeKB5X1QP+ZDM/6xUFIu7A73NfsIb9bnlI U 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240223_175128_465470_31755D89 X-CRM114-Status: GOOD ( 11.62 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org 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: 13569810 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 07869C54798 for ; Fri, 23 Feb 2024 17:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=A87V2gO58aqRhbHcYJ/bDMjBy2ZhfcENWgEcojXwzEg=; b=DAbqoy0VWGcRGl xcIy4zP0qA08SUJKwxoVCqmNz4/I+W0jiz7pvE4GUuqejHw//6CCJNL0sxjxdcRk4QuJkTNVDmAmL btZpChxrOdL54BXIWA2PputDg4KPuZorXu/b98D0JjrMPCRFnwuFzlNNkfPeYeocvL/PdfkbfailK i9wwHQbPBcgSkE+TyZmjsmGhYRCCsOj9yeNtCB14lcxdrrWPgPz6roc6EKSPJ9ox0m27z8rdywBN9 f5f43puylMg7tfKg4Z0bMLq1mdUq6fDemdkdyYxgfaXy+pOhJJGM6OHDgpOAiUpjBmcSFwfJb1+4A GBz9fox1f5HuPOSfM0dg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdZhx-0000000Adm8-0oax; Fri, 23 Feb 2024 17:51:37 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdZhr-0000000Adfs-1yZt for linux-amlogic@bombadil.infradead.org; Fri, 23 Feb 2024 17:51:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=C1/AGt7uLQCyc0DA39X/n7sIWq1BnWpXSGWjqPrX0bo=; b=aJljQ4JSS5QFcyrhxy5Iq8x4fI L1E+iyFPAyDJId13n4LKuauTC9LY9s1bTjT9gXjwZLNK/ULNY0arZ7FyNfkmnuhY/ii/n/+4GTs6c jHMTMIFnBRMsx3ZmZnsI5LS2WUEjXO8PyreC4VUjG/4CbWB5NPeZJx6rSRJvX/ydvjKqQuompwyY8 sL3UcxRIsBJn7oxVwIgNgNF98OZlKY7vqccOs5uiCaigxOOox3YibE++owaD6G2VkGr9WM3PghK+O CJ2ghPjgNmIC/BMCExqHMdKwTouWQz+5bhHv7jEP2Vq0xcy+A3XH7uAC0b14RdqUQzl4QoX4T9I08 H2WuAhGg==; Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdZhn-000000003vo-0ida for linux-amlogic@lists.infradead.org; Fri, 23 Feb 2024 17:51:30 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4127190ad83so7592675e9.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=lists.infradead.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=LFZdBfewPC7GCJXbzU8hFaA4JunMnhduEHSx1GounyyPqzA3P8TzFBijKEr1xza/ZT x9AxxxlVFwGT3ckhjKyOVRnKadF9fLwJjKDYp/MQzA01IxT04RDhIJd3QFxGQZE2rjCx kDeAmrWfJA8T2ln49wLIuFJg4YbpBw0coYjbm+nWDz/jL7sLrB1UjAg3Gugi7Ajgp+oh lweqmRegkEfPGjY3m0wLG3Xh5RwqzQ1EJVbbors9UrP6ZJl8j1RSYFiqrcBFppWhT7rR QI5gLHzG3yYV/apvMujEuvFHfYFt4CLlq5GDM00M9R6NJDxCgaG5zfy6a1lFFxNEQ6LA IfTw== 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=WGlaavm+rU+3byui8HwT9Jd2mlQNAQmnVxXGBv37m1L6SksJrL7baU+Hj/QTRVNkdE IR2p2fg8UC20Vu3vN8H9S1Snt+uoxnz19e8jvwPpy1BGn2gFVXu3fP4+Rc9lNdHtjXYF +f6KVL/lLvLQgAxLGodxvDDTBokB5AJFn52Q607xTRiPiF4Y21qFw6gKELuL5OfJXf37 0qPBw02ug93EYOATmdaAAFUj/yZmIqQnvTsAtNqCZ7/aSCqlZDp1jalyAFQti5dtBmng WMQLmoDO8F6y/tkpmQyJeNOt1CsQg0lE/bvkb5YwFq6eWEsPa7b5xYc/o88cYCNQn2Nm 2Z6Q== X-Forwarded-Encrypted: i=1; AJvYcCVdERzRlCkCja9/g5tAsMRZauz9UApP7Cw+2KhyMiJ5cYcjKfVsoEfhdZrTaSRiMeVzyfQbtrmANPJlgL53WjjlMdMpGSoz/25OXLTX7l6mvF0= X-Gm-Message-State: AOJu0YxmS+DfleL3JdT1H10l+8LjnLA/1BjJCQ9TSbuzEKHvzIdR2vOg 9DaKrVFMzhSN9QSMNIlXdB4jEu1pWCfqNb58NXFneGVf12L4eAV4lSKWneCtl6I= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240223_175128_470039_3BE39C3A X-CRM114-Status: GOOD ( 14.19 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org 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; }