From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Current simple-card-utils sets asoc_simple_dai::clk via asoc_simple_card_parse_clk(), and requested parameter is only simple_dai. But current simple card drivers are using simple_dai::clk directly for clk_enable/disable. Encapsulation is one of simple card util's purpose. Let's encapsulate it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 6 ++++++ 2 files changed, 8 insertions(+)
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 108cae4..9e8e829 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -45,6 +45,8 @@ int asoc_simple_card_parse_clk(struct device *dev, struct device_node *dai_of_node, struct asoc_simple_dai *simple_dai, const char *name); +#define asoc_simple_card_clk_enable(dai) clk_prepare_enable((dai)->clk) +#define asoc_simple_card_clk_disable(dai) clk_disable_unprepare((dai)->clk)
#define asoc_simple_card_parse_cpu(node, dai_link, \ list_name, cells_name, is_single_link) \ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index d9d8b8a..f7df08b 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -128,6 +128,12 @@ int asoc_simple_card_parse_clk(struct device *dev, clk = devm_get_clk_from_child(dev, node, NULL); if (!IS_ERR(clk)) { simple_dai->sysclk = clk_get_rate(clk); + + /* + * This enables + * asoc_simple_card_clk_enable() + * asoc_simple_card_clk_disable() + */ simple_dai->clk = clk; } else if (!of_property_read_u32(node, "system-clock-frequency", &val)) { simple_dai->sysclk = val;