From 873486ed4af3e11bfc20832dff7b124ba652bf77 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 2 Jul 2018 06:24:18 +0000 Subject: ASoC: soc-core: convert to SPDX identifiers Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) (limited to 'sound/soc/soc-core.c') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 4663de3cf495..68b08781c832 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1,26 +1,21 @@ -/* - * soc-core.c -- ALSA SoC Audio Layer - * - * Copyright 2005 Wolfson Microelectronics PLC. - * Copyright 2005 Openedhand Ltd. - * Copyright (C) 2010 Slimlogic Ltd. - * Copyright (C) 2010 Texas Instruments Inc. - * - * Author: Liam Girdwood - * with code, comments and ideas from :- - * Richard Purdie - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * TODO: - * o Add hw rules to enforce rates, etc. - * o More testing with other codecs/machines. - * o Add more codecs and platforms to ensure good API coverage. - * o Support TDM on PCM and I2S - */ +// SPDX-License-Identifier: GPL-2.0+ +// +// soc-core.c -- ALSA SoC Audio Layer +// +// Copyright 2005 Wolfson Microelectronics PLC. +// Copyright 2005 Openedhand Ltd. +// Copyright (C) 2010 Slimlogic Ltd. +// Copyright (C) 2010 Texas Instruments Inc. +// +// Author: Liam Girdwood +// with code, comments and ideas from :- +// Richard Purdie +// +// TODO: +// o Add hw rules to enforce rates, etc. +// o More testing with other codecs/machines. +// o Add more codecs and platforms to ensure good API coverage. +// o Support TDM on PCM and I2S #include #include -- cgit v1.2.3-59-g8ed1b From a655de808cbde6c58b3298e704d786b53f59fb5d Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Mon, 2 Jul 2018 16:59:54 +0100 Subject: ASoC: core: Allow topology to override machine driver FE DAI link config. Machine drivers statically define a number of DAI links that currently cannot be changed or removed by topology. This means PCMs and platform components cannot be changed by topology at runtime AND machine drivers are tightly coupled to topology. This patch allows topology to override the machine driver DAI link config in order to reuse machine drivers with different topologies and platform components. The patch supports :- 1) create new FE PCMs with a topology defined PCM ID. 2) destroy existing static FE PCMs 3) change the platform component driver. 4) assign any new HW params fixups. 5) assign a new card name prefix to differentiate this topology to userspace. The patch requires no changes to the machine drivers, but does add some platform component flags that the platform component driver can assign before loading topologies. Signed-off-by: Liam Girdwood Signed-off-by: Mark Brown --- include/sound/soc.h | 13 +++++++ sound/soc/soc-core.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++-- sound/soc/soc-pcm.c | 12 ++++++ 3 files changed, 123 insertions(+), 3 deletions(-) (limited to 'sound/soc/soc-core.c') diff --git a/include/sound/soc.h b/include/sound/soc.h index 16f0bf10cc42..870ba6b64817 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -803,6 +803,14 @@ struct snd_soc_component_driver { unsigned int use_pmdown_time:1; /* care pmdown_time at stop */ unsigned int endianness:1; unsigned int non_legacy_dai_naming:1; + + /* this component uses topology and ignore machine driver FEs */ + const char *ignore_machine; + const char *topology_name_prefix; + int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_hw_params *params); + bool use_dai_pcm_id; /* use the DAI link PCM ID as PCM device number */ + int be_pcm_base; /* base device ID for all BE PCMs */ }; struct snd_soc_component { @@ -960,6 +968,9 @@ struct snd_soc_dai_link { /* pmdown_time is ignored at stop */ unsigned int ignore_pmdown_time:1; + /* Do not create a PCM for this DAI link (Backend link) */ + unsigned int ignore:1; + struct list_head list; /* DAI link list of the soc card */ struct snd_soc_dobj dobj; /* For topology */ }; @@ -999,6 +1010,7 @@ struct snd_soc_card { const char *long_name; const char *driver_name; char dmi_longname[80]; + char topology_shortname[32]; struct device *dev; struct snd_card *snd_card; @@ -1008,6 +1020,7 @@ struct snd_soc_card { struct mutex dapm_mutex; bool instantiated; + bool topology_shortname_created; int (*probe)(struct snd_soc_card *card); int (*late_probe)(struct snd_soc_card *card); diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 68b08781c832..00bd58d167dd 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -847,6 +847,9 @@ static int soc_bind_dai_link(struct snd_soc_card *card, const char *platform_name; int i; + if (dai_link->ignore) + return 0; + dev_dbg(card->dev, "ASoC: binding %s\n", dai_link->name); if (soc_is_dai_link_bound(card, dai_link)) { @@ -1456,7 +1459,9 @@ static int soc_probe_link_dais(struct snd_soc_card *card, { struct snd_soc_dai_link *dai_link = rtd->dai_link; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; - int i, ret; + struct snd_soc_rtdcom_list *rtdcom; + struct snd_soc_component *component; + int i, ret, num; dev_dbg(card->dev, "ASoC: probe %s dai link %d late %d\n", card->name, rtd->num, order); @@ -1502,9 +1507,28 @@ static int soc_probe_link_dais(struct snd_soc_card *card, soc_dpcm_debugfs_add(rtd); #endif + num = rtd->num; + + /* + * most drivers will register their PCMs using DAI link ordering but + * topology based drivers can use the DAI link id field to set PCM + * device number and then use rtd + a base offset of the BEs. + */ + for_each_rtdcom(rtd, rtdcom) { + component = rtdcom->component; + + if (!component->driver->use_dai_pcm_id) + continue; + + if (rtd->dai_link->no_pcm) + num += component->driver->be_pcm_base; + else + num = rtd->dai_link->id; + } + if (cpu_dai->driver->compress_new) { /*create compress_device"*/ - ret = cpu_dai->driver->compress_new(rtd, rtd->num); + ret = cpu_dai->driver->compress_new(rtd, num); if (ret < 0) { dev_err(card->dev, "ASoC: can't create compress %s\n", dai_link->stream_name); @@ -1514,7 +1538,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, if (!dai_link->params) { /* create the pcm */ - ret = soc_new_pcm(rtd, rtd->num); + ret = soc_new_pcm(rtd, num); if (ret < 0) { dev_err(card->dev, "ASoC: can't create pcm %s :%d\n", dai_link->stream_name, ret); @@ -1841,6 +1865,74 @@ int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour) EXPORT_SYMBOL_GPL(snd_soc_set_dmi_name); #endif /* CONFIG_DMI */ +static void soc_check_tplg_fes(struct snd_soc_card *card) +{ + struct snd_soc_component *component; + const struct snd_soc_component_driver *comp_drv; + struct snd_soc_dai_link *dai_link; + int i; + + list_for_each_entry(component, &component_list, list) { + + /* does this component override FEs ? */ + if (!component->driver->ignore_machine) + continue; + + /* for this machine ? */ + if (strcmp(component->driver->ignore_machine, + card->dev->driver->name)) + continue; + + /* machine matches, so override the rtd data */ + for (i = 0; i < card->num_links; i++) { + + dai_link = &card->dai_link[i]; + + /* ignore this FE */ + if (dai_link->dynamic) { + dai_link->ignore = true; + continue; + } + + dev_info(card->dev, "info: override FE DAI link %s\n", + card->dai_link[i].name); + + /* override platform component */ + dai_link->platform_name = component->name; + + /* convert non BE into BE */ + dai_link->no_pcm = 1; + + /* override any BE fixups */ + dai_link->be_hw_params_fixup = + component->driver->be_hw_params_fixup; + + /* most BE links don't set stream name, so set it to + * dai link name if it's NULL to help bind widgets. + */ + if (!dai_link->stream_name) + dai_link->stream_name = dai_link->name; + } + + /* Inform userspace we are using alternate topology */ + if (component->driver->topology_name_prefix) { + + /* topology shortname created ? */ + if (!card->topology_shortname_created) { + comp_drv = component->driver; + + snprintf(card->topology_shortname, 32, "%s-%s", + comp_drv->topology_name_prefix, + card->name); + card->topology_shortname_created = true; + } + + /* use topology shortname */ + card->name = card->topology_shortname; + } + } +} + static int snd_soc_instantiate_card(struct snd_soc_card *card) { struct snd_soc_pcm_runtime *rtd; @@ -1850,6 +1942,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) mutex_lock(&client_mutex); mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT); + /* check whether any platform is ignore machine FE and using topology */ + soc_check_tplg_fes(card); + /* bind DAIs */ for (i = 0; i < card->num_links; i++) { ret = soc_bind_dai_link(card, &card->dai_link[i]); diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index c2a31b51da4f..b7e67b871c0c 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -859,8 +859,20 @@ int soc_dai_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; int ret; + /* perform any topology hw_params fixups before DAI */ + if (rtd->dai_link->be_hw_params_fixup) { + ret = rtd->dai_link->be_hw_params_fixup(rtd, params); + if (ret < 0) { + dev_err(rtd->dev, + "ASoC: hw_params topology fixup failed %d\n", + ret); + return ret; + } + } + if (dai->driver->ops->hw_params) { ret = dai->driver->ops->hw_params(substream, params, dai); if (ret < 0) { -- cgit v1.2.3-59-g8ed1b From aefba45539bc4868c1fae336410aec907ee0882a Mon Sep 17 00:00:00 2001 From: Jerome Brunet Date: Fri, 13 Jul 2018 14:50:43 +0200 Subject: ASoC: allow soc-core to pick up name prefixes from component nodes When the component does not match the configuration table provided by the card, let soc-core check the component node for a name prefix Signed-off-by: Jerome Brunet Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'sound/soc/soc-core.c') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 00bd58d167dd..3be0310d5c81 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1193,15 +1193,27 @@ void snd_soc_remove_dai_link(struct snd_soc_card *card, } EXPORT_SYMBOL_GPL(snd_soc_remove_dai_link); +static void soc_set_of_name_prefix(struct snd_soc_component *component) +{ + struct device_node *component_of_node = component->dev->of_node; + const char *str; + int ret; + + if (!component_of_node && component->dev->parent) + component_of_node = component->dev->parent->of_node; + + ret = of_property_read_string(component_of_node, "sound-name-prefix", + &str); + if (!ret) + component->name_prefix = str; +} + static void soc_set_name_prefix(struct snd_soc_card *card, struct snd_soc_component *component) { int i; - if (card->codec_conf == NULL) - return; - - for (i = 0; i < card->num_configs; i++) { + for (i = 0; i < card->num_configs && card->codec_conf; i++) { struct snd_soc_codec_conf *map = &card->codec_conf[i]; struct device_node *component_of_node = component->dev->of_node; @@ -1213,8 +1225,14 @@ static void soc_set_name_prefix(struct snd_soc_card *card, if (map->dev_name && strcmp(component->name, map->dev_name)) continue; component->name_prefix = map->name_prefix; - break; + return; } + + /* + * If there is no configuration table or no match in the table, + * check if a prefix is provided in the node + */ + soc_set_of_name_prefix(component); } static int soc_probe_component(struct snd_soc_card *card, -- cgit v1.2.3-59-g8ed1b From bb4b894addb09a069c072a0a032f644cc470d17f Mon Sep 17 00:00:00 2001 From: Srinivas Kandagatla Date: Fri, 13 Jul 2018 16:36:28 +0100 Subject: ASoC: core: add support to card re-bind using component framework This patch aims at achieving dynamic behaviour of audio card when the dependent components disappear and reappear. With this patch the card is removed if any of the dependent component is removed and card is added back if the dependent component comes back. All this is done using component framework and matching based on component name. Signed-off-by: Srinivas Kandagatla Reviewed-by: Vinod Koul Signed-off-by: Mark Brown --- include/sound/soc.h | 7 ++++++ sound/soc/soc-core.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) (limited to 'sound/soc/soc-core.c') diff --git a/include/sound/soc.h b/include/sound/soc.h index a4915148f739..a23ecdf3eff1 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -1090,6 +1091,12 @@ struct snd_soc_card { struct work_struct deferred_resume_work; + /* component framework related */ + bool components_added; + /* set in machine driver to enable/disable auto re-binding */ + bool auto_bind; + struct component_match *match; + /* lists of probed devices belonging to this card */ struct list_head component_dev_list; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 3be0310d5c81..08e189485009 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -279,11 +279,28 @@ static inline void snd_soc_debugfs_exit(void) #endif +static int snd_soc_card_comp_compare(struct device *dev, void *data) +{ + struct snd_soc_component *component; + + lockdep_assert_held(&client_mutex); + list_for_each_entry(component, &component_list, list) { + if (dev == component->dev) { + if (!strcmp(component->name, data)) + return 1; + break; + } + } + + return 0; +} + static int snd_soc_rtdcom_add(struct snd_soc_pcm_runtime *rtd, struct snd_soc_component *component) { struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *new_rtdcom; + char *cname; for_each_rtdcom(rtd, rtdcom) { /* already connected */ @@ -300,6 +317,13 @@ static int snd_soc_rtdcom_add(struct snd_soc_pcm_runtime *rtd, list_add_tail(&new_rtdcom->list, &rtd->component_list); + if (rtd->card->auto_bind && !rtd->card->components_added) { + cname = devm_kasprintf(rtd->card->dev, GFP_KERNEL, + "%s", component->name); + component_match_add(rtd->card->dev, &rtd->card->match, + snd_soc_card_comp_compare, cname); + } + return 0; } @@ -835,6 +859,25 @@ static bool soc_is_dai_link_bound(struct snd_soc_card *card, return false; } +static int snd_soc_card_comp_bind(struct device *dev) +{ + struct snd_soc_card *card = dev_get_drvdata(dev); + + if (card->instantiated) + return 0; + + return snd_soc_register_card(card); +} + +static void snd_soc_card_comp_unbind(struct device *dev) +{ +} + +static const struct component_master_ops snd_soc_card_comp_ops = { + .bind = snd_soc_card_comp_bind, + .unbind = snd_soc_card_comp_unbind, +}; + static int soc_bind_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) { @@ -2126,6 +2169,12 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) card->instantiated = 1; snd_soc_dapm_sync(&card->dapm); + if (card->auto_bind && !card->components_added) { + component_master_add_with_match(card->dev, + &snd_soc_card_comp_ops, + card->match); + card->components_added = true; + } mutex_unlock(&card->mutex); mutex_unlock(&client_mutex); @@ -2749,6 +2798,9 @@ int snd_soc_unregister_card(struct snd_soc_card *card) dev_dbg(card->dev, "ASoC: Unregistered card '%s'\n", card->name); } + if (!card->auto_bind && card->components_added) + component_master_del(card->dev, &snd_soc_card_comp_ops); + return 0; } EXPORT_SYMBOL_GPL(snd_soc_unregister_card); @@ -3161,8 +3213,17 @@ int snd_soc_add_component(struct device *dev, snd_soc_component_add(component); + ret = component_add(dev, NULL); + if (ret < 0) { + dev_err(dev, "ASoC: Failed to add Component: %d\n", ret); + goto err_comp; + } + return 0; +err_comp: + soc_remove_component(component); + snd_soc_unregister_dais(component); err_cleanup: snd_soc_component_cleanup(component); err_free: @@ -3210,6 +3271,7 @@ static int __snd_soc_unregister_component(struct device *dev) mutex_unlock(&client_mutex); if (found) { + component_del(dev, NULL); snd_soc_component_cleanup(component); } -- cgit v1.2.3-59-g8ed1b From cbdfab3b675f4c34258b0ec9e4707de44e1f6989 Mon Sep 17 00:00:00 2001 From: Jerome Brunet Date: Tue, 17 Jul 2018 17:43:02 +0200 Subject: ASoC: export snd_soc_of_get_slot_mask Amlogic's axg card driver can't use snd_soc_of_parse_tdm_slot() directly because it needs to handle 4 mask for each direction. Yet the parsing of each mask is the same, so export snd_soc_of_get_slot_mask() to reuse the the existing code. Signed-off-by: Jerome Brunet Signed-off-by: Mark Brown --- include/sound/soc.h | 3 +++ sound/soc/soc-core.c | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'sound/soc/soc-core.c') diff --git a/include/sound/soc.h b/include/sound/soc.h index a23ecdf3eff1..ace474e8649e 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1433,6 +1433,9 @@ int snd_soc_of_parse_card_name(struct snd_soc_card *card, const char *propname); int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card, const char *propname); +int snd_soc_of_get_slot_mask(struct device_node *np, + const char *prop_name, + unsigned int *mask); int snd_soc_of_parse_tdm_slot(struct device_node *np, unsigned int *tx_mask, unsigned int *rx_mask, diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 08e189485009..ad5b0ef16d82 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3428,9 +3428,9 @@ int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card, } EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_simple_widgets); -static int snd_soc_of_get_slot_mask(struct device_node *np, - const char *prop_name, - unsigned int *mask) +int snd_soc_of_get_slot_mask(struct device_node *np, + const char *prop_name, + unsigned int *mask) { u32 val; const __be32 *of_slot_mask = of_get_property(np, prop_name, &val); @@ -3445,6 +3445,7 @@ static int snd_soc_of_get_slot_mask(struct device_node *np, return val; } +EXPORT_SYMBOL_GPL(snd_soc_of_get_slot_mask); int snd_soc_of_parse_tdm_slot(struct device_node *np, unsigned int *tx_mask, -- cgit v1.2.3-59-g8ed1b From 467b061f1ac80f323bedb56d20a24f7bc0d2cec5 Mon Sep 17 00:00:00 2001 From: Srinivas Kandagatla Date: Mon, 23 Jul 2018 16:54:03 +0100 Subject: ASoC: core: add support to snd_soc_dai_get_channel_map() On Qualcomm platforms, specifically with SLIMbus interfaced codecs, the codec slim channel numbers are passed to DSP while configuring the slim audio path. Having get_channel_map() would allow dais to share such information across multiple dais. Signed-off-by: Srinivas Kandagatla Signed-off-by: Mark Brown --- include/sound/soc-dai.h | 8 ++++++++ sound/soc/soc-core.c | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'sound/soc/soc-core.c') diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index a14bc0608ae9..f5d70041108f 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -138,6 +138,11 @@ int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute, int direction); + +int snd_soc_dai_get_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_is_dummy(struct snd_soc_dai *dai); struct snd_soc_dai_ops { @@ -165,6 +170,9 @@ struct snd_soc_dai_ops { 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 (*get_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); int (*set_sdw_stream)(struct snd_soc_dai *dai, diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index ad5b0ef16d82..81b27923303d 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2679,6 +2679,28 @@ int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai, } EXPORT_SYMBOL_GPL(snd_soc_dai_set_channel_map); +/** + * snd_soc_dai_get_channel_map - Get 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 + */ +int snd_soc_dai_get_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->driver->ops->get_channel_map) + return dai->driver->ops->get_channel_map(dai, tx_num, tx_slot, + rx_num, rx_slot); + else + return -ENOTSUPP; +} +EXPORT_SYMBOL_GPL(snd_soc_dai_get_channel_map); + /** * snd_soc_dai_set_tristate - configure DAI system or master clock. * @dai: DAI -- cgit v1.2.3-59-g8ed1b From 611cbc8799b672f41b6ba7afed758ad9efb959a7 Mon Sep 17 00:00:00 2001 From: Srinivas Kandagatla Date: Thu, 2 Aug 2018 16:03:38 +0100 Subject: ASoC: core: remove support for card rebind using component framework DRM based audio components get registered inside the component framework bind callback. However component framework has a big mutex lock taken for every call to component_add, component_del and bind, unbind callbacks. This can lead to deadlock situation if we are trying to add new/remove component within a bind/unbind callbacks. Which is what was happening with bcm2837 rpi 3. Revert this change till we sort out the mutex issue. Reported-by: Guillaume Tucker Reported-by: Stefan Wahren Signed-off-by: Srinivas Kandagatla Signed-off-by: Mark Brown --- include/sound/soc.h | 7 ------ sound/soc/soc-core.c | 62 ---------------------------------------------------- 2 files changed, 69 deletions(-) (limited to 'sound/soc/soc-core.c') diff --git a/include/sound/soc.h b/include/sound/soc.h index ace474e8649e..41cec42fb456 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -1091,12 +1090,6 @@ struct snd_soc_card { struct work_struct deferred_resume_work; - /* component framework related */ - bool components_added; - /* set in machine driver to enable/disable auto re-binding */ - bool auto_bind; - struct component_match *match; - /* lists of probed devices belonging to this card */ struct list_head component_dev_list; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 81b27923303d..82eb3868be67 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -279,28 +279,11 @@ static inline void snd_soc_debugfs_exit(void) #endif -static int snd_soc_card_comp_compare(struct device *dev, void *data) -{ - struct snd_soc_component *component; - - lockdep_assert_held(&client_mutex); - list_for_each_entry(component, &component_list, list) { - if (dev == component->dev) { - if (!strcmp(component->name, data)) - return 1; - break; - } - } - - return 0; -} - static int snd_soc_rtdcom_add(struct snd_soc_pcm_runtime *rtd, struct snd_soc_component *component) { struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *new_rtdcom; - char *cname; for_each_rtdcom(rtd, rtdcom) { /* already connected */ @@ -317,13 +300,6 @@ static int snd_soc_rtdcom_add(struct snd_soc_pcm_runtime *rtd, list_add_tail(&new_rtdcom->list, &rtd->component_list); - if (rtd->card->auto_bind && !rtd->card->components_added) { - cname = devm_kasprintf(rtd->card->dev, GFP_KERNEL, - "%s", component->name); - component_match_add(rtd->card->dev, &rtd->card->match, - snd_soc_card_comp_compare, cname); - } - return 0; } @@ -859,25 +835,6 @@ static bool soc_is_dai_link_bound(struct snd_soc_card *card, return false; } -static int snd_soc_card_comp_bind(struct device *dev) -{ - struct snd_soc_card *card = dev_get_drvdata(dev); - - if (card->instantiated) - return 0; - - return snd_soc_register_card(card); -} - -static void snd_soc_card_comp_unbind(struct device *dev) -{ -} - -static const struct component_master_ops snd_soc_card_comp_ops = { - .bind = snd_soc_card_comp_bind, - .unbind = snd_soc_card_comp_unbind, -}; - static int soc_bind_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) { @@ -2169,12 +2126,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) card->instantiated = 1; snd_soc_dapm_sync(&card->dapm); - if (card->auto_bind && !card->components_added) { - component_master_add_with_match(card->dev, - &snd_soc_card_comp_ops, - card->match); - card->components_added = true; - } mutex_unlock(&card->mutex); mutex_unlock(&client_mutex); @@ -2820,9 +2771,6 @@ int snd_soc_unregister_card(struct snd_soc_card *card) dev_dbg(card->dev, "ASoC: Unregistered card '%s'\n", card->name); } - if (!card->auto_bind && card->components_added) - component_master_del(card->dev, &snd_soc_card_comp_ops); - return 0; } EXPORT_SYMBOL_GPL(snd_soc_unregister_card); @@ -3235,17 +3183,8 @@ int snd_soc_add_component(struct device *dev, snd_soc_component_add(component); - ret = component_add(dev, NULL); - if (ret < 0) { - dev_err(dev, "ASoC: Failed to add Component: %d\n", ret); - goto err_comp; - } - return 0; -err_comp: - soc_remove_component(component); - snd_soc_unregister_dais(component); err_cleanup: snd_soc_component_cleanup(component); err_free: @@ -3293,7 +3232,6 @@ static int __snd_soc_unregister_component(struct device *dev) mutex_unlock(&client_mutex); if (found) { - component_del(dev, NULL); snd_soc_component_cleanup(component); } -- cgit v1.2.3-59-g8ed1b From 1a12d5dc7dd1ffd985503f9770b736fb03db2e3f Mon Sep 17 00:00:00 2001 From: "Gustavo A. R. Silva" Date: Fri, 3 Aug 2018 11:34:30 -0500 Subject: ASoC: core: mark expected switch fall-through In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 146568 ("Missing break in switch") Signed-off-by: Gustavo A. R. Silva Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound/soc/soc-core.c') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 82eb3868be67..9cfe10d8040c 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -528,6 +528,7 @@ int snd_soc_suspend(struct device *dev) "ASoC: idle_bias_off CODEC on over suspend\n"); break; } + /* fall through */ case SND_SOC_BIAS_OFF: if (component->driver->suspend) -- cgit v1.2.3-59-g8ed1b