Skip to content

Commit

Permalink
ALSA: at73c213: manage SSC clock
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
mansr authored and tiwai committed Jan 20, 2016
1 parent c0bcdbd commit 3568459
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sound/spi/at73c213.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,16 @@ static int snd_at73c213_pcm_open(struct snd_pcm_substream *substream)
runtime->hw = snd_at73c213_playback_hw;
chip->substream = substream;

clk_enable(chip->ssc->clk);

return 0;
}

static int snd_at73c213_pcm_close(struct snd_pcm_substream *substream)
{
struct snd_at73c213 *chip = snd_pcm_substream_chip(substream);
chip->substream = NULL;
clk_disable(chip->ssc->clk);
return 0;
}

Expand Down Expand Up @@ -897,6 +900,8 @@ static int snd_at73c213_dev_init(struct snd_card *card,
chip->card = card;
chip->irq = -1;

clk_enable(chip->ssc->clk);

retval = request_irq(irq, snd_at73c213_interrupt, 0, "at73c213", chip);
if (retval) {
dev_dbg(&chip->spi->dev, "unable to request irq %d\n", irq);
Expand Down Expand Up @@ -935,6 +940,8 @@ static int snd_at73c213_dev_init(struct snd_card *card,
free_irq(chip->irq, chip);
chip->irq = -1;
out:
clk_disable(chip->ssc->clk);

return retval;
}

Expand Down Expand Up @@ -1012,7 +1019,9 @@ static int snd_at73c213_remove(struct spi_device *spi)
int retval;

/* Stop playback. */
clk_enable(chip->ssc->clk);
ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXDIS));
clk_disable(chip->ssc->clk);

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

ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXDIS));
clk_disable(chip->ssc->clk);
clk_disable(chip->board->dac_clk);

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

clk_enable(chip->board->dac_clk);
clk_enable(chip->ssc->clk);
ssc_writel(chip->ssc->regs, CR, SSC_BIT(CR_TXEN));

return 0;
Expand Down

0 comments on commit 3568459

Please sign in to comment.