mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 07:13:34 +00:00
ASoC: samsung: i2s: Don't use register read to determine slave/master mode
We can simplify the code by caching the CPU DAI master/slave information rather than reading previously set register bit. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
bf31cbfbe2
commit
f29eec793d
1 changed files with 11 additions and 16 deletions
|
@ -88,12 +88,6 @@ struct samsung_i2s_priv {
|
||||||
struct platform_device *pdev;
|
struct platform_device *pdev;
|
||||||
struct platform_device *pdev_sec;
|
struct platform_device *pdev_sec;
|
||||||
|
|
||||||
/* Memory mapped SFR region */
|
|
||||||
void __iomem *addr;
|
|
||||||
|
|
||||||
/* Spinlock protecting access to the device's registers */
|
|
||||||
spinlock_t lock;
|
|
||||||
|
|
||||||
/* Lock for cross interface checks */
|
/* Lock for cross interface checks */
|
||||||
spinlock_t pcm_lock;
|
spinlock_t pcm_lock;
|
||||||
|
|
||||||
|
@ -122,6 +116,15 @@ struct samsung_i2s_priv {
|
||||||
/* The clock provider's data */
|
/* The clock provider's data */
|
||||||
struct clk *clk_table[3];
|
struct clk *clk_table[3];
|
||||||
struct clk_onecell_data clk_data;
|
struct clk_onecell_data clk_data;
|
||||||
|
|
||||||
|
/* Spinlock protecting member fields below */
|
||||||
|
spinlock_t lock;
|
||||||
|
|
||||||
|
/* Memory mapped SFR region */
|
||||||
|
void __iomem *addr;
|
||||||
|
|
||||||
|
/* A flag indicating the I2S slave mode operation */
|
||||||
|
bool slave_mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Returns true if this is the 'overlay' stereo DAI */
|
/* Returns true if this is the 'overlay' stereo DAI */
|
||||||
|
@ -130,15 +133,6 @@ static inline bool is_secondary(struct i2s_dai *i2s)
|
||||||
return i2s->drv->id == SAMSUNG_I2S_ID_SECONDARY;
|
return i2s->drv->id == SAMSUNG_I2S_ID_SECONDARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If operating in SoC-Slave mode */
|
|
||||||
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 << priv->variant_regs->mss_off)) ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If this interface of the controller is transmitting data */
|
/* If this interface of the controller is transmitting data */
|
||||||
static inline bool tx_active(struct i2s_dai *i2s)
|
static inline bool tx_active(struct i2s_dai *i2s)
|
||||||
{
|
{
|
||||||
|
@ -715,6 +709,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
||||||
mod &= ~(sdf_mask | lrp_rlow | mod_slave);
|
mod &= ~(sdf_mask | lrp_rlow | mod_slave);
|
||||||
mod |= tmp;
|
mod |= tmp;
|
||||||
writel(mod, priv->addr + I2SMOD);
|
writel(mod, priv->addr + I2SMOD);
|
||||||
|
priv->slave_mode = (mod & mod_slave);
|
||||||
spin_unlock_irqrestore(&priv->lock, flags);
|
spin_unlock_irqrestore(&priv->lock, flags);
|
||||||
pm_runtime_put(dai->dev);
|
pm_runtime_put(dai->dev);
|
||||||
|
|
||||||
|
@ -917,7 +912,7 @@ static int config_setup(struct i2s_dai *i2s)
|
||||||
set_rfs(i2s, rfs);
|
set_rfs(i2s, rfs);
|
||||||
|
|
||||||
/* Don't bother with PSR in Slave mode */
|
/* Don't bother with PSR in Slave mode */
|
||||||
if (is_slave(i2s))
|
if (priv->slave_mode)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!(priv->quirks & QUIRK_NO_MUXPSR)) {
|
if (!(priv->quirks & QUIRK_NO_MUXPSR)) {
|
||||||
|
|
Loading…
Reference in a new issue