From patchwork Tue Aug 14 09:07:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 1318771 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 3D68FDF215 for ; Tue, 14 Aug 2012 09:11:03 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T1D6k-0006qJ-1K; Tue, 14 Aug 2012 09:08:14 +0000 Received: from na3sys009aog102.obsmtp.com ([74.125.149.69]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1T1D6R-0006nx-GS for linux-arm-kernel@lists.infradead.org; Tue, 14 Aug 2012 09:07:56 +0000 Received: from mail-ob0-f178.google.com ([209.85.214.178]) (using TLSv1) by na3sys009aob102.postini.com ([74.125.148.12]) with SMTP ID DSNKUCoVaaM4USJ5yDpA1MZTH1m6vTwSQQGk@postini.com; Tue, 14 Aug 2012 02:07:55 PDT Received: by obbwd20 with SMTP id wd20so327968obb.23 for ; Tue, 14 Aug 2012 02:07:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=5dbafUj1Yp0JwoEinXe4nAwc9eT+r8ot7ZUDpPsqCEY=; b=k7Y4316ngRmY7G8mlNjqnnI2HwnrdtAwQzJ0lJ9iFQ7daHcguaHDggTcGGKewl6+P3 xmBUPHgVdXZq4xpb3lEBq5wkvFva4E9sWEPOW4mASAu9tJCt363feAMT5drDVainwuBP 3IZ5CBMGULJeGTSNxe6NlVzpaBbIJptX/185On+Ruqy5rlLlSmMj7UqbIbI32tuTC4D5 uYtvK8XdoKE77fz9dRBiLQ+t5pBNcIGys3vcYHVxX2MD+afZTU0HKf5/7WyRzNy+BgHb qhe/QwMoOHeVnNlwJ//ZczZPWfJRztm1rPgX6i4tm/jovbJ8WCeVCgVNUG4QdSiKIiBL KcWA== Received: by 10.60.22.167 with SMTP id e7mr18807750oef.35.1344935273423; Tue, 14 Aug 2012 02:07:53 -0700 (PDT) Received: from barack.emea.dhcp.ti.com (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id e9sm1760645oee.12.2012.08.14.02.07.50 (version=SSLv3 cipher=OTHER); Tue, 14 Aug 2012 02:07:52 -0700 (PDT) From: Peter Ujfalusi To: Mark Brown , Liam Girdwood , Tony Lindgren Subject: [PATCH v2 2/4] ARM: OMAP: twl-common: Add helper function to register the omap-twl4030 audio driver Date: Tue, 14 Aug 2012 12:07:57 +0300 Message-Id: <1344935279-32364-3-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1344935279-32364-1-git-send-email-peter.ujfalusi@ti.com> References: <1344935279-32364-1-git-send-email-peter.ujfalusi@ti.com> X-Gm-Message-State: ALoCoQkzxucUCqbW5pDOPl76sF+Hukqp2GyD0hR7R2bSj9bJ+0nl7yNgSU6ksA6MM5uBGGEUJDGE X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [74.125.149.69 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: alsa-devel@alsa-project.org, Benoit Cousson , devicetree-discuss@lists.ozlabs.org, Anuj Aggarwal , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Steve Sakoman X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Since several OMAP3 based boards will be using the unified simple audio driver it is better to not have duplicated code in the board files for this purpose. Board files can call omap_twl4030_audio_init(); to set up the needed device for the audio support. For example: omap_twl4030_audio_init("omap3beagle", 26000000); Signed-off-by: Peter Ujfalusi Acked-by: Tony Lindgren --- arch/arm/mach-omap2/twl-common.c | 27 +++++++++++++++++++++++++++ arch/arm/mach-omap2/twl-common.h | 2 ++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index d52be85..1c6045a 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c @@ -522,3 +522,30 @@ void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data, pmic_data->v2v1 = &omap4_v2v1_idata; } #endif /* CONFIG_ARCH_OMAP4 */ + +#if defined(CONFIG_SND_OMAP_SOC_OMAP_TWL4030) || \ + defined(CONFIG_SND_OMAP_SOC_OMAP_TWL4030_MODULE) +#include + +static struct omap_tw4030_pdata omap_twl4030_audio_data; + +static struct platform_device audio_device = { + .name = "omap-twl4030", + .id = -1, + .dev = { + .platform_data = &omap_twl4030_audio_data, + }, +}; + +void __init omap_twl4030_audio_init(char *card_name) +{ + omap_twl4030_audio_data.card_name = card_name; + platform_device_register(&audio_device); +} + +#else /* SOC_OMAP_TWL4030 */ +void __init omap_twl4030_audio_init(char *card_name, int codec_sysclk) +{ + return; +} +#endif /* SOC_OMAP_TWL4030 */ diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h index de062c7..b86c676 100644 --- a/arch/arm/mach-omap2/twl-common.h +++ b/arch/arm/mach-omap2/twl-common.h @@ -60,4 +60,6 @@ void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, void omap4_pmic_get_config(struct twl4030_platform_data *pmic_data, u32 pdata_flags, u32 regulators_flags); +void omap_twl4030_audio_init(char *card_name); + #endif /* __OMAP_PMIC_COMMON__ */