Skip to contentSkip to conversation

ARM: OMAP4+: HDMI: Update platform devices for audio

PATCH Superseded Ricardo Neri 2 participants 9 messages Dec 18, 2012 – Jan 4, 2013

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v3 cover ARM: OMAP4+: HDMI: Update platform devices for audio

Hi Mark, Tomi, Liam, Tony,

This set aims to be the version 3 of my previous submission[1] and aims to address the comments that Mark and Tomi kindly provided on such submission.

The creation of the platform device for the HDMI audio interface from within the OMAPDSS HDMI driver that was previously submitted[2] is resubmitted to be complemented with code to relocate to arch/arm/mach-omap2/display.c the creation of the platform devices for the HDMI ASoC codec and card drivers. This series does not break the HDMI audio functionality in any patch.

Also, the names of the platform devices are changed to give them more logical and more descriptive names.

As the commit

commit 14840b9a83c6a56629db2ba0ec247503e975f143

Author: Ricardo Neri <[email protected]>
Date:   Tue Nov 6 00:19:17 2012 -0600

OMAPDSS: HDMI: Create platform device for audio support

is reverted in Tomi's git://gitorious.org/linux-omap-dss2/linux.git master branch, this series applies cleanly.

Changes from v1:
*Put in a single series all the patches related to platform device updates. *Now HDMI audio works correctly in every patch.
*Remove reference to the TPD12S015 HDMI companion chip as the ASoC drivers
are not aware of this and other chips could be used in the future.

Changes from v2:
*Split in two patches the renaming and the relocation of the platform devices. *Create a separate patch to pass only the address offset of the DMA data port
to the audio interface platform device.
*Keep the name hdmi-audio-codec to not refer to explicitly to OMAP. The codec
can be made generic in a different patch series submitted to alsa-devel.

BR,

Ricardo

[1]. http://www.mail-archive.com/[email protected]/msg80785.html
[2]. http://www.mail-archive.com/[email protected]/msg79795.html

Ricardo Neri (5):
ARM: OMAP4+: HDMI: Rename platform devices for ASoC drivers
ARM: OMAP4: Assign IDs to DSS HDMI devices
ARM4: OMAP4+: HDMI: Relocate devices for audio codec and card
ARM: OMAP4+: HDMI: Relocate the device for audio interface
ARM: OMAP4+: HDMI: Refine the DMA port resource for audio

 arch/arm/mach-omap2/board-4430sdp.c    |    9 ++---
 arch/arm/mach-omap2/board-omap4panda.c |    9 ++---
 arch/arm/mach-omap2/devices.c          |   31 ----------------
 arch/arm/mach-omap2/display.c          |   31 ++++++++++++++++
 drivers/video/omap2/dss/hdmi.c         |   62 ++++++++++++++++++++++++++++++++
 sound/soc/omap/omap-hdmi-card.c        |    4 +--
 sound/soc/omap/omap-hdmi.c             |    5 ++-
 sound/soc/omap/omap-hdmi.h             |    2 --
 8 files changed, 103 insertions(+), 50 deletions(-)

--
1.7.10.4

#1 lore raw

PATCH v3 1/5 ARM: OMAP4+: HDMI: Rename platform devices for ASoC drivers

Assign more logical and meaningful names to the platform devices used by ASoC OMAP HDMI drivers.

The previous omap-hdmi-audio device is renamed as omap-hdmi-audio-card This is to better illustrate the fact that it describes the whole HDMI audio in a given board.

The previous omap-hdmi-audio-dai is renamed as omap-hdmi-audio. The -dai part is removed to not have references to ASoC concepts in the OMAPDSS HDMI driver. Also, as it will be used by the ASoC HDMI CPU DAI driver, the name refers only to OMAP HDMI audio functionality, irrespective of the board.

The names of the ASoC drivers are also updated accordingly.

---
 arch/arm/mach-omap2/devices.c   |    4 ++--
 sound/soc/omap/omap-hdmi-card.c |    4 ++--
 sound/soc/omap/omap-hdmi.c      |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/devices.c +2 -2
index cba60e0..66518b2 100644
@@ -356,7 +356,7 @@ static inline void omap_init_dmic(void) {}
 		defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI_MODULE)
 
 static struct platform_device omap_hdmi_audio = {
-	.name	= "omap-hdmi-audio",
+	.name	= "omap-hdmi-audio-card",
 	.id	= -1,
 };
 
