From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758284AbcATJAH (ORCPT ); Wed, 20 Jan 2016 04:00:07 -0500 Received: from mx2.suse.de ([195.135.220.15]:33078 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751218AbcATJAD (ORCPT ); Wed, 20 Jan 2016 04:00:03 -0500 Date: Wed, 20 Jan 2016 10:00:01 +0100 Message-ID: From: Takashi Iwai To: "Mans Rullgard" Cc: "Hans-Christian Noren Egtvedt" , , "Jaroslav Kysela" , Subject: Re: [PATCH v2] ALSA: at73c213: manage SSC clock In-Reply-To: <1453069862-27884-1-git-send-email-mans@mansr.com> References: <1453069862-27884-1-git-send-email-mans@mansr.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 17 Jan 2016 23:31:02 +0100, Mans Rullgard wrote: > > 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 > --- > Changes: > - enable the ssc clock only when it is required Applied, thanks. Takashi > --- > sound/spi/at73c213.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > 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) > runtime->hw = snd_at73c213_playback_hw; > chip->substream = substream; > > + clk_enable(chip->ssc->clk); > + > return 0; > } > > @@ -228,6 +230,7 @@ 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; > } > > @@ -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); > @@ -935,6 +940,8 @@ out_irq: > free_irq(chip->irq, chip); > chip->irq = -1; > out: > + clk_disable(chip->ssc->clk); > + > return retval; > } > > @@ -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); > @@ -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; > @@ -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; > -- > 2.7.0 > >