From patchwork Mon Jul 13 21:27:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 35474 Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6DLRsft004706 for ; Mon, 13 Jul 2009 21:27:54 GMT Received: from dlep33.itg.ti.com ([157.170.170.112]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id n6DLRnNP007926 for ; Mon, 13 Jul 2009 16:27:54 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id n6DLRmgd009062 for ; Mon, 13 Jul 2009 16:27:48 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 5720180718 for ; Mon, 13 Jul 2009 16:27:37 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 852AB80626 for ; Mon, 13 Jul 2009 16:27:13 -0500 (CDT) Received: from red.ext.ti.com (localhost [127.0.0.1]) by dflp52.itg.ti.com (8.13.7/8.13.7) with ESMTP id n6DLRDjV015542 for ; Mon, 13 Jul 2009 16:27:13 -0500 (CDT) Received: from mail221-wa4-R.bigfish.com (mail-wa4.bigfish.com [216.32.181.115]) by red.ext.ti.com (8.13.7/8.13.7) with ESMTP id n6DLR7nU010742 for ; Mon, 13 Jul 2009 16:27:12 -0500 Received: from mail221-wa4 (localhost.localdomain [127.0.0.1]) by mail221-wa4-R.bigfish.com (Postfix) with ESMTP id 9DCA8280145 for ; Mon, 13 Jul 2009 21:27:07 +0000 (UTC) X-SpamScore: -26 X-BigFish: vps-26(zz1432R98dN936eM1805Mzz1202hzzz2dh6bh61h) X-Spam-TCS-SCL: 0:0 X-FB-SS: 5, X-MS-Exchange-Organization-Antispam-Report: OrigIP: 209.85.200.173; Service: EHS Received: by mail221-wa4 (MessageSwitch) id 1247520424716501_21069; Mon, 13 Jul 2009 21:27:04 +0000 (UCT) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.173]) by mail221-wa4.bigfish.com (Postfix) with ESMTP id 996CC5D0057 for ; Mon, 13 Jul 2009 21:27:04 +0000 (UTC) Received: by wf-out-1314.google.com with SMTP id 28so902663wff.31 for ; Mon, 13 Jul 2009 14:27:04 -0700 (PDT) Received: by 10.142.125.8 with SMTP id x8mr1558926wfc.70.1247520424322; Mon, 13 Jul 2009 14:27:04 -0700 (PDT) Received: from localhost (deeprooted.net [216.254.16.51]) by mx.google.com with ESMTPS id 28sm9824752wfd.4.2009.07.13.14.27.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 13 Jul 2009 14:27:03 -0700 (PDT) To: Troy Kisky References: <7A436F7769CA33409C6B44B358BFFF0C011E51262E@dlee02.ent.ti.com> <4A579AE6.2030606@boundarydevices.com> <20090711123846.GA23978@n2100.arm.linux.org.uk> <4A5B8F56.8070902@boundarydevices.com> From: Kevin Hilman Organization: Deep Root Systems, LLC Date: Mon, 13 Jul 2009 14:27:01 -0700 In-Reply-To: <4A5B8F56.8070902@boundarydevices.com> (Troy Kisky's message of "Mon\, 13 Jul 2009 12\:47\:34 -0700") Message-ID: <87fxd0ff4q.fsf@deeprootsystems.com> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Cc: "davinci-linux-open-source@linux.davincidsp.com" , Mark Brown , Russell King - ARM Linux , "linux-arm-kernel@lists.arm.linux.org.uk" , "Medisetty, Naresh" Subject: Re: [PATCH 07/26] davinci: dm646x: Adds McASP clock X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Troy Kisky writes: > Russell King - ARM Linux wrote: >> On Fri, Jul 10, 2009 at 12:47:50PM -0700, Troy Kisky wrote: >>> Mani, Arun wrote: >>>> Hi, >>>> I am trying the latest 2.6.31 rc2 branch. I am trying to make the Audio work. >>>> I found that the I2S clock is set to NULL. Because of this I am getting a NODEV error. >>>> If I commented the check, I was able to map the I2S to the AIC33X. but I am not getting any sound. >>> You need a clock, so don't comment out the check, rather give it one. ie. >>> >>> +static struct snd_platform_data snd_data = { >>> + .clk_name = "asp0", >>> +}; >>> + >> >> This is broken from the clk API perspective. clock "names" must not >> be passed via platform data. If you want to do that kind of thing you >> might as well give up with the clk API and stop abusing it. >> > > Then this patch needs further review. I added Chaithrika to the CC. > > > commit 2a0232a115e81a4687d7ae07d5e1f2719a67f8a8 > Author: Chaithrika U S > Date: Fri Jun 5 06:28:08 2009 -0400 > > davinci: ASoC: Add the platform devices for ASP > > 1) Registers the platform devices for ASP on dm355, dm644x and dm646x > so that the machine driver can probe to get ASP related platform > data. > 2) Move towards definition of the asp clocks using physical name(for > dm355 and dm644x) > 3) Add platform data to board specific files. > > Signed-off-by: Naresh Medisetty > Signed-off-by: Chaithrika U S > Signed-off-by: Kevin Hilman > > diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c > index 5ac2f56..78a9604 100644 > --- a/arch/arm/mach-davinci/board-dm355-evm.c > +++ b/arch/arm/mach-davinci/board-dm355-evm.c > @@ -118,6 +118,10 @@ static struct davinci_i2c_platform_data i2c_pdata = { > .bus_delay = 0 /* usec */, > }; > > +static struct snd_platform_data dm355_evm_snd_data = { > + .clk_name = "asp1", > +}; > + > static int dm355evm_mmc_gpios = -EINVAL; > > static void dm355evm_mmcsd_gpios(unsigned gpio) > @@ -280,6 +284,9 @@ static __init void dm355_evm_init(void) > > dm355_init_spi0(BIT(0), dm355_evm_spi_info, > ARRAY_SIZE(dm355_evm_spi_info)); > + > + /* DM335 EVM uses ASP1; line-out is a stereo mini-jack */ > + dm355_init_asp1(ASP1_TX_EVT_EN | ASP1_RX_EVT_EN, &dm355_evm_snd_data); > } Well, it's not actually this patch that started the problem, it was the platform_data updates where clock names were added as part of the new platform_data struct shared between platform code and ASoC. My original proposal was to pass a clock pointer, not a clock name, but that was not done, so... I've pushed an update my 'temp/asoc' branch with the patch below which converts to pasing clock pointers instead of clock names. I'll rework this into two parts. One for DaVinci git and one for Mark's for-2.6.32 branch and submit. Kevin >From 9a3f98f1ed34ea407644f5bf174f7d70b496fb9e Mon Sep 17 00:00:00 2001 From: Kevin Hilman Date: Mon, 13 Jul 2009 14:06:10 -0700 Subject: [PATCH 3/3] davinci: ASoC: pass clock instead of clock name Clock name strings should not be passed along to drivers. Rather, Let platform code get the correct clock for the platform, and pass it along to ASoC via platform data. Signed-off-by: Kevin Hilman --- arch/arm/mach-davinci/board-dm355-evm.c | 9 +++++---- arch/arm/mach-davinci/board-dm644x-evm.c | 9 +++++---- arch/arm/mach-davinci/board-dm646x-evm.c | 12 ++++++++---- arch/arm/mach-davinci/include/mach/asp.h | 2 +- sound/soc/davinci/davinci-i2s.c | 2 +- sound/soc/davinci/davinci-mcasp.c | 2 +- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c index 78a9604..cd87f89 100644 --- a/arch/arm/mach-davinci/board-dm355-evm.c +++ b/arch/arm/mach-davinci/board-dm355-evm.c @@ -118,9 +118,7 @@ static struct davinci_i2c_platform_data i2c_pdata = { .bus_delay = 0 /* usec */, }; -static struct snd_platform_data dm355_evm_snd_data = { - .clk_name = "asp1", -}; +static struct snd_platform_data dm355_evm_snd_data; static int dm355evm_mmc_gpios = -EINVAL; @@ -286,7 +284,10 @@ static __init void dm355_evm_init(void) ARRAY_SIZE(dm355_evm_spi_info)); /* DM335 EVM uses ASP1; line-out is a stereo mini-jack */ - dm355_init_asp1(ASP1_TX_EVT_EN | ASP1_RX_EVT_EN, &dm355_evm_snd_data); + dm355_evm_snd_data.clk = clk_get(NULL, "asp1"); + if (!WARN_ON(!dm355_evm_snd_data.clk)) + dm355_init_asp1(ASP1_TX_EVT_EN | ASP1_RX_EVT_EN, + &dm355_evm_snd_data); } static __init void dm355_evm_irq_init(void) diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index 30b2fd4..611583b 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c @@ -226,9 +226,7 @@ static struct platform_device ide_dev = { }, }; -static struct snd_platform_data dm644x_evm_snd_data = { - .clk_name = "asp0", -}; +static struct snd_platform_data dm644x_evm_snd_data; /*----------------------------------------------------------------------*/ @@ -671,7 +669,10 @@ static __init void davinci_evm_init(void) davinci_setup_mmc(0, &dm6446evm_mmc_config); davinci_serial_init(&uart_config); - dm644x_init_asp(&dm644x_evm_snd_data); + + dm644x_evm_snd_data.clk = clk_get(NULL, "asp0"); + if (!WARN_ON(!dm644x_evm_snd_data.clk)) + dm644x_init_asp(&dm644x_evm_snd_data); soc_info->emac_pdata->phy_mask = DM644X_EVM_PHY_MASK; soc_info->emac_pdata->mdio_max_freq = DM644X_EVM_MDIO_FREQUENCY; diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c index 575c6ca..b8fe6f4 100644 --- a/arch/arm/mach-davinci/board-dm646x-evm.c +++ b/arch/arm/mach-davinci/board-dm646x-evm.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -217,7 +218,6 @@ static u8 dm646x_dit_serializer_direction[] = { static struct snd_platform_data dm646x_evm_snd_data[] = { { - .clk_name = "mcasp0", .tx_dma_offset = 0x400, .rx_dma_offset = 0x400, .op_mode = DAVINCI_MCASP_IIS_MODE, @@ -227,7 +227,6 @@ static struct snd_platform_data dm646x_evm_snd_data[] = { .eventq_no = EVENTQ_0, }, { - .clk_name = "mcasp1", .tx_dma_offset = 0x400, .rx_dma_offset = 0, .op_mode = DAVINCI_MCASP_DIT_MODE, @@ -271,8 +270,13 @@ static __init void evm_init(void) evm_init_i2c(); davinci_serial_init(&uart_config); - dm646x_init_mcasp0(&dm646x_evm_snd_data[0]); - dm646x_init_mcasp1(&dm646x_evm_snd_data[1]); + + dm646x_evm_snd_data[0].clk = clk_get(NULL, "mcasp0"); + if (!WARN_ON(!dm646x_evm_snd_data[0].clk)) + dm646x_init_mcasp0(&dm646x_evm_snd_data[0]); + dm646x_evm_snd_data[1].clk = clk_get(NULL, "mcasp1"); + if (!WARN_ON(!dm646x_evm_snd_data[1].clk)) + dm646x_init_mcasp1(&dm646x_evm_snd_data[1]); soc_info->emac_pdata->phy_mask = DM646X_EVM_PHY_MASK; soc_info->emac_pdata->mdio_max_freq = DM646X_EVM_MDIO_FREQUENCY; diff --git a/arch/arm/mach-davinci/include/mach/asp.h b/arch/arm/mach-davinci/include/mach/asp.h index 038ecb7..2df4ecb 100644 --- a/arch/arm/mach-davinci/include/mach/asp.h +++ b/arch/arm/mach-davinci/include/mach/asp.h @@ -33,7 +33,7 @@ #define DAVINCI_ASP1_TX_INT IRQ_MBXINT struct snd_platform_data { - char *clk_name; + struct clk *clk; u32 tx_dma_offset; u32 rx_dma_offset; enum dma_event_q eventq_no; /* event queue number */ diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index f7330e1..ddc047e 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c @@ -528,7 +528,7 @@ static int davinci_i2s_probe(struct platform_device *pdev) goto err_release_region; } - dev->clk = clk_get(&pdev->dev, pdata->clk_name); + dev->clk = pdata->clk; if (IS_ERR(dev->clk)) { ret = -ENODEV; goto err_free_mem; diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index b27aab6..3b095f9 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -764,7 +764,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) } pdata = pdev->dev.platform_data; - dev->clk = clk_get(&pdev->dev, pdata->clk_name); + dev->clk = pdata->clk; if (IS_ERR(dev->clk)) { ret = -ENODEV; goto err_release_region;