From 7696eb78b6112e3d44ae1d50e34dbdd030ed4381 Mon Sep 17 00:00:00 2001 From: Shuai Zhang Date: Fri, 4 Mar 2022 12:27:06 +0530 Subject: [PATCH] ASOC: ext-clk: Fix hw init issue caused by CLK upgrade CLK driver upgrade causes hw->init to be NULL. Unable to get hw->init from CLK core. Modify to obtain hw->init from local static data. Change-Id: I2ffc3e7dfd356cfcb2735336dd67ff70a35328c4 Signed-off-by: Shuai Zhang --- asoc/codecs/audio-ext-clk-up.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/asoc/codecs/audio-ext-clk-up.c b/asoc/codecs/audio-ext-clk-up.c index acd00da91404..f3e9b694c5b5 100644 --- a/asoc/codecs/audio-ext-clk-up.c +++ b/asoc/codecs/audio-ext-clk-up.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -58,6 +59,8 @@ struct audio_ext_clk_priv { uint32_t lpass_audio_hwvote_client_handle; }; +static struct audio_ext_clk audio_clk_array[]; + static inline struct audio_ext_clk_priv *to_audio_clk(struct clk_hw *hw) { return container_of(hw, struct audio_ext_clk_priv, audio_clk.fact.hw); @@ -137,8 +140,8 @@ static u8 audio_ext_clk_get_parent(struct clk_hw *hw) { struct audio_ext_clk_priv *clk_priv = to_audio_clk(hw); int num_parents = clk_hw_get_num_parents(hw); - const char * const *parent_names = hw->init->parent_names; - u8 i = 0, ret = hw->init->num_parents + 1; + const char * const *parent_names = audio_clk_array[clk_priv->clk_src].fact.hw.init->parent_names; + u8 i = 0, ret = num_parents + 1; if ((clk_priv->clk_src == AUDIO_EXT_CLK_PMI) && clk_priv->clk_name) { for (i = 0; i < num_parents; i++) {