Lines Matching +full:mt8188 +full:- +full:afe

1 // SPDX-License-Identifier: GPL-2.0
3 * mt8188-audsys-clk.c -- MediaTek 8188 audsys clock control
6 * Author: Chun-Chia Chiu <chun-chia.chiu@mediatek.com>
10 #include <linux/clk-provider.h>
12 #include "mt8188-afe-common.h"
13 #include "mt8188-audsys-clk.h"
14 #include "mt8188-audsys-clkid.h"
15 #include "mt8188-reg.h"
143 struct mtk_base_afe *afe = data; in mt8188_audsys_clk_unregister() local
144 struct mt8188_afe_private *afe_priv = afe->platform_priv; in mt8188_audsys_clk_unregister()
153 cl = afe_priv->lookup[i]; in mt8188_audsys_clk_unregister()
157 clk = cl->clk; in mt8188_audsys_clk_unregister()
164 int mt8188_audsys_clk_register(struct mtk_base_afe *afe) in mt8188_audsys_clk_register() argument
166 struct mt8188_afe_private *afe_priv = afe->platform_priv; in mt8188_audsys_clk_register()
171 afe_priv->lookup = devm_kcalloc(afe->dev, CLK_AUD_NR_CLK, in mt8188_audsys_clk_register()
172 sizeof(*afe_priv->lookup), in mt8188_audsys_clk_register()
175 if (!afe_priv->lookup) in mt8188_audsys_clk_register()
176 return -ENOMEM; in mt8188_audsys_clk_register()
181 clk = clk_register_gate(afe->dev, gate->name, gate->parent_name, in mt8188_audsys_clk_register()
182 gate->flags, afe->base_addr + gate->reg, in mt8188_audsys_clk_register()
183 gate->bit, gate->cg_flags, NULL); in mt8188_audsys_clk_register()
186 dev_err(afe->dev, "Failed to register clk %s: %ld\n", in mt8188_audsys_clk_register()
187 gate->name, PTR_ERR(clk)); in mt8188_audsys_clk_register()
194 return -ENOMEM; in mt8188_audsys_clk_register()
196 cl->clk = clk; in mt8188_audsys_clk_register()
197 cl->con_id = gate->name; in mt8188_audsys_clk_register()
198 cl->dev_id = dev_name(afe->dev); in mt8188_audsys_clk_register()
199 cl->clk_hw = NULL; in mt8188_audsys_clk_register()
202 afe_priv->lookup[i] = cl; in mt8188_audsys_clk_register()
205 return devm_add_action_or_reset(afe->dev, mt8188_audsys_clk_unregister, afe); in mt8188_audsys_clk_register()