Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752257AbaBJJWo (ORCPT ); Mon, 10 Feb 2014 04:22:44 -0500 Received: from eusmtp01.atmel.com ([212.144.249.243]:49122 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751654AbaBJJWk (ORCPT ); Mon, 10 Feb 2014 04:22:40 -0500 Message-ID: <52F89A53.4090402@atmel.com> Date: Mon, 10 Feb 2014 10:22:27 +0100 From: Nicolas Ferre Organization: atmel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Bo Shen , CC: , , , , "Arnd Bergmann" , Greg Kroah-Hartman , Chas Williams , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , "Lars-Peter Clausen" , , , Subject: Re: [PATCH v3 1/2] ASoC: atmel_ssc_dai: make option to choose clock References: <1392012586-30790-1-git-send-email-voice.shen@atmel.com> <1392012586-30790-2-git-send-email-voice.shen@atmel.com> In-Reply-To: <1392012586-30790-2-git-send-email-voice.shen@atmel.com> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.161.30.18] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/02/2014 07:09, Bo Shen : > When SSC works in slave mode, according to the hardware design, the > clock can get from TK pin, also can get from RK pin. So, add one > parameter to choose where the clock from. > > Signed-off-by: Bo Shen Acked-by: Nicolas Ferre > --- > Changes in v3: > - New, move clk-from-rk-pin property from card to ssc device > > drivers/misc/atmel-ssc.c | 6 ++++++ > include/linux/atmel-ssc.h | 1 + > sound/soc/atmel/atmel_ssc_dai.c | 13 +++++++++---- > 3 files changed, 16 insertions(+), 4 deletions(-) > > diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c > index 5be80840..22de137 100644 > --- a/drivers/misc/atmel-ssc.c > +++ b/drivers/misc/atmel-ssc.c > @@ -150,6 +150,12 @@ static int ssc_probe(struct platform_device *pdev) > return -ENODEV; > ssc->pdata = (struct atmel_ssc_platform_data *)plat_dat; > > + if (pdev->dev.of_node) { > + struct device_node *np = pdev->dev.of_node; > + ssc->clk_from_rk_pin = > + of_property_read_bool(np, "atmel,clk-from-rk-pin"); > + } > + > regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); > ssc->regs = devm_ioremap_resource(&pdev->dev, regs); > if (IS_ERR(ssc->regs)) > diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h > index 66a0e53..571a12e 100644 > --- a/include/linux/atmel-ssc.h > +++ b/include/linux/atmel-ssc.h > @@ -18,6 +18,7 @@ struct ssc_device { > struct clk *clk; > int user; > int irq; > + bool clk_from_rk_pin; > }; > > struct ssc_device * __must_check ssc_request(unsigned int ssc_num); > diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c > index 8697ced..ca1d8a3 100644 > --- a/sound/soc/atmel/atmel_ssc_dai.c > +++ b/sound/soc/atmel/atmel_ssc_dai.c > @@ -341,6 +341,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, > { > int id = dai->id; > struct atmel_ssc_info *ssc_p = &ssc_info[id]; > + struct ssc_device *ssc = ssc_p->ssc; > struct atmel_pcm_dma_params *dma_params; > int dir, channels, bits; > u32 tfmr, rfmr, tcmr, rcmr; > @@ -466,7 +467,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, > | SSC_BF(RCMR_START, start_event) > | SSC_BF(RCMR_CKI, SSC_CKI_RISING) > | SSC_BF(RCMR_CKO, SSC_CKO_NONE) > - | SSC_BF(RCMR_CKS, SSC_CKS_CLOCK); > + | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ? > + SSC_CKS_PIN : SSC_CKS_CLOCK); > > rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE) > | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE) > @@ -481,7 +483,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, > | SSC_BF(TCMR_START, start_event) > | SSC_BF(TCMR_CKI, SSC_CKI_FALLING) > | SSC_BF(TCMR_CKO, SSC_CKO_NONE) > - | SSC_BF(TCMR_CKS, SSC_CKS_PIN); > + | SSC_BF(TCMR_CKS, ssc->clk_from_rk_pin ? > + SSC_CKS_CLOCK : SSC_CKS_PIN); > > tfmr = SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE) > | SSC_BF(TFMR_FSDEN, 0) > @@ -550,7 +553,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, > | SSC_BF(RCMR_START, SSC_START_RISING_RF) > | SSC_BF(RCMR_CKI, SSC_CKI_RISING) > | SSC_BF(RCMR_CKO, SSC_CKO_NONE) > - | SSC_BF(RCMR_CKS, SSC_CKS_PIN); > + | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ? > + SSC_CKS_PIN : SSC_CKS_CLOCK); > > rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE) > | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE) > @@ -565,7 +569,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, > | SSC_BF(TCMR_START, SSC_START_RISING_RF) > | SSC_BF(TCMR_CKI, SSC_CKI_FALLING) > | SSC_BF(TCMR_CKO, SSC_CKO_NONE) > - | SSC_BF(TCMR_CKS, SSC_CKS_PIN); > + | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ? > + SSC_CKS_CLOCK : SSC_CKS_PIN); > > tfmr = SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE) > | SSC_BF(TFMR_FSDEN, 0) > -- Nicolas Ferre -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/