Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1311005 > unrolled thread

[PATCH] ALSA: at73c213: manage SSC clock

Started byMans Rullgard <mans@mansr.com>
First post2016-01-16 19:40 +0100
Last post2016-01-17 22:50 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ALSA: at73c213: manage SSC clock Mans Rullgard <mans@mansr.com> - 2016-01-16 19:40 +0100
    Re: [PATCH] ALSA: at73c213: manage SSC clock Måns Rullgård <mans@mansr.com> - 2016-01-17 15:50 +0100
    Re: [PATCH] ALSA: at73c213: manage SSC clock Hans-Christian Noren Egtvedt <egtvedt@samfundet.no> - 2016-01-17 22:40 +0100
      Re: [PATCH] ALSA: at73c213: manage SSC clock Måns Rullgård <mans@mansr.com> - 2016-01-17 22:50 +0100

#1311005 — [PATCH] ALSA: at73c213: manage SSC clock

FromMans Rullgard <mans@mansr.com>
Date2016-01-16 19:40 +0100
Subject[PATCH] ALSA: at73c213: manage SSC clock
Message-ID<qRDVv-88K-1@gated-at.bofh.it>
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.

Signed-off-by: Mans Rullgard <mans@mansr.com>
---
 sound/spi/at73c213.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c
index 39522367897c..3b2d0b2be421 100644
--- a/sound/spi/at73c213.c
+++ b/sound/spi/at73c213.c
@@ -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;
-- 
2.7.0

[toc] | [next] | [standalone]


#1311156

FromMåns Rullgård <mans@mansr.com>
Date2016-01-17 15:50 +0100
Message-ID<qRWOt-3Ia-3@gated-at.bofh.it>
In reply to#1311005
Mans Rullgard <mans@mansr.com> writes:

> 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.
>
> Signed-off-by: Mans Rullgard <mans@mansr.com>
> ---
>  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.

> diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c
> index 39522367897c..3b2d0b2be421 100644
> --- a/sound/spi/at73c213.c
> +++ b/sound/spi/at73c213.c
> @@ -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;
> -- 
> 2.7.0
>

-- 
Måns Rullgård

[toc] | [prev] | [next] | [standalone]


#1311190

FromHans-Christian Noren Egtvedt <egtvedt@samfundet.no>
Date2016-01-17 22:40 +0100
Message-ID<qS3dg-83t-11@gated-at.bofh.it>
In reply to#1311005
Around Sat 16 Jan 2016 18:35:49 +0000 or thereabout, Mans Rullgard wrote:
> 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.
> 
> Signed-off-by: Mans Rullgard <mans@mansr.com>

Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>

I assume this will go through the alsa tree.

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

<snipp diff>

-- 
Best regards, Hans-Christian Egtvedt.

[toc] | [prev] | [next] | [standalone]


#1311191

FromMåns Rullgård <mans@mansr.com>
Date2016-01-17 22:50 +0100
Message-ID<qS3mW-87m-9@gated-at.bofh.it>
In reply to#1311190
Hans-Christian Noren Egtvedt <egtvedt@samfundet.no> writes:

> Around Sat 16 Jan 2016 18:35:49 +0000 or thereabout, Mans Rullgard wrote:
>> 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.
>> 
>> Signed-off-by: Mans Rullgard <mans@mansr.com>
>
> Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
>
> 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.

-- 
Måns Rullgård

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web