aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/samsung/i2s.c
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2014-07-10 12:11:13 -0400
committerMark Brown <broonie@linaro.org>2014-07-11 09:04:03 -0400
commitb97c60abf9a561f86ae71bd741add02673cc1a08 (patch)
tree851e1dcb759881e00193956e9cf30a0ec8779e74 /sound/soc/samsung/i2s.c
parentd3d4e5247b013008a39e4d5f69ce4c60ed57f997 (diff)
ASoC: samsung-i2s: Maintain CDCLK settings across i2s_{shutdown/startup}
Currently configuration of the CDCLK pad is being overwritten in the i2s_shutdown() callback in order to gate the SoC output clock. However if an ASoC machine driver doesn't restore that clock settings each time after opening the sound device this results in the CDCLK pin being permanently configured into input mode. I.e. the output clock will always stay disabled. Fix that by saving the CDCLKCON bit state in i2s_shutdown() and and restoring it in the i2s_startup() callback. Signed-off-by: Chen Zhen <zhen1.chen@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/samsung/i2s.c')
-rw-r--r--sound/soc/samsung/i2s.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 5f9b255a8b38..d2533dbc8399 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -68,6 +68,8 @@ struct i2s_dai {
68#define DAI_OPENED (1 << 0) /* Dai is opened */ 68#define DAI_OPENED (1 << 0) /* Dai is opened */
69#define DAI_MANAGER (1 << 1) /* Dai is the manager */ 69#define DAI_MANAGER (1 << 1) /* Dai is the manager */
70 unsigned mode; 70 unsigned mode;
71 /* CDCLK pin direction: 0 - input, 1 - output */
72 unsigned int cdclk_out:1;
71 /* Driver for this DAI */ 73 /* Driver for this DAI */
72 struct snd_soc_dai_driver i2s_dai_drv; 74 struct snd_soc_dai_driver i2s_dai_drv;
73 /* DMA parameters */ 75 /* DMA parameters */
@@ -737,6 +739,9 @@ static int i2s_startup(struct snd_pcm_substream *substream,
737 739
738 spin_unlock_irqrestore(&lock, flags); 740 spin_unlock_irqrestore(&lock, flags);
739 741
742 if (!is_opened(other) && i2s->cdclk_out)
743 i2s_set_sysclk(dai, SAMSUNG_I2S_CDCLK,
744 0, SND_SOC_CLOCK_OUT);
740 return 0; 745 return 0;
741} 746}
742 747
@@ -752,9 +757,13 @@ static void i2s_shutdown(struct snd_pcm_substream *substream,
752 i2s->mode &= ~DAI_OPENED; 757 i2s->mode &= ~DAI_OPENED;
753 i2s->mode &= ~DAI_MANAGER; 758 i2s->mode &= ~DAI_MANAGER;
754 759
755 if (is_opened(other)) 760 if (is_opened(other)) {
756 other->mode |= DAI_MANAGER; 761 other->mode |= DAI_MANAGER;
757 762 } else {
763 u32 mod = readl(i2s->addr + I2SMOD);
764 i2s->cdclk_out = !(mod & MOD_CDCLKCON);
765 other->cdclk_out = i2s->cdclk_out;
766 }
758 /* Reset any constraint on RFS and BFS */ 767 /* Reset any constraint on RFS and BFS */
759 i2s->rfs = 0; 768 i2s->rfs = 0;
760 i2s->bfs = 0; 769 i2s->bfs = 0;