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 <quic_shuzhan@quicinc.com>
This commit is contained in:
Shuai Zhang 2022-03-04 12:27:06 +05:30
commit 7696eb78b6

View file

@ -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 <linux/kernel.h>
@ -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++) {