未验证 提交 05a41340 编写于 作者: S Srinivas Kandagatla 提交者: Mark Brown

ASoC: codecs: wsa-macro: setup soundwire clks correctly

For SoundWire Frame sync to be generated correctly we need both MCLK
and MCLKx2 (npl). Without pm runtime enabled these two clocks will remain on,
however after adding pm runtime support its possible that NPl clock could be
turned off even when SoundWire controller is active.

Fix this by enabling mclk and npl clk when SoundWire clks are enabled.
Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220224111718.6264-8-srinivas.kandagatla@linaro.orgSigned-off-by: NMark Brown <broonie@kernel.org>
上级 e252801d
...@@ -2260,6 +2260,13 @@ static int wsa_swrm_clock(struct wsa_macro *wsa, bool enable) ...@@ -2260,6 +2260,13 @@ static int wsa_swrm_clock(struct wsa_macro *wsa, bool enable)
struct regmap *regmap = wsa->regmap; struct regmap *regmap = wsa->regmap;
if (enable) { if (enable) {
int ret;
ret = clk_prepare_enable(wsa->mclk);
if (ret) {
dev_err(wsa->dev, "failed to enable mclk\n");
return ret;
}
wsa_macro_mclk_enable(wsa, true); wsa_macro_mclk_enable(wsa, true);
/* reset swr ip */ /* reset swr ip */
...@@ -2284,6 +2291,7 @@ static int wsa_swrm_clock(struct wsa_macro *wsa, bool enable) ...@@ -2284,6 +2291,7 @@ static int wsa_swrm_clock(struct wsa_macro *wsa, bool enable)
regmap_update_bits(regmap, CDC_WSA_CLK_RST_CTRL_SWR_CONTROL, regmap_update_bits(regmap, CDC_WSA_CLK_RST_CTRL_SWR_CONTROL,
CDC_WSA_SWR_CLK_EN_MASK, 0); CDC_WSA_SWR_CLK_EN_MASK, 0);
wsa_macro_mclk_enable(wsa, false); wsa_macro_mclk_enable(wsa, false);
clk_disable_unprepare(wsa->mclk);
} }
return 0; return 0;
...@@ -2354,7 +2362,7 @@ static int wsa_macro_register_mclk_output(struct wsa_macro *wsa) ...@@ -2354,7 +2362,7 @@ static int wsa_macro_register_mclk_output(struct wsa_macro *wsa)
struct clk_init_data init; struct clk_init_data init;
int ret; int ret;
parent_clk_name = __clk_get_name(wsa->mclk); parent_clk_name = __clk_get_name(wsa->npl);
init.name = clk_name; init.name = clk_name;
init.ops = &swclk_gate_ops; init.ops = &swclk_gate_ops;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册