Skip to content

Commit 3568459

Browse files
mansrtiwai
authored andcommitted
ALSA: at73c213: manage SSC clock
Since commit 49af54f ("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 <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent c0bcdbd commit 3568459

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sound/spi/at73c213.c

+11
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,16 @@ static int snd_at73c213_pcm_open(struct snd_pcm_substream *substream)
221221
runtime->hw = snd_at73c213_playback_hw;
222222
chip->substream = substream;
223223

224+
clk_enable(chip->ssc->clk);
225+
224226
return 0;
225227
}
226228

227229
static int snd_at73c213_pcm_close(struct snd_pcm_substream *substream)
228230
{
229231
struct snd_at73c213 *chip = snd_pcm_substream_chip(substream);
230232
chip->substream = NULL;
233+
clk_disable(chip->ssc->clk);
231234
return 0;
232235
}
233236

@@ -897,6 +900,8 @@ static int snd_at73c213_dev_init(struct snd_card *card,
897900
chip->card = card;
898901
chip->irq = -1;
899902

903+
clk_enable(chip->ssc->clk);
904+
900905
retval = request_irq(irq, snd_at73c213_interrupt, 0, "at73c213", chip);
901906
if (retval) {
902907
dev_dbg(&chip->spi->dev, "unable to request irq %d\n", irq);
@@ -935,6 +940,8 @@ static int snd_at73c213_dev_init(struct snd_card *card,
935940
free_irq(chip->irq, chip);
936941
chip->irq = -1;
937942
out:
943+
clk_disable(chip->ssc->clk);
944+
938945
return retval;
939946
}
940947

@@ -1012,7 +1019,9 @@ static int snd_at73c213_remove(struct spi_device *spi)
10121019
int retval;
10131020

10141021
/* Stop playback. */
1022+
clk_enable(chip->ssc->clk);
10151023
ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXDIS));
1024+
clk_disable(chip->ssc->clk);
10161025

10171026
/* Mute sound. */
10181027
retval = snd_at73c213_write_reg(chip, DAC_LMPG, 0x3f);
@@ -1080,6 +1089,7 @@ static int snd_at73c213_suspend(struct device *dev)
10801089
struct snd_at73c213 *chip = card->private_data;
10811090

10821091
ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXDIS));
1092+
clk_disable(chip->ssc->clk);
10831093
clk_disable(chip->board->dac_clk);
10841094

10851095
return 0;
@@ -1091,6 +1101,7 @@ static int snd_at73c213_resume(struct device *dev)
10911101
struct snd_at73c213 *chip = card->private_data;
10921102

10931103
clk_enable(chip->board->dac_clk);
1104+
clk_enable(chip->ssc->clk);
10941105
ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXEN));
10951106

10961107
return 0;

0 commit comments

Comments
 (0)