All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] add channel order map interface in asoc core
@ 2009-09-11 17:16 Barry Song
  2009-09-12 12:49 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Barry Song @ 2009-09-11 17:16 UTC (permalink / raw)
  To: lrg, broonie; +Cc: uclinux-dist-devel, alsa-devel, Barry Song

The patch adds an interface to set the relationship between audio
channel number and slot number. The interface should be really useful
because audio channel n doesn't always use slot n in all platforms. And
for some devices, the relationship even can change with sound mode
switch in 2.1,3.1,4.1,5.1,6.1,7.1 etc.

Signed-off-by: Barry Song <21cnbao@gmail.com>
---
 include/sound/soc-dai.h |    7 +++++++
 sound/soc/soc-core.c    |   24 ++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 97ca9af..5c84566 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -114,6 +114,10 @@ int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
 int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
 	unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width);
 
+int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai,
+	unsigned int tx_num, unsigned int *tx_slot,
+	unsigned int rx_num, unsigned int *rx_slot);
+
 int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);
 
 /* Digital Audio Interface mute */
@@ -148,6 +152,9 @@ struct snd_soc_dai_ops {
 	int (*set_tdm_slot)(struct snd_soc_dai *dai,
 		unsigned int tx_mask, unsigned int rx_mask,
 		int slots, int slot_width);
+	int (*set_channel_map)(struct snd_soc_dai *dai,
+		unsigned int tx_num, unsigned int *tx_slot,
+		unsigned int rx_num, unsigned int *rx_slot);
 	int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
 
 	/*
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 7ff04ad..ba1f8e5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2251,6 +2251,30 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
 EXPORT_SYMBOL_GPL(snd_soc_dai_set_tdm_slot);
 
 /**
+ * snd_soc_dai_set_channel_map - configure DAI audio channel map
+ * @dai: DAI
+ * @tx_num: how many TX channels
+ * @tx_slot: pointer to an array which imply the TX slot number channel
+ *           0~num-1 uses
+ * @rx_num: how many RX channels
+ * @rx_slot: pointer to an array which imply the RX slot number channel
+ *           0~num-1 uses
+ *
+ * configure the relationship between channel number and TDM slot number.
+ */
+int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai,
+	unsigned int tx_num, unsigned int *tx_slot,
+	unsigned int rx_num, unsigned int *rx_slot)
+{
+	if (dai->ops && dai->ops->set_tdm_slot)
+		return dai->ops->set_channel_map(dai, tx_num, tx_slot,
+			rx_num, rx_slot);
+	else
+		return -EINVAL;
+}
+EXPORT_SYMBOL_GPL(snd_soc_dai_set_channel_map);
+
+/**
  * snd_soc_dai_set_tristate - configure DAI system or master clock.
  * @dai: DAI
  * @tristate: tristate enable
-- 
1.5.6.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] add channel order map interface in asoc core
  2009-09-11 17:16 [PATCH v2] add channel order map interface in asoc core Barry Song
@ 2009-09-12 12:49 ` Mark Brown
  2009-09-12 12:55   ` Barry Song
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2009-09-12 12:49 UTC (permalink / raw)
  To: Barry Song; +Cc: uclinux-dist-devel, alsa-devel, lrg

On Sat, Sep 12, 2009 at 01:16:29AM +0800, Barry Song wrote:
> The patch adds an interface to set the relationship between audio
> channel number and slot number. The interface should be really useful
> because audio channel n doesn't always use slot n in all platforms. And
> for some devices, the relationship even can change with sound mode
> switch in 2.1,3.1,4.1,5.1,6.1,7.1 etc.

> Signed-off-by: Barry Song <21cnbao@gmail.com>

Applied, thanks.  I'll probably add another patch shortly clarifying the
documentation a little.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] add channel order map interface in asoc core
  2009-09-12 12:49 ` Mark Brown
@ 2009-09-12 12:55   ` Barry Song
  2009-09-13 11:37     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Barry Song @ 2009-09-12 12:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: uclinux-dist-devel, alsa-devel, lrg

On Sat, Sep 12, 2009 at 8:49 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Sat, Sep 12, 2009 at 01:16:29AM +0800, Barry Song wrote:
>> The patch adds an interface to set the relationship between audio
>> channel number and slot number. The interface should be really useful
>> because audio channel n doesn't always use slot n in all platforms. And
>> for some devices, the relationship even can change with sound mode
>> switch in 2.1,3.1,4.1,5.1,6.1,7.1 etc.
>
>> Signed-off-by: Barry Song <21cnbao@gmail.com>
>
> Applied, thanks.  I'll probably add another patch shortly clarifying the
> documentation a little.
>
I am just sending v3 patch to fix a typo existing in v1/v2 version
patch before you apply it:
+       if (dai->ops && dai->ops->set_tdm_slot)
should be:
 if (dai->ops && dai->ops->set_channel_map)
I am really sorry for that.
+               return dai->ops->set_channel_map(dai, tx_num, tx_slot,
+                       rx_num, rx_slot);
+       else
+               return -EINVAL;

-Barry
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] add channel order map interface in asoc core
  2009-09-12 12:55   ` Barry Song
@ 2009-09-13 11:37     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2009-09-13 11:37 UTC (permalink / raw)
  To: Barry Song; +Cc: uclinux-dist-devel, alsa-devel, lrg

On Sat, Sep 12, 2009 at 08:55:03PM +0800, Barry Song wrote:

> I am just sending v3 patch to fix a typo existing in v1/v2 version
> patch before you apply it:

That's OK, I've fixed up the current version locally.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-09-13 11:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-11 17:16 [PATCH v2] add channel order map interface in asoc core Barry Song
2009-09-12 12:49 ` Mark Brown
2009-09-12 12:55   ` Barry Song
2009-09-13 11:37     ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.