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

Commit 891caea4 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown
Browse files

ASoC: simple_card_utils: add asoc_simple_card_clk_xxx()



Current simple-card-utils sets asoc_simple_dai::clk via
asoc_simple_card_parse_clk().
Current simple card drivers are using it directly for
clk_enable/disable.
Encapsulation is one of simple card util's purpose.
Let's encapsulate it.

Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 03cf603a
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -45,6 +45,8 @@ int asoc_simple_card_parse_clk(struct device *dev,
			       struct device_node *dai_of_node,
			       struct device_node *dai_of_node,
			       struct asoc_simple_dai *simple_dai,
			       struct asoc_simple_dai *simple_dai,
			       const char *name);
			       const char *name);
int asoc_simple_card_clk_enable(struct asoc_simple_dai *dai);
void asoc_simple_card_clk_disable(struct asoc_simple_dai *dai);


#define asoc_simple_card_parse_cpu(node, dai_link,				\
#define asoc_simple_card_parse_cpu(node, dai_link,				\
				   list_name, cells_name, is_single_link)	\
				   list_name, cells_name, is_single_link)	\
+18 −1
Original line number Original line Diff line number Diff line
@@ -110,6 +110,22 @@ int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
}
}
EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name);
EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name);


static void asoc_simple_card_clk_register(struct asoc_simple_dai *dai,
					  struct clk *clk)
{
	dai->clk = clk;
}

int asoc_simple_card_clk_enable(struct asoc_simple_dai *dai)
{
	return clk_prepare_enable(dai->clk);
}

void asoc_simple_card_clk_disable(struct asoc_simple_dai *dai)
{
	clk_disable_unprepare(dai->clk);
}

int asoc_simple_card_parse_clk(struct device *dev,
int asoc_simple_card_parse_clk(struct device *dev,
			       struct device_node *node,
			       struct device_node *node,
			       struct device_node *dai_of_node,
			       struct device_node *dai_of_node,
@@ -128,7 +144,8 @@ int asoc_simple_card_parse_clk(struct device *dev,
	clk = devm_get_clk_from_child(dev, node, NULL);
	clk = devm_get_clk_from_child(dev, node, NULL);
	if (!IS_ERR(clk)) {
	if (!IS_ERR(clk)) {
		simple_dai->sysclk = clk_get_rate(clk);
		simple_dai->sysclk = clk_get_rate(clk);
		simple_dai->clk = clk;

		asoc_simple_card_clk_register(simple_dai, clk);
	} else if (!of_property_read_u32(node, "system-clock-frequency", &val)) {
	} else if (!of_property_read_u32(node, "system-clock-frequency", &val)) {
		simple_dai->sysclk = val;
		simple_dai->sysclk = val;
	} else {
	} else {