All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, liam.r.girdwood@linux.intel.com, vkoul@kernel.org,
	broonie@kernel.org,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: [PATCH 01/15] ASoC: add helper to change platform name for all dailinks
Date: Fri, 25 Jan 2019 14:34:55 -0600	[thread overview]
Message-ID: <20190125203509.22994-2-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20190125203509.22994-1-pierre-louis.bossart@linux.intel.com>

To reuse the same machine drivers with Atom/SST, Skylake and SOF, we
need to change the default platform_name (or platforms->name in the
"modern" representation).

So far, this override was done with an automatic override, which was
broken by a set of changes for DT platforms related to deferred probe
handling.

This automatic override is actually not really needed, the machine
driver can already receive the platform name as a platform_data
parameter. This is used e.g. for HDaudio support where we have
different PCI aliases used for different platforms. We can reuse the
same mechanism and modify the machine drivers to override the dailinks
prior to registrating the card.

This will require additional work for SOF, but with this helper it'll
be just two lines of additional code per machine driver which is
reused, not the end of the world.

This helper can be simplified when all drivers have transitioned to
the "modern" representation of dailinks.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 include/sound/soc.h | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 3089257ead95..95689680336b 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1580,6 +1580,37 @@ struct snd_soc_dai *snd_soc_card_get_codec_dai(struct snd_soc_card *card,
 	return NULL;
 }
 
+static inline
+int snd_soc_fixup_dai_links_platform_name(struct snd_soc_card *card,
+					  const char *platform_name)
+{
+	struct snd_soc_dai_link *dai_link;
+	const char *name;
+	int i;
+
+	if (!platform_name) /* nothing to do */
+		return 0;
+
+	/* set platform name for each dailink */
+	for_each_card_prelinks(card, i, dai_link) {
+		name = devm_kstrdup(card->dev, platform_name, GFP_KERNEL);
+		if (!name)
+			return -ENOMEM;
+
+		if (dai_link->platforms)
+			/* only single platform is supported for now */
+			dai_link->platforms->name = name;
+		else
+			/*
+			 * legacy mode, this case will be removed when all
+			 * derivers are switched to modern style dai_link.
+			 */
+			dai_link->platform_name = name;
+	}
+
+	return 0;
+}
+
 #ifdef CONFIG_DEBUG_FS
 extern struct dentry *snd_soc_debugfs_root;
 #endif
-- 
2.17.1

  reply	other threads:[~2019-01-25 20:35 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 20:34 [PATCH 00/15] ASoC: Intel: pass platform name to machine drivers Pierre-Louis Bossart
2019-01-25 20:34 ` Pierre-Louis Bossart [this message]
2019-01-26 17:47   ` [PATCH 01/15] ASoC: add helper to change platform name for all dailinks Takashi Iwai
2019-01-28 12:19     ` Mark Brown
2019-01-28 15:57       ` Pierre-Louis Bossart
2019-01-28 18:25   ` Applied "ASoC: add helper to change platform name for all dailinks" to the asoc tree Mark Brown
2019-01-25 20:34 ` [PATCH 02/15] ASoC: Intel: haswell: platform name fixup support Pierre-Louis Bossart
2019-01-28 18:25   ` Applied "ASoC: Intel: haswell: platform name fixup support" to the asoc tree Mark Brown
2019-01-25 20:34 ` [PATCH 03/15] ASoC: Intel: broadwell: platform name fixup support Pierre-Louis Bossart
2019-01-28 18:25   ` Applied "ASoC: Intel: broadwell: platform name fixup support" to the asoc tree Mark Brown
2019-01-25 20:34 ` [PATCH 04/15] ASoC: Intel: bdw-rt5677: platform name fixup support Pierre-Louis Bossart
2019-01-28 18:25   ` Applied "ASoC: Intel: bdw-rt5677: platform name fixup support" to the asoc tree Mark Brown
2019-01-25 20:34 ` [PATCH 05/15] ASoC: Intel: bytcr_rt5640: platform name fixup support Pierre-Louis Bossart
2019-01-28 18:25   ` Applied "ASoC: Intel: bytcr_rt5640: platform name fixup support" to the asoc tree Mark Brown
2019-01-25 20:35 ` [PATCH 06/15] ASoC: Intel: bytcr_rt5651: platform name fixup support Pierre-Louis Bossart
2019-01-25 20:35 ` [PATCH 07/15] ASoC: Intel: bytcht_da7213: " Pierre-Louis Bossart
2019-01-28 18:25   ` Applied "ASoC: Intel: bytcht_da7213: platform name fixup support" to the asoc tree Mark Brown
2019-01-25 20:35 ` [PATCH 08/15] ASoC: Intel: bytcht_es8316: platform name fixup support Pierre-Louis Bossart
2019-01-28 18:25   ` Applied "ASoC: Intel: bytcht_es8316: platform name fixup support" to the asoc tree Mark Brown
2019-01-25 20:35 ` [PATCH 09/15] ASoC: Intel: cht_bsw_max98090_ti: platform name fixup support Pierre-Louis Bossart
2019-01-28 18:25   ` Applied "ASoC: Intel: cht_bsw_max98090_ti: platform name fixup support" to the asoc tree Mark Brown
2019-01-25 20:35 ` [PATCH 10/15] ASoC: Intel: cht_bsw_nau8824: platform name fixup support Pierre-Louis Bossart
2019-01-28 18:25   ` Applied "ASoC: Intel: cht_bsw_nau8824: platform name fixup support" to the asoc tree Mark Brown
2019-01-25 20:35 ` [PATCH 11/15] ASoC: Intel: cht_bsw_rt5645: platform name fixup support Pierre-Louis Bossart
2019-01-28 18:25   ` Applied "ASoC: Intel: cht_bsw_rt5645: platform name fixup support" to the asoc tree Mark Brown
2019-01-25 20:35 ` [PATCH 12/15] ASoC: Intel: cht_bsw_rt5672: platform name fixup support Pierre-Louis Bossart
2019-01-28 18:25   ` Applied "ASoC: Intel: cht_bsw_rt5672: platform name fixup support" to the asoc tree Mark Brown
2019-01-25 20:35 ` [PATCH 13/15] ASoC: Intel: bxt_da7219_max98357a: platform name fixup support Pierre-Louis Bossart
2019-01-28 18:25   ` Applied "ASoC: Intel: bxt_da7219_max98357a: platform name fixup support" to the asoc tree Mark Brown
2019-01-25 20:35 ` [PATCH 14/15] ASoC: Intel: bxt_rt298: platform name fixup support Pierre-Louis Bossart
2019-01-28 18:25   ` Applied "ASoC: Intel: bxt_rt298: platform name fixup support" to the asoc tree Mark Brown
2019-01-25 20:35 ` [PATCH 15/15] ASoC: Intel: glk_rt5682_max98357a: platform name fixup support Pierre-Louis Bossart
2019-01-28 18:25   ` Applied "ASoC: Intel: glk_rt5682_max98357a: platform name fixup support" to the asoc tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190125203509.22994-2-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=tiwai@suse.de \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.