diff options
author | Mans Rullgard <mans@mansr.com> | 2016-01-17 17:31:02 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-01-20 03:59:27 -0500 |
commit | 3568459a51136f418ca8cad48a0db3803010148a (patch) | |
tree | bd62b4fb29f83d30bfadf35137810686451096e7 /sound/spi | |
parent | c0bcdbdff3ff73a54161fca3cb8b6cdbd0bb8762 (diff) |
ALSA: at73c213: manage SSC clock
Since commit 49af54ff0fc7 ("misc: atmel-ssc: prepare clock only when
request") the SSC driver expects clients to manage the SSC clock.
This updates the at73c213 driver to enable the SSC clock whenever it is
needed.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/spi')
-rw-r--r-- | sound/spi/at73c213.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c index 39522367897c..fac7e6eb9529 100644 --- a/sound/spi/at73c213.c +++ b/sound/spi/at73c213.c | |||
@@ -221,6 +221,8 @@ static int snd_at73c213_pcm_open(struct snd_pcm_substream *substream) | |||
221 | runtime->hw = snd_at73c213_playback_hw; | 221 | runtime->hw = snd_at73c213_playback_hw; |
222 | chip->substream = substream; | 222 | chip->substream = substream; |
223 | 223 | ||
224 | clk_enable(chip->ssc->clk); | ||
225 | |||
224 | return 0; | 226 | return 0; |
225 | } | 227 | } |
226 | 228 | ||
@@ -228,6 +230,7 @@ static int snd_at73c213_pcm_close(struct snd_pcm_substream *substream) | |||
228 | { | 230 | { |
229 | struct snd_at73c213 *chip = snd_pcm_substream_chip(substream); | 231 | struct snd_at73c213 *chip = snd_pcm_substream_chip(substream); |
230 | chip->substream = NULL; | 232 | chip->substream = NULL; |
233 | clk_disable(chip->ssc->clk); | ||
231 | return 0; | 234 | return 0; |
232 | } | 235 | } |
233 | 236 | ||
@@ -897,6 +900,8 @@ static int snd_at73c213_dev_init(struct snd_card *card, | |||
897 | chip->card = card; | 900 | chip->card = card; |
898 | chip->irq = -1; | 901 | chip->irq = -1; |
899 | 902 | ||
903 | clk_enable(chip->ssc->clk); | ||
904 | |||
900 | retval = request_irq(irq, snd_at73c213_interrupt, 0, "at73c213", chip); | 905 | retval = request_irq(irq, snd_at73c213_interrupt, 0, "at73c213", chip); |
901 | if (retval) { | 906 | if (retval) { |
902 | dev_dbg(&chip->spi->dev, "unable to request irq %d\n", irq); | 907 | dev_dbg(&chip->spi->dev, "unable to request irq %d\n", irq); |
@@ -935,6 +940,8 @@ out_irq: | |||
935 | free_irq(chip->irq, chip); | 940 | free_irq(chip->irq, chip); |
936 | chip->irq = -1; | 941 | chip->irq = -1; |
937 | out: | 942 | out: |
943 | clk_disable(chip->ssc->clk); | ||
944 | |||
938 | return retval; | 945 | return retval; |
939 | } | 946 | } |
940 | 947 | ||
@@ -1012,7 +1019,9 @@ static int snd_at73c213_remove(struct spi_device *spi) | |||
1012 | int retval; | 1019 | int retval; |
1013 | 1020 | ||
1014 | /* Stop playback. */ | 1021 | /* Stop playback. */ |
1022 | clk_enable(chip->ssc->clk); | ||
1015 | ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXDIS)); | 1023 | ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXDIS)); |
1024 | clk_disable(chip->ssc->clk); | ||
1016 | 1025 | ||
1017 | /* Mute sound. */ | 1026 | /* Mute sound. */ |
1018 | retval = snd_at73c213_write_reg(chip, DAC_LMPG, 0x3f); | 1027 | retval = snd_at73c213_write_reg(chip, DAC_LMPG, 0x3f); |
@@ -1080,6 +1089,7 @@ static int snd_at73c213_suspend(struct device *dev) | |||
1080 | struct snd_at73c213 *chip = card->private_data; | 1089 | struct snd_at73c213 *chip = card->private_data; |
1081 | 1090 | ||
1082 | ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXDIS)); | 1091 | ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXDIS)); |
1092 | clk_disable(chip->ssc->clk); | ||
1083 | clk_disable(chip->board->dac_clk); | 1093 | clk_disable(chip->board->dac_clk); |
1084 | 1094 | ||
1085 | return 0; | 1095 | return 0; |
@@ -1091,6 +1101,7 @@ static int snd_at73c213_resume(struct device *dev) | |||
1091 | struct snd_at73c213 *chip = card->private_data; | 1101 | struct snd_at73c213 *chip = card->private_data; |
1092 | 1102 | ||
1093 | clk_enable(chip->board->dac_clk); | 1103 | clk_enable(chip->board->dac_clk); |
1104 | clk_enable(chip->ssc->clk); | ||
1094 | ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXEN)); | 1105 | ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXEN)); |
1095 | 1106 | ||
1096 | return 0; | 1107 | return 0; |