All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: core: Allow DAIs to specify a base address
@ 2012-05-01 19:04 Mark Brown
  2012-05-01 19:04 ` [PATCH 2/2] ASoC: wm5100: Set the DAI base address in the DAI drivers Mark Brown
  2012-05-02 14:06 ` [PATCH 1/2] ASoC: core: Allow DAIs to specify a base address Liam Girdwood
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Brown @ 2012-05-01 19:04 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

Devices with many DAIs are becoming more and more common, and generally
the more modern devices have consistent register layouts between DAIs.
Rather than have drivers open code lookups based on the DAI ID or cause
uglification in UI by having register addresses for IDs provide a base
address field they can use.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 include/sound/soc-dai.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index c63985b..2704ab0 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -198,6 +198,7 @@ struct snd_soc_dai_driver {
 	const char *name;
 	unsigned int id;
 	int ac97_control;
+	unsigned int base;
 
 	/* DAI driver callbacks */
 	int (*probe)(struct snd_soc_dai *dai);
-- 
1.7.10

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

* [PATCH 2/2] ASoC: wm5100: Set the DAI base address in the DAI drivers
  2012-05-01 19:04 [PATCH 1/2] ASoC: core: Allow DAIs to specify a base address Mark Brown
@ 2012-05-01 19:04 ` Mark Brown
  2012-05-02 14:06 ` [PATCH 1/2] ASoC: core: Allow DAIs to specify a base address Liam Girdwood
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2012-05-01 19:04 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/codecs/wm5100.c |   26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)

diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
index 7fbcd6d..1f13ccd 100644
--- a/sound/soc/codecs/wm5100.c
+++ b/sound/soc/codecs/wm5100.c
@@ -1342,29 +1342,12 @@ static const __devinitdata struct reg_default wm5100_reva_patches[] = {
 	{ WM5100_AUDIO_IF_3_19, 1 },
 };
 
-static int wm5100_dai_to_base(struct snd_soc_dai *dai)
-{
-	switch (dai->id) {
-	case 0:
-		return WM5100_AUDIO_IF_1_1 - 1;
-	case 1:
-		return WM5100_AUDIO_IF_2_1 - 1;
-	case 2:
-		return WM5100_AUDIO_IF_3_1 - 1;
-	default:
-		BUG();
-		return -EINVAL;
-	}
-}
-
 static int wm5100_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 {
 	struct snd_soc_codec *codec = dai->codec;
 	int lrclk, bclk, mask, base;
 
-	base = wm5100_dai_to_base(dai);
-	if (base < 0)
-		return base;
+	base = dai->driver->base;
 
 	lrclk = 0;
 	bclk = 0;
@@ -1491,9 +1474,7 @@ static int wm5100_hw_params(struct snd_pcm_substream *substream,
 	int i, base, bclk, aif_rate, lrclk, wl, fl, sr;
 	int *bclk_rates;
 
-	base = wm5100_dai_to_base(dai);
-	if (base < 0)
-		return base;
+	base = dai->driver->base;
 
 	/* Data sizes if not using TDM */
 	wl = snd_pcm_format_width(params_format(params));
@@ -1974,6 +1955,7 @@ static int wm5100_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
 static struct snd_soc_dai_driver wm5100_dai[] = {
 	{
 		.name = "wm5100-aif1",
+		.base = WM5100_AUDIO_IF_1_1 - 1,
 		.playback = {
 			.stream_name = "AIF1 Playback",
 			.channels_min = 2,
@@ -1993,6 +1975,7 @@ static struct snd_soc_dai_driver wm5100_dai[] = {
 	{
 		.name = "wm5100-aif2",
 		.id = 1,
+		.base = WM5100_AUDIO_IF_2_1 - 1,
 		.playback = {
 			.stream_name = "AIF2 Playback",
 			.channels_min = 2,
@@ -2012,6 +1995,7 @@ static struct snd_soc_dai_driver wm5100_dai[] = {
 	{
 		.name = "wm5100-aif3",
 		.id = 2,
+		.base = WM5100_AUDIO_IF_3_1 - 1,
 		.playback = {
 			.stream_name = "AIF3 Playback",
 			.channels_min = 2,
-- 
1.7.10

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

* Re: [PATCH 1/2] ASoC: core: Allow DAIs to specify a base address
  2012-05-01 19:04 [PATCH 1/2] ASoC: core: Allow DAIs to specify a base address Mark Brown
  2012-05-01 19:04 ` [PATCH 2/2] ASoC: wm5100: Set the DAI base address in the DAI drivers Mark Brown
@ 2012-05-02 14:06 ` Liam Girdwood
  1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2012-05-02 14:06 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, patches

On Tue, 2012-05-01 at 20:04 +0100, Mark Brown wrote:
> Devices with many DAIs are becoming more and more common, and generally
> the more modern devices have consistent register layouts between DAIs.
> Rather than have drivers open code lookups based on the DAI ID or cause
> uglification in UI by having register addresses for IDs provide a base
> address field they can use.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Both

Acked-by: Liam Girdwood <lrg@ti.com>

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

end of thread, other threads:[~2012-05-02 14:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-01 19:04 [PATCH 1/2] ASoC: core: Allow DAIs to specify a base address Mark Brown
2012-05-01 19:04 ` [PATCH 2/2] ASoC: wm5100: Set the DAI base address in the DAI drivers Mark Brown
2012-05-02 14:06 ` [PATCH 1/2] ASoC: core: Allow DAIs to specify a base address Liam Girdwood

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.