* [PATCH 0/4] More componentization preparation
@ 2014-07-17 20:01 Lars-Peter Clausen
2014-07-17 20:01 ` [PATCH 1/4] ASoC: Remove per card platform list Lars-Peter Clausen
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Lars-Peter Clausen @ 2014-07-17 20:01 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, Lars-Peter Clausen, Stephen Warren
Now that the multi-CODEC patches have been merged we can continue with the
componentization. Since it is already rather late in the development cycle again
this series only has a small set of cleanup and preparation patches so we have
that out of the way. The first patch removes the unused snd_soc_card
platform_list, the other three patches move the card field from the
snd_soc_platform and snd_soc_codec struct and consolidates the registration of
controls on top of that.
Series depends on topic/multi
- Lars
Lars-Peter Clausen (4):
ASoC: Remove per card platform list
ASoC: tegra: Replace instances of rtd->codec->card with rtd->card
ASoC: Move card field form platform/codec to component
ASoC: Add function to register component controls
include/sound/soc.h | 12 ++++------
sound/soc/codecs/ac97.c | 4 ++--
sound/soc/codecs/cx20442.c | 6 ++---
sound/soc/codecs/uda134x.c | 2 +-
sound/soc/codecs/wm8960.c | 2 +-
sound/soc/codecs/wm_adsp.c | 4 ++--
sound/soc/omap/ams-delta.c | 2 +-
sound/soc/soc-core.c | 52 +++++++++++++++++++++++++---------------
sound/soc/soc-dapm.c | 2 +-
sound/soc/soc-jack.c | 4 ++--
sound/soc/tegra/tegra_alc5632.c | 5 ++--
sound/soc/tegra/tegra_max98090.c | 5 ++--
sound/soc/tegra/tegra_rt5640.c | 5 ++--
sound/soc/tegra/tegra_wm8753.c | 3 +--
sound/soc/tegra/tegra_wm8903.c | 5 ++--
sound/soc/tegra/trimslice.c | 3 +--
16 files changed, 61 insertions(+), 55 deletions(-)
--
1.8.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] ASoC: Remove per card platform list
2014-07-17 20:01 [PATCH 0/4] More componentization preparation Lars-Peter Clausen
@ 2014-07-17 20:01 ` Lars-Peter Clausen
2014-07-17 20:01 ` [PATCH 2/4] ASoC: tegra: Replace instances of rtd->codec->card with rtd->card Lars-Peter Clausen
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Lars-Peter Clausen @ 2014-07-17 20:01 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, Lars-Peter Clausen, Stephen Warren
The platform_dev_list was added in commit f0fba2ad1b ("ASoC: multi-component -
ASoC Multi-Component Support") and while platforms are added and remove from
that list it is otherwise unused. This patch removes it again.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
include/sound/soc.h | 3 ---
sound/soc/soc-core.c | 2 --
2 files changed, 5 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 96a5ff2..6a8d577 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -876,7 +876,6 @@ struct snd_soc_platform {
struct snd_soc_card *card;
struct list_head list;
- struct list_head card_list;
struct snd_soc_component component;
@@ -1067,7 +1066,6 @@ struct snd_soc_card {
/* lists of probed devices belonging to this card */
struct list_head codec_dev_list;
- struct list_head platform_dev_list;
struct list_head widgets;
struct list_head paths;
@@ -1313,7 +1311,6 @@ static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
{
INIT_LIST_HEAD(&card->codec_dev_list);
- INIT_LIST_HEAD(&card->platform_dev_list);
INIT_LIST_HEAD(&card->widgets);
INIT_LIST_HEAD(&card->paths);
INIT_LIST_HEAD(&card->dapm_list);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 9e4a23e..2cb2edd 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1027,7 +1027,6 @@ static int soc_remove_platform(struct snd_soc_platform *platform)
soc_cleanup_platform_debugfs(platform);
platform->probed = 0;
- list_del(&platform->card_list);
module_put(platform->dev->driver->owner);
return 0;
@@ -1297,7 +1296,6 @@ static int soc_probe_platform(struct snd_soc_card *card,
/* mark platform as probed and add to card platform list */
platform->probed = 1;
- list_add(&platform->card_list, &card->platform_dev_list);
list_add(&platform->component.dapm.list, &card->dapm_list);
return 0;
--
1.8.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] ASoC: tegra: Replace instances of rtd->codec->card with rtd->card
2014-07-17 20:01 [PATCH 0/4] More componentization preparation Lars-Peter Clausen
2014-07-17 20:01 ` [PATCH 1/4] ASoC: Remove per card platform list Lars-Peter Clausen
@ 2014-07-17 20:01 ` Lars-Peter Clausen
2014-07-21 20:23 ` Stephen Warren
2014-07-17 20:01 ` [PATCH 3/4] ASoC: Move card field form platform/codec to component Lars-Peter Clausen
` (2 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Lars-Peter Clausen @ 2014-07-17 20:01 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, Lars-Peter Clausen, Stephen Warren
No need to go via the CODEC to get a pointer to the card. This will help to
eventually remove the card field from the snd_soc_codec struct.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
sound/soc/tegra/tegra_alc5632.c | 5 ++---
sound/soc/tegra/tegra_max98090.c | 5 ++---
sound/soc/tegra/tegra_rt5640.c | 5 ++---
sound/soc/tegra/tegra_wm8753.c | 3 +--
sound/soc/tegra/tegra_wm8903.c | 5 ++---
sound/soc/tegra/trimslice.c | 3 +--
6 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/sound/soc/tegra/tegra_alc5632.c b/sound/soc/tegra/tegra_alc5632.c
index 02734bd..a83aff0 100644
--- a/sound/soc/tegra/tegra_alc5632.c
+++ b/sound/soc/tegra/tegra_alc5632.c
@@ -41,8 +41,7 @@ static int tegra_alc5632_asoc_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_codec *codec = codec_dai->codec;
- struct snd_soc_card *card = codec->card;
+ struct snd_soc_card *card = rtd->card;
struct tegra_alc5632 *alc5632 = snd_soc_card_get_drvdata(card);
int srate, mclk;
int err;
@@ -105,7 +104,7 @@ static int tegra_alc5632_asoc_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_codec *codec = codec_dai->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
- struct tegra_alc5632 *machine = snd_soc_card_get_drvdata(codec->card);
+ struct tegra_alc5632 *machine = snd_soc_card_get_drvdata(rtd->card);
snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET,
&tegra_alc5632_hs_jack);
diff --git a/sound/soc/tegra/tegra_max98090.c b/sound/soc/tegra/tegra_max98090.c
index ce73e1f..b86cd99 100644
--- a/sound/soc/tegra/tegra_max98090.c
+++ b/sound/soc/tegra/tegra_max98090.c
@@ -49,8 +49,7 @@ static int tegra_max98090_asoc_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_codec *codec = codec_dai->codec;
- struct snd_soc_card *card = codec->card;
+ struct snd_soc_card *card = rtd->card;
struct tegra_max98090 *machine = snd_soc_card_get_drvdata(card);
int srate, mclk;
int err;
@@ -127,7 +126,7 @@ static int tegra_max98090_asoc_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_codec *codec = codec_dai->codec;
- struct tegra_max98090 *machine = snd_soc_card_get_drvdata(codec->card);
+ struct tegra_max98090 *machine = snd_soc_card_get_drvdata(rtd->card);
if (gpio_is_valid(machine->gpio_hp_det)) {
snd_soc_jack_new(codec, "Headphones", SND_JACK_HEADPHONE,
diff --git a/sound/soc/tegra/tegra_rt5640.c b/sound/soc/tegra/tegra_rt5640.c
index 4feb16a..a689883 100644
--- a/sound/soc/tegra/tegra_rt5640.c
+++ b/sound/soc/tegra/tegra_rt5640.c
@@ -51,8 +51,7 @@ static int tegra_rt5640_asoc_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_codec *codec = codec_dai->codec;
- struct snd_soc_card *card = codec->card;
+ struct snd_soc_card *card = rtd->card;
struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(card);
int srate, mclk;
int err;
@@ -110,7 +109,7 @@ static int tegra_rt5640_asoc_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_codec *codec = codec_dai->codec;
- struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(codec->card);
+ struct tegra_rt5640 *machine = snd_soc_card_get_drvdata(rtd->card);
snd_soc_jack_new(codec, "Headphones", SND_JACK_HEADPHONE,
&tegra_rt5640_hp_jack);
diff --git a/sound/soc/tegra/tegra_wm8753.c b/sound/soc/tegra/tegra_wm8753.c
index 8e774d1..769e28f 100644
--- a/sound/soc/tegra/tegra_wm8753.c
+++ b/sound/soc/tegra/tegra_wm8753.c
@@ -55,8 +55,7 @@ static int tegra_wm8753_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_codec *codec = codec_dai->codec;
- struct snd_soc_card *card = codec->card;
+ struct snd_soc_card *card = rtd->card;
struct tegra_wm8753 *machine = snd_soc_card_get_drvdata(card);
int srate, mclk;
int err;
diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c
index 0939661..86e05e9 100644
--- a/sound/soc/tegra/tegra_wm8903.c
+++ b/sound/soc/tegra/tegra_wm8903.c
@@ -60,8 +60,7 @@ static int tegra_wm8903_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_codec *codec = codec_dai->codec;
- struct snd_soc_card *card = codec->card;
+ struct snd_soc_card *card = rtd->card;
struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
int srate, mclk;
int err;
@@ -173,7 +172,7 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_codec *codec = codec_dai->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
- struct snd_soc_card *card = codec->card;
+ struct snd_soc_card *card = rtd->card;
struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
if (gpio_is_valid(machine->gpio_hp_det)) {
diff --git a/sound/soc/tegra/trimslice.c b/sound/soc/tegra/trimslice.c
index 734bfcd..589d2d9 100644
--- a/sound/soc/tegra/trimslice.c
+++ b/sound/soc/tegra/trimslice.c
@@ -50,8 +50,7 @@ static int trimslice_asoc_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_codec *codec = codec_dai->codec;
- struct snd_soc_card *card = codec->card;
+ struct snd_soc_card *card = rtd->card;
struct tegra_trimslice *trimslice = snd_soc_card_get_drvdata(card);
int srate, mclk;
int err;
--
1.8.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] ASoC: Move card field form platform/codec to component
2014-07-17 20:01 [PATCH 0/4] More componentization preparation Lars-Peter Clausen
2014-07-17 20:01 ` [PATCH 1/4] ASoC: Remove per card platform list Lars-Peter Clausen
2014-07-17 20:01 ` [PATCH 2/4] ASoC: tegra: Replace instances of rtd->codec->card with rtd->card Lars-Peter Clausen
@ 2014-07-17 20:01 ` Lars-Peter Clausen
2014-07-17 20:01 ` [PATCH 4/4] ASoC: Add function to register component controls Lars-Peter Clausen
2014-07-22 22:14 ` [PATCH 0/4] More componentization preparation Mark Brown
4 siblings, 0 replies; 7+ messages in thread
From: Lars-Peter Clausen @ 2014-07-17 20:01 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, Lars-Peter Clausen, Stephen Warren
Both the snd_soc_codec and snd_soc_platform struct do have a pointer to the
parent card and both handle this pointer in mostly the same way. This patch
moves the card field to the component level which will allow further code
consolidation between platforms and CODECS.
Since there are only a handful of users of the snd_soc_codec struct's card field
(and none of the snd_soc_platform's) these are update in this patch as well,
which allows it to be removed from the snd_soc_codec struct.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
include/sound/soc.h | 3 +--
sound/soc/codecs/ac97.c | 4 ++--
sound/soc/codecs/cx20442.c | 6 +++---
sound/soc/codecs/uda134x.c | 2 +-
sound/soc/codecs/wm8960.c | 2 +-
sound/soc/codecs/wm_adsp.c | 4 ++--
sound/soc/omap/ams-delta.c | 2 +-
sound/soc/soc-core.c | 19 ++++++++++---------
sound/soc/soc-dapm.c | 2 +-
sound/soc/soc-jack.c | 4 ++--
10 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 6a8d577..248db66 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -702,6 +702,7 @@ struct snd_soc_component {
int id;
const char *name_prefix;
struct device *dev;
+ struct snd_soc_card *card;
unsigned int active;
@@ -736,7 +737,6 @@ struct snd_soc_codec {
const struct snd_soc_codec_driver *driver;
struct mutex mutex;
- struct snd_soc_card *card;
struct list_head list;
struct list_head card_list;
@@ -874,7 +874,6 @@ struct snd_soc_platform {
unsigned int suspended:1; /* platform is suspended */
unsigned int probed:1;
- struct snd_soc_card *card;
struct list_head list;
struct snd_soc_component component;
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c
index 8d9ba4ba..e889e1b 100644
--- a/sound/soc/codecs/ac97.c
+++ b/sound/soc/codecs/ac97.c
@@ -89,8 +89,8 @@ static int ac97_soc_probe(struct snd_soc_codec *codec)
int ret;
/* add codec as bus device for standard ac97 */
- ret = snd_ac97_bus(codec->card->snd_card, 0, soc_ac97_ops, NULL,
- &ac97_bus);
+ ret = snd_ac97_bus(codec->component.card->snd_card, 0, soc_ac97_ops,
+ NULL, &ac97_bus);
if (ret < 0)
return ret;
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c
index d5fd00a..4ba60eb 100644
--- a/sound/soc/codecs/cx20442.c
+++ b/sound/soc/codecs/cx20442.c
@@ -253,7 +253,7 @@ static void v253_close(struct tty_struct *tty)
/* Prevent the codec driver from further accessing the modem */
codec->hw_write = NULL;
cx20442->control_data = NULL;
- codec->card->pop_time = 0;
+ codec->component.card->pop_time = 0;
}
/* Line discipline .hangup() */
@@ -281,7 +281,7 @@ static void v253_receive(struct tty_struct *tty,
/* Set up codec driver access to modem controls */
cx20442->control_data = tty;
codec->hw_write = (hw_write_t)tty->ops->write;
- codec->card->pop_time = 1;
+ codec->component.card->pop_time = 1;
}
}
@@ -372,7 +372,7 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec)
snd_soc_codec_set_drvdata(codec, cx20442);
codec->hw_write = NULL;
- codec->card->pop_time = 0;
+ codec->component.card->pop_time = 0;
return 0;
}
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c
index edf27ac..12fc0ae 100644
--- a/sound/soc/codecs/uda134x.c
+++ b/sound/soc/codecs/uda134x.c
@@ -479,7 +479,7 @@ static struct snd_soc_dai_driver uda134x_dai = {
static int uda134x_soc_probe(struct snd_soc_codec *codec)
{
struct uda134x_priv *uda134x;
- struct uda134x_platform_data *pd = codec->card->dev->platform_data;
+ struct uda134x_platform_data *pd = codec->component.card->dev->platform_data;
const struct snd_soc_dapm_widget *widgets;
unsigned num_widgets;
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index a145d04..e96349b 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -472,7 +472,7 @@ static int wm8960_add_widgets(struct snd_soc_codec *codec)
* list each time to find the desired power state do so now
* and save the result.
*/
- list_for_each_entry(w, &codec->card->widgets, list) {
+ list_for_each_entry(w, &codec->component.card->widgets, list) {
if (w->dapm != &codec->dapm)
continue;
if (strcmp(w->name, "LOUT1 PGA") == 0)
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 2537725..f412a99 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -1382,7 +1382,7 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w,
int ret;
int val;
- dsp->card = codec->card;
+ dsp->card = codec->component.card;
switch (event) {
case SND_SOC_DAPM_POST_PMU:
@@ -1617,7 +1617,7 @@ int wm_adsp2_early_event(struct snd_soc_dapm_widget *w,
struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec);
struct wm_adsp *dsp = &dsps[w->shift];
- dsp->card = codec->card;
+ dsp->card = codec->component.card;
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index 0cc41f9..8c9cc64 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -301,7 +301,7 @@ static int cx81801_open(struct tty_struct *tty)
static void cx81801_close(struct tty_struct *tty)
{
struct snd_soc_codec *codec = tty->disc_data;
- struct snd_soc_dapm_context *dapm = &codec->card->dapm;
+ struct snd_soc_dapm_context *dapm = &codec->component.card->dapm;
del_timer_sync(&cx81801_timer);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 2cb2edd..6337603 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -292,7 +292,7 @@ static struct dentry *soc_debugfs_create_dir(struct dentry *parent,
static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
{
- struct dentry *debugfs_card_root = codec->card->debugfs_card_root;
+ struct dentry *debugfs_card_root = codec->component.card->debugfs_card_root;
codec->debugfs_codec_root = soc_debugfs_create_dir(debugfs_card_root,
"codec:%s",
@@ -325,7 +325,7 @@ static void soc_cleanup_codec_debugfs(struct snd_soc_codec *codec)
static void soc_init_platform_debugfs(struct snd_soc_platform *platform)
{
- struct dentry *debugfs_card_root = platform->card->debugfs_card_root;
+ struct dentry *debugfs_card_root = platform->component.card->debugfs_card_root;
platform->debugfs_platform_root = soc_debugfs_create_dir(debugfs_card_root,
"platform:%s",
@@ -546,11 +546,12 @@ static int soc_ac97_dev_register(struct snd_soc_codec *codec)
int err;
codec->ac97->dev.bus = &ac97_bus_type;
- codec->ac97->dev.parent = codec->card->dev;
+ codec->ac97->dev.parent = codec->component.card->dev;
codec->ac97->dev.release = soc_ac97_device_release;
dev_set_name(&codec->ac97->dev, "%d-%d:%s",
- codec->card->snd_card->number, 0, codec->component.name);
+ codec->component.card->snd_card->number, 0,
+ codec->component.name);
err = device_register(&codec->ac97->dev);
if (err < 0) {
dev_err(codec->dev, "ASoC: Can't register ac97 bus\n");
@@ -1179,7 +1180,7 @@ static int soc_probe_codec(struct snd_soc_card *card,
const struct snd_soc_codec_driver *driver = codec->driver;
struct snd_soc_dai *dai;
- codec->card = card;
+ codec->component.card = card;
codec->dapm.card = card;
soc_set_name_prefix(card, &codec->component);
@@ -1255,7 +1256,7 @@ static int soc_probe_platform(struct snd_soc_card *card,
struct snd_soc_component *component;
struct snd_soc_dai *dai;
- platform->card = card;
+ platform->component.card = card;
platform->component.dapm.card = card;
if (!try_module_get(platform->dev->driver->owner))
@@ -2406,7 +2407,7 @@ EXPORT_SYMBOL_GPL(snd_soc_card_get_kcontrol);
int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
const struct snd_kcontrol_new *controls, int num_controls)
{
- struct snd_card *card = codec->card->snd_card;
+ struct snd_card *card = codec->component.card->snd_card;
return snd_soc_add_controls(card, codec->dev, controls, num_controls,
codec->component.name_prefix, &codec->component);
@@ -2426,7 +2427,7 @@ EXPORT_SYMBOL_GPL(snd_soc_add_codec_controls);
int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
const struct snd_kcontrol_new *controls, int num_controls)
{
- struct snd_card *card = platform->card->snd_card;
+ struct snd_card *card = platform->component.card->snd_card;
return snd_soc_add_controls(card, platform->dev, controls, num_controls,
NULL, &platform->component);
@@ -3101,7 +3102,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_range);
int snd_soc_limit_volume(struct snd_soc_codec *codec,
const char *name, int max)
{
- struct snd_card *card = codec->card->snd_card;
+ struct snd_card *card = codec->component.card->snd_card;
struct snd_kcontrol *kctl;
struct soc_mixer_control *mc;
int found = 0;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 8cb68a38..8348352 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2090,7 +2090,7 @@ static ssize_t dapm_widget_show_codec(struct snd_soc_codec *codec, char *buf)
int count = 0;
char *state = "not set";
- list_for_each_entry(w, &codec->card->widgets, list) {
+ list_for_each_entry(w, &codec->component.card->widgets, list) {
if (w->dapm != &codec->dapm)
continue;
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index d0d9881..ab47fea 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -43,7 +43,7 @@ int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type,
INIT_LIST_HEAD(&jack->jack_zones);
BLOCKING_INIT_NOTIFIER_HEAD(&jack->notifier);
- return snd_jack_new(codec->card->snd_card, id, type, &jack->jack);
+ return snd_jack_new(codec->component.card->snd_card, id, type, &jack->jack);
}
EXPORT_SYMBOL_GPL(snd_soc_jack_new);
@@ -260,7 +260,7 @@ static void snd_soc_jack_gpio_detect(struct snd_soc_jack_gpio *gpio)
static irqreturn_t gpio_handler(int irq, void *data)
{
struct snd_soc_jack_gpio *gpio = data;
- struct device *dev = gpio->jack->codec->card->dev;
+ struct device *dev = gpio->jack->codec->component.card->dev;
trace_snd_soc_jack_irq(gpio->name);
--
1.8.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] ASoC: Add function to register component controls
2014-07-17 20:01 [PATCH 0/4] More componentization preparation Lars-Peter Clausen
` (2 preceding siblings ...)
2014-07-17 20:01 ` [PATCH 3/4] ASoC: Move card field form platform/codec to component Lars-Peter Clausen
@ 2014-07-17 20:01 ` Lars-Peter Clausen
2014-07-22 22:14 ` [PATCH 0/4] More componentization preparation Mark Brown
4 siblings, 0 replies; 7+ messages in thread
From: Lars-Peter Clausen @ 2014-07-17 20:01 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, Lars-Peter Clausen, Stephen Warren
We have now everything in place to actual let a component register controls. Add
a function which allows to do so.
Also update snd_soc_add_codec_controls() and snd_soc_platform_controls() to use
this new function internally. And while we are at it also change the
num_controls parameter of those two functions from int to unsigned int.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
include/sound/soc.h | 6 ++++--
sound/soc/soc-core.c | 35 +++++++++++++++++++++++++----------
2 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 248db66..be6ecae 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -516,10 +516,12 @@ struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
const char *prefix);
struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
const char *name);
+int snd_soc_add_component_controls(struct snd_soc_component *component,
+ const struct snd_kcontrol_new *controls, unsigned int num_controls);
int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
- const struct snd_kcontrol_new *controls, int num_controls);
+ const struct snd_kcontrol_new *controls, unsigned int num_controls);
int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
- const struct snd_kcontrol_new *controls, int num_controls);
+ const struct snd_kcontrol_new *controls, unsigned int num_controls);
int snd_soc_add_card_controls(struct snd_soc_card *soc_card,
const struct snd_kcontrol_new *controls, int num_controls);
int snd_soc_add_dai_controls(struct snd_soc_dai *dai,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 6337603..d4bfd4a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2394,6 +2394,25 @@ struct snd_kcontrol *snd_soc_card_get_kcontrol(struct snd_soc_card *soc_card,
EXPORT_SYMBOL_GPL(snd_soc_card_get_kcontrol);
/**
+ * snd_soc_add_component_controls - Add an array of controls to a component.
+ *
+ * @component: Component to add controls to
+ * @controls: Array of controls to add
+ * @num_controls: Number of elements in the array
+ *
+ * Return: 0 for success, else error.
+ */
+int snd_soc_add_component_controls(struct snd_soc_component *component,
+ const struct snd_kcontrol_new *controls, unsigned int num_controls)
+{
+ struct snd_card *card = component->card->snd_card;
+
+ return snd_soc_add_controls(card, component->dev, controls,
+ num_controls, component->name_prefix, component);
+}
+EXPORT_SYMBOL_GPL(snd_soc_add_component_controls);
+
+/**
* snd_soc_add_codec_controls - add an array of controls to a codec.
* Convenience function to add a list of controls. Many codecs were
* duplicating this code.
@@ -2405,12 +2424,10 @@ EXPORT_SYMBOL_GPL(snd_soc_card_get_kcontrol);
* Return 0 for success, else error.
*/
int snd_soc_add_codec_controls(struct snd_soc_codec *codec,
- const struct snd_kcontrol_new *controls, int num_controls)
+ const struct snd_kcontrol_new *controls, unsigned int num_controls)
{
- struct snd_card *card = codec->component.card->snd_card;
-
- return snd_soc_add_controls(card, codec->dev, controls, num_controls,
- codec->component.name_prefix, &codec->component);
+ return snd_soc_add_component_controls(&codec->component, controls,
+ num_controls);
}
EXPORT_SYMBOL_GPL(snd_soc_add_codec_controls);
@@ -2425,12 +2442,10 @@ EXPORT_SYMBOL_GPL(snd_soc_add_codec_controls);
* Return 0 for success, else error.
*/
int snd_soc_add_platform_controls(struct snd_soc_platform *platform,
- const struct snd_kcontrol_new *controls, int num_controls)
+ const struct snd_kcontrol_new *controls, unsigned int num_controls)
{
- struct snd_card *card = platform->component.card->snd_card;
-
- return snd_soc_add_controls(card, platform->dev, controls, num_controls,
- NULL, &platform->component);
+ return snd_soc_add_component_controls(&platform->component, controls,
+ num_controls);
}
EXPORT_SYMBOL_GPL(snd_soc_add_platform_controls);
--
1.8.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/4] ASoC: tegra: Replace instances of rtd->codec->card with rtd->card
2014-07-17 20:01 ` [PATCH 2/4] ASoC: tegra: Replace instances of rtd->codec->card with rtd->card Lars-Peter Clausen
@ 2014-07-21 20:23 ` Stephen Warren
0 siblings, 0 replies; 7+ messages in thread
From: Stephen Warren @ 2014-07-21 20:23 UTC (permalink / raw)
To: Lars-Peter Clausen, Mark Brown, Liam Girdwood; +Cc: alsa-devel
On 07/17/2014 02:01 PM, Lars-Peter Clausen wrote:
> No need to go via the CODEC to get a pointer to the card. This will help to
> eventually remove the card field from the snd_soc_codec struct.
Acked-by: Stephen Warren <swarren@nvidia.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/4] More componentization preparation
2014-07-17 20:01 [PATCH 0/4] More componentization preparation Lars-Peter Clausen
` (3 preceding siblings ...)
2014-07-17 20:01 ` [PATCH 4/4] ASoC: Add function to register component controls Lars-Peter Clausen
@ 2014-07-22 22:14 ` Mark Brown
4 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2014-07-22 22:14 UTC (permalink / raw)
To: Lars-Peter Clausen; +Cc: alsa-devel, Liam Girdwood, Stephen Warren
[-- Attachment #1.1: Type: text/plain, Size: 580 bytes --]
On Thu, Jul 17, 2014 at 10:01:04PM +0200, Lars-Peter Clausen wrote:
> Now that the multi-CODEC patches have been merged we can continue with the
> componentization. Since it is already rather late in the development cycle again
> this series only has a small set of cleanup and preparation patches so we have
> that out of the way. The first patch removes the unused snd_soc_card
> platform_list, the other three patches move the card field from the
> snd_soc_platform and snd_soc_codec struct and consolidates the registration of
> controls on top of that.
Applied all, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-07-22 22:15 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-17 20:01 [PATCH 0/4] More componentization preparation Lars-Peter Clausen
2014-07-17 20:01 ` [PATCH 1/4] ASoC: Remove per card platform list Lars-Peter Clausen
2014-07-17 20:01 ` [PATCH 2/4] ASoC: tegra: Replace instances of rtd->codec->card with rtd->card Lars-Peter Clausen
2014-07-21 20:23 ` Stephen Warren
2014-07-17 20:01 ` [PATCH 3/4] ASoC: Move card field form platform/codec to component Lars-Peter Clausen
2014-07-17 20:01 ` [PATCH 4/4] ASoC: Add function to register component controls Lars-Peter Clausen
2014-07-22 22:14 ` [PATCH 0/4] More componentization preparation Mark Brown
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).