Message ID | 20220221131037.8809-10-srinivas.kandagatla@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ASoC: codec: add pm runtime support for Qualcomm codecs | expand |
On Mon, Feb 21, 2022 at 01:10:36PM +0000, Srinivas Kandagatla wrote: > 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. A lot of these commit messages sound like earlier patches in the series introduced bugs which isn't going to be ideal for bisection.
On 21/02/2022 15:38, Mark Brown wrote: > On Mon, Feb 21, 2022 at 01:10:36PM +0000, Srinivas Kandagatla wrote: >> 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. > > A lot of these commit messages sound like earlier patches in the series > introduced bugs which isn't going to be ideal for bisection. Yes that is true, I did think about sending this as a fix. Adding a fix tag would not really make any functional difference as we will be hitting the issue only when we enable pm runtime in codec and SoundWire controller, so I did add this as part of pm runtime patches. Without runtime pm the clocks are left always on, so it worked so far. --srini
On Mon, Feb 21, 2022 at 04:11:56PM +0000, Srinivas Kandagatla wrote: > On 21/02/2022 15:38, Mark Brown wrote: > > A lot of these commit messages sound like earlier patches in the series > > introduced bugs which isn't going to be ideal for bisection. > Yes that is true, I did think about sending this as a fix. > Adding a fix tag would not really make any functional difference as we will > be hitting the issue only when we enable pm runtime in codec and > SoundWire controller, so I did add this as part of pm runtime patches. > Without runtime pm the clocks are left always on, so it worked so far. You still need to pull this before you introduce changes that cause trouble, not after - it needs to be preparation for those other changes.
On 21/02/2022 16:48, Mark Brown wrote: > On Mon, Feb 21, 2022 at 04:11:56PM +0000, Srinivas Kandagatla wrote: >> On 21/02/2022 15:38, Mark Brown wrote: > >>> A lot of these commit messages sound like earlier patches in the series >>> introduced bugs which isn't going to be ideal for bisection. > >> Yes that is true, I did think about sending this as a fix. > >> Adding a fix tag would not really make any functional difference as we will >> be hitting the issue only when we enable pm runtime in codec and >> SoundWire controller, so I did add this as part of pm runtime patches. > >> Without runtime pm the clocks are left always on, so it worked so far. > > You still need to pull this before you introduce changes that cause > trouble, not after - it needs to be preparation for those other changes. I agree, Will reorder this in next spin. --srini
diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c index 1c0f0d27ed42..f90786100d1a 100644 --- a/sound/soc/codecs/lpass-tx-macro.c +++ b/sound/soc/codecs/lpass-tx-macro.c @@ -1687,6 +1687,7 @@ static int swclk_gate_enable(struct clk_hw *hw) struct tx_macro *tx = to_tx_macro(hw); struct regmap *regmap = tx->regmap; + clk_prepare_enable(tx->clks[2].clk); tx_macro_mclk_enable(tx, true); if (tx->reset_swr) regmap_update_bits(regmap, CDC_TX_CLK_RST_CTRL_SWR_CONTROL, @@ -1713,6 +1714,7 @@ static void swclk_gate_disable(struct clk_hw *hw) CDC_TX_SWR_CLK_EN_MASK, 0x0); tx_macro_mclk_enable(tx, false); + clk_disable_unprepare(tx->clks[2].clk); } static int swclk_gate_is_enabled(struct clk_hw *hw) @@ -1750,7 +1752,7 @@ static struct clk *tx_macro_register_mclk_output(struct tx_macro *tx) struct clk_init_data init; int ret; - parent_clk_name = __clk_get_name(tx->clks[2].clk); + parent_clk_name = __clk_get_name(tx->clks[3].clk); init.name = clk_name; init.ops = &swclk_gate_ops;
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: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> --- sound/soc/codecs/lpass-tx-macro.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)