From patchwork Thu Feb 20 20:57:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 11395047 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF11A17F0 for ; Thu, 20 Feb 2020 20:57:49 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id CD50520679 for ; Thu, 20 Feb 2020 20:57:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Wj/BSqQH"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b="MXSn1rgd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD50520679 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ibXZhKlTOUv0JNiV0wla83xlF6AL152DbX2bqHwRYTE=; b=Wj/BSqQHKXtEkh 9BnzuUiBWdFtRvea1O893G2Up8ZsrerttpRDCLDGwX3BdcBFi36mr2rkd2MK1+976IZ3dP+NANYnI ohjCJEtzNlysaGCwHnCefbxQtNLJLo6xCG/ZCb3yipM1QLGVCGm8rosjSFjFROFX6snE/kjkhnk9O Wi6IUM+hqBo5/LFsdZWVGEyTXm+8DN4l0XWxT4/sIbFWByMm6SthoE+R/hNRdTmyCudQ4j9GaK3DS iC3lNuPjKgOHJxLodj6bov7IRe/LQOCZvqT8QymT4v2AUQUeDnbvuas2pl58MVzWGoNW3CIzFj7tX n4+PmdragOn4DVi36P3g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j4stI-0003wg-WF; Thu, 20 Feb 2020 20:57:49 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j4ssq-0003dP-OI; Thu, 20 Feb 2020 20:57:21 +0000 Received: by mail-wr1-x441.google.com with SMTP id m16so6139315wrx.11; Thu, 20 Feb 2020 12:57:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2f3uV3RWKbMqCO2QFYzkPoEF8LM6TNVDI/Gi9TBUfHI=; b=MXSn1rgdt7P3tH8KZP0tFbRW6901b2HrvP3o9gUFzYQW2YGGn1fvKWV5NbQR8QnUEm VVPdxU2ZVBFz09WF9nLh6Th61kWM5IYt2PHvpZ5fMlsHe/S4YDfA6kqHtd6/bzu3Vctd gzuBSqpJ865xupjulzXrZpNZs2zBp6Sqbey6Yp7xpAaCm9ojA3Y3OBWgDOVD1pYeL9hi RiQQYprFLTNE0iABe1B0lPQOJWgYGIyYrFrBQy6rH9OSpUKysGYV2sC3AEo7pVGr0q7g +1d/YnfZyo9if35mQTuIQqcesG72SynQdXGtogTKJuXOSrLvOxVNtZr3BG6YaVnJgxUA 5L8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2f3uV3RWKbMqCO2QFYzkPoEF8LM6TNVDI/Gi9TBUfHI=; b=Fk9eqfKns1Smz16RvEKfxpIkpKKpPifMkyWD2KhX+mXZyn1f4kgShUmG/Fq9D2UQqh PreRMZqn7bfHh5yMxSraIRUGQJrO+gOt9p/ivb+TstTaAtHLVbptks3tpDLhasGmAqx9 o3n3UCTvzcwOr6kJlJz+CRWBC+iRIYkT2c+n8vPWuRV47533U8+3Y8ZpYZ0VpKsIb2e3 7Vo8WXZc4n59xU1jeyeNf1fXZH1Fm7VXC/On05Bq94L+UB8QhpvwLMU8NTC15eiKqmg+ ZjJHwMJsSHVNGF5Gl/7Znm5cJJCMW1zY2fAtckbjHFm6JiaAIlH5Z9f1jArVYFDYRB8h Qx9A== X-Gm-Message-State: APjAAAUDjskbsW5yZZPntzcu72mzDKZ3nYAmpVs4yeNJC0LD8ZGj6s2w Y66M9yUuZgjIPXRXiI2NURk= X-Google-Smtp-Source: APXvYqxE6O1xRP/s3Eex8+uTAabiof5+67V1QlISYwfPiFGVMeLM+jOyIb3TGVjHrpRx4Ny1OfKZJQ== X-Received: by 2002:adf:f787:: with SMTP id q7mr44114421wrp.297.1582232239167; Thu, 20 Feb 2020 12:57:19 -0800 (PST) Received: from localhost.localdomain (p200300F1373A1900428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:373a:1900:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id a184sm695039wmf.29.2020.02.20.12.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2020 12:57:18 -0800 (PST) From: Martin Blumenstingl To: jbrunet@baylibre.com, broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH 1/3] ASoC: meson: aiu: Document Meson8 and Meson8b support in the dt-bindings Date: Thu, 20 Feb 2020 21:57:09 +0100 Message-Id: <20200220205711.77953-2-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200220205711.77953-1-martin.blumenstingl@googlemail.com> References: <20200220205711.77953-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200220_125720_788362_D763629B X-CRM114-Status: GOOD ( 10.07 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:441 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [martin.blumenstingl[at]googlemail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lgirdwood@gmail.com, Martin Blumenstingl , linux-kernel@vger.kernel.org, tiwai@suse.com, perex@perex.cz, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org The AIU audio output controller on the Meson8 and Meson8b SoC families is compatible with the one found in the GXBB family. Document the compatible string for these two older SoCs. Signed-off-by: Martin Blumenstingl Reviewed-by: Jerome Brunet --- Documentation/devicetree/bindings/sound/amlogic,aiu.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/amlogic,aiu.yaml b/Documentation/devicetree/bindings/sound/amlogic,aiu.yaml index 3ef7632dcb59..a61bccf915d8 100644 --- a/Documentation/devicetree/bindings/sound/amlogic,aiu.yaml +++ b/Documentation/devicetree/bindings/sound/amlogic,aiu.yaml @@ -21,6 +21,8 @@ properties: - enum: - amlogic,aiu-gxbb - amlogic,aiu-gxl + - amlogic,aiu-meson8 + - amlogic,aiu-meson8b - const: amlogic,aiu From patchwork Thu Feb 20 20:57:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 11395051 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 287F1924 for ; Thu, 20 Feb 2020 20:58:12 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 06DD620679 for ; Thu, 20 Feb 2020 20:58:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Z/6PBKYo"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b="Tw8m8gSM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06DD620679 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wy4A7Uh74Pst7Tq9RzowFAtvaSPWvw8xFY2tS5JspJY=; b=Z/6PBKYoLS7WFQ 2mDBenJPD4VXGIp3IocaoXIE6oz57avryWRDGFBgKc0RjqJJS9L2/Uz7uNoXpIoqzAIh6THvGi8/6 ocmf9kP7HSP9X8Py9imCecHHsKSFixQjkdhP8iyl35siTMUaKRZrkcN+I2E1YXdBHrPuMlBG15cNn jE15FYqCWeyKBb/r3GtU8bjCeoT6j1dSKVvk3zJbLDJERNJJ0DuWjXrdYb/JfjeETttr8WpzRvnQS XRXE1WmAoO/eh55ma2fiB9EBzRXP/FXaZuTaXeW3CLoJyNthcfjkGhcgThnCscDXKiaRENP4BWrLz 3Hcobp5+F/bMDi3e6lnw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j4stf-0004E2-HX; Thu, 20 Feb 2020 20:58:11 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j4ssr-0003du-NB; Thu, 20 Feb 2020 20:57:23 +0000 Received: by mail-wr1-x441.google.com with SMTP id e8so6180527wrm.5; Thu, 20 Feb 2020 12:57:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RG8nTnetEI+zdQjFw+fmF3JKM7yL0FmTV3DulfAKQCE=; b=Tw8m8gSMOT8HmDjVje0Qqtmvu1U75EqYkkj4CDyN694mrjiG4H9ixFL2ezGX4KPDP3 RjqIMJCIlrU/m0Shxaa2uhHl2wTuHEFrA/kHFDRSTPMlEKfIWben3M4DFLBuw6204jVH iTuKVmWjSCBJr04vHF7OQcG73RbDcNi+T4WQtGbPHEwnhg4ioIebtxFg/2etrbwniV8Z HZEGb5wo+0xV8CYGYPyAoIZT3j6IJrBTt1glz3IaW9CBQpuFO03JuAkS5OfG6GH8ppkL hEQywUFRlH6qC359qrWtBjGugkoIYB3bc31prtrRyNhxwPULco1Mb3dkG1DM8Ydozbeu TqxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RG8nTnetEI+zdQjFw+fmF3JKM7yL0FmTV3DulfAKQCE=; b=Soklya1OU8xNuERmwsQqAq7DXKu+v2XX+6Xp6OBx9yqwpn5Wg+szG7+iMWn8U6SDeJ MLW1aSYamHIwZbB8qTwQ1mz9XaJDwHSczB7YpdeRuCbj6crGBqJhL3j3FPUZoSphfdVO nDna7OMF4xZThD1jlczfAQhoHSl+QWzFuAJgXMlxJeRktzIe9LhZUirg0sGe7nvkef7I y0qaNUDlDqPDXzo7EFM3h9xHYFafS5zQj92Ged5eztqTPanKfFhRJ6VQV9a7itkczFxu Y9LT4GK51/88T2izbikb2Oek4jjY1MSvOrVZJQJNwpo0mZ7FhleDVziCNMuzWQ4hRTBK mTwA== X-Gm-Message-State: APjAAAVnqGwXMIknPRym1TAXtNjAom/Hsf0BnoqWtdVaQ/+45Y9hADP3 eHh4at4h427DSN/NJhMhbvg= X-Google-Smtp-Source: APXvYqxlxFGLAA9Vo8M059FO6ksBPW7ZfiFJySSp6CnBQQsFIx7JY0Gf28LdZvkjqbiU1JCkeMKvAQ== X-Received: by 2002:adf:ecc2:: with SMTP id s2mr44990985wro.263.1582232240472; Thu, 20 Feb 2020 12:57:20 -0800 (PST) Received: from localhost.localdomain (p200300F1373A1900428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:373a:1900:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id a184sm695039wmf.29.2020.02.20.12.57.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2020 12:57:19 -0800 (PST) From: Martin Blumenstingl To: jbrunet@baylibre.com, broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH 2/3] ASoC: meson: aiu: introduce a struct for platform specific information Date: Thu, 20 Feb 2020 21:57:10 +0100 Message-Id: <20200220205711.77953-3-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200220205711.77953-1-martin.blumenstingl@googlemail.com> References: <20200220205711.77953-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200220_125721_755824_3D0887BC X-CRM114-Status: GOOD ( 14.56 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:441 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [martin.blumenstingl[at]googlemail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lgirdwood@gmail.com, Martin Blumenstingl , linux-kernel@vger.kernel.org, tiwai@suse.com, perex@perex.cz, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org Introduce a struct aiu_platform_data to make the driver aware of platform specific information. Convert the existing check for the internal stereo audio codec (only available on GXL) to this new struct. Support for the 32-bit SoCs will need this as well because the AIU_CLK_CTRL_MORE register doesn't have the I2S divider bits (and we need to use the I2S divider from AIU_CLK_CTRL instead). Signed-off-by: Martin Blumenstingl Reviewed-by: Jerome Brunet --- sound/soc/meson/aiu.c | 19 ++++++++++++++++--- sound/soc/meson/aiu.h | 5 +++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c index d3e2d40e9562..38209312a8c3 100644 --- a/sound/soc/meson/aiu.c +++ b/sound/soc/meson/aiu.c @@ -273,6 +273,11 @@ static int aiu_probe(struct platform_device *pdev) aiu = devm_kzalloc(dev, sizeof(*aiu), GFP_KERNEL); if (!aiu) return -ENOMEM; + + aiu->platform = device_get_match_data(dev); + if (!aiu->platform) + return -ENODEV; + platform_set_drvdata(pdev, aiu); ret = device_reset(dev); @@ -322,7 +327,7 @@ static int aiu_probe(struct platform_device *pdev) } /* Register the internal dac control component on gxl */ - if (of_device_is_compatible(dev->of_node, "amlogic,aiu-gxl")) { + if (aiu->platform->has_acodec) { ret = aiu_acodec_ctrl_register_component(dev); if (ret) { dev_err(dev, @@ -344,9 +349,17 @@ static int aiu_remove(struct platform_device *pdev) return 0; } +static const struct aiu_platform_data aiu_gxbb_pdata = { + .has_acodec = false, +}; + +static const struct aiu_platform_data aiu_gxl_pdata = { + .has_acodec = true, +}; + static const struct of_device_id aiu_of_match[] = { - { .compatible = "amlogic,aiu-gxbb", }, - { .compatible = "amlogic,aiu-gxl", }, + { .compatible = "amlogic,aiu-gxbb", .data = &aiu_gxbb_pdata }, + { .compatible = "amlogic,aiu-gxl", .data = &aiu_gxl_pdata }, {} }; MODULE_DEVICE_TABLE(of, aiu_of_match); diff --git a/sound/soc/meson/aiu.h b/sound/soc/meson/aiu.h index 06a968c55728..ab003638d5e5 100644 --- a/sound/soc/meson/aiu.h +++ b/sound/soc/meson/aiu.h @@ -27,11 +27,16 @@ struct aiu_interface { int irq; }; +struct aiu_platform_data { + bool has_acodec; +}; + struct aiu { struct clk *pclk; struct clk *spdif_mclk; struct aiu_interface i2s; struct aiu_interface spdif; + const struct aiu_platform_data *platform; }; #define AIU_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ From patchwork Thu Feb 20 20:57:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 11395055 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A3A4924 for ; Thu, 20 Feb 2020 20:58:24 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1B0AB222C4 for ; Thu, 20 Feb 2020 20:58:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="G2mgdLd/"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b="b6Q3mgJE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B0AB222C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Qp9CJF11bPHBBkDghSTAph6lkUKPP1dUhAvcMVAdemg=; b=G2mgdLd/giXMpc itBwMocnRx7GTh44JTomeFASEu2rCCmDf1kJKl8tx6368+vDhHt9Z1RJD6BLK+3++DpyrVJ/30iCR MGSa7xREB2hYtj1A5+9/QVEBqCYdubEq4WBxnqPDus/amGN2TfHmUnsvBNNg8gxbcGgoCSzO+7DtW 8VQN6Vh3SkxqVG200r2tsu5LdHKsk0bPBELT8/p14qKwZ+jTEHicU5MpgQsZokKYeih6erJ4gfdYr 7zG/5YwCuTJzRIzvUp5Hu7pN/ueqvXXQ5gvK6PhtTOsMnrOfZ/YvMQHEUXoU9QHr1YDA3MhDwvU4g DnMLi5jtmqnD7hXkvpNA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j4stq-0004T3-SV; Thu, 20 Feb 2020 20:58:22 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j4sst-0003en-0X; Thu, 20 Feb 2020 20:57:24 +0000 Received: by mail-wr1-x444.google.com with SMTP id w12so6204078wrt.2; Thu, 20 Feb 2020 12:57:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=O9H0QZyYuaUeSBKWNz88pbKgmPYyIAQJ2VGIcN7sek0=; b=b6Q3mgJE/4X0ENVknSqB4BtsyvQ74D276ZzvnPLSb7sg7O+6chdR1qLWsLsIDf25vJ hFELriumpX90BRiMoHhBeLiOe+eK8z3s29hsNJM6JYhBpiUkFzlRJcjWkSslZANli+w3 vizSo+w7cNiah9ptmHqyTO6fOJ2Z1FYUeP4uFO3SJra4UWofMbcgcO+jgcAQsPrYpQaZ hLQ/BJq3fiK5EZXom38aJkJ7xmL+cY2EVEFaK89D6wWp5vW0IJsCAQJd4siKS6m5Zs7u YuI7WrCS3XX656MKm9ELKGHESQ7YJG9OsD5J7FYsTdPx+PTKkmP6YVSbp3us4NI4sT6n Iyqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O9H0QZyYuaUeSBKWNz88pbKgmPYyIAQJ2VGIcN7sek0=; b=SizvXZiF318rGhj+1nltQ+TuDIaDM2RNsWTKwQalRNWl3NyJSG89xnFDgqfCOVnZFp Jg6fzSLEMK0tU7sEPySeRG20mj7EpyFkK04KPcl78CqjfLR3Ht2O18U9wskm4EmO3Oqs IJaBfZtiG8StfoSKz2fvaDPq/0+ks/tIKsTBUd6KZPLFoASz7RP/7HjzHKC9iN3rwRZe Tp6Eu2fxV9mYLdst4Dh5Dk4RAsImqdU4GLTL8xP83x3H2LZywSUa763YYKeypGcjUw48 9san114e/onyWnmvv69sLO+MNPnSAJekS44H9DstlWzz+gHAgp9QPJHPrPz8y1t8Ut5W svpA== X-Gm-Message-State: APjAAAVf5UTaYahVMak3+N+Ee9UvE7MeSPelnnLVcV7J6gv0VRApKDrb 8itl6jBMf0p1QFO4PqIG8CY= X-Google-Smtp-Source: APXvYqxYZID8xJsIWV9Ml8b2mVsDTj0py1fbWd0tADweJ9z/lQnfqtkr1cSxhaTtWPJxJis6vxvwGA== X-Received: by 2002:adf:a39a:: with SMTP id l26mr43640993wrb.211.1582232241757; Thu, 20 Feb 2020 12:57:21 -0800 (PST) Received: from localhost.localdomain (p200300F1373A1900428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:373a:1900:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id a184sm695039wmf.29.2020.02.20.12.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2020 12:57:21 -0800 (PST) From: Martin Blumenstingl To: jbrunet@baylibre.com, broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH 3/3] ASoC: meson: aiu: add support for the Meson8 and Meson8b SoC families Date: Thu, 20 Feb 2020 21:57:11 +0100 Message-Id: <20200220205711.77953-4-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200220205711.77953-1-martin.blumenstingl@googlemail.com> References: <20200220205711.77953-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200220_125723_121692_1A269019 X-CRM114-Status: GOOD ( 20.13 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.3 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:444 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [martin.blumenstingl[at]googlemail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lgirdwood@gmail.com, Martin Blumenstingl , linux-kernel@vger.kernel.org, tiwai@suse.com, perex@perex.cz, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org The AIU audio controller on the Meson8 and Meson8b SoC families is compatible with the one found in the later GXBB family. Add compatible strings for these two older SoC families so the driver can be loaded for them. Instead of using the I2S divider from the AIU_CLK_CTRL_MORE register we need to use the I2S divider from the AIU_CLK_CTRL register. This older register is less flexible because it only supports four divider settings (1, 2, 4, 8) compared to the AIU_CLK_CTRL_MORE register (which supports dividers in the range 0..64). Signed-off-by: Martin Blumenstingl Reviewed-by: Jerome Brunet --- sound/soc/meson/Kconfig | 2 +- sound/soc/meson/aiu-encoder-i2s.c | 92 +++++++++++++++++++++++-------- sound/soc/meson/aiu.c | 9 +++ sound/soc/meson/aiu.h | 1 + 4 files changed, 81 insertions(+), 23 deletions(-) diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig index 897a706dcda0..d27e9180b453 100644 --- a/sound/soc/meson/Kconfig +++ b/sound/soc/meson/Kconfig @@ -10,7 +10,7 @@ config SND_MESON_AIU imply SND_SOC_HDMI_CODEC if DRM_MESON_DW_HDMI help Select Y or M to add support for the Audio output subsystem found - in the Amlogic GX SoC family + in the Amlogic Meson8, Meson8b and GX SoC families config SND_MESON_AXG_FIFO tristate diff --git a/sound/soc/meson/aiu-encoder-i2s.c b/sound/soc/meson/aiu-encoder-i2s.c index 4900e38e7e49..cc73b5d5c2b7 100644 --- a/sound/soc/meson/aiu-encoder-i2s.c +++ b/sound/soc/meson/aiu-encoder-i2s.c @@ -111,34 +111,40 @@ static int aiu_encoder_i2s_setup_desc(struct snd_soc_component *component, return 0; } -static int aiu_encoder_i2s_set_clocks(struct snd_soc_component *component, - struct snd_pcm_hw_params *params) +static int aiu_encoder_i2s_set_legacy_div(struct snd_soc_component *component, + struct snd_pcm_hw_params *params, + unsigned int bs) { - struct aiu *aiu = snd_soc_component_get_drvdata(component); - unsigned int srate = params_rate(params); - unsigned int fs, bs; - - /* Get the oversampling factor */ - fs = DIV_ROUND_CLOSEST(clk_get_rate(aiu->i2s.clks[MCLK].clk), srate); + switch (bs) { + case 1: + case 2: + case 4: + case 8: + /* These are the only valid legacy dividers */ + break; - if (fs % 64) + default: + dev_err(component->dev, "Unsupported i2s divider: %u\n", bs); return -EINVAL; + }; - /* Send data MSB first */ - snd_soc_component_update_bits(component, AIU_I2S_DAC_CFG, - AIU_I2S_DAC_CFG_MSB_FIRST, - AIU_I2S_DAC_CFG_MSB_FIRST); + snd_soc_component_update_bits(component, AIU_CLK_CTRL, + AIU_CLK_CTRL_I2S_DIV, + FIELD_PREP(AIU_CLK_CTRL_I2S_DIV, + __ffs(bs))); - /* Set bclk to lrlck ratio */ - snd_soc_component_update_bits(component, AIU_CODEC_DAC_LRCLK_CTRL, - AIU_CODEC_DAC_LRCLK_CTRL_DIV, - FIELD_PREP(AIU_CODEC_DAC_LRCLK_CTRL_DIV, - 64 - 1)); + snd_soc_component_update_bits(component, AIU_CLK_CTRL_MORE, + AIU_CLK_CTRL_MORE_I2S_DIV, + FIELD_PREP(AIU_CLK_CTRL_MORE_I2S_DIV, + 0)); - /* Use CLK_MORE for mclk to bclk divider */ - snd_soc_component_update_bits(component, AIU_CLK_CTRL, - AIU_CLK_CTRL_I2S_DIV, 0); + return 0; +} +static int aiu_encoder_i2s_set_more_div(struct snd_soc_component *component, + struct snd_pcm_hw_params *params, + unsigned int bs) +{ /* * NOTE: this HW is odd. * In most configuration, the i2s divider is 'mclk / blck'. @@ -146,7 +152,6 @@ static int aiu_encoder_i2s_set_clocks(struct snd_soc_component *component, * increased by 50% to get the correct output rate. * No idea why ! */ - bs = fs / 64; if (params_width(params) == 16 && params_channels(params) == 8) { if (bs % 2) { dev_err(component->dev, @@ -156,11 +161,54 @@ static int aiu_encoder_i2s_set_clocks(struct snd_soc_component *component, bs += bs / 2; } + /* Use CLK_MORE for mclk to bclk divider */ + snd_soc_component_update_bits(component, AIU_CLK_CTRL, + AIU_CLK_CTRL_I2S_DIV, + FIELD_PREP(AIU_CLK_CTRL_I2S_DIV, 0)); + snd_soc_component_update_bits(component, AIU_CLK_CTRL_MORE, AIU_CLK_CTRL_MORE_I2S_DIV, FIELD_PREP(AIU_CLK_CTRL_MORE_I2S_DIV, bs - 1)); + return 0; +} + +static int aiu_encoder_i2s_set_clocks(struct snd_soc_component *component, + struct snd_pcm_hw_params *params) +{ + struct aiu *aiu = snd_soc_component_get_drvdata(component); + unsigned int srate = params_rate(params); + unsigned int fs, bs; + int ret; + + /* Get the oversampling factor */ + fs = DIV_ROUND_CLOSEST(clk_get_rate(aiu->i2s.clks[MCLK].clk), srate); + + if (fs % 64) + return -EINVAL; + + /* Send data MSB first */ + snd_soc_component_update_bits(component, AIU_I2S_DAC_CFG, + AIU_I2S_DAC_CFG_MSB_FIRST, + AIU_I2S_DAC_CFG_MSB_FIRST); + + /* Set bclk to lrlck ratio */ + snd_soc_component_update_bits(component, AIU_CODEC_DAC_LRCLK_CTRL, + AIU_CODEC_DAC_LRCLK_CTRL_DIV, + FIELD_PREP(AIU_CODEC_DAC_LRCLK_CTRL_DIV, + 64 - 1)); + + bs = fs / 64; + + if (aiu->platform->has_clk_ctrl_more_i2s_div) + ret = aiu_encoder_i2s_set_more_div(component, params, bs); + else + ret = aiu_encoder_i2s_set_legacy_div(component, params, bs); + + if (ret) + return ret; + /* Make sure amclk is used for HDMI i2s as well */ snd_soc_component_update_bits(component, AIU_CLK_CTRL_MORE, AIU_CLK_CTRL_MORE_HDMI_AMCLK, diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c index 38209312a8c3..dc35ca79021c 100644 --- a/sound/soc/meson/aiu.c +++ b/sound/soc/meson/aiu.c @@ -351,15 +351,24 @@ static int aiu_remove(struct platform_device *pdev) static const struct aiu_platform_data aiu_gxbb_pdata = { .has_acodec = false, + .has_clk_ctrl_more_i2s_div = true, }; static const struct aiu_platform_data aiu_gxl_pdata = { .has_acodec = true, + .has_clk_ctrl_more_i2s_div = true, +}; + +static const struct aiu_platform_data aiu_meson8_pdata = { + .has_acodec = false, + .has_clk_ctrl_more_i2s_div = false, }; static const struct of_device_id aiu_of_match[] = { { .compatible = "amlogic,aiu-gxbb", .data = &aiu_gxbb_pdata }, { .compatible = "amlogic,aiu-gxl", .data = &aiu_gxl_pdata }, + { .compatible = "amlogic,aiu-meson8", .data = &aiu_meson8_pdata }, + { .compatible = "amlogic,aiu-meson8b", .data = &aiu_meson8_pdata }, {} }; MODULE_DEVICE_TABLE(of, aiu_of_match); diff --git a/sound/soc/meson/aiu.h b/sound/soc/meson/aiu.h index ab003638d5e5..87aa19ac4af3 100644 --- a/sound/soc/meson/aiu.h +++ b/sound/soc/meson/aiu.h @@ -29,6 +29,7 @@ struct aiu_interface { struct aiu_platform_data { bool has_acodec; + bool has_clk_ctrl_more_i2s_div; }; struct aiu {