@@ -371,7 +371,7 @@ static void __init omap_init_hdmi_audio(void)
 		return;
 	}
 
-	pdev = omap_device_build("omap-hdmi-audio-dai",
+	pdev = omap_device_build("omap-hdmi-audio",
 		-1, oh, NULL, 0, NULL, 0, 0);
 	WARN(IS_ERR(pdev),
 	     "Can't build omap_device for omap-hdmi-audio-dai.\n");
sound/soc/omap/omap-hdmi-card.c +2 -2
index eaa2ea0..07b9959 100644
@@ -27,12 +27,12 @@
 #include <asm/mach-types.h>
 #include <video/omapdss.h>
 
-#define DRV_NAME "omap-hdmi-audio"
+#define DRV_NAME "omap-hdmi-audio-card"
 
 static struct snd_soc_dai_link omap_hdmi_dai = {
 	.name = "HDMI",
 	.stream_name = "HDMI",
-	.cpu_dai_name = "omap-hdmi-audio-dai",
+	.cpu_dai_name = "omap-hdmi-audio",
 	.platform_name = "omap-pcm-audio",
 	.codec_name = "hdmi-audio-codec",
 	.codec_dai_name = "omap-hdmi-hifi",
sound/soc/omap/omap-hdmi.c +1 -1
index f59c69f..db08501 100644
@@ -37,7 +37,7 @@
 #include "omap-pcm.h"
 #include "omap-hdmi.h"
 
-#define DRV_NAME "omap-hdmi-audio-dai"
+#define DRV_NAME "omap-hdmi-audio"
 
 struct hdmi_priv {
 	struct omap_pcm_dma_data dma_params;
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH v3 2/5 ARM: OMAP4: Assign IDs to DSS HDMI devices

In reply to Ricardo Neri

While Pandaboard and SDP4430 have only one HDMI output connector, it may be possible that future boards and SoCs support more than one HDMI output. Thus, we define the identifier of the device. This is used by display common code to identify and create the platform devices for HDMI audio drivers.

---
 arch/arm/mach-omap2/board-4430sdp.c    |    3 +++
 arch/arm/mach-omap2/board-omap4panda.c |    3 +++
 2 files changed, 6 insertions(+)
arch/arm/mach-omap2/board-4430sdp.c +3 -0
index 3669c12..5a486d9 100644
@@ -666,6 +666,9 @@ static struct omap_dss_device sdp4430_hdmi_device = {
 	.type = OMAP_DISPLAY_TYPE_HDMI,
 	.channel = OMAP_DSS_CHANNEL_DIGIT,
 	.data = &sdp4430_hdmi_data,
+	.dev = {
+		.id = -1,
+	},
 };
 
 static struct picodlp_panel_data sdp4430_picodlp_pdata = {
arch/arm/mach-omap2/board-omap4panda.c +3 -0
index bfcd397..9f336a3 100644
@@ -440,6 +440,9 @@ static struct omap_dss_device  omap4_panda_hdmi_device = {
 	.type = OMAP_DISPLAY_TYPE_HDMI,
 	.channel = OMAP_DSS_CHANNEL_DIGIT,
 	.data = &omap4_panda_hdmi_data,
+	.dev = {
+		.id = -1,
+	},
 };
 
 static struct omap_dss_device *omap4_panda_dss_devices[] = {
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH v3 3/5 ARM4: OMAP4+: HDMI: Relocate devices for audio codec and card

In reply to Ricardo Neri

Relocate the creation the platform devices for audio the HDMI audio codec and the audio card to display.c. This allows the display code to create the required platform devices based on what is wired on the board. Thus, as many devices as required are created; or none if the HDMI output is not implemented.

---
 arch/arm/mach-omap2/board-4430sdp.c    |    6 ------
 arch/arm/mach-omap2/board-omap4panda.c |    6 ------
 arch/arm/mach-omap2/devices.c          |    7 -------
 arch/arm/mach-omap2/display.c          |   31 +++++++++++++++++++++++++++++++
 4 files changed, 31 insertions(+), 19 deletions(-)
arch/arm/mach-omap2/board-4430sdp.c +0 -6
index 5a486d9..0830d98 100644
@@ -383,11 +383,6 @@ static struct platform_device sdp4430_dmic_codec = {
 	.id	= -1,
 };
 
-static struct platform_device sdp4430_hdmi_audio_codec = {
-	.name	= "hdmi-audio-codec",
-	.id	= -1,
-};
-
 static struct omap_abe_twl6040_data sdp4430_abe_audio_data = {
 	.card_name = "SDP4430",
 	.has_hs		= ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
@@ -422,7 +417,6 @@ static struct platform_device *sdp4430_devices[] __initdata = {
 	&sdp4430_vbat,
 	&sdp4430_dmic_codec,
 	&sdp4430_abe_audio,
-	&sdp4430_hdmi_audio_codec,
 };
 
 static struct omap_musb_board_data musb_board_data = {
arch/arm/mach-omap2/board-omap4panda.c +0 -6
index 9f336a3..561a5a7 100644
@@ -126,11 +126,6 @@ static struct platform_device panda_abe_audio = {
 	},
 };
 
-static struct platform_device panda_hdmi_audio_codec = {
-	.name	= "hdmi-audio-codec",
-	.id	= -1,
-};
-
 static struct platform_device btwilink_device = {
 	.name	= "btwilink",
 	.id	= -1,
@@ -140,7 +135,6 @@ static struct platform_device *panda_devices[] __initdata = {
 	&leds_gpio,
 	&wl1271_device,
 	&panda_abe_audio,
-	&panda_hdmi_audio_codec,
 	&btwilink_device,
 };
 
arch/arm/mach-omap2/devices.c +0 -7
index 66518b2..6d37438 100644
@@ -355,11 +355,6 @@ static inline void omap_init_dmic(void) {}
 #if defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI) || \
 		defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI_MODULE)
 
-static struct platform_device omap_hdmi_audio = {
-	.name	= "omap-hdmi-audio-card",
-	.id	= -1,
-};
-
 static void __init omap_init_hdmi_audio(void)
 {
 	struct omap_hwmod *oh;
@@ -375,8 +370,6 @@ static void __init omap_init_hdmi_audio(void)
 		-1, oh, NULL, 0, NULL, 0, 0);
 	WARN(IS_ERR(pdev),
 	     "Can't build omap_device for omap-hdmi-audio-dai.\n");
-
-	platform_device_register(&omap_hdmi_audio);
 }
 #else
 static inline void omap_init_hdmi_audio(void) {}
arch/arm/mach-omap2/display.c +31 -0
index 282c814e..6cc9cea 100644
@@ -414,6 +414,37 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
 		}
 	}
 
+	/* Create devices for HDMI audio drivers */
+	for (i = 0; i < board_data->num_devices; i++) {
+		struct platform_device *au_pdev;
+		struct omap_dss_device *dssdev = board_data->devices[i];
+		bool card_created = false;
+
+		if (dssdev->type != OMAP_DISPLAY_TYPE_HDMI)
+			continue;
+
+		/* We need only one device for the audio card */
+		if (card_created == false) {
+			au_pdev = create_simple_dss_pdev("omap-hdmi-audio-card",
+							 -1, NULL, 0, dss_pdev);
+			if (IS_ERR(au_pdev)) {
+				pr_err("Could not build platform_device for omap-hdmi-audio-card\n");
+				return PTR_ERR(au_pdev);
+			}
+			card_created = true;
+		}
+
+		/* One device for each HDMI connector in the board */
+		au_pdev = create_simple_dss_pdev("hdmi-audio-codec",
+						  dssdev->dev.id,
+						  NULL, 0, dss_pdev);
+		if (IS_ERR(au_pdev)) {
+			pr_err("Could not build platform_device for hdmi-audio-codec\n");
+			return PTR_ERR(au_pdev);
+		}
+
+	}
+
 	return 0;
 }
 

--
1.7.10.4

#4 lore raw

PATCH v3 4/5 ARM: OMAP4+: HDMI: Relocate the device for audio interface

In reply to Ricardo Neri

The HDMI display and audio functionality share the same resources (e.g., register spaces). The ASoC HDMI CPU-DAI driver needs access to some (but not all) the resources of the dss_hdmi platform device. As such resources are within the address space of omapdss_hdmi, it makes sense to have the DSS HDMI driver to create the platform driver with the required resources.

---
 arch/arm/mach-omap2/devices.c  |   24 ----------------
 drivers/video/omap2/dss/hdmi.c |   59 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 24 deletions(-)
arch/arm/mach-omap2/devices.c +0 -24
index 6d37438..9fdc1f9 100644
@@ -352,29 +352,6 @@ static void __init omap_init_dmic(void)
 static inline void omap_init_dmic(void) {}
 #endif
 
-#if defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI) || \
-		defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI_MODULE)
-
-static void __init omap_init_hdmi_audio(void)
-{
-	struct omap_hwmod *oh;
-	struct platform_device *pdev;
-
-	oh = omap_hwmod_lookup("dss_hdmi");
-	if (!oh) {
-		printk(KERN_ERR "Could not look up dss_hdmi hw_mod\n");
-		return;
-	}
-
-	pdev = omap_device_build("omap-hdmi-audio",
-		-1, oh, NULL, 0, NULL, 0, 0);
-	WARN(IS_ERR(pdev),
-	     "Can't build omap_device for omap-hdmi-audio-dai.\n");
-}
-#else
-static inline void omap_init_hdmi_audio(void) {}
-#endif
-
 #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
 
 #include <linux/platform_data/spi-omap2-mcspi.h>
@@ -620,7 +597,6 @@ static int __init omap2_init_devices(void)
 	 */
 	omap_init_audio();
 	omap_init_camera();
-	omap_init_hdmi_audio();
 	omap_init_mbox();
 	/* If dtb is there, the devices will be created dynamically */
 	if (!of_have_populated_dt()) {
drivers/video/omap2/dss/hdmi.c +59 -0

83 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#5 lore raw

PATCH v3 5/5 ARM: OMAP4+: HDMI: Refine the DMA port resource for audio

In reply to Ricardo Neri

Instead of passing the complete address space to the platform device for audio, just pass the address offset of the DMA port for audio samples. Thus, we prevent that two drivers try to ioremap the same resources. This is to be safe, as the ASoC HDMI CPU-DAI driver will not need to ioremap such resource.

---
 drivers/video/omap2/dss/hdmi.c |    9 ++++++---
 sound/soc/omap/omap-hdmi.c     |    3 +--
 sound/soc/omap/omap-hdmi.h     |    2 --
 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/video/omap2/dss/hdmi.c +6 -3
index 0dde2b5..b758f83 100644
@@ -829,6 +829,7 @@ static int hdmi_probe_audio(struct platform_device *pdev)
 {
 	struct resource *res;
 	struct platform_device *aud_pdev;
+	u32 port_offset, port_size;
 	struct resource aud_res[2] = {
 		DEFINE_RES_MEM(-1, -1),
 		DEFINE_RES_DMA(-1),
@@ -841,11 +842,13 @@ static int hdmi_probe_audio(struct platform_device *pdev)
 	}
 
 	/*
-	 * Pass this resource to audio drivers to find the DMA port address.
+	 * Pass DMA audio port to audio drivers.
 	 * Audio drivers should not ioremap it.
 	 */
-	aud_res[0].start = res->start;
-	aud_res[0].end = res->end;
+	hdmi.ip_data.ops->audio_get_dma_port(&port_offset, &port_size);
+
+	aud_res[0].start = res->start + port_offset;
+	aud_res[0].end =  aud_res[0].start + port_size - 1;
 
 	res = platform_get_resource(hdmi.pdev, IORESOURCE_DMA, 0);
 	if (!res) {
sound/soc/omap/omap-hdmi.c +1 -2
index db08501..33418fc 100644
@@ -281,8 +281,7 @@ static __devinit int omap_hdmi_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	hdmi_data->dma_params.port_addr =  hdmi_rsrc->start
-		+ OMAP_HDMI_AUDIO_DMA_PORT;
+	hdmi_data->dma_params.port_addr =  hdmi_rsrc->start;
 
 	hdmi_rsrc = platform_get_resource(pdev, IORESOURCE_DMA, 0);
 	if (!hdmi_rsrc) {
sound/soc/omap/omap-hdmi.h +0 -2
index 6ad2bf4..33d7a93 100644
@@ -25,8 +25,6 @@
 #ifndef __OMAP_HDMI_H__
 #define __OMAP_HDMI_H__
 
-#define OMAP_HDMI_AUDIO_DMA_PORT 0x8c
-
 #define OMAP_HDMI_RATES	(SNDRV_PCM_RATE_32000 | \
 				SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | \
 				SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | \
Signature · 1 line
1.7.10.4
#6 lore raw
In reply to Ricardo Neri

Hi Mark, Tomi,

Just wondering if you had a chance to take a look at these patches.

Thanks!

Ricardo

Quoted 66 lines · Ricardo Neri

Hi Mark, Tomi, Liam, Tony,

This set aims to be the version 3 of my previous submission[1] and aims to address the comments that Mark and Tomi kindly provided on such submission.

The creation of the platform device for the HDMI audio interface from within the OMAPDSS HDMI driver that was previously submitted[2] is resubmitted to be complemented with code to relocate to arch/arm/mach-omap2/display.c the creation of the platform devices for the HDMI ASoC codec and card drivers. This series does not break the HDMI audio functionality in any patch.

Also, the names of the platform devices are changed to give them more logical and more descriptive names.

As the commit

commit 14840b9a83c6a56629db2ba0ec247503e975f143

Author: Ricardo Neri <[email protected]>
Date:   Tue Nov 6 00:19:17 2012 -0600

OMAPDSS: HDMI: Create platform device for audio support

is reverted in Tomi's git://gitorious.org/linux-omap-dss2/linux.git master branch, this series applies cleanly.

Changes from v1:
*Put in a single series all the patches related to platform device updates. *Now HDMI audio works correctly in every patch.
*Remove reference to the TPD12S015 HDMI companion chip as the ASoC drivers
are not aware of this and other chips could be used in the future.

Changes from v2:
*Split in two patches the renaming and the relocation of the platform devices. *Create a separate patch to pass only the address offset of the DMA data port
to the audio interface platform device.
*Keep the name hdmi-audio-codec to not refer to explicitly to OMAP. The codec
can be made generic in a different patch series submitted to alsa-devel.

BR,

Ricardo

[1]. http://www.mail-archive.com/[email protected]/msg80785.html
[2]. http://www.mail-archive.com/[email protected]/msg79795.html

Ricardo Neri (5):
ARM: OMAP4+: HDMI: Rename platform devices for ASoC drivers
ARM: OMAP4: Assign IDs to DSS HDMI devices
ARM4: OMAP4+: HDMI: Relocate devices for audio codec and card
ARM: OMAP4+: HDMI: Relocate the device for audio interface
ARM: OMAP4+: HDMI: Refine the DMA port resource for audio

  arch/arm/mach-omap2/board-4430sdp.c    |    9 ++---
  arch/arm/mach-omap2/board-omap4panda.c |    9 ++---
  arch/arm/mach-omap2/devices.c          |   31 ----------------
  arch/arm/mach-omap2/display.c          |   31 ++++++++++++++++
  drivers/video/omap2/dss/hdmi.c         |   62 ++++++++++++++++++++++++++++++++
  sound/soc/omap/omap-hdmi-card.c        |    4 +--
  sound/soc/omap/omap-hdmi.c             |    5 ++-
  sound/soc/omap/omap-hdmi.h             |    2 --
  8 files changed, 103 insertions(+), 50 deletions(-)

--
1.7.10.4

#7 lore raw
Quoted 1 line · Ricardo Neri

Just wondering if you had a chance to take a look at these patches.

Don't top post. Whatever patches you're talking about I don't have them (given that they say "ARM: OMAP4:" I'm likely to have just discarded them if you sent them to me, people CC me on far too much irrelevant OMAP stuff).

#8 lore raw

Hi Mark,

Quoted 5 lines · Mark Brown
Quoted 1 line · Ricardo Neri

Just wondering if you had a chance to take a look at these patches.

Don't top post.

Sorry, my bad. Won't do it again.

Whatever patches you're talking about I don't have them

Quoted 4 lines

(given that they say "ARM: OMAP4:" I'm likely to have just discarded them if you sent them to me, people CC me on far too much irrelevant OMAP stuff).

Even though changes involve mostly how and where the platform devices for OMAP HDMI audio are created, the OMAP HDMI ASoC drivers are modified as well. Also, you provided feedback in the previous versions. I thought I should send them to you. I will resend.

BR,

Ricardo