From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: broonie@kernel.org
Cc: lgirdwood@gmail.com, krzk@kernel.org, sbkim73@samsung.com,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
Sylwester Nawrocki <s.nawrocki@samsung.com>
Subject: [PATCH v3 Resend 03/13] ASoC: samsung: i2s: Move IP variant data to common driver data structure
Date: Thu, 14 Feb 2019 10:37:37 +0100 [thread overview]
Message-ID: <20190214093747.2414-4-s.nawrocki@samsung.com> (raw)
In-Reply-To: <20190214093747.2414-1-s.nawrocki@samsung.com>
The IP variant data is another thing common for both DAIs, move it
to the driver's common data structure.
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
---
sound/soc/samsung/i2s.c | 42 ++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index cf8615e23879..0c4c4de8c7e9 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -85,7 +85,6 @@ struct i2s_dai {
struct snd_dmaengine_dai_dma_data idma_playback;
dma_filter_fn filter;
u32 quirks;
- const struct samsung_i2s_variant_regs *variant_regs;
struct samsung_i2s_priv *priv;
};
@@ -122,6 +121,8 @@ struct samsung_i2s_priv {
u32 suspend_i2scon;
u32 suspend_i2spsr;
+ const struct samsung_i2s_variant_regs *variant_regs;
+
/* The clock provider's data */
struct clk *clk_table[3];
struct clk_onecell_data clk_data;
@@ -146,7 +147,7 @@ static inline bool is_slave(struct i2s_dai *i2s)
struct samsung_i2s_priv *priv = i2s->priv;
u32 mod = readl(priv->addr + I2SMOD);
- return (mod & (1 << i2s->variant_regs->mss_off)) ? true : false;
+ return (mod & (1 << priv->variant_regs->mss_off)) ? true : false;
}
/* If this interface of the controller is transmitting data */
@@ -261,8 +262,8 @@ static inline unsigned get_rfs(struct i2s_dai *i2s)
struct samsung_i2s_priv *priv = i2s->priv;
u32 rfs;
- rfs = readl(priv->addr + I2SMOD) >> i2s->variant_regs->rfs_off;
- rfs &= i2s->variant_regs->rfs_mask;
+ rfs = readl(priv->addr + I2SMOD) >> priv->variant_regs->rfs_off;
+ rfs &= priv->variant_regs->rfs_mask;
switch (rfs) {
case 7: return 192;
@@ -281,9 +282,9 @@ static inline void set_rfs(struct i2s_dai *i2s, unsigned rfs)
{
struct samsung_i2s_priv *priv = i2s->priv;
u32 mod = readl(priv->addr + I2SMOD);
- int rfs_shift = i2s->variant_regs->rfs_off;
+ int rfs_shift = priv->variant_regs->rfs_off;
- mod &= ~(i2s->variant_regs->rfs_mask << rfs_shift);
+ mod &= ~(priv->variant_regs->rfs_mask << rfs_shift);
switch (rfs) {
case 192:
@@ -321,8 +322,8 @@ static inline unsigned get_bfs(struct i2s_dai *i2s)
struct samsung_i2s_priv *priv = i2s->priv;
u32 bfs;
- bfs = readl(priv->addr + I2SMOD) >> i2s->variant_regs->bfs_off;
- bfs &= i2s->variant_regs->bfs_mask;
+ bfs = readl(priv->addr + I2SMOD) >> priv->variant_regs->bfs_off;
+ bfs &= priv->variant_regs->bfs_mask;
switch (bfs) {
case 8: return 256;
@@ -343,7 +344,7 @@ static inline void set_bfs(struct i2s_dai *i2s, unsigned bfs)
struct samsung_i2s_priv *priv = i2s->priv;
u32 mod = readl(priv->addr + I2SMOD);
int tdm = i2s->quirks & QUIRK_SUPPORTS_TDM;
- int bfs_shift = i2s->variant_regs->bfs_off;
+ int bfs_shift = priv->variant_regs->bfs_off;
/* Non-TDM I2S controllers do not support BCLK > 48 * FS */
if (!tdm && bfs > 48) {
@@ -351,7 +352,7 @@ static inline void set_bfs(struct i2s_dai *i2s, unsigned bfs)
return;
}
- mod &= ~(i2s->variant_regs->bfs_mask << bfs_shift);
+ mod &= ~(priv->variant_regs->bfs_mask << bfs_shift);
switch (bfs) {
case 48:
@@ -408,7 +409,7 @@ static void i2s_txctrl(struct i2s_dai *i2s, int on)
{
struct samsung_i2s_priv *priv = i2s->priv;
void __iomem *addr = priv->addr;
- int txr_off = i2s->variant_regs->txr_off;
+ int txr_off = priv->variant_regs->txr_off;
u32 con = readl(addr + I2SCON);
u32 mod = readl(addr + I2SMOD) & ~(3 << txr_off);
@@ -459,7 +460,7 @@ static void i2s_rxctrl(struct i2s_dai *i2s, int on)
{
struct samsung_i2s_priv *priv = i2s->priv;
void __iomem *addr = priv->addr;
- int txr_off = i2s->variant_regs->txr_off;
+ int txr_off = priv->variant_regs->txr_off;
u32 con = readl(addr + I2SCON);
u32 mod = readl(addr + I2SMOD) & ~(3 << txr_off);
@@ -516,7 +517,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs,
struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai);
struct i2s_dai *i2s = to_info(dai);
struct i2s_dai *other = get_other_dai(i2s);
- const struct samsung_i2s_variant_regs *i2s_regs = i2s->variant_regs;
+ const struct samsung_i2s_variant_regs *i2s_regs = priv->variant_regs;
unsigned int cdcon_mask = 1 << i2s_regs->cdclkcon_off;
unsigned int rsrc_mask = 1 << i2s_regs->rclksrc_off;
u32 mod, mask, val = 0;
@@ -644,9 +645,9 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
u32 mod, tmp = 0;
unsigned long flags;
- lrp_shift = i2s->variant_regs->lrp_off;
- sdf_shift = i2s->variant_regs->sdf_off;
- mod_slave = 1 << i2s->variant_regs->mss_off;
+ lrp_shift = priv->variant_regs->lrp_off;
+ sdf_shift = priv->variant_regs->sdf_off;
+ mod_slave = 1 << priv->variant_regs->mss_off;
sdf_mask = MOD_SDF_MASK << sdf_shift;
lrp_rlow = MOD_LR_RLOW << lrp_shift;
@@ -1023,7 +1024,6 @@ i2s_delay(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
struct i2s_dai *i2s = to_info(dai);
u32 reg = readl(priv->addr + I2SFIC);
snd_pcm_sframes_t delay;
- const struct samsung_i2s_variant_regs *i2s_regs = i2s->variant_regs;
WARN_ON(!pm_runtime_active(dai->dev));
@@ -1032,7 +1032,7 @@ i2s_delay(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
else if (is_secondary(i2s))
delay = FICS_TXCOUNT(readl(priv->addr + I2SFICS));
else
- delay = (reg >> i2s_regs->ftx0cnt_off) & 0x7f;
+ delay = (reg >> priv->variant_regs->ftx0cnt_off) & 0x7f;
return delay;
}
@@ -1281,7 +1281,7 @@ static int i2s_register_clock_provider(struct samsung_i2s_priv *priv)
const char *p_names[2] = { NULL };
struct device *dev = &priv->pdev->dev;
struct i2s_dai *i2s = samsung_i2s_get_pri_dai(dev);
- const struct samsung_i2s_variant_regs *reg_info = i2s->variant_regs;
+ const struct samsung_i2s_variant_regs *reg_info = priv->variant_regs;
const char *i2s_clk_name[ARRAY_SIZE(i2s_clk_desc)];
struct clk *rclksrc;
int ret, i;
@@ -1400,6 +1400,8 @@ static int samsung_i2s_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;
+ priv->variant_regs = i2s_dai_data->i2s_variant_regs;
+
quirks = np ? i2s_dai_data->quirks : i2s_pdata->type.quirks;
num_dais = (quirks & QUIRK_SEC_DAI) ? 2 : 1;
priv->pdev = pdev;
@@ -1458,7 +1460,6 @@ static int samsung_i2s_probe(struct platform_device *pdev)
pri_dai->dma_playback.addr_width = 4;
pri_dai->dma_capture.addr_width = 4;
pri_dai->quirks = quirks;
- pri_dai->variant_regs = i2s_dai_data->i2s_variant_regs;
pri_dai->priv = priv;
if (quirks & QUIRK_PRI_6CHAN)
@@ -1472,7 +1473,6 @@ static int samsung_i2s_probe(struct platform_device *pdev)
if (quirks & QUIRK_SEC_DAI) {
sec_dai = &priv->dai[SAMSUNG_I2S_ID_SECONDARY - 1];
- sec_dai->variant_regs = pri_dai->variant_regs;
sec_dai->dma_playback.addr = regs_base + I2STXDS;
sec_dai->dma_playback.chan_name = "tx-sec";
--
2.17.1
next prev parent reply other threads:[~2019-02-14 9:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20190214093822epcas2p11380606cb3272aa4fd56eb55dea8f8c8@epcas2p1.samsung.com>
2019-02-14 9:37 ` [PATCH v3 Resend 00/13] ASoC: dmaengine updates, secondary CPU DAI for Odroid Sylwester Nawrocki
[not found] ` <CGME20190214093825epcas1p24af57e964af261c979af4d4cbffcfa6c@epcas1p2.samsung.com>
2019-02-14 9:37 ` [PATCH v3 Resend 01/13] ASoC: samsung: i2s: Move SFR pointer to common driver data structure Sylwester Nawrocki
[not found] ` <CGME20190214093828epcas2p444b9d819fefb0eb730a716589a00218b@epcas2p4.samsung.com>
2019-02-14 9:37 ` [PATCH v3 Resend 02/13] ASoC: samsung: i2s: Drop spinlock pointer from i2s_dai " Sylwester Nawrocki
[not found] ` <CGME20190214093831epcas1p2a42c5b95424a251e7ae38dd21c1a4696@epcas1p2.samsung.com>
2019-02-14 9:37 ` Sylwester Nawrocki [this message]
[not found] ` <CGME20190214093833epcas2p1cd99c749360aadf06a551810862d9bf4@epcas2p1.samsung.com>
2019-02-14 9:37 ` [PATCH v3 Resend 04/13] ASoC: samsung: i2s: Move quirks data to common driver " Sylwester Nawrocki
[not found] ` <CGME20190214093836epcas1p36ff39d1a7ae59bf475256c6ae5c6171c@epcas1p3.samsung.com>
2019-02-14 9:37 ` [PATCH v3 Resend 05/13] ASoC: samsung: i2s: Get rid of a static spinlock Sylwester Nawrocki
[not found] ` <CGME20190214093839epcas2p2609ddf53eb48143ff2160d6a30dad615@epcas2p2.samsung.com>
2019-02-14 9:37 ` [PATCH v3 Resend 06/13] ASoC: samsung: odroid: Add support for secondary CPU DAI Sylwester Nawrocki
[not found] ` <CGME20190214093842epcas1p154bd9c945a6897d5211c152aefabb32c@epcas1p1.samsung.com>
2019-02-14 9:37 ` [PATCH v3 Resend 07/13] ASoC: samsung: Specify DMA channel names through custom DMA config Sylwester Nawrocki
[not found] ` <CGME20190214093844epcas1p432e337986df8edc10206413da8a7cd08@epcas1p4.samsung.com>
2019-02-14 9:37 ` [PATCH v3 Resend 08/13] ASoC: samsung: Drop DAI DMA data chan_name assignments Sylwester Nawrocki
[not found] ` <CGME20190214093847epcas2p1056c7371ba485f375a9d408ea45078e4@epcas2p1.samsung.com>
2019-02-14 9:37 ` [PATCH v3 Resend 09/13] ASoC: dmaengine: Remove unused SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag Sylwester Nawrocki
2019-02-14 13:07 ` Mark Brown
2019-02-14 14:32 ` Sylwester Nawrocki
2019-02-14 14:47 ` Mark Brown
[not found] ` <CGME20190214093850epcas1p2ced5d0673c9c4aebe57aa0ab4b08aeaf@epcas1p2.samsung.com>
2019-02-14 9:37 ` [PATCH v3 Resend 10/13] ASoC: samsung: i2s: Simplify pri_dai, sec_dai pointers usage Sylwester Nawrocki
[not found] ` <CGME20190214093853epcas2p2f48340585495bf0ba662ae42399d1cab@epcas2p2.samsung.com>
2019-02-14 9:37 ` [PATCH v3 Resend 11/13] ASoC: samsung: i2s: Change indentation in SAMSUNG_I2S_FMTS definition Sylwester Nawrocki
[not found] ` <CGME20190214093856epcas1p333b119e4b70f2c0edaf0c181e45adfb7@epcas1p3.samsung.com>
2019-02-14 9:37 ` [PATCH v3 Resend 12/13] ASoC: samsung: i2s: Comments clean up Sylwester Nawrocki
[not found] ` <CGME20190214093858epcas2p10993b30cf39b6c12d3fe0a4dfd20f6e8@epcas2p1.samsung.com>
2019-02-14 9:37 ` [PATCH v3 Resend 13/13] ASoC: samsung: i2s: Convert to SPDX License Indentifier Sylwester Nawrocki
2019-02-14 14:51 ` Applied "ASoC: samsung: i2s: Convert to SPDX License Indentifier" to the asoc tree Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190214093747.2414-4-s.nawrocki@samsung.com \
--to=s.nawrocki@samsung.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=krzk@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sbkim73@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).