* [PATCH 0/5] OMAPDSS: Relocate ASoC HDMI codec to sound
@ 2012-02-11 23:55 Ricardo Neri
2012-02-11 23:55 ` [PATCH 1/5] OMAPDSS: HDMI: Add function to get the HDMI mode Ricardo Neri
` (5 more replies)
0 siblings, 6 replies; 12+ messages in thread
From: Ricardo Neri @ 2012-02-11 23:55 UTC (permalink / raw)
To: tomi.valkeinen, mythripk
Cc: s-guiriec, lrg, peter.ujfalusi, linux-omap, Ricardo Neri
Hello,
In order to give to the OMAP HDMI code a more logical arrangement, the audio
part is moved to /sound. Only the IP-specific functions remain in the DSS HDMI
IP library. These patches introduce modifications to expose the DSS functio-
nality that is going to be required by the ASoC driver.
This relocation is split in two parts. This is first part. The second part
is for ASoC and is to be submitted to the ALSA list. The purpose of
this split is to ease the integration of these patches first to DSS
and then to ASoC.
This work is also based on the patches previously sent for HDMI audio MCLK
support:
http://www.spinics.net/lists/linux-omap/msg64302.html
and was implemented on top of:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git v3.3-rc3
Thanks,
Ricardo
Ricardo Neri (5):
OMAPDSS: HDMI: Add function to get the HDMI mode
OMAPDSS: HDMI: Rename audio functions in HDMI IP library
OMAPDSS: HDMI: Add audio config functions to HDMI IP ops
OMAPDSS: Export functions to enable dynamic linking
OMAPDSS/ASoC: Relocate ASoC HDMI codec. Part 1
drivers/video/omap2/dss/dss.h | 1 +
drivers/video/omap2/dss/dss_features.c | 10 +-
drivers/video/omap2/dss/hdmi.c | 236 +----------------------------
drivers/video/omap2/dss/ti_hdmi.h | 26 +++-
drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | 63 +--------
drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h | 13 --
6 files changed, 41 insertions(+), 308 deletions(-)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/5] OMAPDSS: HDMI: Add function to get the HDMI mode
2012-02-11 23:55 [PATCH 0/5] OMAPDSS: Relocate ASoC HDMI codec to sound Ricardo Neri
@ 2012-02-11 23:55 ` Ricardo Neri
2012-02-11 23:55 ` [PATCH 2/5] OMAPDSS: HDMI: Rename audio functions in HDMI IP library Ricardo Neri
` (4 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Ricardo Neri @ 2012-02-11 23:55 UTC (permalink / raw)
To: tomi.valkeinen, mythripk
Cc: s-guiriec, lrg, peter.ujfalusi, linux-omap, Ricardo Neri
Add function to obtain the DVI/HDMI mode. This is needed by
the ASoC HDMI audio codec. HDMI audio can only be transmitted
when the IP is configured as HDMI. As the DVI/HDMI mode is a private
parameter of the HDMI driver, this functions allows to expose
such mode to the ASoC driver. Also, the function is exported for
dynamic linking as the ASoC codec and DSS may be built as separate
modules.
Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
---
drivers/video/omap2/dss/dss.h | 1 +
drivers/video/omap2/dss/hdmi.c | 6 ++++++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 32ff69f..881fab8 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -520,6 +520,7 @@ int omapdss_hdmi_read_edid(u8 *buf, int len);
bool omapdss_hdmi_detect(void);
int hdmi_panel_init(void);
void hdmi_panel_exit(void);
+int omapdss_hdmi_get_hdmi_mode(void);
/* RFBI */
#ifdef CONFIG_OMAP2_DSS_RFBI
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 04c83c8..2ba108f 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -558,6 +558,12 @@ void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev)
mutex_unlock(&hdmi.lock);
}
+int omapdss_hdmi_get_hdmi_mode(void)
+{
+ return hdmi.ip_data.cfg.cm.mode;
+}
+EXPORT_SYMBOL(omapdss_hdmi_get_hdmi_mode);
+
#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/5] OMAPDSS: HDMI: Rename audio functions in HDMI IP library
2012-02-11 23:55 [PATCH 0/5] OMAPDSS: Relocate ASoC HDMI codec to sound Ricardo Neri
2012-02-11 23:55 ` [PATCH 1/5] OMAPDSS: HDMI: Add function to get the HDMI mode Ricardo Neri
@ 2012-02-11 23:55 ` Ricardo Neri
2012-02-11 23:55 ` [PATCH 3/5] OMAPDSS: HDMI: Add audio config functions to HDMI IP ops Ricardo Neri
` (3 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Ricardo Neri @ 2012-02-11 23:55 UTC (permalink / raw)
To: tomi.valkeinen, mythripk
Cc: s-guiriec, lrg, peter.ujfalusi, linux-omap, Ricardo Neri
The renamed functions are specific to OMAP4. Hence, rename so that
similar functions can be added in the future for other OMAP versions.
Also, remove the reference to the HDMI wrapper in the name of the
_audio_enable function as enabling audio involves both core and
wrapper settings.
Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
---
drivers/video/omap2/dss/dss_features.c | 2 +-
drivers/video/omap2/dss/hdmi.c | 4 ++--
drivers/video/omap2/dss/ti_hdmi.h | 2 +-
drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | 6 +++---
drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h | 4 ++--
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
index 162c9a9..b0b5b00 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -499,7 +499,7 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
.dump_phy = ti_hdmi_4xxx_phy_dump,
#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
- .audio_enable = ti_hdmi_4xxx_wp_audio_enable,
+ .audio_enable = ti_hdmi_4xxx_audio_enable,
#endif
};
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 2ba108f..dfc1487 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -718,7 +718,7 @@ static int hdmi_audio_hw_params(struct snd_pcm_substream *substream,
/* Use parallel audio interface */
core_cfg.en_parallel_aud_input = true;
- hdmi_core_audio_config(ip_data, &core_cfg);
+ ti_hdmi_4xxx_core_audio_config(ip_data, &core_cfg);
/*
* Configure packet
@@ -732,7 +732,7 @@ static int hdmi_audio_hw_params(struct snd_pcm_substream *substream,
aud_if_cfg.db5_downmix_inh = false;
aud_if_cfg.db5_lsv = 0;
- hdmi_core_audio_infoframe_config(ip_data, &aud_if_cfg);
+ ti_hdmi_4xxx_core_audio_infoframe_config(ip_data, &aud_if_cfg);
return 0;
}
diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h
index 7503f7f..2080993 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -141,6 +141,6 @@ void ti_hdmi_4xxx_core_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
-void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable);
+void ti_hdmi_4xxx_audio_enable(struct hdmi_ip_data *ip_data, bool enable);
#endif
#endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 0150e21..542963b 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -1017,7 +1017,7 @@ void hdmi_wp_audio_config_dma(struct hdmi_ip_data *ip_data,
hdmi_write_reg(hdmi_wp_base(ip_data), HDMI_WP_AUDIO_CTRL, r);
}
-void hdmi_core_audio_config(struct hdmi_ip_data *ip_data,
+void ti_hdmi_4xxx_core_audio_config(struct hdmi_ip_data *ip_data,
struct hdmi_core_audio_config *cfg)
{
u32 r;
@@ -1102,7 +1102,7 @@ void hdmi_core_audio_config(struct hdmi_ip_data *ip_data,
hdmi_write_reg(av_base, HDMI_CORE_AV_AUD_MODE, r);
}
-void hdmi_core_audio_infoframe_config(struct hdmi_ip_data *ip_data,
+void ti_hdmi_4xxx_core_audio_infoframe_config(struct hdmi_ip_data *ip_data,
struct hdmi_core_infoframe_audio *info_aud)
{
u8 val;
@@ -1211,7 +1211,7 @@ int hdmi_config_audio_acr(struct hdmi_ip_data *ip_data,
return 0;
}
-void ti_hdmi_4xxx_wp_audio_enable(struct hdmi_ip_data *ip_data, bool enable)
+void ti_hdmi_4xxx_audio_enable(struct hdmi_ip_data *ip_data, bool enable)
{
REG_FLD_MOD(hdmi_av_base(ip_data),
HDMI_CORE_AV_AUD_MODE, enable, 0, 0);
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index a442998..bd8b387 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -578,9 +578,9 @@ struct hdmi_core_audio_config {
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
int hdmi_config_audio_acr(struct hdmi_ip_data *ip_data,
u32 sample_freq, u32 *n, u32 *cts);
-void hdmi_core_audio_infoframe_config(struct hdmi_ip_data *ip_data,
+void ti_hdmi_4xxx_core_audio_infoframe_config(struct hdmi_ip_data *ip_data,
struct hdmi_core_infoframe_audio *info_aud);
-void hdmi_core_audio_config(struct hdmi_ip_data *ip_data,
+void ti_hdmi_4xxx_core_audio_config(struct hdmi_ip_data *ip_data,
struct hdmi_core_audio_config *cfg);
void hdmi_wp_audio_config_dma(struct hdmi_ip_data *ip_data,
struct hdmi_audio_dma *aud_dma);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/5] OMAPDSS: HDMI: Add audio config functions to HDMI IP ops
2012-02-11 23:55 [PATCH 0/5] OMAPDSS: Relocate ASoC HDMI codec to sound Ricardo Neri
2012-02-11 23:55 ` [PATCH 1/5] OMAPDSS: HDMI: Add function to get the HDMI mode Ricardo Neri
2012-02-11 23:55 ` [PATCH 2/5] OMAPDSS: HDMI: Rename audio functions in HDMI IP library Ricardo Neri
@ 2012-02-11 23:55 ` Ricardo Neri
2012-02-11 23:55 ` [PATCH 4/5] OMAPDSS: Export functions to enable dynamic linking Ricardo Neri
` (2 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Ricardo Neri @ 2012-02-11 23:55 UTC (permalink / raw)
To: tomi.valkeinen, mythripk
Cc: s-guiriec, lrg, peter.ujfalusi, linux-omap, Ricardo Neri
DSS defines a set functions to perform HDMI IP-specific operations
that may differ across OMAP versions. Audio needs to be configured
at IP level as well. This patch adds the audio configuration to the
HDMI IP operations and defines them for OMAP4.
Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
---
drivers/video/omap2/dss/dss_features.c | 5 +++++
drivers/video/omap2/dss/ti_hdmi.h | 24 ++++++++++++++++++++++++
drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h | 8 --------
3 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
index b0b5b00..004d34b 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -500,6 +500,11 @@ static const struct ti_hdmi_ip_ops omap4_hdmi_functions = {
#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
.audio_enable = ti_hdmi_4xxx_audio_enable,
+ .audio_dma_cfg = hdmi_wp_audio_config_dma,
+ .audio_core_cfg = ti_hdmi_4xxx_core_audio_config,
+ .audio_fmt_cfg = hdmi_wp_audio_config_format,
+ .audio_if_cfg =
+ ti_hdmi_4xxx_core_audio_infoframe_config,
#endif
};
diff --git a/drivers/video/omap2/dss/ti_hdmi.h b/drivers/video/omap2/dss/ti_hdmi.h
index 2080993..c9dac4e 100644
--- a/drivers/video/omap2/dss/ti_hdmi.h
+++ b/drivers/video/omap2/dss/ti_hdmi.h
@@ -22,6 +22,10 @@
#define _TI_HDMI_H
struct hdmi_ip_data;
+struct hdmi_audio_format;
+struct hdmi_audio_dma;
+struct hdmi_core_audio_config;
+struct hdmi_core_infoframe_audio;
enum hdmi_pll_pwr {
HDMI_PLLPWRCMD_ALLOFF = 0,
@@ -113,6 +117,18 @@ struct ti_hdmi_ip_ops {
#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
void (*audio_enable)(struct hdmi_ip_data *ip_data, bool start);
+
+ void (*audio_dma_cfg)(struct hdmi_ip_data *ip_data,
+ struct hdmi_audio_dma *aud_dma);
+
+ void (*audio_core_cfg)(struct hdmi_ip_data *ip_data,
+ struct hdmi_core_audio_config *cfg);
+
+ void (*audio_fmt_cfg)(struct hdmi_ip_data *ip_data,
+ struct hdmi_audio_format *aud_fmt);
+
+ void (*audio_if_cfg)(struct hdmi_ip_data *ip_data,
+ struct hdmi_core_infoframe_audio *info_aud);
#endif
};
@@ -142,5 +158,13 @@ void ti_hdmi_4xxx_phy_dump(struct hdmi_ip_data *ip_data, struct seq_file *s);
#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
void ti_hdmi_4xxx_audio_enable(struct hdmi_ip_data *ip_data, bool enable);
+void ti_hdmi_4xxx_core_audio_infoframe_config(struct hdmi_ip_data *ip_data,
+ struct hdmi_core_infoframe_audio *info_aud);
+void ti_hdmi_4xxx_core_audio_config(struct hdmi_ip_data *ip_data,
+ struct hdmi_core_audio_config *cfg);
+void hdmi_wp_audio_config_dma(struct hdmi_ip_data *ip_data,
+ struct hdmi_audio_dma *aud_dma);
+void hdmi_wp_audio_config_format(struct hdmi_ip_data *ip_data,
+ struct hdmi_audio_format *aud_fmt);
#endif
#endif
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index bd8b387..43cd783 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -578,13 +578,5 @@ struct hdmi_core_audio_config {
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
int hdmi_config_audio_acr(struct hdmi_ip_data *ip_data,
u32 sample_freq, u32 *n, u32 *cts);
-void ti_hdmi_4xxx_core_audio_infoframe_config(struct hdmi_ip_data *ip_data,
- struct hdmi_core_infoframe_audio *info_aud);
-void ti_hdmi_4xxx_core_audio_config(struct hdmi_ip_data *ip_data,
- struct hdmi_core_audio_config *cfg);
-void hdmi_wp_audio_config_dma(struct hdmi_ip_data *ip_data,
- struct hdmi_audio_dma *aud_dma);
-void hdmi_wp_audio_config_format(struct hdmi_ip_data *ip_data,
- struct hdmi_audio_format *aud_fmt);
#endif
#endif
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/5] OMAPDSS: Export functions to enable dynamic linking
2012-02-11 23:55 [PATCH 0/5] OMAPDSS: Relocate ASoC HDMI codec to sound Ricardo Neri
` (2 preceding siblings ...)
2012-02-11 23:55 ` [PATCH 3/5] OMAPDSS: HDMI: Add audio config functions to HDMI IP ops Ricardo Neri
@ 2012-02-11 23:55 ` Ricardo Neri
2012-02-13 13:48 ` Tomi Valkeinen
2012-02-11 23:55 ` [PATCH 5/5] OMAPDSS/ASoC: Relocate ASoC HDMI codec. Part 1 Ricardo Neri
2012-02-12 0:34 ` [PATCH 0/5] OMAPDSS: Relocate ASoC HDMI codec to sound Ricardo Neri
5 siblings, 1 reply; 12+ messages in thread
From: Ricardo Neri @ 2012-02-11 23:55 UTC (permalink / raw)
To: tomi.valkeinen, mythripk
Cc: s-guiriec, lrg, peter.ujfalusi, linux-omap, Ricardo Neri
The functions dss_init_hdmi_ip_ops and dss_has_feature are used by
the ASoC HDMI codec. Both the ASoC codec and DSS may be built
as separate kernel modules. Hence, these two functions need to be
available for dynamic linking.
Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
---
drivers/video/omap2/dss/dss_features.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
index 004d34b..d5707b5 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -21,6 +21,7 @@
#include <linux/types.h>
#include <linux/err.h>
#include <linux/slab.h>
+#include <linux/export.h>
#include <video/omapdss.h>
#include <plat/cpu.h>
@@ -514,6 +515,7 @@ void dss_init_hdmi_ip_ops(struct hdmi_ip_data *ip_data)
if (cpu_is_omap44xx())
ip_data->ops = &omap4_hdmi_functions;
}
+EXPORT_SYMBOL(dss_init_hdmi_ip_ops);
#endif
/* Functions returning values related to a DSS feature */
@@ -579,6 +581,7 @@ bool dss_has_feature(enum dss_feat_id id)
{
return omap_current_dss_features->has_feature & id;
}
+EXPORT_SYMBOL(dss_has_feature);
void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end)
{
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 5/5] OMAPDSS/ASoC: Relocate ASoC HDMI codec. Part 1
2012-02-11 23:55 [PATCH 0/5] OMAPDSS: Relocate ASoC HDMI codec to sound Ricardo Neri
` (3 preceding siblings ...)
2012-02-11 23:55 ` [PATCH 4/5] OMAPDSS: Export functions to enable dynamic linking Ricardo Neri
@ 2012-02-11 23:55 ` Ricardo Neri
2012-02-12 0:34 ` [PATCH 0/5] OMAPDSS: Relocate ASoC HDMI codec to sound Ricardo Neri
5 siblings, 0 replies; 12+ messages in thread
From: Ricardo Neri @ 2012-02-11 23:55 UTC (permalink / raw)
To: tomi.valkeinen, mythripk
Cc: s-guiriec, lrg, peter.ujfalusi, linux-omap, Ricardo Neri
The ASoC HDMI codec is to be relocated under sound/soc/codecs. This
patch removes the codec from DSS code. A second patch will place
this code under ASoC.
Signed-off-by: Ricardo Neri <ricardo.neri@ti.com>
---
drivers/video/omap2/dss/hdmi.c | 236 -----------------------------
drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | 57 -------
drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h | 5 -
3 files changed, 0 insertions(+), 298 deletions(-)
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index dfc1487..e463940 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -33,12 +33,6 @@
#include <linux/pm_runtime.h>
#include <linux/clk.h>
#include <video/omapdss.h>
-#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
- defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
-#include <sound/soc.h>
-#include <sound/pcm_params.h>
-#include "ti_hdmi_4xxx_ip.h"
-#endif
#include "ti_hdmi.h"
#include "dss.h"
@@ -564,220 +558,6 @@ int omapdss_hdmi_get_hdmi_mode(void)
}
EXPORT_SYMBOL(omapdss_hdmi_get_hdmi_mode);
-#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
- defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
-
-static int hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd,
- struct snd_soc_dai *dai)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_codec *codec = rtd->codec;
- struct platform_device *pdev = to_platform_device(codec->dev);
- struct hdmi_ip_data *ip_data = snd_soc_codec_get_drvdata(codec);
- int err = 0;
-
- if (!(ip_data->ops) && !(ip_data->ops->audio_enable)) {
- dev_err(&pdev->dev, "Cannot enable/disable audio\n");
- return -ENODEV;
- }
-
- switch (cmd) {
- case SNDRV_PCM_TRIGGER_START:
- case SNDRV_PCM_TRIGGER_RESUME:
- case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- ip_data->ops->audio_enable(ip_data, true);
- break;
- case SNDRV_PCM_TRIGGER_STOP:
- case SNDRV_PCM_TRIGGER_SUSPEND:
- case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- ip_data->ops->audio_enable(ip_data, false);
- break;
- default:
- err = -EINVAL;
- }
- return err;
-}
-
-static int hdmi_audio_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params,
- struct snd_soc_dai *dai)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_codec *codec = rtd->codec;
- struct hdmi_ip_data *ip_data = snd_soc_codec_get_drvdata(codec);
- struct hdmi_audio_format audio_format;
- struct hdmi_audio_dma audio_dma;
- struct hdmi_core_audio_config core_cfg;
- struct hdmi_core_infoframe_audio aud_if_cfg;
- int err, n, cts;
- enum hdmi_core_audio_sample_freq sample_freq;
-
- switch (params_format(params)) {
- case SNDRV_PCM_FORMAT_S16_LE:
- core_cfg.i2s_cfg.word_max_length =
- HDMI_AUDIO_I2S_MAX_WORD_20BITS;
- core_cfg.i2s_cfg.word_length = HDMI_AUDIO_I2S_CHST_WORD_16_BITS;
- core_cfg.i2s_cfg.in_length_bits =
- HDMI_AUDIO_I2S_INPUT_LENGTH_16;
- core_cfg.i2s_cfg.justification = HDMI_AUDIO_JUSTIFY_LEFT;
- audio_format.samples_per_word = HDMI_AUDIO_ONEWORD_TWOSAMPLES;
- audio_format.sample_size = HDMI_AUDIO_SAMPLE_16BITS;
- audio_format.justification = HDMI_AUDIO_JUSTIFY_LEFT;
- audio_dma.transfer_size = 0x10;
- break;
- case SNDRV_PCM_FORMAT_S24_LE:
- core_cfg.i2s_cfg.word_max_length =
- HDMI_AUDIO_I2S_MAX_WORD_24BITS;
- core_cfg.i2s_cfg.word_length = HDMI_AUDIO_I2S_CHST_WORD_24_BITS;
- core_cfg.i2s_cfg.in_length_bits =
- HDMI_AUDIO_I2S_INPUT_LENGTH_24;
- audio_format.samples_per_word = HDMI_AUDIO_ONEWORD_ONESAMPLE;
- audio_format.sample_size = HDMI_AUDIO_SAMPLE_24BITS;
- audio_format.justification = HDMI_AUDIO_JUSTIFY_RIGHT;
- core_cfg.i2s_cfg.justification = HDMI_AUDIO_JUSTIFY_RIGHT;
- audio_dma.transfer_size = 0x20;
- break;
- default:
- return -EINVAL;
- }
-
- switch (params_rate(params)) {
- case 32000:
- sample_freq = HDMI_AUDIO_FS_32000;
- break;
- case 44100:
- sample_freq = HDMI_AUDIO_FS_44100;
- break;
- case 48000:
- sample_freq = HDMI_AUDIO_FS_48000;
- break;
- default:
- return -EINVAL;
- }
-
- err = hdmi_config_audio_acr(ip_data, params_rate(params), &n, &cts);
- if (err < 0)
- return err;
-
- /* Audio wrapper config */
- audio_format.stereo_channels = HDMI_AUDIO_STEREO_ONECHANNEL;
- audio_format.active_chnnls_msk = 0x03;
- audio_format.type = HDMI_AUDIO_TYPE_LPCM;
- audio_format.sample_order = HDMI_AUDIO_SAMPLE_LEFT_FIRST;
- /* Disable start/stop signals of IEC 60958 blocks */
- audio_format.en_sig_blk_strt_end = HDMI_AUDIO_BLOCK_SIG_STARTEND_OFF;
-
- audio_dma.block_size = 0xC0;
- audio_dma.mode = HDMI_AUDIO_TRANSF_DMA;
- audio_dma.fifo_threshold = 0x20; /* in number of samples */
-
- hdmi_wp_audio_config_dma(ip_data, &audio_dma);
- hdmi_wp_audio_config_format(ip_data, &audio_format);
-
- /*
- * I2S config
- */
- core_cfg.i2s_cfg.en_high_bitrate_aud = false;
- /* Only used with high bitrate audio */
- core_cfg.i2s_cfg.cbit_order = false;
- /* Serial data and word select should change on sck rising edge */
- core_cfg.i2s_cfg.sck_edge_mode = HDMI_AUDIO_I2S_SCK_EDGE_RISING;
- core_cfg.i2s_cfg.vbit = HDMI_AUDIO_I2S_VBIT_FOR_PCM;
- /* Set I2S word select polarity */
- core_cfg.i2s_cfg.ws_polarity = HDMI_AUDIO_I2S_WS_POLARITY_LOW_IS_LEFT;
- core_cfg.i2s_cfg.direction = HDMI_AUDIO_I2S_MSB_SHIFTED_FIRST;
- /* Set serial data to word select shift. See Phillips spec. */
- core_cfg.i2s_cfg.shift = HDMI_AUDIO_I2S_FIRST_BIT_SHIFT;
- /* Enable one of the four available serial data channels */
- core_cfg.i2s_cfg.active_sds = HDMI_AUDIO_I2S_SD0_EN;
-
- /* Core audio config */
- core_cfg.freq_sample = sample_freq;
- core_cfg.n = n;
- core_cfg.cts = cts;
- if (dss_has_feature(FEAT_HDMI_CTS_SWMODE)) {
- core_cfg.aud_par_busclk = 0;
- core_cfg.cts_mode = HDMI_AUDIO_CTS_MODE_SW;
- core_cfg.use_mclk = dss_has_feature(FEAT_HDMI_AUDIO_USE_MCLK);
- } else {
- core_cfg.aud_par_busclk = (((128 * 31) - 1) << 8);
- core_cfg.cts_mode = HDMI_AUDIO_CTS_MODE_HW;
- core_cfg.use_mclk = true;
- }
-
- if (core_cfg.use_mclk)
- core_cfg.mclk_mode = HDMI_AUDIO_MCLK_128FS;
- core_cfg.layout = HDMI_AUDIO_LAYOUT_2CH;
- core_cfg.en_spdif = false;
- /* Use sample frequency from channel status word */
- core_cfg.fs_override = true;
- /* Enable ACR packets */
- core_cfg.en_acr_pkt = true;
- /* Disable direct streaming digital audio */
- core_cfg.en_dsd_audio = false;
- /* Use parallel audio interface */
- core_cfg.en_parallel_aud_input = true;
-
- ti_hdmi_4xxx_core_audio_config(ip_data, &core_cfg);
-
- /*
- * Configure packet
- * info frame audio see doc CEA861-D page 74
- */
- aud_if_cfg.db1_coding_type = HDMI_INFOFRAME_AUDIO_DB1CT_FROM_STREAM;
- aud_if_cfg.db1_channel_count = 2;
- aud_if_cfg.db2_sample_freq = HDMI_INFOFRAME_AUDIO_DB2SF_FROM_STREAM;
- aud_if_cfg.db2_sample_size = HDMI_INFOFRAME_AUDIO_DB2SS_FROM_STREAM;
- aud_if_cfg.db4_channel_alloc = 0x00;
- aud_if_cfg.db5_downmix_inh = false;
- aud_if_cfg.db5_lsv = 0;
-
- ti_hdmi_4xxx_core_audio_infoframe_config(ip_data, &aud_if_cfg);
- return 0;
-}
-
-static int hdmi_audio_startup(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
-{
- if (!hdmi.mode) {
- pr_err("Current video settings do not support audio.\n");
- return -EIO;
- }
- return 0;
-}
-
-static int hdmi_audio_codec_probe(struct snd_soc_codec *codec)
-{
- struct hdmi_ip_data *priv = &hdmi.ip_data;
-
- snd_soc_codec_set_drvdata(codec, priv);
- return 0;
-}
-
-static struct snd_soc_codec_driver hdmi_audio_codec_drv = {
- .probe = hdmi_audio_codec_probe,
-};
-
-static struct snd_soc_dai_ops hdmi_audio_codec_ops = {
- .hw_params = hdmi_audio_hw_params,
- .trigger = hdmi_audio_trigger,
- .startup = hdmi_audio_startup,
-};
-
-static struct snd_soc_dai_driver hdmi_codec_dai_drv = {
- .name = "hdmi-audio-codec",
- .playback = {
- .channels_min = 2,
- .channels_max = 2,
- .rates = SNDRV_PCM_RATE_32000 |
- SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000,
- .formats = SNDRV_PCM_FMTBIT_S16_LE |
- SNDRV_PCM_FMTBIT_S24_LE,
- },
- .ops = &hdmi_audio_codec_ops,
-};
-#endif
-
static int hdmi_get_clocks(struct platform_device *pdev)
{
struct clk *clk;
@@ -839,17 +619,6 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
hdmi_panel_init();
-#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
- defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
-
- /* Register ASoC codec DAI */
- r = snd_soc_register_codec(&pdev->dev, &hdmi_audio_codec_drv,
- &hdmi_codec_dai_drv, 1);
- if (r) {
- DSSERR("can't register ASoC HDMI audio codec\n");
- return r;
- }
-#endif
return 0;
}
@@ -857,11 +626,6 @@ static int omapdss_hdmihw_remove(struct platform_device *pdev)
{
hdmi_panel_exit();
-#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
- defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
- snd_soc_unregister_codec(&pdev->dev);
-#endif
-
pm_runtime_disable(&pdev->dev);
hdmi_put_clocks();
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 542963b..4a3b5b1 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -1154,63 +1154,6 @@ void ti_hdmi_4xxx_core_audio_infoframe_config(struct hdmi_ip_data *ip_data,
*/
}
-int hdmi_config_audio_acr(struct hdmi_ip_data *ip_data,
- u32 sample_freq, u32 *n, u32 *cts)
-{
- u32 r;
- u32 deep_color = 0;
- u32 pclk = ip_data->cfg.timings.timings.pixel_clock;
-
- if (n == NULL || cts == NULL)
- return -EINVAL;
- /*
- * Obtain current deep color configuration. This needed
- * to calculate the TMDS clock based on the pixel clock.
- */
- r = REG_GET(hdmi_wp_base(ip_data), HDMI_WP_VIDEO_CFG, 1, 0);
- switch (r) {
- case 1: /* No deep color selected */
- deep_color = 100;
- break;
- case 2: /* 10-bit deep color selected */
- deep_color = 125;
- break;
- case 3: /* 12-bit deep color selected */
- deep_color = 150;
- break;
- default:
- return -EINVAL;
- }
-
- switch (sample_freq) {
- case 32000:
- if ((deep_color == 125) && ((pclk == 54054)
- || (pclk == 74250)))
- *n = 8192;
- else
- *n = 4096;
- break;
- case 44100:
- *n = 6272;
- break;
- case 48000:
- if ((deep_color == 125) && ((pclk == 54054)
- || (pclk == 74250)))
- *n = 8192;
- else
- *n = 6144;
- break;
- default:
- *n = 0;
- return -EINVAL;
- }
-
- /* Calculate CTS. See HDMI 1.3a or 1.4a specifications */
- *cts = pclk * (*n / 128) * deep_color / (sample_freq / 10);
-
- return 0;
-}
-
void ti_hdmi_4xxx_audio_enable(struct hdmi_ip_data *ip_data, bool enable)
{
REG_FLD_MOD(hdmi_av_base(ip_data),
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
index 43cd783..d51022b 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h
@@ -574,9 +574,4 @@ struct hdmi_core_audio_config {
bool en_spdif;
};
-#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
- defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
-int hdmi_config_audio_acr(struct hdmi_ip_data *ip_data,
- u32 sample_freq, u32 *n, u32 *cts);
-#endif
#endif
--
1.7.0.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 0/5] OMAPDSS: Relocate ASoC HDMI codec to sound
2012-02-11 23:55 [PATCH 0/5] OMAPDSS: Relocate ASoC HDMI codec to sound Ricardo Neri
` (4 preceding siblings ...)
2012-02-11 23:55 ` [PATCH 5/5] OMAPDSS/ASoC: Relocate ASoC HDMI codec. Part 1 Ricardo Neri
@ 2012-02-12 0:34 ` Ricardo Neri
5 siblings, 0 replies; 12+ messages in thread
From: Ricardo Neri @ 2012-02-12 0:34 UTC (permalink / raw)
To: tomi.valkeinen, K, Mythri P; +Cc: s-guiriec, lrg, peter.ujfalusi, linux-omap
Hi,
On Sat, 2012-02-11 at 17:55 -0600, Ricardo Neri wrote:
> Hello,
>
> In order to give to the OMAP HDMI code a more logical arrangement, the audio
> part is moved to /sound. Only the IP-specific functions remain in the DSS HDMI
> IP library. These patches introduce modifications to expose the DSS functio-
> nality that is going to be required by the ASoC driver.
>
> This relocation is split in two parts. This is first part. The second part
> is for ASoC and is to be submitted to the ALSA list. The purpose of
> this split is to ease the integration of these patches first to DSS
> and then to ASoC.
The ASoC part has also been submitted and can be consulted here:
http://mailman.alsa-project.org/pipermail/alsa-devel/2012-February/049058.html
Ricardo
>
> This work is also based on the patches previously sent for HDMI audio MCLK
> support:
>
> http://www.spinics.net/lists/linux-omap/msg64302.html
>
> and was implemented on top of:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git v3.3-rc3
>
> Thanks,
>
> Ricardo
>
> Ricardo Neri (5):
> OMAPDSS: HDMI: Add function to get the HDMI mode
> OMAPDSS: HDMI: Rename audio functions in HDMI IP library
> OMAPDSS: HDMI: Add audio config functions to HDMI IP ops
> OMAPDSS: Export functions to enable dynamic linking
> OMAPDSS/ASoC: Relocate ASoC HDMI codec. Part 1
>
> drivers/video/omap2/dss/dss.h | 1 +
> drivers/video/omap2/dss/dss_features.c | 10 +-
> drivers/video/omap2/dss/hdmi.c | 236 +----------------------------
> drivers/video/omap2/dss/ti_hdmi.h | 26 +++-
> drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c | 63 +--------
> drivers/video/omap2/dss/ti_hdmi_4xxx_ip.h | 13 --
> 6 files changed, 41 insertions(+), 308 deletions(-)
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/5] OMAPDSS: Export functions to enable dynamic linking
2012-02-11 23:55 ` [PATCH 4/5] OMAPDSS: Export functions to enable dynamic linking Ricardo Neri
@ 2012-02-13 13:48 ` Tomi Valkeinen
2012-02-15 0:00 ` Ricardo Neri
0 siblings, 1 reply; 12+ messages in thread
From: Tomi Valkeinen @ 2012-02-13 13:48 UTC (permalink / raw)
To: Ricardo Neri; +Cc: mythripk, s-guiriec, lrg, peter.ujfalusi, linux-omap
[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]
Hi,
On Sat, 2012-02-11 at 17:55 -0600, Ricardo Neri wrote:
> The functions dss_init_hdmi_ip_ops and dss_has_feature are used by
> the ASoC HDMI codec. Both the ASoC codec and DSS may be built
> as separate kernel modules. Hence, these two functions need to be
> available for dynamic linking.
Neither of those functions should be exported, they are omapdss
internal. And you had to hack around to make those usable by adding
drivers/video/omap2/dss into the include path.
Anything that is exported from omapdss should be added to
include/video/omapdss.h. Users of omapdss should never include anything
from drivers/video/omap2/dss.
But as I said, neither of those functions should be exported, they are
clearly omapdss internal functions. For dss_has_feature we probably need
a new function to convey the information about the hdmi features that
the audio side needs. Or perhaps it can be in the ip_data.
For dss_init_hdmi_ip_ops I don't see why the audio part should see it.
Initializing the ops should clearly be done by omapdss automatically.
Tomi
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/5] OMAPDSS: Export functions to enable dynamic linking
2012-02-13 13:48 ` Tomi Valkeinen
@ 2012-02-15 0:00 ` Ricardo Neri
2012-02-15 8:23 ` Tomi Valkeinen
0 siblings, 1 reply; 12+ messages in thread
From: Ricardo Neri @ 2012-02-15 0:00 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: mythripk, s-guiriec, lrg, peter.ujfalusi, linux-omap
Hi Tomi,
Thanks for your comments.
On Mon, 2012-02-13 at 15:48 +0200, Tomi Valkeinen wrote:
> Hi,
>
> On Sat, 2012-02-11 at 17:55 -0600, Ricardo Neri wrote:
> > The functions dss_init_hdmi_ip_ops and dss_has_feature are used by
> > the ASoC HDMI codec. Both the ASoC codec and DSS may be built
> > as separate kernel modules. Hence, these two functions need to be
> > available for dynamic linking.
>
> Neither of those functions should be exported, they are omapdss
> internal. And you had to hack around to make those usable by adding
> drivers/video/omap2/dss into the include path.
>
> Anything that is exported from omapdss should be added to
> include/video/omapdss.h. Users of omapdss should never include anything
> from drivers/video/omap2/dss.
>
> But as I said, neither of those functions should be exported, they are
> clearly omapdss internal functions. For dss_has_feature we probably need
> a new function to convey the information about the hdmi features that
> the audio side needs. Or perhaps it can be in the ip_data.
I will try to create this new functions and add it to
include/video/omapdss.h and resubmit the patch. The approach that I am
following is to maintain an hdmi_ip_data structure in the ASoC HDMI
codec driver to utilize the functions of the HDMI IP library. If the DSS
features are stored in the ip_data then I would need a DSS function
(i.e., dss_features_init or similar) to initialize it. This may not be
right as that is an omapdss internal function.
>
> For dss_init_hdmi_ip_ops I don't see why the audio part should see it.
> Initializing the ops should clearly be done by omapdss automatically.
Yes, the DSS HDMI driver already does this for its own struct
hdmi_ip_data. However, under my approach, the hdmi_ip_data of the ASoC
HDMI driver needs to be initialized as well.
Another approach is to not have an hdmi_ip_data in the ASoC HDMI driver
and reuse the ip_data of the DSS HDMI driver. In that case, however, a
lot of set/get functions would need to be implemented in DSS to expose
audio functionality: HDMI mode, deep color configuration, audio
infoframe config and core and wrapper configuration for audio. An
example of this is already present in here:
http://www.spinics.net/lists/linux-omap/msg64479.html
Being HDMI special as no other display combines audio and video, maybe a
special header file could be created for HDMI.
What do you think?
Ricardo
>
> Tomi
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/5] OMAPDSS: Export functions to enable dynamic linking
2012-02-15 0:00 ` Ricardo Neri
@ 2012-02-15 8:23 ` Tomi Valkeinen
2012-02-16 2:46 ` Ricardo Neri
0 siblings, 1 reply; 12+ messages in thread
From: Tomi Valkeinen @ 2012-02-15 8:23 UTC (permalink / raw)
To: Ricardo Neri; +Cc: mythripk, s-guiriec, lrg, peter.ujfalusi, linux-omap
[-- Attachment #1: Type: text/plain, Size: 4322 bytes --]
On Tue, 2012-02-14 at 18:00 -0600, Ricardo Neri wrote:
> Hi Tomi,
>
> Thanks for your comments.
> On Mon, 2012-02-13 at 15:48 +0200, Tomi Valkeinen wrote:
> > Hi,
> >
> > On Sat, 2012-02-11 at 17:55 -0600, Ricardo Neri wrote:
> > > The functions dss_init_hdmi_ip_ops and dss_has_feature are used by
> > > the ASoC HDMI codec. Both the ASoC codec and DSS may be built
> > > as separate kernel modules. Hence, these two functions need to be
> > > available for dynamic linking.
> >
> > Neither of those functions should be exported, they are omapdss
> > internal. And you had to hack around to make those usable by adding
> > drivers/video/omap2/dss into the include path.
> >
> > Anything that is exported from omapdss should be added to
> > include/video/omapdss.h. Users of omapdss should never include anything
> > from drivers/video/omap2/dss.
> >
> > But as I said, neither of those functions should be exported, they are
> > clearly omapdss internal functions. For dss_has_feature we probably need
> > a new function to convey the information about the hdmi features that
> > the audio side needs. Or perhaps it can be in the ip_data.
> I will try to create this new functions and add it to
> include/video/omapdss.h and resubmit the patch. The approach that I am
> following is to maintain an hdmi_ip_data structure in the ASoC HDMI
> codec driver to utilize the functions of the HDMI IP library. If the DSS
> features are stored in the ip_data then I would need a DSS function
> (i.e., dss_features_init or similar) to initialize it. This may not be
> right as that is an omapdss internal function.
>
> >
> > For dss_init_hdmi_ip_ops I don't see why the audio part should see it.
> > Initializing the ops should clearly be done by omapdss automatically.
> Yes, the DSS HDMI driver already does this for its own struct
> hdmi_ip_data. However, under my approach, the hdmi_ip_data of the ASoC
> HDMI driver needs to be initialized as well.
Ah, I see, you create your own hdmi_ip_data there. I don't think this is
the right direction to go...
I have a feeling that this won't be an easy task.
> Another approach is to not have an hdmi_ip_data in the ASoC HDMI driver
> and reuse the ip_data of the DSS HDMI driver. In that case, however, a
> lot of set/get functions would need to be implemented in DSS to expose
> audio functionality: HDMI mode, deep color configuration, audio
> infoframe config and core and wrapper configuration for audio. An
> example of this is already present in here:
>
> http://www.spinics.net/lists/linux-omap/msg64479.html
>
> Being HDMI special as no other display combines audio and video, maybe a
> special header file could be created for HDMI.
We will have the same issue with DisplayPort, so it's not that special.
The HDMI and DSS architecture doesn't currently have a way to do this
easily. I'm not even sure how this should be done.
However, I think the audio driver should be a bit similar conceptually
than, say, omapfb, but for audio instead of video. What I mean is that
the audio driver should find the omap_dss_device/driver that it wants to
use, and then uses the API offered by the device/driver to handle the
audio.
This would mean adding a bunch of functions into omap_dss_driver.
Preferably the functions would be non-HDMI specific, so that DisplayPort
could use them also, or actually any other display type.
The audio driver should iterate the dss devices to find the ones (there
could well be multiple HDMI outputs) that support audio when the driver
starts.
Does the above make sense?
Btw, another thing, not directly related:
I see these in the hdmi driver:
#if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
If the audio driver is separate, I don't see need for those. In fact, I
think they are wrong in that case. The HDMI driver should have the audio
support for any user, which could in theory be some other driver than
the audio driver you are working on.
If the amount of audio code is big in the hdmi driver (which I guess it
isn't), we could have a hidden kernel config option to enable the HDMI
audio support. And the audio driver would use Kconfig's "select" to
enable it.
Tomi
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/5] OMAPDSS: Export functions to enable dynamic linking
2012-02-15 8:23 ` Tomi Valkeinen
@ 2012-02-16 2:46 ` Ricardo Neri
2012-02-16 6:34 ` Tomi Valkeinen
0 siblings, 1 reply; 12+ messages in thread
From: Ricardo Neri @ 2012-02-16 2:46 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: mythripk, s-guiriec, lrg, peter.ujfalusi, linux-omap
Hi Tomi,
On Wed, 2012-02-15 at 10:23 +0200, Tomi Valkeinen wrote:
> On Tue, 2012-02-14 at 18:00 -0600, Ricardo Neri wrote:
> > Hi Tomi,
> >
> > Thanks for your comments.
> > On Mon, 2012-02-13 at 15:48 +0200, Tomi Valkeinen wrote:
> > > Hi,
> > >
> > > On Sat, 2012-02-11 at 17:55 -0600, Ricardo Neri wrote:
> > > > The functions dss_init_hdmi_ip_ops and dss_has_feature are used by
> > > > the ASoC HDMI codec. Both the ASoC codec and DSS may be built
> > > > as separate kernel modules. Hence, these two functions need to be
> > > > available for dynamic linking.
> > >
> > > Neither of those functions should be exported, they are omapdss
> > > internal. And you had to hack around to make those usable by adding
> > > drivers/video/omap2/dss into the include path.
> > >
> > > Anything that is exported from omapdss should be added to
> > > include/video/omapdss.h. Users of omapdss should never include anything
> > > from drivers/video/omap2/dss.
> > >
> > > But as I said, neither of those functions should be exported, they are
> > > clearly omapdss internal functions. For dss_has_feature we probably need
> > > a new function to convey the information about the hdmi features that
> > > the audio side needs. Or perhaps it can be in the ip_data.
> > I will try to create this new functions and add it to
> > include/video/omapdss.h and resubmit the patch. The approach that I am
> > following is to maintain an hdmi_ip_data structure in the ASoC HDMI
> > codec driver to utilize the functions of the HDMI IP library. If the DSS
> > features are stored in the ip_data then I would need a DSS function
> > (i.e., dss_features_init or similar) to initialize it. This may not be
> > right as that is an omapdss internal function.
> >
> > >
> > > For dss_init_hdmi_ip_ops I don't see why the audio part should see it.
> > > Initializing the ops should clearly be done by omapdss automatically.
> > Yes, the DSS HDMI driver already does this for its own struct
> > hdmi_ip_data. However, under my approach, the hdmi_ip_data of the ASoC
> > HDMI driver needs to be initialized as well.
>
> Ah, I see, you create your own hdmi_ip_data there. I don't think this is
> the right direction to go...
>
> I have a feeling that this won't be an easy task.
This approach seemed appealing as the ASoC driver only deals with HDMI
audio configuration, requires access only to the HDMI IP library and
minimizes the amount of code to be implemented in DSS. While it is true
that it uses its own hdmi_ip_data, it does not overlap the DSS HDMI
driver functionality nor overwrites any configuration done by DSS.
>
> > Another approach is to not have an hdmi_ip_data in the ASoC HDMI driver
> > and reuse the ip_data of the DSS HDMI driver. In that case, however, a
> > lot of set/get functions would need to be implemented in DSS to expose
> > audio functionality: HDMI mode, deep color configuration, audio
> > infoframe config and core and wrapper configuration for audio. An
> > example of this is already present in here:
> >
> > http://www.spinics.net/lists/linux-omap/msg64479.html
> >
> > Being HDMI special as no other display combines audio and video, maybe a
> > special header file could be created for HDMI.
>
> We will have the same issue with DisplayPort, so it's not that special.
I spent some time comparing audio support in HDMI and DisplayPort. On
both, audio is based on CEA-861 infoframes and IEC-60958 and IEC-61937
transport frames. Also, both configure clock recovery parameters. Hence,
both will have similar configuration needs and perhaps they can share
the same set of functions exposed by DSS (omap_dss_audio_* maybe?).
Then, DSS will pass this configuration to the appropriate HDMI or
DisplayPort driver.
> The HDMI and DSS architecture doesn't currently have a way to do this
> easily. I'm not even sure how this should be done.
>
> However, I think the audio driver should be a bit similar conceptually
> than, say, omapfb, but for audio instead of video. What I mean is that
> the audio driver should find the omap_dss_device/driver that it wants to
> use, and then uses the API offered by the device/driver to handle the
> audio.
> This would mean adding a bunch of functions into omap_dss_driver.
> Preferably the functions would be non-HDMI specific, so that DisplayPort
> could use them also, or actually any other display type.
What other display types featuring audio and video should be considered
at this point?
>
> The audio driver should iterate the dss devices to find the ones (there
> could well be multiple HDMI outputs) that support audio when the driver
> starts.
>
> Does the above make sense?
At first glance, I think the omapd_dss_audio_* functions should cover
the following:
* CEA-861 infoframe configuration
* IEC-60958 configuration (IEC-61937 support added later)
* audio start/stop
* whether audio is supported by the current video configuration
* a notifier power and video events (e.g, DVI/HDMI mode, changes in
pixel clock and deep color configuration) to the ASoC driver. Maybe an
enum can encompass DisplayPort and HDMI events.
I think that this is generic enough to cover DisplayPort and HDMI,
unless you consider that I am missing some important display type.
I can try to make it similar to omapfb.
> Btw, another thing, not directly related:
>
> I see these in the hdmi driver:
>
> #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \
> defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE)
>
> If the audio driver is separate, I don't see need for those. In fact, I
> think they are wrong in that case. The HDMI driver should have the audio
> support for any user, which could in theory be some other driver than
> the audio driver you are working on.
>
> If the amount of audio code is big in the hdmi driver (which I guess it
> isn't), we could have a hidden kernel config option to enable the HDMI
> audio support. And the audio driver would use Kconfig's "select" to
> enable it.
I agree. Actually, I had created a patch (not submitted yet) that made
HDMI audio support available when selecting just the ASoC HDMI codec not
the whole ASoC HDMI audio support. As you say, this can be taken one
step further with a DSS config option for HDMI audio selectable by
anyone that desires it.
Ricardo
>
> Tomi
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/5] OMAPDSS: Export functions to enable dynamic linking
2012-02-16 2:46 ` Ricardo Neri
@ 2012-02-16 6:34 ` Tomi Valkeinen
0 siblings, 0 replies; 12+ messages in thread
From: Tomi Valkeinen @ 2012-02-16 6:34 UTC (permalink / raw)
To: Ricardo Neri; +Cc: mythripk, s-guiriec, lrg, peter.ujfalusi, linux-omap
[-- Attachment #1: Type: text/plain, Size: 1801 bytes --]
On Wed, 2012-02-15 at 20:46 -0600, Ricardo Neri wrote:
> What other display types featuring audio and video should be considered
> at this point?
I guess they are a bit theoretical, so I wouldn't worry too much about
them. But if it's easy to make the API generic, instead of HDMI
specific, let's aim for generic one just to be on the safe side.
> > The audio driver should iterate the dss devices to find the ones (there
> > could well be multiple HDMI outputs) that support audio when the driver
> > starts.
> >
> > Does the above make sense?
>
> At first glance, I think the omapd_dss_audio_* functions should cover
> the following:
> * CEA-861 infoframe configuration
> * IEC-60958 configuration (IEC-61937 support added later)
> * audio start/stop
> * whether audio is supported by the current video configuration
> * a notifier power and video events (e.g, DVI/HDMI mode, changes in
> pixel clock and deep color configuration) to the ASoC driver. Maybe an
> enum can encompass DisplayPort and HDMI events.
Sounds fine to me (not that I understand anything about the audio side
=). For notifications, I've long planned to implement notifications for
omapdss/displays, mainly for hotplug but also other events. So I think
we should try to make the notification system not audio-specific, but
usable for other events also.
As for the API, I don't think omap_dss_audio_* is the way to go. The
audio functions should probably be function pointers in the
omap_dss_driver struct.
> I think that this is generic enough to cover DisplayPort and HDMI,
> unless you consider that I am missing some important display type.
>
> I can try to make it similar to omapfb.
Don't look too closely at omapfb, it's horribly ugly in many places =).
Tomi
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2012-02-16 6:35 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-11 23:55 [PATCH 0/5] OMAPDSS: Relocate ASoC HDMI codec to sound Ricardo Neri
2012-02-11 23:55 ` [PATCH 1/5] OMAPDSS: HDMI: Add function to get the HDMI mode Ricardo Neri
2012-02-11 23:55 ` [PATCH 2/5] OMAPDSS: HDMI: Rename audio functions in HDMI IP library Ricardo Neri
2012-02-11 23:55 ` [PATCH 3/5] OMAPDSS: HDMI: Add audio config functions to HDMI IP ops Ricardo Neri
2012-02-11 23:55 ` [PATCH 4/5] OMAPDSS: Export functions to enable dynamic linking Ricardo Neri
2012-02-13 13:48 ` Tomi Valkeinen
2012-02-15 0:00 ` Ricardo Neri
2012-02-15 8:23 ` Tomi Valkeinen
2012-02-16 2:46 ` Ricardo Neri
2012-02-16 6:34 ` Tomi Valkeinen
2012-02-11 23:55 ` [PATCH 5/5] OMAPDSS/ASoC: Relocate ASoC HDMI codec. Part 1 Ricardo Neri
2012-02-12 0:34 ` [PATCH 0/5] OMAPDSS: Relocate ASoC HDMI codec to sound Ricardo Neri
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).