From patchwork Fri Oct 14 10:21:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Padmanabhan Rajanbabu X-Patchwork-Id: 13006905 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5A23C4332F for ; Fri, 14 Oct 2022 11:10:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229613AbiJNLKR (ORCPT ); Fri, 14 Oct 2022 07:10:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229764AbiJNLKP (ORCPT ); Fri, 14 Oct 2022 07:10:15 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B072C42D44 for ; Fri, 14 Oct 2022 04:10:10 -0700 (PDT) Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20221014111005epoutp03a667254f69bcbfbd6021cd33b2614659~d6vwiyyZg1249612496epoutp03O for ; Fri, 14 Oct 2022 11:10:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20221014111005epoutp03a667254f69bcbfbd6021cd33b2614659~d6vwiyyZg1249612496epoutp03O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1665745805; bh=b0SpkS4ju/nMLrPXxPclPFQEAVxgNqmow5paQbtJPUc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IAvFc8WEXoPQHIaf4SOoerpBC6qz3yjazYtvSl297qUiYa8THSc/Iw3NUreHN6VuI hiWXFpjNZag9LYIgDSz7baMfhM4ysjOHNnz4iBMj/ezPh9Qu5VHlxGbQWBlHxAh0v9 BF3dpr+rGlINjAMzfC7VsmJDVHeoItH0myRxOde8= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20221014111005epcas5p16b721de3063b2aa36be8030e23076149~d6vv7bzYX0967309673epcas5p1H; Fri, 14 Oct 2022 11:10:05 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.176]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4MpkF63nhqz4x9Pt; Fri, 14 Oct 2022 11:10:02 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 31.3E.56352.A8349436; Fri, 14 Oct 2022 20:10:02 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20221014104850epcas5p1a707b9d407a0947c3519077cf7fca5ff~d6dMcJ3X02013820138epcas5p1w; Fri, 14 Oct 2022 10:48:50 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20221014104850epsmtrp1b40bf3b4a9eb9bf0311fb12133d443dc~d6dMbRuoq3160431604epsmtrp1p; Fri, 14 Oct 2022 10:48:50 +0000 (GMT) X-AuditID: b6c32a4b-5f7fe7000001dc20-e3-6349438aeec3 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id A5.2C.18644.19E39436; Fri, 14 Oct 2022 19:48:50 +0900 (KST) Received: from cheetah.sa.corp.samsungelectronics.net (unknown [107.109.115.53]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20221014104847epsmtip1a09b60df02bcbbdd501ba89313fa8bc1~d6dKT-h8_2736427364epsmtip1Z; Fri, 14 Oct 2022 10:48:47 +0000 (GMT) From: Padmanabhan Rajanbabu To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, s.nawrocki@samsung.com, perex@perex.cz, tiwai@suse.com, pankaj.dubey@samsung.com, alim.akhtar@samsung.com, rcsekar@samsung.com, aswani.reddy@samsung.com Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Padmanabhan Rajanbabu Subject: [PATCH 1/6] ASoC: samsung: i2s: TDM Support for CPU DAI driver Date: Fri, 14 Oct 2022 15:51:46 +0530 Message-Id: <20221014102151.108539-2-p.rajanbabu@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221014102151.108539-1-p.rajanbabu@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNJsWRmVeSWpSXmKPExsWy7bCmlm6Xs2eywfOf0hYP5m1js7hy8RCT xaHNW9ktpj58wmYx/8g5Vou+Fw+ZLb5d6WCyuLxrDpvFjPP7mCyObgy2WLT1C7tF565+VotZ F3awWrTuPcJucfhNO6vFhu9rGR0EPDZ8bmLz2DnrLrvHplWdbB53ru1h89j3dhmbR9+WVYwe 67dcZfH4vEkugCMq2yYjNTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnF J0DXLTMH6AMlhbLEnFKgUEBicbGSvp1NUX5pSapCRn5xia1SakFKToFJgV5xYm5xaV66Xl5q iZWhgYGRKVBhQnbGgjdRBT+MK3aeeczewNit1cXIySEhYCLx+9Jjli5GLg4hgd2MEpcnd7NB OJ8YJZo6OpkhnM+MEvcunWCDabl1+CwjRGIXo8T+lXNYIZxWJonL7/qYQKrYBEwlVs1pBEuI CDQxSbS9mQi2hVlgI6PE6WMPgao4OIQF3CW+zCgBaWARUJW4/P0GG0iYV8BW4swqY4ht8hKr NxxgBrE5Bewknrc0gc2UEFjIIfH82zuok1wkvrx6zwphC0u8Or6FHcKWknjZ3w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cZJSBhFgFVicvfb7CBhHkFbCXOrDKGmC8vsXrD AWYQm1PATuJ5SxMriC0EVPL8/DvGCYx8CxgZVjFKphYU56bnFhsWGOWllusVJ+YWl+al6yXn 525iBAe6ltYOxj2rPugdYmTiYDzEKMHBrCTC+1rJM1mINyWxsiq1KD++qDQntfgQozQHi5I4 74Wuk/FCAumJJanZqakFqUUwWSYOTqkGJoMta28y5p7bVXTmRj3zjCIzn6J7s/mTL++8/TNu 0c/n8Sn8DtceNBrf0ppRaTWvaLrpzTc7u28U70ldY92978WZrXUZ50tOPDKV7DjbNj9+sYSx eL2Ki8y7mg5RnYUPrn3rkb6+/JjKm6bChMsmNd5+ul3Hjpx6tHVBSwHrvFaWZ7/my9V9yAj4 IRQf9G2yldDivFvJS5oTeVwmv+va2cEte5+R6UCwrkaJwxvTJT9lGbvv3lml8mwpZ3DGK9dF on9LVNV9056pRuz8zJKWeVjZIcZ0q1PdlABdAZlb1yx//VvXpbLj+JII49S+c7mfnsh+CFYw fLrouXm1wEd314r2W/ySF36U8k+XtmI5r8RSnJFoqMVcVJwIAHNuNmnjAgAA X-CMS-MailID: 20221014104850epcas5p1a707b9d407a0947c3519077cf7fca5ff X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20221014104850epcas5p1a707b9d407a0947c3519077cf7fca5ff References: <20221014102151.108539-1-p.rajanbabu@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Add support to configure samsung I2S CPU DAI in TDM mode. Signed-off-by: Chandrasekar R Signed-off-by: Padmanabhan Rajanbabu --- sound/soc/samsung/i2s-regs.h | 15 +++++++ sound/soc/samsung/i2s.c | 84 +++++++++++++++++++++++++++++++++++- 2 files changed, 98 insertions(+), 1 deletion(-) diff --git a/sound/soc/samsung/i2s-regs.h b/sound/soc/samsung/i2s-regs.h index b4b5d6053503..cb2be4a3b70b 100644 --- a/sound/soc/samsung/i2s-regs.h +++ b/sound/soc/samsung/i2s-regs.h @@ -154,4 +154,19 @@ #define I2SSIZE_TRNMSK (0xffff) #define I2SSIZE_SHIFT (16) +#define TDM_LRCLK_WIDTH_SHIFT 12 +#define TDM_LRCLK_WIDTH_MASK 0xFF +#define TDM_RX_SLOTS_SHIFT 8 +#define TDM_RX_SLOTS_MASK 7 +#define TDM_TX_SLOTS_SHIFT 4 +#define TDM_TX_SLOTS_MASK 7 +#define TDM_MODE_MASK 1 +#define TDM_MODE_SHIFT 1 +#define TDM_MODE_DSPA 0 +#define TDM_MODE_DSPB 1 +#define TDM_ENABLE (1 << 0) + +/* stereo default */ +#define TDM_DEFAULT_SLOT_NUM_DIVIDER 2 + #endif /* __SND_SOC_SAMSUNG_I2S_REGS_H */ diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 9505200f3d11..fb806b0af6ab 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -117,6 +117,8 @@ struct samsung_i2s_priv { struct clk *clk_table[3]; struct clk_onecell_data clk_data; + int tdm_slots; + /* Spinlock protecting member fields below */ spinlock_t lock; @@ -625,15 +627,19 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai); struct i2s_dai *i2s = to_info(dai); int lrp_shift, sdf_shift, sdf_mask, lrp_rlow, mod_slave; + int tdm_mod_mask, tdm_mod_shift; + u32 tdm = 0, tdm_tmp = 0; u32 mod, tmp = 0; unsigned long flags; lrp_shift = priv->variant_regs->lrp_off; sdf_shift = priv->variant_regs->sdf_off; + tdm_mod_shift = TDM_MODE_SHIFT; mod_slave = 1 << priv->variant_regs->mss_off; sdf_mask = MOD_SDF_MASK << sdf_shift; lrp_rlow = MOD_LR_RLOW << lrp_shift; + tdm_mod_mask = TDM_MODE_MASK << tdm_mod_shift; /* Format is priority */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { @@ -648,6 +654,20 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) case SND_SOC_DAIFMT_I2S: tmp |= (MOD_SDF_IIS << sdf_shift); break; + case SND_SOC_DAIFMT_DSP_A: + if (!(priv->quirks & QUIRK_SUPPORTS_TDM)) { + dev_err(&i2s->pdev->dev, "TDM mode not supported\n"); + return -EINVAL; + } + tdm_tmp |= (TDM_MODE_DSPA << tdm_mod_shift); + break; + case SND_SOC_DAIFMT_DSP_B: + if (!(priv->quirks & QUIRK_SUPPORTS_TDM)) { + dev_err(&i2s->pdev->dev, "TDM mode not supported\n"); + return -EINVAL; + } + tdm_tmp |= (TDM_MODE_DSPB << tdm_mod_shift); + break; default: dev_err(&i2s->pdev->dev, "Format not supported\n"); return -EINVAL; @@ -693,12 +713,17 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) pm_runtime_get_sync(dai->dev); spin_lock_irqsave(&priv->lock, flags); mod = readl(priv->addr + I2SMOD); + + if (priv->quirks & QUIRK_SUPPORTS_TDM) + tdm = readl(priv->addr + I2STDM); /* * Don't change the I2S mode if any controller is active on this * channel. */ if (any_active(i2s) && - ((mod & (sdf_mask | lrp_rlow | mod_slave)) != tmp)) { + (((mod & (sdf_mask | lrp_rlow | mod_slave)) != tmp) || + ((priv->quirks & QUIRK_SUPPORTS_TDM) && + ((tdm & tdm_mod_mask) != tdm_tmp)))) { spin_unlock_irqrestore(&priv->lock, flags); pm_runtime_put(dai->dev); dev_err(&i2s->pdev->dev, @@ -706,6 +731,12 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) return -EAGAIN; } + if (priv->quirks & QUIRK_SUPPORTS_TDM) { + tdm &= ~(tdm_mod_mask); + tdm |= tdm_tmp; + writel(tdm, priv->addr + I2STDM); + } + mod &= ~(sdf_mask | lrp_rlow | mod_slave); mod |= tmp; writel(mod, priv->addr + I2SMOD); @@ -812,6 +843,47 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, return 0; } +static int i2s_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, + unsigned int rx_mask, int slots, int slot_width) +{ + struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai); + struct i2s_dai *i2s = to_info(dai); + u32 tdm = 0, mask = 0, val = 0; + unsigned long flags; + + if (!(priv->quirks & QUIRK_SUPPORTS_TDM)) { + dev_err(&i2s->pdev->dev, "Invalid request: TDM not enabled\n"); + return -EINVAL; + } + + mask |= (TDM_ENABLE); + mask |= (TDM_TX_SLOTS_MASK << TDM_TX_SLOTS_SHIFT); + mask |= (TDM_RX_SLOTS_MASK << TDM_RX_SLOTS_SHIFT); + + if (slots) { + val |= ((slots-1) & TDM_TX_SLOTS_MASK) << TDM_TX_SLOTS_SHIFT; + val |= ((slots-1) & TDM_RX_SLOTS_MASK) << TDM_RX_SLOTS_SHIFT; + + dev_info(&i2s->pdev->dev, + "TDM Mode Configured - TX and RX Slots: %d\n", slots); + + val |= TDM_ENABLE; + + priv->tdm_slots = slots; + } else { + val = 0; + priv->tdm_slots = 0; + } + + spin_lock_irqsave(&priv->lock, flags); + tdm = readl(priv->addr + I2STDM); + tdm = (tdm & ~mask) | val; + writel(tdm, priv->addr + I2STDM); + spin_unlock_irqrestore(&priv->lock, flags); + + return 0; +} + /* We set constraints on the substream according to the version of I2S */ static int i2s_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) @@ -879,6 +951,9 @@ static int config_setup(struct i2s_dai *i2s) if (!bfs && other) bfs = other->bfs; + if (!bfs && (priv->quirks & QUIRK_SUPPORTS_TDM) && priv->tdm_slots) + bfs = blc * priv->tdm_slots; + /* Select least possible multiple(2) if no constraint set */ if (!bfs) bfs = blc * 2; @@ -899,6 +974,9 @@ static int config_setup(struct i2s_dai *i2s) rfs = 256; else rfs = 384; + + if ((priv->quirks & QUIRK_SUPPORTS_TDM) && priv->tdm_slots) + rfs /= (priv->tdm_slots / TDM_DEFAULT_SLOT_NUM_DIVIDER); } /* If already setup and running */ @@ -1110,6 +1188,7 @@ static const struct snd_soc_dai_ops samsung_i2s_dai_ops = { .set_fmt = i2s_set_fmt, .set_clkdiv = i2s_set_clkdiv, .set_sysclk = i2s_set_sysclk, + .set_tdm_slot = i2s_set_tdm_slot, .startup = i2s_startup, .shutdown = i2s_shutdown, .delay = i2s_delay, @@ -1464,6 +1543,9 @@ static int samsung_i2s_probe(struct platform_device *pdev) dev_err(&pdev->dev, "failed to enable clock: %d\n", ret); return ret; } + + priv->tdm_slots = 0; + pri_dai->dma_playback.addr = regs_base + I2STXD; pri_dai->dma_capture.addr = regs_base + I2SRXD; pri_dai->dma_playback.chan_name = "tx"; From patchwork Fri Oct 14 10:21:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Padmanabhan Rajanbabu X-Patchwork-Id: 13006906 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDAADC43219 for ; Fri, 14 Oct 2022 11:10:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229748AbiJNLKS (ORCPT ); Fri, 14 Oct 2022 07:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229768AbiJNLKP (ORCPT ); Fri, 14 Oct 2022 07:10:15 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9DEA476C8 for ; Fri, 14 Oct 2022 04:10:12 -0700 (PDT) Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20221014111010epoutp0439241f03fa8566b7013c085073ab174f~d6v1S7Gf-0641706417epoutp04X for ; Fri, 14 Oct 2022 11:10:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20221014111010epoutp0439241f03fa8566b7013c085073ab174f~d6v1S7Gf-0641706417epoutp04X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1665745810; bh=X+AgLGa5lEnY8GHICnKcE5aQCOfPFmz4hGlS4PuZixQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=llKkbRjQEpsYxihhXRlOSXqYYCjY5MuaUJe9WFg5/f/0FhK13bBaw2zv7I1HVPIS8 sgBFu3wcVmHHdcSh1KF80gNGX6ADJfGYL6Zm0aHJXCvQn0MsL+r8xnOcQhMekwHZB9 qlQ275ficWYw5ZQSXPrxPQpvkjvFbMuX/zrTODU8= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20221014111010epcas5p20d10d00d365e0f4073ddf47b171ecc0e~d6v0rrd7w1113011130epcas5p2a; Fri, 14 Oct 2022 11:10:10 +0000 (GMT) Received: from epsmges5p2new.samsung.com (unknown [182.195.38.182]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4MpkFC5vL9z4x9Pr; Fri, 14 Oct 2022 11:10:07 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 27.06.39477.F8349436; Fri, 14 Oct 2022 20:10:07 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20221014104857epcas5p2a275a1d606ca066227228d13bcf5b120~d6dS97GIL0052600526epcas5p22; Fri, 14 Oct 2022 10:48:57 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20221014104857epsmtrp2a596a658fb9740b9ee46152613e68298~d6dS8-1ID0248602486epsmtrp2u; Fri, 14 Oct 2022 10:48:57 +0000 (GMT) X-AuditID: b6c32a4a-259fb70000019a35-58-6349438fde64 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id B7.2C.18644.89E39436; Fri, 14 Oct 2022 19:48:56 +0900 (KST) Received: from cheetah.sa.corp.samsungelectronics.net (unknown [107.109.115.53]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20221014104854epsmtip10e316d810d89bf2e6392115791f00634~d6dQxi0AG2688026880epsmtip1J; Fri, 14 Oct 2022 10:48:54 +0000 (GMT) From: Padmanabhan Rajanbabu To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, s.nawrocki@samsung.com, perex@perex.cz, tiwai@suse.com, pankaj.dubey@samsung.com, alim.akhtar@samsung.com, rcsekar@samsung.com, aswani.reddy@samsung.com Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Padmanabhan Rajanbabu Subject: [PATCH 2/6] ASoC: samsung: i2s: configure PSR from sound card Date: Fri, 14 Oct 2022 15:51:47 +0530 Message-Id: <20221014102151.108539-3-p.rajanbabu@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221014102151.108539-1-p.rajanbabu@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNJsWRmVeSWpSXmKPExsWy7bCmlm6/s2eyQfs8XYsH87axWVy5eIjJ 4tDmrewWUx8+YbOYf+Qcq0Xfi4fMFt+udDBZXN41h81ixvl9TBZHNwZbLNr6hd2ic1c/q8Ws CztYLVr3HmG3OPymndViw/e1jA4CHhs+N7F57Jx1l91j06pONo871/aweex7u4zNo2/LKkaP 9Vuusnh83iQXwBGVbZORmpiSWqSQmpecn5KZl26r5B0c7xxvamZgqGtoaWGupJCXmJtqq+Ti E6DrlpkD9IG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ExsWy7bCSnO5MO89kg0saFg/mbWOzuHLxEJPF oc1b2S2mPnzCZjH/yDlWi74XD5ktvl3pYLK4vGsOm8WM8/uYLI5uDLZYtPULu0Xnrn5Wi1kX drBatO49wm5x+E07q8WG72sZHQQ8NnxuYvPYOesuu8emVZ1sHneu7WHz2Pd2GZtH35ZVjB7r t1xl8fi8SS6AI4rLJiU1J7MstUjfLoErY9Wpj0wFTxQrzlxpYm9gXCDdxcjJISFgInFzx17m LkYuDiGBHYwST7fOY4dISEtM79/DBmELS6z895wdoqiZSWLy3nVgRWwCphKr5jSygiREBCYw SZx8d4wFJMEssJVRYupnoy5GDg5hATeJzv0hIGEWAVWJZ4dusoCEeQVsJa7fD4CYLy+xesMB ZhCbU8BO4nlLEyuILQRU8vz8O8YJjHwLGBlWMUqmFhTnpucWGxYY5aWW6xUn5haX5qXrJefn bmIEB7qW1g7GPas+6B1iZOJgPMQowcGsJML7WskzWYg3JbGyKrUoP76oNCe1+BCjNAeLkjjv ha6T8UIC6YklqdmpqQWpRTBZJg5OqQamwhwOKe1kzyDG92kZl3c9WTFBsTfk6pG2XEn/W5wx x/f7xn2+VVpoZjs/am/Tfu6sWn3HUBZbMd1j27IE3HX/2ysXuul9WbOymCthS+KcYOv5qbEO lVebzW5WPNfeae69zshGNn6W6xvWwhvLWie/WyMwy8+4tNJKmNlhinWDxOWbf5LfZjVYq8+Z x6ly/0TEa8vbLd7WCU9263WZv5pj59j66t8kxltuc44WznOxCZorMa1wTb568Wsppi0fr7Nu NZJdwCC+oqn90cxtrcI7Zm231Xv+SvPHhpBH28+e0pWeNetC44e8iKa6vvxbtzz2P79guOdt 7Ca7mfWhtU8U1W02rLSOMikPqJkk9lWJpTgj0VCLuag4EQB8G1By4wIAAA== X-CMS-MailID: 20221014104857epcas5p2a275a1d606ca066227228d13bcf5b120 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20221014104857epcas5p2a275a1d606ca066227228d13bcf5b120 References: <20221014102151.108539-1-p.rajanbabu@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Currently the prescaler value in samsung I2S dai is calculated by dividing the peripheral input clock frequency with frame clock frequency and root clock frequency divider. This prescaler value is used to divide the input clock to generate root clock (RCLK) from which frame clock is generated for I2S communication. However for the platforms which does not have a dedicated audio PLL as an input clock source, the prescaler divider will not generate accurate root clock frequency, which inturn affects sampling frequency also. To overcome this scenario, support has been added to let the sound card identify right prescaler divider value and configure the prescaler (PSR) divider directly the from the sound card to achieve near accurate sample frequencies Signed-off-by: Padmanabhan Rajanbabu --- sound/soc/samsung/i2s-regs.h | 2 ++ sound/soc/samsung/i2s.c | 36 ++++++++++++++++++++++++++++++++---- sound/soc/samsung/i2s.h | 1 + 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/sound/soc/samsung/i2s-regs.h b/sound/soc/samsung/i2s-regs.h index cb2be4a3b70b..e2581dc73df2 100644 --- a/sound/soc/samsung/i2s-regs.h +++ b/sound/soc/samsung/i2s-regs.h @@ -132,6 +132,8 @@ #define EXYNOS7_MOD_RCLK_192FS 7 #define PSR_PSREN (1 << 15) +#define PSR_PSVAL_SHIFT 8 +#define PSR_PSVAL_MASK 0x3f #define FIC_TX2COUNT(x) (((x) >> 24) & 0xf) #define FIC_TX1COUNT(x) (((x) >> 16) & 0xf) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index fb806b0af6ab..a96286b27f1d 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -59,10 +59,10 @@ struct i2s_dai { /* Frame clock */ unsigned frmclk; /* - * Specifically requested RCLK, BCLK by machine driver. + * Specifically requested RCLK, BCLK and PSR by machine driver. * 0 indicates CPU driver is free to choose any value. */ - unsigned rfs, bfs; + unsigned int rfs, bfs, psr; /* Pointer to the Primary_Fifo if this is Sec_Fifo, NULL otherwise */ struct i2s_dai *pri_dai; /* Pointer to the Secondary_Fifo if it has one, NULL otherwise */ @@ -389,6 +389,17 @@ static inline int get_blc(struct i2s_dai *i2s) } } +static inline unsigned int get_psval(struct i2s_dai *i2s) +{ + struct samsung_i2s_priv *priv = i2s->priv; + u32 psr; + + psr = readl(priv->addr + I2SPSR) >> PSR_PSVAL_SHIFT; + psr &= PSR_PSVAL_MASK; + + return (psr + 1); +} + /* TX channel control */ static void i2s_txctrl(struct i2s_dai *i2s, int on) { @@ -994,7 +1005,11 @@ static int config_setup(struct i2s_dai *i2s) return 0; if (!(priv->quirks & QUIRK_NO_MUXPSR)) { - psr = priv->rclk_srcrate / i2s->frmclk / rfs; + if (i2s->psr) + psr = i2s->psr; + else + psr = priv->rclk_srcrate / i2s->frmclk / rfs; + writel(((psr - 1) << 8) | PSR_PSREN, priv->addr + I2SPSR); dev_dbg(&i2s->pdev->dev, "RCLK_SRC=%luHz PSR=%u, RCLK=%dfs, BCLK=%dfs\n", @@ -1072,6 +1087,18 @@ static int i2s_set_clkdiv(struct snd_soc_dai *dai, i2s->bfs = div; pm_runtime_put(dai->dev); break; + case SAMSUNG_I2S_DIV_RCLK: + pm_runtime_get_sync(dai->dev); + if ((any_active(i2s) && div && (get_psval(i2s) != div)) + || (other && other->psr && (other->psr != div))) { + pm_runtime_put(dai->dev); + dev_err(&i2s->pdev->dev, + "%s:%d Other DAI busy\n", __func__, __LINE__); + return -EAGAIN; + } + i2s->psr = div; + pm_runtime_put(dai->dev); + break; default: dev_err(&i2s->pdev->dev, "Invalid clock divider(%d)\n", div_id); @@ -1140,9 +1167,10 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) other->idma_playback.addr); } - /* Reset any constraint on RFS and BFS */ + /* Reset any constraint on RFS, BFS and PSR*/ i2s->rfs = 0; i2s->bfs = 0; + i2s->psr = 0; spin_lock_irqsave(&priv->lock, flags); i2s_txctrl(i2s, 0); diff --git a/sound/soc/samsung/i2s.h b/sound/soc/samsung/i2s.h index 78b475ef98d9..e783d33fdfac 100644 --- a/sound/soc/samsung/i2s.h +++ b/sound/soc/samsung/i2s.h @@ -13,6 +13,7 @@ #define SAMSUNG_I2S_DAI_SEC "samsung-i2s-sec" #define SAMSUNG_I2S_DIV_BCLK 1 +#define SAMSUNG_I2S_DIV_RCLK 2 #define SAMSUNG_I2S_RCLKSRC_0 0 #define SAMSUNG_I2S_RCLKSRC_1 1 From patchwork Fri Oct 14 10:21:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Padmanabhan Rajanbabu X-Patchwork-Id: 13006907 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D916C4332F for ; Fri, 14 Oct 2022 11:10:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229806AbiJNLKe (ORCPT ); Fri, 14 Oct 2022 07:10:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229766AbiJNLKc (ORCPT ); Fri, 14 Oct 2022 07:10:32 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 205694DB47 for ; Fri, 14 Oct 2022 04:10:20 -0700 (PDT) Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20221014111018epoutp032d59f5cfa4b021632416c8df05080fe4~d6v8NhZBl1241412414epoutp03R for ; Fri, 14 Oct 2022 11:10:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20221014111018epoutp032d59f5cfa4b021632416c8df05080fe4~d6v8NhZBl1241412414epoutp03R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1665745818; bh=Qw7Z1dzmSAO8dt+O9QgqCihC0iOroNtHcGevkHYv7ZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kQNaCz5AOs3o3ws4DoYzK5M4fRERj6/gYMpEY88aMmel3G4Tki4FjbUDfRL6GaLkk JGJuJ2f9YN+/+d93DuyVIP7TSQaBOl49EAbJHJoEuNwSZ4OuhM2juZAuLqn02FlZPc sa6Sek0JraP9oiFmqhYyaPZfKfhNUAxK3QafzIx0= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20221014111017epcas5p40a8b5d6e9aa30313768a4a5e10b307b1~d6v7uqakf2372423724epcas5p43; Fri, 14 Oct 2022 11:10:17 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.183]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4MpkFM3tSvz4x9Pp; Fri, 14 Oct 2022 11:10:15 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id A1.21.26992.79349436; Fri, 14 Oct 2022 20:10:15 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20221014104901epcas5p1a61ea81c3b1640bd8a064633c0b1e40d~d6dWoFx_12011520115epcas5p1J; Fri, 14 Oct 2022 10:49:01 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20221014104901epsmtrp1293f8715ec9b7a2c41faa8b76d9d6249~d6dWnCrET3160431604epsmtrp14; Fri, 14 Oct 2022 10:49:01 +0000 (GMT) X-AuditID: b6c32a49-319fb70000016970-0d-634943977369 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 39.56.14392.C9E39436; Fri, 14 Oct 2022 19:49:00 +0900 (KST) Received: from cheetah.sa.corp.samsungelectronics.net (unknown [107.109.115.53]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20221014104858epsmtip1508af7d320f124b1161a7aaa84ead629~d6dUcbDeT0142901429epsmtip1U; Fri, 14 Oct 2022 10:48:58 +0000 (GMT) From: Padmanabhan Rajanbabu To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, s.nawrocki@samsung.com, perex@perex.cz, tiwai@suse.com, pankaj.dubey@samsung.com, alim.akhtar@samsung.com, rcsekar@samsung.com, aswani.reddy@samsung.com Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Padmanabhan Rajanbabu Subject: [PATCH 3/6] dt-bindings: sound: Add sound card bindings for Tesla FSD Date: Fri, 14 Oct 2022 15:51:48 +0530 Message-Id: <20221014102151.108539-4-p.rajanbabu@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221014102151.108539-1-p.rajanbabu@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprLJsWRmVeSWpSXmKPExsWy7bCmlu50Z89kgz1PZCwezNvGZnHl4iEm i0Obt7JbTH34hM1i/pFzrBZ9Lx4yW3y70sFkcXnXHDaLGef3MVkc3RhssWjrF3aLzl39rBaz LuxgtWjde4Td4vCbdlaLDd/XMjoIeGz43MTmsXPWXXaPTas62TzuXNvD5rHv7TI2j74tqxg9 1m+5yuLxeZNcAEdUtk1GamJKapFCal5yfkpmXrqtkndwvHO8qZmBoa6hpYW5kkJeYm6qrZKL T4CuW2YO0AdKCmWJOaVAoYDE4mIlfTubovzSklSFjPziElul1IKUnAKTAr3ixNzi0rx0vbzU EitDAwMjU6DChOyMV8f3MhVc1qyYMWcRewPjLtkuRk4OCQETie41u5i7GLk4hAR2M0ocPnuI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z43MTmsXPWXXaPTas62TzuXNvD5rHv7TI2j74tqxg9 1m+5yuLxeZNcAEcUl01Kak5mWWqRvl0CV8ar43uZCi5rVsyYs4i9gXGXbBcjJ4eEgInE75eT mboYuTiEBHYzSjzcv4wRIiEtMb1/DxuELSyx8t9zdoiiZiaJI6teghWxCZhKrJrTyAqSEBGY wCRx8t0xFpAEs8BWRompn41AbGEBP4nl916AxVkEVCWmvNsA1swrYCvx9sppVogN8hKrNxxg BrE5Bewknrc0gcWFgGqen3/HOIGRbwEjwypGydSC4tz03GLDAsO81HK94sTc4tK8dL3k/NxN jOBw19Lcwbh91Qe9Q4xMHIyHGCU4mJVEeF8reSYL8aYkVlalFuXHF5XmpBYfYpTmYFES573Q dTJeSCA9sSQ1OzW1ILUIJsvEwSnVwFR7xDJLMHbp5/jKU111Fg26yknKdYxz/jC/ur3kqOGj oGWrQyvZ0ne4NsUtnbtt8fLN8eomYbeK/HYde7by/NX+ib323xdWTw5dvdnzgnJsc4weS9Dh OSuX2z0X3uqzVHdBT+Ff/VvOC5nX74va9viIktHS3Xd54zWLueV3XIlVlsyxFjdZYjdzo2b+ 94Y57qYehXH1U2ZzavKEHJm/tZ19q+eS4Jjr367HpMTfv3ri8pR//KbfWW5Yh33ZXT+tZ2bB uvvZu87/lFXm38Ce6v/vRlYfWzp3YYyARufqg3yCj9pfvHmgqj3rbBBDyqO9It/vHqxtj1oo 43UnQE4xZz9/mtP/O7euVzhuXFRaZKzEUpyRaKjFXFScCADaUQpl5gIAAA== X-CMS-MailID: 20221014104901epcas5p1a61ea81c3b1640bd8a064633c0b1e40d X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20221014104901epcas5p1a61ea81c3b1640bd8a064633c0b1e40d References: <20221014102151.108539-1-p.rajanbabu@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Add dt-binding reference document to configure the DAI link for Tesla FSD sound card driver. Signed-off-by: Padmanabhan Rajanbabu --- .../bindings/sound/tesla,fsd-card.yaml | 158 ++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/tesla,fsd-card.yaml diff --git a/Documentation/devicetree/bindings/sound/tesla,fsd-card.yaml b/Documentation/devicetree/bindings/sound/tesla,fsd-card.yaml new file mode 100644 index 000000000000..4bd590f4ee27 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/tesla,fsd-card.yaml @@ -0,0 +1,158 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright 2022 Samsung Electronics Co. Ltd. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/tesla,fsd-card.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Tesla FSD ASoC sound card driver + +maintainers: + - Padmanabhan Rajanbabu + +description: | + This binding describes the node properties and essential DT entries of FSD + SoC sound card node + +select: false + +properties: + compatible: + enum: + - tesla,fsd-sndcard + + model: + description: Describes the Name of the sound card + $ref: /schemas/types.yaml#/definitions/string + + widgets: + description: A list of DAPM widgets in the sound card. Each entry is a pair + of strings, the first being the widget name and the second being the + widget alias + $ref: /schemas/types.yaml#/definitions/string-array + + audio-routing: + description: A list of the connections between audio components. Each entry + is a pair of strings, the first being the connection's sink, the second + being the connection's source + $ref: /schemas/types.yaml#/definitions/string-array + + dai-tdm-slot-num: + description: Enables TDM mode and specifies the number of TDM slots to be + enabled + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3, 4, 5, 6, 7, 8] + default: 2 + + dai-tdm-slot-width: + description: Specifies the slot width of each TDm slot enabled + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [8, 16, 24] + default: 16 + + dai-link: + description: Holds the DAI link data between CPU, Codec and Platform + type: object + properties: + link-name: + description: Specifies the name of the DAI link + $ref: /schemas/types.yaml#/definitions/string + + dai-format: + description: Specifies the serial data format of CPU DAI + $ref: /schemas/types.yaml#/definitions/string + + tesla,bitclock-master: + description: Specifies the phandle of bitclock master DAI + $ref: /schemas/types.yaml#/definitions/phandle + + tesla,frame-master: + description: Specifies the phandle of frameclock master DAI + $ref: /schemas/types.yaml#/definitions/phandle + + cpu: + description: Holds the CPU DAI node and instance + type: object + properties: + sound-dai: + description: Specifies the phandle of CPU DAI node + $ref: /schemas/types.yaml#/definitions/phandle-array + + required: + - sound-dai + + codec: + description: Holds the Codec DAI node and instance + type: object + properties: + sound-dai: + description: Specifies the phandle of Codec DAI node + $ref: /schemas/types.yaml#/definitions/phandle-array + + required: + - sound-dai + + required: + - link-name + - dai-format + - tesla,bitclock-master + - tesla,frame-master + - cpu + +dependencies: + dai-tdm-slot-width: [ 'dai-tdm-slot-num' ] + +required: + - compatible + - model + - dai-link + +additionalProperties: false + +examples: + - | + sound { + compatible = "tesla,fsd-sndcard"; + status = "disabled"; + model = "fsd-i2s"; + + primary-dai-link-0 { + link-name = "fsd-primary-0"; + dai-format = "i2s"; + tesla,bitclock-master = <&tdm_0>; + tesla,frame-master = <&tdm_0>; + cpu { + sound-dai = <&tdm_0 0>; + }; + }; + + secondary-dai-link-0 { + link-name = "fsd-secondary-0"; + dai-format = "i2s"; + tesla,bitclock-master = <&tdm_0>; + tesla,frame-master = <&tdm_0>; + cpu { + sound-dai = <&tdm_0 1>; + }; + }; + + primary-dai-link-1 { + link-name = "fsd-primary-1"; + dai-format = "i2s"; + tesla,bitclock-master = <&tdm_1>; + tesla,frame-master = <&tdm_1>; + cpu { + sound-dai = <&tdm_1 0>; + }; + }; + + secondary-dai-link-1 { + link-name = "fsd-secondary-1"; + dai-format = "i2s"; + tesla,bitclock-master = <&tdm_1>; + tesla,frame-master = <&tdm_1>; + cpu { + sound-dai = <&tdm_1 1>; + }; + }; + }; From patchwork Fri Oct 14 10:21:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Padmanabhan Rajanbabu X-Patchwork-Id: 13006908 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1794C43219 for ; Fri, 14 Oct 2022 11:10:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229791AbiJNLKk (ORCPT ); Fri, 14 Oct 2022 07:10:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229816AbiJNLKg (ORCPT ); Fri, 14 Oct 2022 07:10:36 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A26BCCF1B9 for ; Fri, 14 Oct 2022 04:10:28 -0700 (PDT) Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20221014111026epoutp022bfc458c57f4f5a1cdfff41bfad13542~d6wDozXMg2101021010epoutp02j for ; Fri, 14 Oct 2022 11:10:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20221014111026epoutp022bfc458c57f4f5a1cdfff41bfad13542~d6wDozXMg2101021010epoutp02j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1665745826; bh=GlsBDX1Xi5F1q3jm3rSzlWAbbze0DTUaqvH5QPdWxjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u6o+MIPoEzOLlnygehv6yEWNM4Wx2QKViJRYnkXUHcMCXzx0VGc8lwi3mEm3hIzT4 VgGUeE2M26TVqlBCL7XTMUNsk6mNBTYhAtIkqwewveyAjtcwltUjK+jqmhFpCsCbeM f3IXOd7oMZ85gAMg74J5CHKS2wrwDZ/jM/zgQys4= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20221014111025epcas5p33454cac9eb221db79700a97069879c83~d6wC17uOx0195101951epcas5p3H; Fri, 14 Oct 2022 11:10:25 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.179]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4MpkFW2sxpz4x9Py; Fri, 14 Oct 2022 11:10:23 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 36.4E.56352.E9349436; Fri, 14 Oct 2022 20:10:22 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20221014104904epcas5p4f458182cc9ac9c223d9a25566f3dd300~d6daR6xQz3049930499epcas5p4j; Fri, 14 Oct 2022 10:49:04 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20221014104904epsmtrp298b6903ee5f33d84ebce31bbbe1bc06c~d6daP7brU0248602486epsmtrp28; Fri, 14 Oct 2022 10:49:04 +0000 (GMT) X-AuditID: b6c32a4b-5f7fe7000001dc20-4a-6349439e61df Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 5B.2C.18644.0AE39436; Fri, 14 Oct 2022 19:49:04 +0900 (KST) Received: from cheetah.sa.corp.samsungelectronics.net (unknown [107.109.115.53]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20221014104902epsmtip1c754c02f30e375a080e53f21eddc2281~d6dYAt4lC2736727367epsmtip1d; Fri, 14 Oct 2022 10:49:02 +0000 (GMT) From: Padmanabhan Rajanbabu To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, s.nawrocki@samsung.com, perex@perex.cz, tiwai@suse.com, pankaj.dubey@samsung.com, alim.akhtar@samsung.com, rcsekar@samsung.com, aswani.reddy@samsung.com Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Padmanabhan Rajanbabu Subject: [PATCH 4/6] ASoC: samsung: fsd: Add FSD soundcard driver Date: Fri, 14 Oct 2022 15:51:49 +0530 Message-Id: <20221014102151.108539-5-p.rajanbabu@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221014102151.108539-1-p.rajanbabu@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprFJsWRmVeSWpSXmKPExsWy7bCmpu48Z89kg8VLRCwezNvGZnHl4iEm i0Obt7JbTH34hM1i/pFzrBZ9Lx4yW3y70sFkcXnXHDaLGef3MVkc3RhssWjrF3aLzl39rBaz LuxgtWjde4Td4vCbdlaLDd/XMjoIeGz43MTmsXPWXXaPTas62TzuXNvD5rHv7TI2j74tqxg9 1m+5yuLxeZNcAEdUtk1GamJKapFCal5yfkpmXrqtkndwvHO8qZmBoa6hpYW5kkJeYm6qrZKL T4CuW2YO0AdKCmWJOaVAoYDE4mIlfTubovzSklSFjPziElul1IKUnAKTAr3ixNzi0rx0vbzU EitDAwMjU6DChOyMnlseBQfCK9q+32RqYNzn3sXIySEhYCKxqKOFEcQWEtjNKHF0t2cXIxeQ /YlRYkn3JnYI5zOjRNP28ywwHSe+rmGESOxilPh8fg9UVSuTxM8z08FmsQmYSqya08gKkhAR aGKSaHszkQXEYRbYyChx+thDJpAqYQFHiab1/ewgNouAqsTWV/1AHRwcvAK2EtM/CkOsk5dY veEAM4jNKWAn8bylCWyohMBCDonHT6+yQxS5SBxs7mCEsIUlXh3fAhWXkvj8bi8bhJ0vMe1j M5RdIdH2cQMThG0vceDKHBaQvcwCmhLrd+lDhGUlpp5aB1bCLMAn0fv7CVQ5r8SOeTC2qsT6 5Zug1kpL7Lu+lxFkjISAh0TDjDRIoExklFj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al6yXn525i BIe6ltYOxj2rPugdYmTiYDzEKMHBrCTC+1rJM1mINyWxsiq1KD++qDQntfgQozQHi5I474Wu k/FCAumJJanZqakFqUUwWSYOTqkGprBtKTfPcn33OsmaUaTzxXLy969Hi9tWy0Ss8VpnnVz1 8MqpoPj2Toagq4yh4arvhIMPPNoU6+vKtosxiX353sd1jgySoa5zPm9izqmUeJbALdOaKCh8 2DX66m5Jvj16v6TOPfP0OnbT/ry0k+63mo92HzhWZHxvPnM7//u8+XL/0303FD4xzJ7o1Xxh /oW39yr/3o/W8N+xXaXZR0lgX5Prs6zZ26ee43k/Iz3v28Jjco+D429a2r/dY33x8O+fjhMy 7wrtXvqrff/LGQcOqKfaVG+1641KzM/6OMeI9fnz5XO0lkgtnhhk9oh9P5Pb9EM+9jo+Twql 9b6s553Omr/Ve8XS/4sNDD5MkovP4FFiKc5INNRiLipOBABI5RM25AIAAA== X-CMS-MailID: 20221014104904epcas5p4f458182cc9ac9c223d9a25566f3dd300 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20221014104904epcas5p4f458182cc9ac9c223d9a25566f3dd300 References: <20221014102151.108539-1-p.rajanbabu@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Add a soundcard driver for FSD audio interface to bridge the CPU DAI of samsung I2S with the codec and platform driver. Signed-off-by: Padmanabhan Rajanbabu --- sound/soc/samsung/Kconfig | 12 ++ sound/soc/samsung/Makefile | 2 + sound/soc/samsung/fsd-card.c | 349 +++++++++++++++++++++++++++++++++++ 3 files changed, 363 insertions(+) create mode 100644 sound/soc/samsung/fsd-card.c diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index 2a61e620cd3b..344503522bd3 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig @@ -239,4 +239,16 @@ config SND_SOC_SAMSUNG_MIDAS_WM1811 help Say Y if you want to add support for SoC audio on the Midas boards. +config SND_SOC_TESLA_FSD + tristate "SoC I2S Audio support for Tesla FSD board" + depends on SND_SOC_SAMSUNG + select SND_SIMPLE_CARD_UTILS + select SND_SAMSUNG_I2S + help + Say Y if you want to add support for SOC audio on the FSD board. + This will select the SND_SIMPLE_CARD_UTILS to use the dummy + codec driver, incase the codec node is not specified in the device + tree. This sound card driver uses Samsung I2S controller as CPU + and platform DAI. + endif #SND_SOC_SAMSUNG diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile index 398e843f388c..0dad88fdb1a8 100644 --- a/sound/soc/samsung/Makefile +++ b/sound/soc/samsung/Makefile @@ -43,6 +43,7 @@ snd-soc-arndale-objs := arndale.o snd-soc-tm2-wm5110-objs := tm2_wm5110.o snd-soc-aries-wm8994-objs := aries_wm8994.o snd-soc-midas-wm1811-objs := midas_wm1811.o +snd-soc-fsd-objs := fsd-card.o obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o @@ -68,3 +69,4 @@ obj-$(CONFIG_SND_SOC_ARNDALE) += snd-soc-arndale.o obj-$(CONFIG_SND_SOC_SAMSUNG_TM2_WM5110) += snd-soc-tm2-wm5110.o obj-$(CONFIG_SND_SOC_SAMSUNG_ARIES_WM8994) += snd-soc-aries-wm8994.o obj-$(CONFIG_SND_SOC_SAMSUNG_MIDAS_WM1811) += snd-soc-midas-wm1811.o +obj-$(CONFIG_SND_SOC_TESLA_FSD) += snd-soc-fsd.o diff --git a/sound/soc/samsung/fsd-card.c b/sound/soc/samsung/fsd-card.c new file mode 100644 index 000000000000..806a4d3b99fd --- /dev/null +++ b/sound/soc/samsung/fsd-card.c @@ -0,0 +1,349 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * ALSA SoC Audio Layer - FSD Soundcard driver + * + * Copyright (c) 2022 Samsung Electronics Co. Ltd. + * Padmanabhan Rajanbabu + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "i2s.h" +#include "i2s-regs.h" + +#define FSD_PREFIX "tesla," +#define FSD_DAI_SRC_PCLK 3 +#define FSD_DAI_RFS_192 192 +#define FSD_DAI_BFS_48 48 +#define FSD_DAI_BFS_96 96 +#define FSD_DAI_BFS_192 192 + +struct fsd_card_priv { + struct snd_soc_card card; + struct snd_soc_dai_link *dai_link; + u32 tdm_slots; + u32 tdm_slot_width; +}; + +static unsigned int fsd_card_get_rfs(unsigned int rate) +{ + return FSD_DAI_RFS_192; +} + +static unsigned int fsd_card_get_bfs(unsigned int channels) +{ + switch (channels) { + case 1: + case 2: + return FSD_DAI_BFS_48; + case 3: + case 4: + return FSD_DAI_BFS_96; + case 5: + case 6: + case 7: + case 8: + return FSD_DAI_BFS_192; + default: + return FSD_DAI_BFS_48; + } +} + +static unsigned int fsd_card_get_psr(unsigned int rate) +{ + switch (rate) { + case 8000: return 43; + case 11025: return 31; + case 16000: return 21; + case 22050: return 16; + case 32000: return 11; + case 44100: return 8; + case 48000: return 7; + case 64000: return 5; + case 88200: return 4; + case 96000: return 4; + case 192000: return 2; + default: return 1; + } +} + +static int fsd_card_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_card *card = rtd->card; + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); + struct snd_soc_dai_link *link = rtd->dai_link; + struct fsd_card_priv *priv = snd_soc_card_get_drvdata(card); + unsigned int rfs, bfs, psr; + int ret = 0, cdclk_dir; + + rfs = fsd_card_get_rfs(params_rate(params)); + bfs = fsd_card_get_bfs(params_channels(params)); + psr = fsd_card_get_psr(params_rate(params)); + + /* Configure the Root Clock Source */ + ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_OPCLK, + false, FSD_DAI_SRC_PCLK); + if (ret < 0) { + dev_err(card->dev, "Failed to set OPCLK: %d\n", ret); + goto err; + } + + ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_RCLKSRC_0, + false, false); + if (ret < 0) { + dev_err(card->dev, "Failed to set RCLKSRC: %d\n", ret); + goto err; + } + + /* Set CPU DAI configuration */ + ret = snd_soc_dai_set_fmt(cpu_dai, link->dai_fmt); + if (ret < 0) { + dev_err(card->dev, "Failed to set DAIFMT: %d\n", ret); + goto err; + } + + if (link->dai_fmt & SND_SOC_DAIFMT_CBC_CFC) { + cdclk_dir = SND_SOC_CLOCK_OUT; + } else if (link->dai_fmt & SND_SOC_DAIFMT_CBP_CFP) { + cdclk_dir = SND_SOC_CLOCK_IN; + } else { + dev_err(card->dev, "Missing Clock Master information\n"); + goto err; + } + + /* Set Clock Source for CDCLK */ + ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_CDCLK, + rfs, cdclk_dir); + if (ret < 0) { + dev_err(card->dev, "Failed to set CDCLK: %d\n", ret); + goto err; + } + + ret = snd_soc_dai_set_clkdiv(cpu_dai, SAMSUNG_I2S_DIV_RCLK, psr); + if (ret < 0) { + dev_err(card->dev, "Failed to set PSR: %d\n", ret); + goto err; + } + + ret = snd_soc_dai_set_clkdiv(cpu_dai, SAMSUNG_I2S_DIV_BCLK, bfs); + if (ret < 0) { + dev_err(card->dev, "Failed to set BCLK: %d\n", ret); + goto err; + } + + if (priv->tdm_slots) { + ret = snd_soc_dai_set_tdm_slot(cpu_dai, false, false, + priv->tdm_slots, priv->tdm_slot_width); + if (ret < 0) { + dev_err(card->dev, + "Failed to configure in TDM mode:%d\n", ret); + goto err; + } + } + +err: + return ret; +} + +static const struct snd_soc_ops fsd_card_ops = { + .hw_params = fsd_card_hw_params, +}; + +static struct fsd_card_priv *fsd_card_parse_of(struct snd_soc_card *card) +{ + struct fsd_card_priv *priv; + struct snd_soc_dai_link *link; + struct device *dev = card->dev; + struct device_node *node = dev->of_node; + struct device_node *np, *cpu_node, *codec_node; + struct snd_soc_dai_link_component *dlc; + int ret, id = 0, num_links; + + ret = snd_soc_of_parse_card_name(card, "model"); + if (ret) { + dev_err(dev, "Error parsing card name: %d\n", ret); + return ERR_PTR(ret); + } + + if (of_property_read_bool(dev->of_node, "widgets")) { + ret = snd_soc_of_parse_audio_simple_widgets(card, "widgets"); + if (ret) + return ERR_PTR(ret); + } + + /* Add DAPM routes to the card */ + if (of_property_read_bool(node, "audio-routing")) { + ret = snd_soc_of_parse_audio_routing(card, "audio-routing"); + if (ret) + return ERR_PTR(ret); + } + + num_links = of_get_child_count(node); + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return ERR_PTR(-ENOMEM); + + priv->dai_link = devm_kzalloc(dev, num_links * sizeof(*priv->dai_link), + GFP_KERNEL); + if (!priv->dai_link) + return ERR_PTR(-ENOMEM); + + priv->tdm_slots = 0; + priv->tdm_slot_width = 0; + + snd_soc_of_parse_tdm_slot(node, NULL, NULL, &priv->tdm_slots, + &priv->tdm_slot_width); + + link = priv->dai_link; + + for_each_child_of_node(node, np) { + dlc = devm_kzalloc(dev, 2 * sizeof(*dlc), GFP_KERNEL); + if (!dlc) + return ERR_PTR(-ENOMEM); + + link->id = id; + link->cpus = &dlc[0]; + link->platforms = &dlc[1]; + link->num_cpus = 1; + link->num_codecs = 1; + link->num_platforms = 1; + + cpu_node = of_get_child_by_name(np, "cpu"); + if (!cpu_node) { + dev_err(dev, "Missing CPU/Codec node\n"); + ret = -EINVAL; + goto err_cpu_node; + } + + ret = snd_soc_of_get_dai_link_cpus(dev, cpu_node, link); + if (ret < 0) { + dev_err(dev, "Error Parsing CPU DAI name\n"); + goto err_cpu_name; + } + + link->platforms->of_node = link->cpus->of_node; + + codec_node = of_get_child_by_name(np, "codec"); + if (codec_node) { + ret = snd_soc_of_get_dai_link_codecs(dev, codec_node, + link); + if (ret < 0) { + dev_err(dev, "Error Parsing Codec DAI name\n"); + goto err_codec_name; + } + } else { + dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL); + if (!dlc) { + ret = -ENOMEM; + goto err_cpu_name; + } + + link->codecs = dlc; + + link->codecs->dai_name = "snd-soc-dummy-dai"; + link->codecs->name = "snd-soc-dummy"; + link->dynamic = 1; + + snd_soc_dai_link_set_capabilities(link); + link->ignore_suspend = 1; + link->nonatomic = 1; + } + + ret = asoc_simple_parse_daifmt(dev, np, codec_node, + FSD_PREFIX, &link->dai_fmt); + if (ret) + link->dai_fmt = SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBC_CFC | + SND_SOC_DAIFMT_I2S; + + ret = of_property_read_string(np, "link-name", &link->name); + if (ret) { + dev_err(card->dev, "Error Parsing link name\n"); + goto err_codec_name; + } + + link->stream_name = link->name; + link->ops = &fsd_card_ops; + + link++; + id++; + + of_node_put(cpu_node); + of_node_put(codec_node); + } + + card->dai_link = priv->dai_link; + card->num_links = num_links; + + return priv; + +err_codec_name: + of_node_put(codec_node); +err_cpu_name: + of_node_put(cpu_node); +err_cpu_node: + of_node_put(np); + return ERR_PTR(ret); +} + +static int fsd_platform_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct snd_soc_card *card; + struct fsd_card_priv *fsd_priv; + + card = devm_kzalloc(dev, sizeof(*card), GFP_KERNEL); + if (!card) + return -ENOMEM; + + card->dev = dev; + fsd_priv = fsd_card_parse_of(card); + + if (IS_ERR(fsd_priv)) { + dev_err(&pdev->dev, "Error Parsing DAI Link: %ld\n", + PTR_ERR(fsd_priv)); + return PTR_ERR(fsd_priv); + } + + snd_soc_card_set_drvdata(card, fsd_priv); + + return devm_snd_soc_register_card(&pdev->dev, card); +} + +static const struct of_device_id fsd_device_id[] = { + { .compatible = "tesla,fsd-card" }, + {}, +}; +MODULE_DEVICE_TABLE(of, fsd_device_id); + +static struct platform_driver fsd_platform_driver = { + .driver = { + .name = "fsd-card", + .of_match_table = of_match_ptr(fsd_device_id), + }, + .probe = fsd_platform_probe, +}; +module_platform_driver(fsd_platform_driver); + +MODULE_AUTHOR("Padmanabhan Rajanbabu "); +MODULE_DESCRIPTION("FSD ASoC Soundcard Driver"); +MODULE_LICENSE("GPL"); From patchwork Fri Oct 14 10:21:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Padmanabhan Rajanbabu X-Patchwork-Id: 13006909 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44954C433FE for ; Fri, 14 Oct 2022 11:10:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229908AbiJNLK4 (ORCPT ); Fri, 14 Oct 2022 07:10:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229776AbiJNLKh (ORCPT ); Fri, 14 Oct 2022 07:10:37 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA149E6F6F for ; Fri, 14 Oct 2022 04:10:32 -0700 (PDT) Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20221014111031epoutp048e23568dc0ff4ea2a266258d0e76f810~d6wIN_YCK0817908179epoutp04w for ; Fri, 14 Oct 2022 11:10:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20221014111031epoutp048e23568dc0ff4ea2a266258d0e76f810~d6wIN_YCK0817908179epoutp04w DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1665745831; bh=Zbx76mlzHBJ+S/AAz4sVRGbKx8JIYIBvPvxtvlSsvBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CqWW08GRSZ+HMULqxhlPtB0aZheCBxHNsceS021v/pi6wIdAWSv0fzn+UH0ylYXeY eTNfz68Xz/bjKT1zYonKMLmc1aNkoAU/FcjY1fmKnpKb3tH55GaG6T7X/S1HkXY4lV b9TN9848kNy/6Nsz+N2Jrdlg3+JhSMjUd0di/3ss= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20221014111030epcas5p13c3443954d01d1f884580c2a7b9071ff~d6wHXc6LT1571915719epcas5p1T; Fri, 14 Oct 2022 11:10:30 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.182]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4MpkFb02Npz4x9Pq; Fri, 14 Oct 2022 11:10:27 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 98.4E.56352.2A349436; Fri, 14 Oct 2022 20:10:26 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20221014104911epcas5p394100ff6ed53be32c4d64c7e23e48833~d6dglrHlO0568205682epcas5p30; Fri, 14 Oct 2022 10:49:11 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20221014104911epsmtrp2b379d1c4e5d136384898960bb0364c24~d6dgkyXTs0248602486epsmtrp2I; Fri, 14 Oct 2022 10:49:11 +0000 (GMT) X-AuditID: b6c32a4b-383ff7000001dc20-53-634943a26bdf Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id FD.2C.18644.7AE39436; Fri, 14 Oct 2022 19:49:11 +0900 (KST) Received: from cheetah.sa.corp.samsungelectronics.net (unknown [107.109.115.53]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20221014104909epsmtip13267170eacab96b4dd5fca0afa5e559d~d6deZpfIO0142901429epsmtip1X; Fri, 14 Oct 2022 10:49:09 +0000 (GMT) From: Padmanabhan Rajanbabu To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, s.nawrocki@samsung.com, perex@perex.cz, tiwai@suse.com, pankaj.dubey@samsung.com, alim.akhtar@samsung.com, rcsekar@samsung.com, aswani.reddy@samsung.com Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Padmanabhan Rajanbabu Subject: [PATCH 5/6] arm64: dts: fsd: Add I2S DAI node for Tesla FSD Date: Fri, 14 Oct 2022 15:51:50 +0530 Message-Id: <20221014102151.108539-6-p.rajanbabu@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221014102151.108539-1-p.rajanbabu@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSfUwbdRjH87u214Ok5Cx7+VmVdaebrgvQjhaPQZkLZDmGGCbJ4jZjd7YX wJZr7RXH/MMB8j5lEOncat10akc65aUDxCK4tAgEFYqFCep0RTKlViIyR3wbtrTof5/n+X2/ eV5+D8YTv4FKsFLWwphZ2kCg8fw+766Hky/l5Gnl7V8oyZsX+lByesqDkJ6rvULSGlhAyYvD EwKy+acAj7wz3YCQfrcdJc9NDiHkp91F5KXe20Ky0X1GQNp8/QKydnBYSHpD9QKya/UD8BhO da1Uo9RHthtCyuVsRKlvr3+MUkO/OFCquccJqM6eGT614koqxI7qs0oYWseYpQyrNepK2WI1 kV+kydGo0uWKZEUG+SghZekyRk3kPl6YfKDUEJ6AkL5AG8rDqUKa44jU7CyzsdzCSEuMnEVN MCadwaQ0pXB0GVfOFqewjGWvQi7fowoLj+tLFt2v8U1VkorLn1jRSlC3uQnEYRBXwqDPAZpA PCbGBwAMXHGh0eA3ABtWBwTRYAXA2RuVg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WEtjBKHHmsS1EXFpiev8eNghbWGLlv+fsXYxcQDXNTBIzLyxjBEmwCZhKrJrTyAqSEBGY wCRx8t0xFpAEs8BWRompn426GDk4hAVcJNbtBhvKIqAqcXjaf7BeXgFbidYJUxkhFshLrN5w gBnE5hSwk3je0sQKcZCtxPPz7xgnMPItYGRYxSiZWlCcm55bbFhglJdarlecmFtcmpeul5yf u4kRHOpaWjsY96z6oHeIkYmD8RCjBAezkgjvayXPZCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8 F7pOxgsJpCeWpGanphakFsFkmTg4pRqYzDY0v9HXWrtapvfgLcY7Gu3LubtLop3+Gt9/4XGs aeKfk268j7QW2zI++dhX3X/N17iVsYBJ3Kj99F7XhTKr7yvu7uU44r+oP+hiZs6B/TP3nZHb xmjacmlSm/2P6t2Fq7Yx1zI9DXN7fWp36oOaKzHtcplX+Z9xz5xdHTkvWFT1pRjzQya22gOr NF85fptjZiiYlJCb/2WRd8tmxedCJVLWrhJxpxbHlSkLWfax7l7WvvGvXbj//0PmoqxOs9eX ++W1TNsb8DOpyCp8wwXRyQs+cK21Wy+2a0vTYR1F/kPhxdrrS+qd3vDPv1ShV1amkLfpztmf uQyPGuY93cRTI+2pJ/7j5oIv9mv/B/oqsRRnJBpqMRcVJwIAi4U8quQCAAA= X-CMS-MailID: 20221014104911epcas5p394100ff6ed53be32c4d64c7e23e48833 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20221014104911epcas5p394100ff6ed53be32c4d64c7e23e48833 References: <20221014102151.108539-1-p.rajanbabu@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Add device tree node for I2S0 and I2S1 CPU DAI instances for Tesla FSD board Signed-off-by: Padmanabhan Rajanbabu --- arch/arm64/boot/dts/tesla/fsd-evb.dts | 8 +++++ arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi | 14 ++++++++ arch/arm64/boot/dts/tesla/fsd.dtsi | 38 ++++++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/arch/arm64/boot/dts/tesla/fsd-evb.dts b/arch/arm64/boot/dts/tesla/fsd-evb.dts index 1db6ddf03f01..c0a4509499ab 100644 --- a/arch/arm64/boot/dts/tesla/fsd-evb.dts +++ b/arch/arm64/boot/dts/tesla/fsd-evb.dts @@ -41,3 +41,11 @@ &ufs { status = "okay"; }; + +&tdm_0 { + status = "okay"; +}; + +&tdm_1 { + status = "okay"; +}; diff --git a/arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi b/arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi index e3852c946352..ff6f5d4b16dd 100644 --- a/arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi +++ b/arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi @@ -339,6 +339,20 @@ samsung,pin-pud = ; samsung,pin-drv = ; }; + + i2s0_bus: i2s0-bus { + samsung,pins = "gpd1-0", "gpd1-1", "gpd1-2", "gpd1-3", "gpd1-4"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = ; + }; + + i2s1_bus: i2s1-bus { + samsung,pins = "gpd2-0", "gpd2-1", "gpd2-2", "gpd2-3", "gpd2-4"; + samsung,pin-function = ; + samsung,pin-pud = ; + samsung,pin-drv = ; + }; }; &pinctrl_pmu { diff --git a/arch/arm64/boot/dts/tesla/fsd.dtsi b/arch/arm64/boot/dts/tesla/fsd.dtsi index f35bc5a288c2..5decad45a1b6 100644 --- a/arch/arm64/boot/dts/tesla/fsd.dtsi +++ b/arch/arm64/boot/dts/tesla/fsd.dtsi @@ -32,6 +32,8 @@ spi0 = &spi_0; spi1 = &spi_1; spi2 = &spi_2; + tdm0 = &tdm_0; + tdm1 = &tdm_1; }; cpus { @@ -809,6 +811,42 @@ status = "disabled"; }; + tdm_0: tdm@140e0000 { + compatible = "samsung,exynos7-i2s"; + reg = <0x0 0x140E0000 0x0 0x100>; + interrupts = ; + dmas = <&pdma1 14>, <&pdma1 13>, <&pdma1 12>; + dma-names = "tx", "rx", "tx-sec"; + #clock-cells = <1>; + #sound-dai-cells = <1>; + clocks = <&clock_peric PERIC_HCLK_TDM0>, + <&clock_peric PERIC_HCLK_TDM0>, + <&clock_peric PERIC_PCLK_TDM0>; + clock-names = "i2s_opclk0", "i2s_opclk1", "iis"; + pinctrl-names = "default"; + pinctrl-0 = <&i2s0_bus>; + samsung,sec-dai-id = <0>; + status = "disabled"; + }; + + tdm_1: tdm@140f0000 { + compatible = "samsung,exynos7-i2s"; + reg = <0x0 0x140F0000 0x0 0x100>; + interrupts = ; + dmas = <&pdma1 17>, <&pdma1 16>, <&pdma1 15>; + dma-names = "tx", "rx", "tx-sec"; + #clock-cells = <1>; + #sound-dai-cells = <1>; + clocks = <&clock_peric PERIC_HCLK_TDM1>, + <&clock_peric PERIC_HCLK_TDM1>, + <&clock_peric PERIC_PCLK_TDM1>; + clock-names = "i2s_opclk0", "i2s_opclk1", "iis"; + pinctrl-names = "default"; + pinctrl-0 = <&i2s1_bus>; + samsung,sec-dai-id = <1>; + status = "disabled"; + }; + timer@10040000 { compatible = "tesla,fsd-mct", "samsung,exynos4210-mct"; reg = <0x0 0x10040000 0x0 0x800>; From patchwork Fri Oct 14 10:21:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Padmanabhan Rajanbabu X-Patchwork-Id: 13006910 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CDC6C433FE for ; Fri, 14 Oct 2022 11:11:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229836AbiJNLLO (ORCPT ); Fri, 14 Oct 2022 07:11:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229893AbiJNLKz (ORCPT ); Fri, 14 Oct 2022 07:10:55 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0111E1BBEF9 for ; Fri, 14 Oct 2022 04:10:38 -0700 (PDT) Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20221014111036epoutp022619e7952a9aaa088702919cab8e33cd~d6wNXgrIQ2100821008epoutp02f for ; Fri, 14 Oct 2022 11:10:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20221014111036epoutp022619e7952a9aaa088702919cab8e33cd~d6wNXgrIQ2100821008epoutp02f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1665745836; bh=9SsgF3hWBhdrZJfljS7+eBsGPvly+gPDoy3K5tTIdBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MziZwkX127b95mJ65tK57IEgMd6yRO/4O7vIf6qiGp0UkJQNE5yTHcM+DWe/S2gGC eGyzElqVDK9bCamL7KJ+u32TJYITSx2UO70XGZRktALjUdIX61EMJwBINyUKOpEUhs nF/FF3LPa7hJRRGPfkvwElApyezT9VBa7b6+38ig= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20221014111036epcas5p34c04fce5100e24c348de56cf4482979a~d6wMq8x480410004100epcas5p38; Fri, 14 Oct 2022 11:10:36 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.174]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4MpkFj3t7Hz4x9Pt; Fri, 14 Oct 2022 11:10:33 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 80.31.26992.9A349436; Fri, 14 Oct 2022 20:10:33 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20221014104915epcas5p12414b87ea127b2d5bf521556bf841b00~d6dj9NWX52011520115epcas5p1k; Fri, 14 Oct 2022 10:49:15 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20221014104915epsmtrp2f5c4039270bdfe8644ff8738d6f79eac~d6dj8SSSL0248602486epsmtrp2M; Fri, 14 Oct 2022 10:49:15 +0000 (GMT) X-AuditID: b6c32a49-0c7ff70000016970-3a-634943a9ba47 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 6D.56.14392.BAE39436; Fri, 14 Oct 2022 19:49:15 +0900 (KST) Received: from cheetah.sa.corp.samsungelectronics.net (unknown [107.109.115.53]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20221014104913epsmtip10879994e360ec84ae6bd8e31ffc0b4ea~d6dh1ysO_2736727367epsmtip1j; Fri, 14 Oct 2022 10:49:12 +0000 (GMT) From: Padmanabhan Rajanbabu To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, s.nawrocki@samsung.com, perex@perex.cz, tiwai@suse.com, pankaj.dubey@samsung.com, alim.akhtar@samsung.com, rcsekar@samsung.com, aswani.reddy@samsung.com Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Padmanabhan Rajanbabu Subject: [PATCH 6/6] arm64: dts: fsd: Add sound card node for Tesla FSD Date: Fri, 14 Oct 2022 15:51:51 +0530 Message-Id: <20221014102151.108539-7-p.rajanbabu@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20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+5WlskZYR+heUrr09w V796el3j8wmvHDI8vz3ZqR7teIVdzo2rPNP4ZZusmnohu6+W5PrM/+XKjvd8rpz4emDv59KP Ny+8e3Hy5rN7LNpVKxvWnecJCxTUZdy4hZOpSazz+5VVvqeMzSpzF3mqBp+dv3fVy6CZ2/V/ y9m1nt4gefV8CfcNZ/lFH9rMbS74XttYp6fEUpyRaKjFXFScCADuAJ825QIAAA== X-CMS-MailID: 20221014104915epcas5p12414b87ea127b2d5bf521556bf841b00 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20221014104915epcas5p12414b87ea127b2d5bf521556bf841b00 References: <20221014102151.108539-1-p.rajanbabu@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Add device tree node support for sound card on Tesla FSD board Signed-off-by: Padmanabhan Rajanbabu --- arch/arm64/boot/dts/tesla/fsd-evb.dts | 49 +++++++++++++++++++++++++++ arch/arm64/boot/dts/tesla/fsd.dtsi | 3 ++ 2 files changed, 52 insertions(+) diff --git a/arch/arm64/boot/dts/tesla/fsd-evb.dts b/arch/arm64/boot/dts/tesla/fsd-evb.dts index c0a4509499ab..ecaa3c2e3045 100644 --- a/arch/arm64/boot/dts/tesla/fsd-evb.dts +++ b/arch/arm64/boot/dts/tesla/fsd-evb.dts @@ -49,3 +49,52 @@ &tdm_1 { status = "okay"; }; + +&sound { + compatible = "tesla,fsd-sndcard"; + status = "okay"; + model = "fsd-i2s"; + widgets = + "Speaker", "MAIN SPK", + "Microphone", "MAIN MIC"; + + primary-dai-link-0 { + link-name = "fsd-primary-0"; + dai-format = "i2s"; + tesla,bitclock-master = <&tdm_0>; + tesla,frame-master = <&tdm_0>; + cpu { + sound-dai = <&tdm_0 0>; + }; + }; + + secondary-dai-link-0 { + link-name = "fsd-secondary-0"; + dai-format = "i2s"; + tesla,bitclock-master = <&tdm_0>; + tesla,frame-master = <&tdm_0>; + cpu { + sound-dai = <&tdm_0 1>; + }; + }; + + primary-dai-link-1 { + link-name = "fsd-primary-1"; + dai-format = "i2s"; + tesla,bitclock-master = <&tdm_1>; + tesla,frame-master = <&tdm_1>; + cpu { + sound-dai = <&tdm_1 0>; + }; + }; + + secondary-dai-link-1 { + link-name = "fsd-secondary-1"; + dai-format = "i2s"; + tesla,bitclock-master = <&tdm_1>; + tesla,frame-master = <&tdm_1>; + cpu { + sound-dai = <&tdm_1 1>; + }; + }; +}; diff --git a/arch/arm64/boot/dts/tesla/fsd.dtsi b/arch/arm64/boot/dts/tesla/fsd.dtsi index 5decad45a1b6..fc8931f830a7 100644 --- a/arch/arm64/boot/dts/tesla/fsd.dtsi +++ b/arch/arm64/boot/dts/tesla/fsd.dtsi @@ -847,6 +847,9 @@ status = "disabled"; }; + sound: sound { + }; + timer@10040000 { compatible = "tesla,fsd-mct", "samsung,exynos4210-mct"; reg = <0x0 0x10040000 0x0 0x800>;