clk: mediatek: clk-mtk: Introduce mtk_clk_get_hwv_regmap()

On MT8196, some clock controllers use a separate regmap for hardware
voting via set/clear/status registers. Add mtk_clk_get_hwv_regmap() to
retrieve this optional regmap, avoiding duplicated lookup code in 
mtk_clk_register_muxes() and mtk_clk_register_gate().

Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Laura Nao <laura.nao@collabora.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
Laura Nao
2025-09-15 17:19:24 +02:00
committed by Stephen Boyd
parent d3c4dde977
commit 516edf79a5
2 changed files with 17 additions and 0 deletions

View File

@@ -685,4 +685,20 @@ void mtk_clk_simple_remove(struct platform_device *pdev)
}
EXPORT_SYMBOL_GPL(mtk_clk_simple_remove);
struct regmap *mtk_clk_get_hwv_regmap(struct device_node *node)
{
struct device_node *hwv_node;
struct regmap *regmap_hwv;
hwv_node = of_parse_phandle(node, "mediatek,hardware-voter", 0);
if (!hwv_node)
return NULL;
regmap_hwv = device_node_to_regmap(hwv_node);
of_node_put(hwv_node);
return regmap_hwv;
}
EXPORT_SYMBOL_GPL(mtk_clk_get_hwv_regmap);
MODULE_LICENSE("GPL");

View File

@@ -245,5 +245,6 @@ int mtk_clk_pdev_probe(struct platform_device *pdev);
void mtk_clk_pdev_remove(struct platform_device *pdev);
int mtk_clk_simple_probe(struct platform_device *pdev);
void mtk_clk_simple_remove(struct platform_device *pdev);
struct regmap *mtk_clk_get_hwv_regmap(struct device_node *node);
#endif /* __DRV_CLK_MTK_H */