diff options
author | Jassi Brar <jassi.brar@samsung.com> | 2010-04-27 02:56:45 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-05-05 10:13:20 -0400 |
commit | 5728242789d3538abcfdcb28e01798801efd9988 (patch) | |
tree | e7610d08a85bd67da0dd82994a286a53e55e19e9 /sound | |
parent | 21a7ad08e274ce7b669b165d65e0bab8391552a6 (diff) |
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: Jassi Brar <jassi.brar@samsung.com>
Acked-by: Ben Dooks <ben-linux@fluff.org>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/s3c24xx/jive_wm8750.c | 2 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c-i2s-v2.c | 12 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c-i2s-v2.h | 2 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c2412-i2s.c | 13 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c2412-i2s.h | 2 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c64xx-i2s.c | 12 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c64xx-i2s.h | 2 |
7 files changed, 15 insertions, 30 deletions
diff --git a/sound/soc/s3c24xx/jive_wm8750.c b/sound/soc/s3c24xx/jive_wm8750.c index 97d8ff3196be..8c108b121c10 100644 --- a/sound/soc/s3c24xx/jive_wm8750.c +++ b/sound/soc/s3c24xx/jive_wm8750.c | |||
@@ -70,7 +70,7 @@ static int jive_hw_params(struct snd_pcm_substream *substream, | |||
70 | } | 70 | } |
71 | 71 | ||
72 | s3c_i2sv2_iis_calc_rate(&div, NULL, params_rate(params), | 72 | s3c_i2sv2_iis_calc_rate(&div, NULL, params_rate(params), |
73 | s3c2412_get_iisclk()); | 73 | s3c_i2sv2_get_clock(cpu_dai)); |
74 | 74 | ||
75 | /* set codec DAI configuration */ | 75 | /* set codec DAI configuration */ |
76 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | | 76 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | |
diff --git a/sound/soc/s3c24xx/s3c-i2s-v2.c b/sound/soc/s3c24xx/s3c-i2s-v2.c index b8803a182cc1..ac153ca9c628 100644 --- a/sound/soc/s3c24xx/s3c-i2s-v2.c +++ b/sound/soc/s3c24xx/s3c-i2s-v2.c | |||
@@ -516,6 +516,18 @@ static snd_pcm_sframes_t s3c2412_i2s_delay(struct snd_pcm_substream *substream, | |||
516 | return delay; | 516 | return delay; |
517 | } | 517 | } |
518 | 518 | ||
519 | struct clk *s3c_i2sv2_get_clock(struct snd_soc_dai *cpu_dai) | ||
520 | { | ||
521 | struct s3c_i2sv2_info *i2s = to_info(cpu_dai); | ||
522 | u32 iismod = readl(i2s->regs + S3C2412_IISMOD); | ||
523 | |||
524 | if (iismod & S3C2412_IISMOD_IMS_SYSMUX) | ||
525 | return i2s->iis_cclk; | ||
526 | else | ||
527 | return i2s->iis_pclk; | ||
528 | } | ||
529 | EXPORT_SYMBOL_GPL(s3c_i2sv2_get_clock); | ||
530 | |||
519 | /* default table of all avaialable root fs divisors */ | 531 | /* default table of all avaialable root fs divisors */ |
520 | static unsigned int iis_fs_tab[] = { 256, 512, 384, 768 }; | 532 | static unsigned int iis_fs_tab[] = { 256, 512, 384, 768 }; |
521 | 533 | ||
diff --git a/sound/soc/s3c24xx/s3c-i2s-v2.h b/sound/soc/s3c24xx/s3c-i2s-v2.h index ea56467f5adc..39a6db6a565c 100644 --- a/sound/soc/s3c24xx/s3c-i2s-v2.h +++ b/sound/soc/s3c24xx/s3c-i2s-v2.h | |||
@@ -60,6 +60,8 @@ struct s3c_i2sv2_info { | |||
60 | u32 suspend_iispsr; | 60 | u32 suspend_iispsr; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | extern struct clk *s3c_i2sv2_get_clock(struct snd_soc_dai *cpu_dai); | ||
64 | |||
63 | struct s3c_i2sv2_rate_calc { | 65 | struct s3c_i2sv2_rate_calc { |
64 | unsigned int clk_div; /* for prescaler */ | 66 | unsigned int clk_div; /* for prescaler */ |
65 | unsigned int fs_div; /* for root frame clock */ | 67 | unsigned int fs_div; /* for root frame clock */ |
diff --git a/sound/soc/s3c24xx/s3c2412-i2s.c b/sound/soc/s3c24xx/s3c2412-i2s.c index ce2daacc4eb9..6b884d75235e 100644 --- a/sound/soc/s3c24xx/s3c2412-i2s.c +++ b/sound/soc/s3c24xx/s3c2412-i2s.c | |||
@@ -91,19 +91,6 @@ static int s3c2412_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, | |||
91 | return 0; | 91 | return 0; |
92 | } | 92 | } |
93 | 93 | ||
94 | |||
95 | struct clk *s3c2412_get_iisclk(void) | ||
96 | { | ||
97 | struct s3c_i2sv2_info *i2s = &s3c2412_i2s; | ||
98 | u32 iismod = readl(i2s->regs + S3C2412_IISMOD); | ||
99 | |||
100 | if (iismod & S3C2412_IISMOD_IMS_SYSMUX) | ||
101 | return i2s->iis_cclk; | ||
102 | else | ||
103 | return i2s->iis_pclk; | ||
104 | } | ||
105 | EXPORT_SYMBOL_GPL(s3c2412_get_iisclk); | ||
106 | |||
107 | static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai) | 94 | static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai) |
108 | { | 95 | { |
109 | return cpu_dai->private_data; | 96 | return cpu_dai->private_data; |
diff --git a/sound/soc/s3c24xx/s3c2412-i2s.h b/sound/soc/s3c24xx/s3c2412-i2s.h index 60cac002a830..0b5686b4d5c3 100644 --- a/sound/soc/s3c24xx/s3c2412-i2s.h +++ b/sound/soc/s3c24xx/s3c2412-i2s.h | |||
@@ -24,8 +24,6 @@ | |||
24 | #define S3C2412_CLKSRC_PCLK S3C_I2SV2_CLKSRC_PCLK | 24 | #define S3C2412_CLKSRC_PCLK S3C_I2SV2_CLKSRC_PCLK |
25 | #define S3C2412_CLKSRC_I2SCLK S3C_I2SV2_CLKSRC_AUDIOBUS | 25 | #define S3C2412_CLKSRC_I2SCLK S3C_I2SV2_CLKSRC_AUDIOBUS |
26 | 26 | ||
27 | extern struct clk *s3c2412_get_iisclk(void); | ||
28 | |||
29 | extern struct snd_soc_dai s3c2412_i2s_dai; | 27 | extern struct snd_soc_dai s3c2412_i2s_dai; |
30 | 28 | ||
31 | #endif /* __SND_SOC_S3C24XX_S3C2412_I2S_H */ | 29 | #endif /* __SND_SOC_S3C24XX_S3C2412_I2S_H */ |
diff --git a/sound/soc/s3c24xx/s3c64xx-i2s.c b/sound/soc/s3c24xx/s3c64xx-i2s.c index b7e951fe30a6..97327ef09de6 100644 --- a/sound/soc/s3c24xx/s3c64xx-i2s.c +++ b/sound/soc/s3c24xx/s3c64xx-i2s.c | |||
@@ -91,18 +91,6 @@ static int s3c64xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, | |||
91 | return 0; | 91 | return 0; |
92 | } | 92 | } |
93 | 93 | ||
94 | struct clk *s3c64xx_i2s_get_clock(struct snd_soc_dai *dai) | ||
95 | { | ||
96 | struct s3c_i2sv2_info *i2s = to_info(dai); | ||
97 | u32 iismod = readl(i2s->regs + S3C2412_IISMOD); | ||
98 | |||
99 | if (iismod & S3C64XX_IISMOD_IMS_SYSMUX) | ||
100 | return i2s->iis_cclk; | ||
101 | else | ||
102 | return i2s->iis_pclk; | ||
103 | } | ||
104 | EXPORT_SYMBOL_GPL(s3c64xx_i2s_get_clock); | ||
105 | |||
106 | static int s3c64xx_i2s_probe(struct platform_device *pdev, | 94 | static int s3c64xx_i2s_probe(struct platform_device *pdev, |
107 | struct snd_soc_dai *dai) | 95 | struct snd_soc_dai *dai) |
108 | { | 96 | { |
diff --git a/sound/soc/s3c24xx/s3c64xx-i2s.h b/sound/soc/s3c24xx/s3c64xx-i2s.h index 53d2a0a0df36..f27ed50e4d82 100644 --- a/sound/soc/s3c24xx/s3c64xx-i2s.h +++ b/sound/soc/s3c24xx/s3c64xx-i2s.h | |||
@@ -38,6 +38,4 @@ struct clk; | |||
38 | 38 | ||
39 | extern struct snd_soc_dai s3c64xx_i2s_dai[]; | 39 | extern struct snd_soc_dai s3c64xx_i2s_dai[]; |
40 | 40 | ||
41 | extern struct clk *s3c64xx_i2s_get_clock(struct snd_soc_dai *dai); | ||
42 | |||
43 | #endif /* __SND_SOC_S3C24XX_S3C64XX_I2S_H */ | 41 | #endif /* __SND_SOC_S3C24XX_S3C64XX_I2S_H */ |