From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: broonie@kernel.org
Cc: lgirdwood@gmail.com, krzk@kernel.org, sbkim73@samsung.com,
m.szyprowski@samsung.com, b.zolnierkie@samsung.com,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
linux-samsung-soc@vger.kernel.org,
Sylwester Nawrocki <s.nawrocki@samsung.com>
Subject: [PATCH v2 08/21] ASoC: samsung: i2s: Drop spinlock pointer from i2s_dai data structure
Date: Tue, 12 Feb 2019 19:03:29 +0100 [thread overview]
Message-ID: <20190212180342.32040-9-s.nawrocki@samsung.com> (raw)
In-Reply-To: <20190212180342.32040-1-s.nawrocki@samsung.com>
As we now have the 'priv' pointer in most of the places we can use
priv->lock directly, dropping extra indirection in the SFR region
spinlock access.
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
---
sound/soc/samsung/i2s.c | 51 +++++++++++++++++++----------------------
1 file changed, 24 insertions(+), 27 deletions(-)
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 05f1de208307..0da07975d59b 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -87,8 +87,6 @@ struct i2s_dai {
u32 quirks;
const struct samsung_i2s_variant_regs *variant_regs;
- spinlock_t *lock;
-
struct samsung_i2s_priv *priv;
};
@@ -103,7 +101,7 @@ struct samsung_i2s_priv {
void __iomem *addr;
/* Spinlock protecting access to the device's registers */
- spinlock_t spinlock;
+ spinlock_t lock;
/* CPU DAIs and their corresponding drivers */
struct i2s_dai *dai;
@@ -527,9 +525,9 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs,
pm_runtime_get_sync(dai->dev);
- spin_lock_irqsave(i2s->lock, flags);
+ spin_lock_irqsave(&priv->lock, flags);
mod = readl(priv->addr + I2SMOD);
- spin_unlock_irqrestore(i2s->lock, flags);
+ spin_unlock_irqrestore(&priv->lock, flags);
switch (clk_id) {
case SAMSUNG_I2S_OPCLK:
@@ -624,11 +622,11 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs,
goto err;
}
- spin_lock_irqsave(i2s->lock, flags);
+ spin_lock_irqsave(&priv->lock, flags);
mod = readl(priv->addr + I2SMOD);
mod = (mod & ~mask) | val;
writel(mod, priv->addr + I2SMOD);
- spin_unlock_irqrestore(i2s->lock, flags);
+ spin_unlock_irqrestore(&priv->lock, flags);
done:
pm_runtime_put(dai->dev);
@@ -709,7 +707,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
}
pm_runtime_get_sync(dai->dev);
- spin_lock_irqsave(i2s->lock, flags);
+ spin_lock_irqsave(&priv->lock, flags);
mod = readl(priv->addr + I2SMOD);
/*
* Don't change the I2S mode if any controller is active on this
@@ -717,7 +715,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
*/
if (any_active(i2s) &&
((mod & (sdf_mask | lrp_rlow | mod_slave)) != tmp)) {
- spin_unlock_irqrestore(i2s->lock, flags);
+ spin_unlock_irqrestore(&priv->lock, flags);
pm_runtime_put(dai->dev);
dev_err(&i2s->pdev->dev,
"%s:%d Other DAI busy\n", __func__, __LINE__);
@@ -727,7 +725,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
mod &= ~(sdf_mask | lrp_rlow | mod_slave);
mod |= tmp;
writel(mod, priv->addr + I2SMOD);
- spin_unlock_irqrestore(i2s->lock, flags);
+ spin_unlock_irqrestore(&priv->lock, flags);
pm_runtime_put(dai->dev);
return 0;
@@ -812,11 +810,11 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
- spin_lock_irqsave(i2s->lock, flags);
+ spin_lock_irqsave(&priv->lock, flags);
mod = readl(priv->addr + I2SMOD);
mod = (mod & ~mask) | val;
writel(mod, priv->addr + I2SMOD);
- spin_unlock_irqrestore(i2s->lock, flags);
+ spin_unlock_irqrestore(&priv->lock, flags);
snd_soc_dai_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture);
@@ -944,6 +942,7 @@ static int config_setup(struct i2s_dai *i2s)
static int i2s_trigger(struct snd_pcm_substream *substream,
int cmd, struct snd_soc_dai *dai)
{
+ struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai);
int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct i2s_dai *i2s = to_info(rtd->cpu_dai);
@@ -954,10 +953,10 @@ static int i2s_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
pm_runtime_get_sync(dai->dev);
- spin_lock_irqsave(i2s->lock, flags);
+ spin_lock_irqsave(&priv->lock, flags);
if (config_setup(i2s)) {
- spin_unlock_irqrestore(i2s->lock, flags);
+ spin_unlock_irqrestore(&priv->lock, flags);
return -EINVAL;
}
@@ -966,12 +965,12 @@ static int i2s_trigger(struct snd_pcm_substream *substream,
else
i2s_txctrl(i2s, 1);
- spin_unlock_irqrestore(i2s->lock, flags);
+ spin_unlock_irqrestore(&priv->lock, flags);
break;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- spin_lock_irqsave(i2s->lock, flags);
+ spin_lock_irqsave(&priv->lock, flags);
if (capture) {
i2s_rxctrl(i2s, 0);
@@ -981,7 +980,7 @@ static int i2s_trigger(struct snd_pcm_substream *substream,
i2s_fifo(i2s, FIC_TXFLUSH);
}
- spin_unlock_irqrestore(i2s->lock, flags);
+ spin_unlock_irqrestore(&priv->lock, flags);
pm_runtime_put(dai->dev);
break;
}
@@ -1081,13 +1080,13 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai)
i2s->rfs = 0;
i2s->bfs = 0;
- spin_lock_irqsave(i2s->lock, flags);
+ spin_lock_irqsave(&priv->lock, flags);
i2s_txctrl(i2s, 0);
i2s_rxctrl(i2s, 0);
i2s_fifo(i2s, FIC_TXFLUSH);
i2s_fifo(other, FIC_TXFLUSH);
i2s_fifo(i2s, FIC_RXFLUSH);
- spin_unlock_irqrestore(i2s->lock, flags);
+ spin_unlock_irqrestore(&priv->lock, flags);
/* Gate CDCLK by default */
if (!is_opened(other))
@@ -1107,9 +1106,9 @@ static int samsung_i2s_dai_remove(struct snd_soc_dai *dai)
if (!is_secondary(i2s)) {
if (i2s->quirks & QUIRK_NEED_RSTCLR) {
- spin_lock_irqsave(i2s->lock, flags);
+ spin_lock_irqsave(&priv->lock, flags);
writel(0, i2s->priv->addr + I2SCON);
- spin_unlock_irqrestore(i2s->lock, flags);
+ spin_unlock_irqrestore(&priv->lock, flags);
}
}
@@ -1316,13 +1315,13 @@ static int i2s_register_clock_provider(struct samsung_i2s_priv *priv)
ARRAY_SIZE(p_names),
CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT,
priv->addr + I2SMOD, reg_info->rclksrc_off,
- 1, 0, i2s->lock);
+ 1, 0, &priv->lock);
priv->clk_table[CLK_I2S_RCLK_PSR] = clk_register_divider(dev,
i2s_clk_name[CLK_I2S_RCLK_PSR],
i2s_clk_name[CLK_I2S_RCLK_SRC],
CLK_SET_RATE_PARENT,
- priv->addr + I2SPSR, 8, 6, 0, i2s->lock);
+ priv->addr + I2SPSR, 8, 6, 0, &priv->lock);
p_names[0] = i2s_clk_name[CLK_I2S_RCLK_PSR];
priv->clk_data.clk_num = 2;
@@ -1332,7 +1331,7 @@ static int i2s_register_clock_provider(struct samsung_i2s_priv *priv)
i2s_clk_name[CLK_I2S_CDCLK], p_names[0],
CLK_SET_RATE_PARENT,
priv->addr + I2SMOD, reg_info->cdclkcon_off,
- CLK_GATE_SET_TO_DISABLE, i2s->lock);
+ CLK_GATE_SET_TO_DISABLE, &priv->lock);
priv->clk_data.clk_num += 1;
priv->clk_data.clks = priv->clk_table;
@@ -1410,8 +1409,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
pri_dai = &priv->dai[SAMSUNG_I2S_ID_PRIMARY - 1];
- spin_lock_init(&priv->spinlock);
- pri_dai->lock = &priv->spinlock;
+ spin_lock_init(&priv->lock);
if (!np) {
if (i2s_pdata == NULL) {
@@ -1473,7 +1471,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->lock = &priv->spinlock;
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.20.1
next prev parent reply other threads:[~2019-02-12 18:05 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20190212180438epcas1p3ae9da367bddb639b15638886f43f69e5@epcas1p3.samsung.com>
2019-02-12 18:03 ` [PATCH v2 00/21] ASoC: dmaengine updates, secondary CPU DAI for Odroid boards Sylwester Nawrocki
[not found] ` <CGME20190212180441epcas2p120393a84b851b38023d197ba2b0af820@epcas2p1.samsung.com>
2019-02-12 18:03 ` [PATCH v2 01/21] ASoC: samsung: i2s: Restore support for the secondary PCM Sylwester Nawrocki
2019-02-13 11:53 ` Applied "ASoC: samsung: i2s: Restore support for the secondary PCM" to the asoc tree Mark Brown
[not found] ` <CGME20190212180445epcas1p15aebbe7d7b11ce36f5d20c6534ba5903@epcas1p1.samsung.com>
2019-02-12 18:03 ` [PATCH v2 02/21] ASoC: samsung: i2s: Move clk supplier data to common driver data structure Sylwester Nawrocki
[not found] ` <CGME20190212180449epcas1p232598bff05255c7f9c582a16b27797c7@epcas1p2.samsung.com>
2019-02-12 18:03 ` [PATCH v2 03/21] ASoC: samsung: i2s: Add widgets and routes for DPCM support Sylwester Nawrocki
[not found] ` <CGME20190212180452epcas2p2f162435a99743c654320219dd25f880b@epcas2p2.samsung.com>
2019-02-12 18:03 ` [PATCH v2 04/21] ASoC: samsung: i2s: Move core clk to the driver common data structure Sylwester Nawrocki
2019-02-13 11:53 ` Applied "ASoC: samsung: i2s: Move core clk to the driver common data structure" to the asoc tree Mark Brown
[not found] ` <CGME20190212180456epcas1p1fd8b2fb8101d4848e56911f16fa4ffef@epcas1p1.samsung.com>
2019-02-12 18:03 ` [PATCH v2 05/21] ASoC: samsung: i2s: Move opclk data to common driver data structure Sylwester Nawrocki
[not found] ` <CGME20190212180459epcas2p2b5f273e37ab86a26bd7292bbcb557aa1@epcas2p2.samsung.com>
2019-02-12 18:03 ` [PATCH v2 06/21] ASoC: samsung: i2s: Move registers cache " Sylwester Nawrocki
[not found] ` <CGME20190212180503epcas1p377484a3f7fd98a8fa7199ab2a126b9e8@epcas1p3.samsung.com>
2019-02-12 18:03 ` [PATCH v2 07/21] ASoC: samsung: i2s: Move SFR pointer " Sylwester Nawrocki
[not found] ` <CGME20190212180506epcas2p43d7efeaec4a4ff63d13e5f79b281707a@epcas2p4.samsung.com>
2019-02-12 18:03 ` Sylwester Nawrocki [this message]
2019-02-13 11:50 ` [PATCH v2 08/21] ASoC: samsung: i2s: Drop spinlock pointer from i2s_dai " Mark Brown
[not found] ` <CGME20190212180510epcas1p47878c53f4d053461d23e8697cde1a63a@epcas1p4.samsung.com>
2019-02-12 18:03 ` [PATCH v2 09/21] ASoC: samsung: i2s: Move IP variant data to common driver " Sylwester Nawrocki
[not found] ` <CGME20190212180513epcas2p128eae26df9eef86550a4f628afd12603@epcas2p1.samsung.com>
2019-02-12 18:03 ` [PATCH v2 10/21] ASoC: samsung: i2s: Move quirks " Sylwester Nawrocki
[not found] ` <CGME20190212180517epcas1p1fdb94e96f06b23dca66d63b3559f6c0b@epcas1p1.samsung.com>
2019-02-12 18:03 ` [PATCH v2 11/21] ASoC: samsung: i2s: Get rid of a static spinlock Sylwester Nawrocki
[not found] ` <CGME20190212180521epcas2p3d3a637804b82c8d537be98a399e1ba7b@epcas2p3.samsung.com>
2019-02-12 18:03 ` [PATCH v2 12/21] ASoC: samsung: odroid: Add support for secondary CPU DAI Sylwester Nawrocki
[not found] ` <CGME20190212180524epcas1p41b5845cef4c81798f4a07fe8c53f1288@epcas1p4.samsung.com>
2019-02-12 18:03 ` [PATCH v2 13/21] ASoC: samsung: Specify DMA channel names through custom DMA config Sylwester Nawrocki
[not found] ` <CGME20190212180528epcas2p1a534f0f69932c28608b0a139ddfd3596@epcas2p1.samsung.com>
2019-02-12 18:03 ` [PATCH v2 14/21] ASoC: samsung: Drop DAI DMA data chan_name assignments Sylwester Nawrocki
[not found] ` <CGME20190212180532epcas1p1d0c276b25c26205a6493cbabfccd74ef@epcas1p1.samsung.com>
2019-02-12 18:03 ` [PATCH v2 15/21] ASoC: dmaengine: Remove unused SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag Sylwester Nawrocki
[not found] ` <CGME20190212180535epcas2p3aaa1c3d8fd9fcfb5a30bc6d132aba70a@epcas2p3.samsung.com>
2019-02-12 18:03 ` [PATCH v2 16/21] ASoC: samsung: i2s: Simplify pri_dai, sec_dai pointers usage Sylwester Nawrocki
2019-02-13 7:58 ` Krzysztof Kozlowski
[not found] ` <CGME20190212180539epcas1p457a5c91f2c2cef0d1b92ff8bf804beee@epcas1p4.samsung.com>
2019-02-12 18:03 ` [PATCH v2 17/21] ASoC: samsung: i2s: Change indentation in SAMSUNG_I2S_FMTS definition Sylwester Nawrocki
2019-02-13 7:59 ` Krzysztof Kozlowski
[not found] ` <CGME20190212180542epcas2p2f7252babc9b4dc97eaaa214658afe5d0@epcas2p2.samsung.com>
2019-02-12 18:03 ` [PATCH v2 18/21] ASoC: samsung: i2s: Comments clean up Sylwester Nawrocki
2019-02-13 8:06 ` Krzysztof Kozlowski
2019-02-13 19:07 ` Sylwester Nawrocki
[not found] ` <CGME20190212180546epcas1p1df261edb23d09dd0b33697f4a279cbd0@epcas1p1.samsung.com>
2019-02-12 18:03 ` [PATCH v2 19/21] ASoC: samsung: i2s: Convert to SPDX License Indentifier Sylwester Nawrocki
2019-02-13 8:08 ` Krzysztof Kozlowski
[not found] ` <CGME20190212180549epcas1p20b5cc51ba13fb934056196d1b89d67ab@epcas1p2.samsung.com>
2019-02-12 18:03 ` [PATCH v2 20/21] ARM: dts: exynos5422-odroidxu3: Add support for secondary DAI Sylwester Nawrocki
2019-02-18 20:22 ` Krzysztof Kozlowski
[not found] ` <CGME20190212180553epcas2p10fb4f2f465392de8609c127ed3f33ab4@epcas2p1.samsung.com>
2019-02-12 18:03 ` [PATCH v2 21/21] ARM: dts: exynos5422-odroidxu4: " Sylwester Nawrocki
2019-02-18 20:22 ` Krzysztof Kozlowski
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=20190212180342.32040-9-s.nawrocki@samsung.com \
--to=s.nawrocki@samsung.com \
--cc=alsa-devel@alsa-project.org \
--cc=b.zolnierkie@samsung.com \
--cc=broonie@kernel.org \
--cc=krzk@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--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).