linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Liam Girdwood <lrg@ti.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Tony Lindgren <tony@atomide.com>
Cc: Jarkko Nikula <jarkko.nikula@bitmer.com>,
	alsa-devel@alsa-project.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 8/9] OMAP4: omap4panda: Enable audio support
Date: Thu, 22 Dec 2011 18:38:21 +0200	[thread overview]
Message-ID: <1324571902-16918-9-git-send-email-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <1324571902-16918-1-git-send-email-peter.ujfalusi@ti.com>

PandaBoard has twl6040 codec for audio.
Register the omap4-abe-twl6040 platform device.
Add platform data to enable the twl6040 codec.
Since there is a difference in audio between  PandaBoard 4430
and PandaBoard ES (4460):
Use different name for the sound card:
"OMAP4-Panda" for PandaBoard 4430
"OMAP4-PandaES" for PandaBoard ES

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

board: audio for panda
---
 arch/arm/mach-omap2/board-omap4panda.c |   56 +++++++++++++++++++++++++++++++-
 1 files changed, 55 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index b6f1144..cb843fc 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -28,6 +28,7 @@
 #include <linux/regulator/machine.h>
 #include <linux/regulator/fixed.h>
 #include <linux/wl12xx.h>
+#include <linux/platform_data/omap-abe-twl6040.h>
 
 #include <mach/hardware.h>
 #include <asm/hardware/gic.h>
@@ -90,9 +91,31 @@ static struct platform_device leds_gpio = {
 	},
 };
 
+static struct omap_abe_twl6040_data panda_abe_audio_data = {
+	/* Audio out */
+	.has_hs		= ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
+	/* HandsFree through expasion connector */
+	.has_hf		= ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
+	/* PandaBoard: FM TX, PandaBoardES: can be connected to audio out */
+	.has_aux	= ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
+	/* PandaBoard: FM RX, PandaBoardES: audio in */
+	.has_afm	= ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
+	/* No jack detection. */
+	.jack_detection	= 0,
+};
+
+static struct platform_device panda_abe_audio = {
+	.name		= "omap-abe-twl6040",
+	.id		= -1,
+	.dev = {
+		.platform_data = &panda_abe_audio_data,
+	},
+};
+
 static struct platform_device *panda_devices[] __initdata = {
 	&leds_gpio,
 	&wl1271_device,
+	&panda_abe_audio,
 };
 
 static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
@@ -251,8 +274,25 @@ static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
 	return 0;
 }
 
+static struct twl4030_codec_data twl6040_codec = {
+	/* single-step ramp for headset and handsfree */
+	.hs_left_step	= 0x0f,
+	.hs_right_step	= 0x0f,
+	.hf_left_step	= 0x1d,
+	.hf_right_step	= 0x1d,
+};
+
+static struct twl4030_audio_data twl6040_audio = {
+	.codec		= &twl6040_codec,
+	.audpwron_gpio	= 127,
+	.naudint_irq	= OMAP44XX_IRQ_SYS_2N,
+	.irq_base	= TWL6040_CODEC_IRQ_BASE,
+};
+
 /* Panda board uses the common PMIC configuration */
-static struct twl4030_platform_data omap4_panda_twldata;
+static struct twl4030_platform_data omap4_panda_twldata = {
+	.audio		= &twl6040_audio,
+};
 
 /*
  * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM
@@ -548,6 +588,19 @@ void omap4_panda_display_init(void)
 	omap_display_init(&omap4_panda_dss_data);
 }
 
+static void omap4_panda_audio_init(void)
+{
+	if (cpu_is_omap4430()) {
+		/* PandaBoard 4430 */
+		panda_abe_audio_data.card_name = "PandaBoard";
+		/* Audio in is connected to HSMIC */
+		panda_abe_audio_data.has_hsmic = 1;
+	} else {
+		/* PandaBoard ES */
+		panda_abe_audio_data.card_name = "PandaBoardES";
+	}
+}
+
 static void __init omap4_panda_init(void)
 {
 	int package = OMAP_PACKAGE_CBS;
@@ -560,6 +613,7 @@ static void __init omap4_panda_init(void)
 		pr_err("error setting wl12xx data\n");
 
 	omap4_panda_i2c_init();
+	omap4_panda_audio_init();
 	platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
 	platform_device_register(&omap_vwlan_device);
 	board_serial_init();
-- 
1.7.8.1


  parent reply	other threads:[~2011-12-22 16:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-22 16:38 [PATCH v2 0/9] OMAP4: ASoC: Support for PandaBoard family Peter Ujfalusi
2011-12-22 16:38 ` [PATCH v2 1/9] include: platform_data: Platform data header for OMAP4 ASoC audio Peter Ujfalusi
2011-12-22 16:38 ` [PATCH v2 2/9] OMAP4: 4430sdp: Register platform device for OMAP4 audio Peter Ujfalusi
2011-12-22 16:38 ` [PATCH v2 3/9] ASoC: omap-abe-twl6040: Convert to platform deriver Peter Ujfalusi
2011-12-22 16:38 ` [PATCH v2 4/9] ASoC: twl6040: Convert MICBIAS to SUPPLY widget Peter Ujfalusi
2011-12-22 17:32   ` Mark Brown
2011-12-22 18:02     ` Peter Ujfalusi
2011-12-22 18:13       ` Mark Brown
2011-12-22 16:38 ` [PATCH v2 5/9] ASoC: omap-abe-twl6040: Add complete DAPM routing Peter Ujfalusi
2011-12-22 16:38 ` [PATCH v2 6/9] ASoC: omap-abe-twl6040: DAI link selection based on platform data Peter Ujfalusi
2011-12-22 16:38 ` [PATCH v2 7/9] ASoC: omap-abe-twl6040: Configure card according to " Peter Ujfalusi
2011-12-22 16:38 ` Peter Ujfalusi [this message]
2011-12-22 17:32   ` [PATCH v2 8/9] OMAP4: omap4panda: Enable audio support Tony Lindgren
2011-12-22 18:08     ` Peter Ujfalusi
2011-12-22 18:15       ` Tony Lindgren
2011-12-22 18:24         ` Peter Ujfalusi
2011-12-22 16:38 ` [PATCH v2 9/9] ASoC: Kconfig: OMAP4: Enable support for PandaBoards Peter Ujfalusi
2011-12-22 17:30 ` [PATCH v2 0/9] OMAP4: ASoC: Support for PandaBoard family Peter Ujfalusi
  -- strict thread matches above, loose matches on Subject: below --
2011-12-22 12:42 Peter Ujfalusi
2011-12-22 12:42 ` [PATCH v2 8/9] OMAP4: omap4panda: Enable audio support Peter Ujfalusi
2011-12-22 13:24   ` Mark Brown
2011-12-22 14:14     ` Peter Ujfalusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1324571902-16918-9-git-send-email-peter.ujfalusi@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=jarkko.nikula@bitmer.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).