From patchwork Wed Jun 30 13:47:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raffaele Recalcati X-Patchwork-Id: 110557 Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o66NER5u023746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 6 Jul 2010 23:15:23 GMT Received: from dlep35.itg.ti.com ([157.170.170.118]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id o66N7ZCO013461 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 6 Jul 2010 18:07:35 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id o66N7Y0O000490; Tue, 6 Jul 2010 18:07:34 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id DA5D08062B; Tue, 6 Jul 2010 18:07:33 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id 4D26E80626 for ; Wed, 30 Jun 2010 08:48:15 -0500 (CDT) Received: from red.ext.ti.com (localhost [127.0.0.1]) by dflp51.itg.ti.com (8.13.7/8.13.7) with ESMTP id o5UDmFPa020427 for ; Wed, 30 Jun 2010 08:48:15 -0500 (CDT) Received: from psmtp.com (na3sys009amx238.postini.com [74.125.149.122]) by red.ext.ti.com (8.13.7/8.13.7) with SMTP id o5UDmEbc018676 for ; Wed, 30 Jun 2010 08:48:14 -0500 Received: from source ([74.125.82.173]) by na3sys009amx238.postini.com ([74.125.148.10]) with SMTP; Wed, 30 Jun 2010 06:48:14 PDT Received: by mail-wy0-f173.google.com with SMTP id 35so919352wyb.4 for ; Wed, 30 Jun 2010 06:48:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=6nCq0Y3xK403xm2b0SGKJ329eQh4LDn040WYtVbq1TY=; b=DwNFnsf03gsI7GDKAB/N+wF2LZpMKrmg0YhQoNQMXwx4BBgcCvmtwGyAoDFHHJQVSz MbVRvOrWxvuaPibbyRHOg+rO0QVWlcv52J0I4Iv/gqrtT+Wvhtf389BCuKttHWnwI2aM jGR0KxfTVY8r020NeUoz0eWriuapvGxyqvm4I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=oirLGkG5LW14UENAIgtoPmfcYix0OX3j/tl7aL91wPOHvcKahKoYDdvdDZ+A3Fjf3A mdhrgMsGlCbNS1axw3ieAZUsqZfGIouvLtvptZGocXNupHDHboxNi70PrdpzjURv4O9F ZBxO6SsU5SpTLlheE4R5ECvvbW+DmqYwCK0WM= Received: by 10.216.184.136 with SMTP id s8mr6995862wem.102.1277905685320; Wed, 30 Jun 2010 06:48:05 -0700 (PDT) Received: from localhost.localdomain (host81-90-static.72-81-b.business.telecomitalia.it [81.72.90.81]) by mx.google.com with ESMTPS id w19sm10373721weq.20.2010.06.30.06.48.01 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 30 Jun 2010 06:48:03 -0700 (PDT) From: Raffaele Recalcati To: davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH 2/3] ASoC: DaVinci: Added selection of clk input pin for McBSP Date: Wed, 30 Jun 2010 15:47:57 +0200 Message-Id: <1277905678-4695-3-git-send-email-lamiaposta71@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1277905678-4695-1-git-send-email-lamiaposta71@gmail.com> References: <1277905678-4695-1-git-send-email-lamiaposta71@gmail.com> X-pstn-neptune: 0/0/0.00/0 X-pstn-levels: (S: 5.14435/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-settings: 2 (0.5000:0.5000) s cv gt3 gt2 gt1 r p m c X-pstn-addresses: from [db-null] X-Mailman-Approved-At: Tue, 06 Jul 2010 18:07:30 -0500 Cc: alsa-devel@alsa-project.org, Russell King , Takashi Iwai , Mark Brown , linux-kernel@vger.kernel.org, Raffaele Recalcati , Jaroslav Kysela , linux-arm-kernel@lists.infradead.org, Liam Girdwood X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 06 Jul 2010 23:15:23 +0000 (UTC) diff --git a/arch/arm/mach-davinci/include/mach/asp.h b/arch/arm/mach-davinci/include/mach/asp.h index 834725f..314570d 100644 --- a/arch/arm/mach-davinci/include/mach/asp.h +++ b/arch/arm/mach-davinci/include/mach/asp.h @@ -63,6 +63,9 @@ struct snd_platform_data { unsigned sram_size_playback; unsigned sram_size_capture; + /* To be used when cpu gets clock from external pin */ + int clk_input_pin; + /* McASP specific fields */ int tdm_slots; u8 op_mode; @@ -78,6 +81,11 @@ enum { MCASP_VERSION_2, /* DA8xx/OMAPL1x */ }; +enum { + MCBSP_CLKR = 0, /* DM365 */ + MCBSP_CLKS, +}; + #define INACTIVE_MODE 0 #define TX_MODE 1 #define RX_MODE 2 diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index 319e8ca..e478be9 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c @@ -152,6 +152,7 @@ struct davinci_mcbsp_dev { unsigned int fmt; int clk_div; + int clk_input_pin; }; static inline void davinci_mcbsp_write_reg(struct davinci_mcbsp_dev *dev, @@ -278,11 +279,26 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, DAVINCI_MCBSP_PCR_CLKRM; break; case SND_SOC_DAIFMT_CBM_CFS: - /* McBSP CLKR pin is the input for the Sample Rate Generator. - * McBSP FSR and FSX are driven by the Sample Rate Generator. */ - pcr = DAVINCI_MCBSP_PCR_SCLKME | - DAVINCI_MCBSP_PCR_FSXM | - DAVINCI_MCBSP_PCR_FSRM; + pcr = DAVINCI_MCBSP_PCR_FSRM | DAVINCI_MCBSP_PCR_FSXM; + /* + * Selection of the clock input pin that is the + * input for the Sample Rate Generator. + * McBSP FSR and FSX are driven by the Sample Rate + * Generator. + */ + switch (dev->clk_input_pin) { + case MCBSP_CLKS: + pcr |= DAVINCI_MCBSP_PCR_CLKXM | + DAVINCI_MCBSP_PCR_CLKRM; + break; + case MCBSP_CLKR: + pcr |= DAVINCI_MCBSP_PCR_SCLKME; + break; + default: + printk(KERN_ERR "%s:bad clk_input_pin\n", __func__); + return -EINVAL; + } + break; case SND_SOC_DAIFMT_CBM_CFM: /* codec is master */ @@ -436,6 +452,7 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, srgr |= clk_div; break; case SND_SOC_DAIFMT_CBM_CFS: + /* Clock given on CLKS */ srgr = DAVINCI_MCBSP_SRGR_FSGM; clk_div = dev->clk_div - 1; srgr |= DAVINCI_MCBSP_SRGR_FWID(mcbsp_word_length * 8 - 1); @@ -626,6 +643,7 @@ static int davinci_i2s_probe(struct platform_device *pdev) pdata->sram_size_playback; dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].sram_size = pdata->sram_size_capture; + dev->clk_input_pin = pdata->clk_input_pin; } dev->clk = clk_get(&pdev->dev, NULL); if (IS_ERR(dev->clk)) {