Skip to contentSkip to conversation

ALSA: at73c213: manage SSC clock

PATCH Superseded Mans Rullgard 2 participants 4 messages Jan 16, 2016 – Jan 17, 2016 Sound

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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. Update this driver accordingly.

---
 sound/spi/at73c213.c | 8 ++++++++
 1 file changed, 8 insertions(+)
sound/spi/at73c213.c +8 -0
index 39522367897c..3b2d0b2be421 100644
@@ -981,6 +981,8 @@ static int snd_at73c213_probe(struct spi_device *spi)
 		goto out_card;
 	}
 
+	clk_enable(chip->ssc->clk);
+
 	retval = snd_at73c213_dev_init(card, spi);
 	if (retval)
 		goto out_ssc;
@@ -998,6 +1000,7 @@ static int snd_at73c213_probe(struct spi_device *spi)
 	goto out;
 
 out_ssc:
+	clk_disable(chip->ssc->clk);
 	ssc_free(chip->ssc);
 out_card:
 	snd_card_free(card);
@@ -1066,6 +1069,9 @@ out:
 	/* Stop DAC master clock. */
 	clk_disable(chip->board->dac_clk);
 
+	/* Stop SSC clock. */
+	clk_disable(chip->ssc->clk);
+
 	ssc_free(chip->ssc);
 	snd_card_free(card);
 
@@ -1080,6 +1086,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;
@@ -1091,6 +1098,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;
Signature · 1 line
2.7.0
#1 lore raw
Quoted 8 lines · Mans Rullgard

Since commit 49af54ff0fc7 ("misc: atmel-ssc: prepare clock only when request") the SSC driver expects clients to manage the SSC clock. Update this driver accordingly.

---
 sound/spi/at73c213.c | 8 ++++++++
 1 file changed, 8 insertions(+)

On second thoughts, please disregard this patch. It's better to enable the clock only when it is actually required.

Quoted 50 lines
sound/spi/at73c213.c +8 -0
index 39522367897c..3b2d0b2be421 100644
@@ -981,6 +981,8 @@ static int snd_at73c213_probe(struct spi_device *spi)
 		goto out_card;
 	}
 
+	clk_enable(chip->ssc->clk);
+
 	retval = snd_at73c213_dev_init(card, spi);
 	if (retval)
 		goto out_ssc;
@@ -998,6 +1000,7 @@ static int snd_at73c213_probe(struct spi_device *spi)
 	goto out;
 
 out_ssc:
+	clk_disable(chip->ssc->clk);
 	ssc_free(chip->ssc);
 out_card:
 	snd_card_free(card);
@@ -1066,6 +1069,9 @@ out:
 	/* Stop DAC master clock. */
 	clk_disable(chip->board->dac_clk);
 
+	/* Stop SSC clock. */
+	clk_disable(chip->ssc->clk);
+
 	ssc_free(chip->ssc);
 	snd_card_free(card);
 
@@ -1080,6 +1086,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;
@@ -1091,6 +1098,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;
Signature · 1 line
2.7.0
Signature · 1 line
Måns Rullgård
Acked-by on v1 1/1
#2 lore raw
In reply to Mans Rullgard
Quoted 5 lines · Mans Rullgard

Since commit 49af54ff0fc7 ("misc: atmel-ssc: prepare clock only when request") the SSC driver expects clients to manage the SSC clock. Update this driver accordingly.

I assume this will go through the alsa tree.

Quoted 3 lines
---
 sound/spi/at73c213.c | 8 ++++++++
 1 file changed, 8 insertions(+)

<snipp diff>

Signature · 1 line
Best regards, Hans-Christian Egtvedt.
#3 lore raw
Quoted 10 lines · Hans-Christian Noren Egtvedt
Quoted 5 lines · Mans Rullgard

Since commit 49af54ff0fc7 ("misc: atmel-ssc: prepare clock only when request") the SSC driver expects clients to manage the SSC clock. Update this driver accordingly.

I assume this will go through the alsa tree.

As I said earlier, this patch can be improved to enable the clock only as needed, i.e. during initial setup and when the device is open.

Signature · 1 line
Måns Rullgård