--- zzzz-none-000/linux-4.4.271/sound/soc/soc-core.c 2021-06-03 06:22:09.000000000 +0000 +++ dakota-7530ac-750/linux-4.4.271/sound/soc/soc-core.c 2023-01-11 09:25:44.000000000 +0000 @@ -861,11 +861,27 @@ static const struct snd_soc_dai_ops null_dai_ops = { }; -static struct snd_soc_component *soc_find_component( +/** + * soc_find_component: find a component from component_list in ASoC core + * + * @of_node: of_node of the component to query. + * @name: name of the component to query. + * + * function to find out if a component is already registered with ASoC core. + * + * Returns component handle for success, else NULL error. + */ +struct snd_soc_component *soc_find_component( const struct device_node *of_node, const char *name) { struct snd_soc_component *component; + if (!of_node && !name) { + pr_err("%s: Either of_node or name must be valid\n", + __func__); + return NULL; + } + lockdep_assert_held(&client_mutex); list_for_each_entry(component, &component_list, list) { @@ -879,6 +895,7 @@ return NULL; } +EXPORT_SYMBOL(soc_find_component); static struct snd_soc_dai *snd_soc_find_dai( const struct snd_soc_dai_link_component *dlc) @@ -3041,6 +3058,18 @@ } /** + * snd_soc_card_change_online_state - Mark if soc card is online/offline + * + * @soc_card : soc_card to mark + */ +void snd_soc_card_change_online_state(struct snd_soc_card *soc_card, int online) +{ + if (soc_card && soc_card->snd_card) + snd_card_change_online_state(soc_card->snd_card, online); +} +EXPORT_SYMBOL(snd_soc_card_change_online_state); + +/** * snd_soc_register_codec - Register a codec with the ASoC core * * @dev: The parent device for this codec @@ -3589,6 +3618,63 @@ return ret; } +/** + * snd_soc_info_multi_ext - external single mixer info callback + * @kcontrol: mixer control + * @uinfo: control element information + * + * Callback to provide information about a single external mixer control. + * that accepts multiple input. + * + * Returns 0 for success. + */ +int snd_soc_info_multi_ext(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + struct soc_multi_mixer_control *mc = + (struct soc_multi_mixer_control *)kcontrol->private_value; + int platform_max; + + if (!mc->platform_max) + mc->platform_max = mc->max; + platform_max = mc->platform_max; + + if (platform_max == 1 && !strnstr(kcontrol->id.name, " Volume", 30)) + uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; + else + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + + uinfo->count = mc->count; + uinfo->value.integer.min = 0; + uinfo->value.integer.max = platform_max; + return 0; +} +EXPORT_SYMBOL_GPL(snd_soc_info_multi_ext); + +/** + * snd_soc_dai_get_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_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 && dai->driver->ops->get_channel_map) + return dai->driver->ops->get_channel_map(dai, tx_num, tx_slot, + rx_num, rx_slot); + else + return -EINVAL; +} +EXPORT_SYMBOL_GPL(snd_soc_dai_get_channel_map); + int snd_soc_of_get_dai_name(struct device_node *of_node, const char **dai_name) {