Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3296d078 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown
Browse files

ASoC: simple-card-utils: add asoc_simple_card_of_parse_routing()



Current simple card drivers are parsing routing on each own driver.
Encapsulation is one of simple card util's purpose.
Let's add asoc_simple_card_of_parse_routing for it.

Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent c564a5b1
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -100,4 +100,8 @@ void asoc_simple_card_convert_fixup(struct asoc_simple_card_data *data,
void asoc_simple_card_parse_convert(struct device *dev, char *prefix,
void asoc_simple_card_parse_convert(struct device *dev, char *prefix,
				    struct asoc_simple_card_data *data);
				    struct asoc_simple_card_data *data);


int asoc_simple_card_of_parse_routing(struct snd_soc_card *card,
				      char *prefix,
				      int optional);

#endif /* __SIMPLE_CARD_UTILS_H */
#endif /* __SIMPLE_CARD_UTILS_H */
+22 −0
Original line number Original line Diff line number Diff line
@@ -375,6 +375,28 @@ int asoc_simple_card_clean_reference(struct snd_soc_card *card)
}
}
EXPORT_SYMBOL_GPL(asoc_simple_card_clean_reference);
EXPORT_SYMBOL_GPL(asoc_simple_card_clean_reference);


int asoc_simple_card_of_parse_routing(struct snd_soc_card *card,
				      char *prefix,
				      int optional)
{
	struct device_node *node = card->dev->of_node;
	char prop[128];

	if (!prefix)
		prefix = "";

	snprintf(prop, sizeof(prop), "%s%s", prefix, "routing");

	if (!of_property_read_bool(node, prop)) {
		if (optional)
			return 0;
		return -EINVAL;
	}

	return snd_soc_of_parse_audio_routing(card, prop);
}
EXPORT_SYMBOL_GPL(asoc_simple_card_of_parse_routing);

/* Module information */
/* Module information */
MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");
MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");
MODULE_DESCRIPTION("ALSA SoC Simple Card Utils");
MODULE_DESCRIPTION("ALSA SoC Simple Card Utils");