Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3878208pxk; Tue, 22 Sep 2020 05:11:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymnXYA2woLpfbXzgBI6dC4GdqZVm9ulga+660iRY6fsza496XUGlt662G7WedLG/yNdvpY X-Received: by 2002:a17:906:9a1:: with SMTP id q1mr4497831eje.30.1600776677105; Tue, 22 Sep 2020 05:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600776677; cv=none; d=google.com; s=arc-20160816; b=om6td4H7QuCKMRelhkhoKLrWslSyjPG8nV+GyW1wESCSM4o4YywvQmmLCD0PlImeUF 7VrAEOogrUpmiWqAci7PZnvGkvlmVKH6P+7sFprpOo9N9q0+ISJkUHP6mRNEMIgOgUKC Qa0qMaRMg6xf+g2+tIFqU19Uk5B3QZ/dtfiq7gJh+WcknFzGlpzDZ/9c5yBgNjNXl4Yr 3sFi4evLpVN5KeY8A8uMC+CKDyGv8G7jQR4yaPNg66pQhgpyqDHUiBitElBY/AIA3Kha MlMQ2n6XoytZ2VBFxchYYEggZ+YMuo1OneZR2Yojk8VNjRNH1xIvxSZyIi70l7PoTvgl p7xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=apPunRT41PWZQ0+1J0kzrh/AjjQz6Ltg7pi7yqxXuyU=; b=QuNKYq9yaZ6Oh+oHU8Z5lH4e9oGfLehuK1vp1IfV36o/XwLDLpVdkgN0J1gq3Jc20y oLybZPizQklsrFJ8aSOJVDbfRVNO0zGjQIXdj1HW33MkioNa0jyHT/w5PsILMM9py06Z qUuPtutHrGDOvOIZ2vw3x34sDq/cbxluiw6I0nD/3Ix8qGf8ySYN8+qMmLIdJ+RKYW9c VLo4ybNjBp9av56ZVYjiA2zowS42/f2LQcVsJJA7YWKZ20xT0mCrjAFM1CsQhZ2WlscY M63THe/CY9Aab2zlauG1bJaJuY+ofW/tjWPo0wPmSUaILBz5+UD+jPOkALAmsS2Q2JOT 27fw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j24si10674447ejd.671.2020.09.22.05.10.53; Tue, 22 Sep 2020 05:11:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726645AbgIVMJU (ORCPT + 99 others); Tue, 22 Sep 2020 08:09:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726589AbgIVMJT (ORCPT ); Tue, 22 Sep 2020 08:09:19 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91BA8C0613CF for ; Tue, 22 Sep 2020 05:09:19 -0700 (PDT) Received: from dude02.hi.pengutronix.de ([2001:67c:670:100:1d::28]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kKh6P-0007EV-MR; Tue, 22 Sep 2020 14:08:57 +0200 Received: from pza by dude02.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1kKh6M-0003wj-DL; Tue, 22 Sep 2020 14:08:54 +0200 Date: Tue, 22 Sep 2020 14:08:54 +0200 From: Philipp Zabel To: "Viorel Suman (OSS)" Cc: Liam Girdwood , Mark Brown , Rob Herring , Jaroslav Kysela , Takashi Iwai , Timur Tabi , Nicolin Chen , Xiubo Li , Fabio Estevam , Shengjiu Wang , Viorel Suman , Matthias Schiffer , Cosmin-Gabriel Samoila , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, NXP Linux Team , Viorel Suman Subject: Re: [PATCH v2 1/2] ASoC: fsl_xcvr: Add XCVR ASoC CPU DAI driver Message-ID: <20200922120854.GA15104@pengutronix.de> References: <1600715292-28529-1-git-send-email-viorel.suman@oss.nxp.com> <1600715292-28529-2-git-send-email-viorel.suman@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1600715292-28529-2-git-send-email-viorel.suman@oss.nxp.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 14:07:31 up 213 days, 23:24, 242 users, load average: 0.15, 0.91, 2.62 User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::28 X-SA-Exim-Mail-From: pza@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 21, 2020 at 10:08:11PM +0300, Viorel Suman (OSS) wrote: > From: Viorel Suman > > XCVR (Audio Transceiver) is a on-chip functional module found > on i.MX8MP. It support HDMI2.1 eARC, HDMI1.4 ARC and SPDIF. > > Signed-off-by: Viorel Suman > --- > sound/soc/fsl/Kconfig | 10 + > sound/soc/fsl/Makefile | 2 + > sound/soc/fsl/fsl_xcvr.c | 1343 ++++++++++++++++++++++++++++++++++++++++++++++ > sound/soc/fsl/fsl_xcvr.h | 266 +++++++++ > 4 files changed, 1621 insertions(+) > create mode 100644 sound/soc/fsl/fsl_xcvr.c > create mode 100644 sound/soc/fsl/fsl_xcvr.h > > diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig > index 3f76ff7..d04b64d 100644 > --- a/sound/soc/fsl/Kconfig > +++ b/sound/soc/fsl/Kconfig > @@ -95,6 +95,16 @@ config SND_SOC_FSL_EASRC > destination sample rate. It is a new design module compare with the > old ASRC. > > +config SND_SOC_FSL_XCVR > + tristate "NXP Audio Transceiver (XCVR) module support" > + select REGMAP_MMIO > + select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n > + select SND_SOC_GENERIC_DMAENGINE_PCM > + help > + Say Y if you want to add Audio Transceiver (XCVR) support for NXP > + iMX CPUs. XCVR is a digital module that supports HDMI2.1 eARC, > + HDMI1.4 ARC and SPDIF. > + > config SND_SOC_FSL_UTILS > tristate > > diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile > index b835eeb..1d2231f 100644 > --- a/sound/soc/fsl/Makefile > +++ b/sound/soc/fsl/Makefile > @@ -25,6 +25,7 @@ snd-soc-fsl-utils-objs := fsl_utils.o > snd-soc-fsl-dma-objs := fsl_dma.o > snd-soc-fsl-mqs-objs := fsl_mqs.o > snd-soc-fsl-easrc-objs := fsl_easrc.o > +snd-soc-fsl-xcvr-objs := fsl_xcvr.o > > obj-$(CONFIG_SND_SOC_FSL_AUDMIX) += snd-soc-fsl-audmix.o > obj-$(CONFIG_SND_SOC_FSL_ASOC_CARD) += snd-soc-fsl-asoc-card.o > @@ -38,6 +39,7 @@ obj-$(CONFIG_SND_SOC_FSL_UTILS) += snd-soc-fsl-utils.o > obj-$(CONFIG_SND_SOC_FSL_MQS) += snd-soc-fsl-mqs.o > obj-$(CONFIG_SND_SOC_FSL_EASRC) += snd-soc-fsl-easrc.o > obj-$(CONFIG_SND_SOC_POWERPC_DMA) += snd-soc-fsl-dma.o > +obj-$(CONFIG_SND_SOC_FSL_XCVR) += snd-soc-fsl-xcvr.o > > # MPC5200 Platform Support > obj-$(CONFIG_SND_MPC52xx_DMA) += mpc5200_dma.o > diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c > new file mode 100644 > index 00000000..7391bca > --- /dev/null > +++ b/sound/soc/fsl/fsl_xcvr.c > @@ -0,0 +1,1343 @@ [...] > +static int fsl_xcvr_probe(struct platform_device *pdev) > +{ > + struct device *dev = &pdev->dev; > + struct device_node *np = dev->of_node; > + const struct of_device_id *of_id; > + struct fsl_xcvr *xcvr; > + struct resource *ram_res, *regs_res, *rx_res, *tx_res; > + void __iomem *regs; > + int ret, irq; > + > + of_id = of_match_device(fsl_xcvr_dt_ids, dev); > + if (!of_id) > + return -EINVAL; > + > + xcvr = devm_kzalloc(dev, sizeof(*xcvr), GFP_KERNEL); > + if (!xcvr) > + return -ENOMEM; > + > + xcvr->pdev = pdev; > + xcvr->ipg_clk = devm_clk_get(dev, "ipg"); > + if (IS_ERR(xcvr->ipg_clk)) { > + dev_err(dev, "failed to get ipg clock\n"); > + return PTR_ERR(xcvr->ipg_clk); > + } > + > + xcvr->phy_clk = devm_clk_get(dev, "phy"); > + if (IS_ERR(xcvr->phy_clk)) { > + dev_err(dev, "failed to get phy clock\n"); > + return PTR_ERR(xcvr->phy_clk); > + } > + > + xcvr->spba_clk = devm_clk_get(dev, "spba"); > + if (IS_ERR(xcvr->spba_clk)) { > + dev_err(dev, "failed to get spba clock\n"); > + return PTR_ERR(xcvr->spba_clk); > + } > + > + xcvr->pll_ipg_clk = devm_clk_get(dev, "pll_ipg"); > + if (IS_ERR(xcvr->pll_ipg_clk)) { > + dev_err(dev, "failed to get pll_ipg clock\n"); > + return PTR_ERR(xcvr->pll_ipg_clk); > + } > + > + ram_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ram"); > + xcvr->ram_addr = devm_ioremap_resource(dev, ram_res); > + if (IS_ERR(xcvr->ram_addr)) > + return PTR_ERR(xcvr->ram_addr); > + > + regs_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); > + regs = devm_ioremap_resource(dev, regs_res); > + if (IS_ERR(regs)) > + return PTR_ERR(regs); > + > + xcvr->regmap = devm_regmap_init_mmio_clk(dev, NULL, regs, > + &fsl_xcvr_regmap_cfg); > + if (IS_ERR(xcvr->regmap)) { > + dev_err(dev, "failed to init XCVR regmap: %ld\n", > + PTR_ERR(xcvr->regmap)); > + return PTR_ERR(xcvr->regmap); > + } > + > + xcvr->reset = of_reset_control_get(np, NULL); Please use devm_reset_control_get_exclusive(). [...] > +static __maybe_unused int fsl_xcvr_runtime_resume(struct device *dev) > +{ > + struct fsl_xcvr *xcvr = dev_get_drvdata(dev); > + int ret; > + > + ret = clk_prepare_enable(xcvr->ipg_clk); > + if (ret) { > + dev_err(dev, "failed to start IPG clock.\n"); > + return ret; > + } > + > + ret = clk_prepare_enable(xcvr->pll_ipg_clk); > + if (ret) { > + dev_err(dev, "failed to start PLL IPG clock.\n"); > + goto stop_ipg_clk; > + } > + > + ret = clk_prepare_enable(xcvr->phy_clk); > + if (ret) { > + dev_err(dev, "failed to start PHY clock: %d\n", ret); > + goto stop_pll_ipg_clk; > + } > + > + ret = clk_prepare_enable(xcvr->spba_clk); > + if (ret) { > + dev_err(dev, "failed to start SPBA clock.\n"); > + goto stop_phy_clk; > + } > + > + regcache_cache_only(xcvr->regmap, false); > + regcache_mark_dirty(xcvr->regmap); > + ret = regcache_sync(xcvr->regmap); > + > + if (ret) { > + dev_err(dev, "failed to sync regcache.\n"); > + goto stop_spba_clk; > + } > + > + reset_control_assert(xcvr->reset); > + reset_control_deassert(xcvr->reset); No delay required between the two? regards Philipp