aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorRicardo Neri <ricardo.neri@ti.com>2012-05-18 02:42:39 -0400
committerLiam Girdwood <lrg@ti.com>2012-05-22 12:33:23 -0400
commita0534e3bb68537b749423efe60db7b38872b00a1 (patch)
treefbfd7cac3aee495d8c08f6d58fc6ac2b5891ffec /sound/soc
parent7e6aa220798efd5cd95737b7493b904dddbf413d (diff)
ASoC: OMAP: HDMI: Improve how the display state is verified
Before starting to play audio, we need to make sure that the display is active and the current video mode supports audio. instead of using the overlay manager in the machine driver, we use the DSS audio interface's audio_supported function. As we already have a pointer to the correct dssdev, we do not have to look for it every time audio is to be played. Also, the CPU DAI startup function is called earlier than the card hw_param function. Hence and we can detect the state of the display earlier. While there, add a error message if the constraint cannot be applied. Signed-off-by: Ricardo Neri <ricardo.neri@ti.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> squash to improve err Signed-off-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/omap/omap-hdmi.c9
-rw-r--r--sound/soc/omap/omap4-hdmi-card.c34
2 files changed, 8 insertions, 35 deletions
diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c
index fc4815a6efb1..ec7c7e62b012 100644
--- a/sound/soc/omap/omap-hdmi.c
+++ b/sound/soc/omap/omap-hdmi.c
@@ -51,6 +51,7 @@ struct hdmi_priv {
51static int omap_hdmi_dai_startup(struct snd_pcm_substream *substream, 51static int omap_hdmi_dai_startup(struct snd_pcm_substream *substream,
52 struct snd_soc_dai *dai) 52 struct snd_soc_dai *dai)
53{ 53{
54 struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai);
54 int err; 55 int err;
55 /* 56 /*
56 * Make sure that the period bytes are multiple of the DMA packet size. 57 * Make sure that the period bytes are multiple of the DMA packet size.
@@ -58,9 +59,15 @@ static int omap_hdmi_dai_startup(struct snd_pcm_substream *substream,
58 */ 59 */
59 err = snd_pcm_hw_constraint_step(substream->runtime, 0, 60 err = snd_pcm_hw_constraint_step(substream->runtime, 0,
60 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 128); 61 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 128);
61 if (err < 0) 62 if (err < 0) {
63 dev_err(dai->dev, "could not apply constraint\n");
62 return err; 64 return err;
65 }
63 66
67 if (!priv->dssdev->driver->audio_supported(priv->dssdev)) {
68 dev_err(dai->dev, "audio not supported\n");
69 return -ENODEV;
70 }
64 return 0; 71 return 0;
65} 72}
66 73
diff --git a/sound/soc/omap/omap4-hdmi-card.c b/sound/soc/omap/omap4-hdmi-card.c
index 99e96c6221a8..6c3255fed2ef 100644
--- a/sound/soc/omap/omap4-hdmi-card.c
+++ b/sound/soc/omap/omap4-hdmi-card.c
@@ -29,39 +29,6 @@
29 29
30#define DRV_NAME "omap-hdmi-audio" 30#define DRV_NAME "omap-hdmi-audio"
31 31
32static int omap4_hdmi_dai_hw_params(struct snd_pcm_substream *substream,
33 struct snd_pcm_hw_params *params)
34{
35 int i;
36 struct omap_overlay_manager *mgr = NULL;
37 struct device *dev = substream->pcm->card->dev;
38
39 /* Find DSS HDMI device */
40 for (i = 0; i < omap_dss_get_num_overlay_managers(); i++) {
41 mgr = omap_dss_get_overlay_manager(i);
42 if (mgr && mgr->device
43 && mgr->device->type == OMAP_DISPLAY_TYPE_HDMI)
44 break;
45 }
46
47 if (i == omap_dss_get_num_overlay_managers()) {
48 dev_err(dev, "HDMI display device not found!\n");
49 return -ENODEV;
50 }
51
52 /* Make sure HDMI is power-on to avoid L3 interconnect errors */
53 if (mgr->device->state != OMAP_DSS_DISPLAY_ACTIVE) {
54 dev_err(dev, "HDMI display is not active!\n");
55 return -EIO;
56 }
57
58 return 0;
59}
60
61static struct snd_soc_ops omap4_hdmi_dai_ops = {
62 .hw_params = omap4_hdmi_dai_hw_params,
63};
64
65static struct snd_soc_dai_link omap4_hdmi_dai = { 32static struct snd_soc_dai_link omap4_hdmi_dai = {
66 .name = "HDMI", 33 .name = "HDMI",
67 .stream_name = "HDMI", 34 .stream_name = "HDMI",
@@ -69,7 +36,6 @@ static struct snd_soc_dai_link omap4_hdmi_dai = {
69 .platform_name = "omap-pcm-audio", 36 .platform_name = "omap-pcm-audio",
70 .codec_name = "hdmi-audio-codec", 37 .codec_name = "hdmi-audio-codec",
71 .codec_dai_name = "omap-hdmi-hifi", 38 .codec_dai_name = "omap-hdmi-hifi",
72 .ops = &omap4_hdmi_dai_ops,
73}; 39};
74 40
75static struct snd_soc_card snd_soc_omap4_hdmi = { 41static struct snd_soc_card snd_soc_omap4_hdmi = {