mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-07 18:36:40 +07:00
Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next
This commit is contained in:
commit
cf82602c41
@ -431,7 +431,6 @@ int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
|
||||
const char *pin);
|
||||
int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
|
||||
const char *pin);
|
||||
void snd_soc_dapm_auto_nc_pins(struct snd_soc_card *card);
|
||||
unsigned int dapm_kcontrol_get_value(const struct snd_kcontrol *kcontrol);
|
||||
|
||||
/* Mostly internal - should not normally be used */
|
||||
|
@ -1626,9 +1626,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
|
||||
}
|
||||
}
|
||||
|
||||
if (card->fully_routed)
|
||||
snd_soc_dapm_auto_nc_pins(card);
|
||||
|
||||
snd_soc_dapm_new_widgets(card);
|
||||
|
||||
ret = snd_card_register(card->snd_card);
|
||||
|
@ -2279,6 +2279,9 @@ static void dapm_update_widget_flags(struct snd_soc_dapm_widget *w)
|
||||
|
||||
switch (w->id) {
|
||||
case snd_soc_dapm_input:
|
||||
/* On a fully routed card a input is never a source */
|
||||
if (w->dapm->card->fully_routed)
|
||||
break;
|
||||
w->is_source = 1;
|
||||
list_for_each_entry(p, &w->sources, list_sink) {
|
||||
if (p->source->id == snd_soc_dapm_micbias ||
|
||||
@ -2291,6 +2294,9 @@ static void dapm_update_widget_flags(struct snd_soc_dapm_widget *w)
|
||||
}
|
||||
break;
|
||||
case snd_soc_dapm_output:
|
||||
/* On a fully routed card a output is never a sink */
|
||||
if (w->dapm->card->fully_routed)
|
||||
break;
|
||||
w->is_sink = 1;
|
||||
list_for_each_entry(p, &w->sinks, list_source) {
|
||||
if (p->sink->id == snd_soc_dapm_spk ||
|
||||
@ -3085,16 +3091,24 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
|
||||
|
||||
switch (w->id) {
|
||||
case snd_soc_dapm_mic:
|
||||
case snd_soc_dapm_input:
|
||||
w->is_source = 1;
|
||||
w->power_check = dapm_generic_check_power;
|
||||
break;
|
||||
case snd_soc_dapm_input:
|
||||
if (!dapm->card->fully_routed)
|
||||
w->is_source = 1;
|
||||
w->power_check = dapm_generic_check_power;
|
||||
break;
|
||||
case snd_soc_dapm_spk:
|
||||
case snd_soc_dapm_hp:
|
||||
case snd_soc_dapm_output:
|
||||
w->is_sink = 1;
|
||||
w->power_check = dapm_generic_check_power;
|
||||
break;
|
||||
case snd_soc_dapm_output:
|
||||
if (!dapm->card->fully_routed)
|
||||
w->is_sink = 1;
|
||||
w->power_check = dapm_generic_check_power;
|
||||
break;
|
||||
case snd_soc_dapm_vmid:
|
||||
case snd_soc_dapm_siggen:
|
||||
w->is_source = 1;
|
||||
@ -3808,93 +3822,6 @@ int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend);
|
||||
|
||||
/**
|
||||
* dapm_is_external_path() - Checks if a path is a external path
|
||||
* @card: The card the path belongs to
|
||||
* @path: The path to check
|
||||
*
|
||||
* Returns true if the path is either between two different DAPM contexts or
|
||||
* between two external pins of the same DAPM context. Otherwise returns
|
||||
* false.
|
||||
*/
|
||||
static bool dapm_is_external_path(struct snd_soc_card *card,
|
||||
struct snd_soc_dapm_path *path)
|
||||
{
|
||||
dev_dbg(card->dev,
|
||||
"... Path %s(id:%d dapm:%p) - %s(id:%d dapm:%p)\n",
|
||||
path->source->name, path->source->id, path->source->dapm,
|
||||
path->sink->name, path->sink->id, path->sink->dapm);
|
||||
|
||||
/* Connection between two different DAPM contexts */
|
||||
if (path->source->dapm != path->sink->dapm)
|
||||
return true;
|
||||
|
||||
/* Loopback connection from external pin to external pin */
|
||||
if (path->sink->id == snd_soc_dapm_input) {
|
||||
switch (path->source->id) {
|
||||
case snd_soc_dapm_output:
|
||||
case snd_soc_dapm_micbias:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool snd_soc_dapm_widget_in_card_paths(struct snd_soc_card *card,
|
||||
struct snd_soc_dapm_widget *w)
|
||||
{
|
||||
struct snd_soc_dapm_path *p;
|
||||
|
||||
list_for_each_entry(p, &w->sources, list_sink) {
|
||||
if (dapm_is_external_path(card, p))
|
||||
return true;
|
||||
}
|
||||
|
||||
list_for_each_entry(p, &w->sinks, list_source) {
|
||||
if (dapm_is_external_path(card, p))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_auto_nc_pins - call snd_soc_dapm_nc_pin for unused pins
|
||||
* @card: The card whose pins should be processed
|
||||
*
|
||||
* Automatically call snd_soc_dapm_nc_pin() for any external pins in the card
|
||||
* which are unused. Pins are used if they are connected externally to a
|
||||
* component, whether that be to some other device, or a loop-back connection to
|
||||
* the component itself.
|
||||
*/
|
||||
void snd_soc_dapm_auto_nc_pins(struct snd_soc_card *card)
|
||||
{
|
||||
struct snd_soc_dapm_widget *w;
|
||||
|
||||
dev_dbg(card->dev, "ASoC: Auto NC: DAPMs: card:%p\n", &card->dapm);
|
||||
|
||||
list_for_each_entry(w, &card->widgets, list) {
|
||||
switch (w->id) {
|
||||
case snd_soc_dapm_input:
|
||||
case snd_soc_dapm_output:
|
||||
case snd_soc_dapm_micbias:
|
||||
dev_dbg(card->dev, "ASoC: Auto NC: Checking widget %s\n",
|
||||
w->name);
|
||||
if (!snd_soc_dapm_widget_in_card_paths(card, w)) {
|
||||
dev_dbg(card->dev,
|
||||
"... Not in map; disabling\n");
|
||||
snd_soc_dapm_nc_pin(w->dapm, w->name);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_free - free dapm resources
|
||||
* @dapm: DAPM context
|
||||
|
Loading…
Reference in New Issue
Block a user