Commit 57282427 authored by Jassi Brar's avatar Jassi Brar Committed by Mark Brown

ASoC: S3C: I2Sv2: Unify i2s_get_clock callback

Now that we have two callbacks s3c2412_i2s_get_clock & s3c64xx_i2s_get_clock
doing exactly the same thing, we can define one generic s3c_i2sv2_get_clock
and discard other two copies. Also, switch the users to make calls to the
newly defined and generic s3c_i2sv2_get_clock
Signed-off-by: default avatarJassi Brar <jassi.brar@samsung.com>
Acked-by: default avatarBen Dooks <ben-linux@fluff.org>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 21a7ad08
...@@ -70,7 +70,7 @@ static int jive_hw_params(struct snd_pcm_substream *substream, ...@@ -70,7 +70,7 @@ static int jive_hw_params(struct snd_pcm_substream *substream,
} }
s3c_i2sv2_iis_calc_rate(&div, NULL, params_rate(params), s3c_i2sv2_iis_calc_rate(&div, NULL, params_rate(params),
s3c2412_get_iisclk()); s3c_i2sv2_get_clock(cpu_dai));
/* set codec DAI configuration */ /* set codec DAI configuration */
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
......
...@@ -516,6 +516,18 @@ static snd_pcm_sframes_t s3c2412_i2s_delay(struct snd_pcm_substream *substream, ...@@ -516,6 +516,18 @@ static snd_pcm_sframes_t s3c2412_i2s_delay(struct snd_pcm_substream *substream,
return delay; return delay;
} }
struct clk *s3c_i2sv2_get_clock(struct snd_soc_dai *cpu_dai)
{
struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
u32 iismod = readl(i2s->regs + S3C2412_IISMOD);
if (iismod & S3C2412_IISMOD_IMS_SYSMUX)
return i2s->iis_cclk;
else
return i2s->iis_pclk;
}
EXPORT_SYMBOL_GPL(s3c_i2sv2_get_clock);
/* default table of all avaialable root fs divisors */ /* default table of all avaialable root fs divisors */
static unsigned int iis_fs_tab[] = { 256, 512, 384, 768 }; static unsigned int iis_fs_tab[] = { 256, 512, 384, 768 };
......
...@@ -60,6 +60,8 @@ struct s3c_i2sv2_info { ...@@ -60,6 +60,8 @@ struct s3c_i2sv2_info {
u32 suspend_iispsr; u32 suspend_iispsr;
}; };
extern struct clk *s3c_i2sv2_get_clock(struct snd_soc_dai *cpu_dai);
struct s3c_i2sv2_rate_calc { struct s3c_i2sv2_rate_calc {
unsigned int clk_div; /* for prescaler */ unsigned int clk_div; /* for prescaler */
unsigned int fs_div; /* for root frame clock */ unsigned int fs_div; /* for root frame clock */
......
...@@ -91,19 +91,6 @@ static int s3c2412_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, ...@@ -91,19 +91,6 @@ static int s3c2412_i2s_set_sysclk(struct snd_soc_dai *cpu_dai,
return 0; return 0;
} }
struct clk *s3c2412_get_iisclk(void)
{
struct s3c_i2sv2_info *i2s = &s3c2412_i2s;
u32 iismod = readl(i2s->regs + S3C2412_IISMOD);
if (iismod & S3C2412_IISMOD_IMS_SYSMUX)
return i2s->iis_cclk;
else
return i2s->iis_pclk;
}
EXPORT_SYMBOL_GPL(s3c2412_get_iisclk);
static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai) static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai)
{ {
return cpu_dai->private_data; return cpu_dai->private_data;
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#define S3C2412_CLKSRC_PCLK S3C_I2SV2_CLKSRC_PCLK #define S3C2412_CLKSRC_PCLK S3C_I2SV2_CLKSRC_PCLK
#define S3C2412_CLKSRC_I2SCLK S3C_I2SV2_CLKSRC_AUDIOBUS #define S3C2412_CLKSRC_I2SCLK S3C_I2SV2_CLKSRC_AUDIOBUS
extern struct clk *s3c2412_get_iisclk(void);
extern struct snd_soc_dai s3c2412_i2s_dai; extern struct snd_soc_dai s3c2412_i2s_dai;
#endif /* __SND_SOC_S3C24XX_S3C2412_I2S_H */ #endif /* __SND_SOC_S3C24XX_S3C2412_I2S_H */
...@@ -91,18 +91,6 @@ static int s3c64xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, ...@@ -91,18 +91,6 @@ static int s3c64xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai,
return 0; return 0;
} }
struct clk *s3c64xx_i2s_get_clock(struct snd_soc_dai *dai)
{
struct s3c_i2sv2_info *i2s = to_info(dai);
u32 iismod = readl(i2s->regs + S3C2412_IISMOD);
if (iismod & S3C64XX_IISMOD_IMS_SYSMUX)
return i2s->iis_cclk;
else
return i2s->iis_pclk;
}
EXPORT_SYMBOL_GPL(s3c64xx_i2s_get_clock);
static int s3c64xx_i2s_probe(struct platform_device *pdev, static int s3c64xx_i2s_probe(struct platform_device *pdev,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
......
...@@ -38,6 +38,4 @@ struct clk; ...@@ -38,6 +38,4 @@ struct clk;
extern struct snd_soc_dai s3c64xx_i2s_dai[]; extern struct snd_soc_dai s3c64xx_i2s_dai[];
extern struct clk *s3c64xx_i2s_get_clock(struct snd_soc_dai *dai);
#endif /* __SND_SOC_S3C24XX_S3C64XX_I2S_H */ #endif /* __SND_SOC_S3C24XX_S3C64XX_I2S_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment