Exemplo n.º 1
0
static void simple_get_conversion(struct device *dev,
				  struct device_node *np,
				  struct asoc_simple_card_data *adata)
{
	struct device_node *top = dev->of_node;
	struct device_node *node = of_get_parent(np);

	asoc_simple_card_parse_convert(dev, top,  PREFIX, adata);
	asoc_simple_card_parse_convert(dev, node, PREFIX, adata);
	asoc_simple_card_parse_convert(dev, node, NULL,   adata);
	asoc_simple_card_parse_convert(dev, np,   NULL,   adata);

	of_node_put(node);
}
Exemplo n.º 2
0
static int asoc_simple_card_parse_of(struct simple_card_data *priv)

{
	struct device *dev = simple_priv_to_dev(priv);
	struct device_node *np;
	struct snd_soc_card *card = simple_priv_to_card(priv);
	struct device_node *node = dev->of_node;
	unsigned int daifmt = 0;
	bool is_fe;
	int ret, i;

	if (!node)
		return -EINVAL;

	ret = asoc_simple_card_of_parse_widgets(card, PREFIX);
	if (ret < 0)
		return ret;

	ret = asoc_simple_card_of_parse_routing(card, PREFIX, 0);
	if (ret < 0)
		return ret;

	asoc_simple_card_parse_convert(dev, PREFIX, &priv->adata);

	/* find 1st codec */
	np = of_get_child_by_name(node, PREFIX "codec");
	if (!np)
		return -ENODEV;

	ret = asoc_simple_card_parse_daifmt(dev, node, np, PREFIX, &daifmt);
	if (ret < 0)
		return ret;

	i = 0;
	for_each_child_of_node(node, np) {
		is_fe = false;
		if (strcmp(np->name, PREFIX "cpu") == 0)
			is_fe = true;

		ret = asoc_simple_card_dai_link_of(np, priv, daifmt, i, is_fe);
		if (ret < 0)
			return ret;
		i++;
	}