Lines Matching +full:jh7110 +full:- +full:ispcrg
1 // SPDX-License-Identifier: GPL-2.0
3 * StarFive JH7110 Image-Signal-Process Clock Driver
5 * Copyright (C) 2022-2023 StarFive Technology Co., Ltd.
9 #include <linux/clk-provider.h>
15 #include <dt-bindings/clock/starfive,jh7110-crg.h>
17 #include "clk-starfive-jh7110.h"
70 top_rsts = devm_reset_control_array_get_shared(priv->dev); in jh7110_isp_top_rst_init()
72 return dev_err_probe(priv->dev, PTR_ERR(top_rsts), in jh7110_isp_top_rst_init()
81 unsigned int idx = clkspec->args[0]; in jh7110_ispclk_get()
84 return &priv->reg[idx].hw; in jh7110_ispclk_get()
86 return ERR_PTR(-EINVAL); in jh7110_ispclk_get()
94 clk_bulk_disable_unprepare(top->top_clks_num, top->top_clks); in jh7110_ispcrg_suspend()
103 return clk_bulk_prepare_enable(top->top_clks_num, top->top_clks); in jh7110_ispcrg_resume()
118 priv = devm_kzalloc(&pdev->dev, in jh7110_ispcrg_probe()
122 return -ENOMEM; in jh7110_ispcrg_probe()
124 top = devm_kzalloc(&pdev->dev, sizeof(*top), GFP_KERNEL); in jh7110_ispcrg_probe()
126 return -ENOMEM; in jh7110_ispcrg_probe()
128 spin_lock_init(&priv->rmw_lock); in jh7110_ispcrg_probe()
129 priv->dev = &pdev->dev; in jh7110_ispcrg_probe()
130 priv->base = devm_platform_ioremap_resource(pdev, 0); in jh7110_ispcrg_probe()
131 if (IS_ERR(priv->base)) in jh7110_ispcrg_probe()
132 return PTR_ERR(priv->base); in jh7110_ispcrg_probe()
134 top->top_clks = jh7110_isp_top_clks; in jh7110_ispcrg_probe()
135 top->top_clks_num = ARRAY_SIZE(jh7110_isp_top_clks); in jh7110_ispcrg_probe()
136 ret = devm_clk_bulk_get(priv->dev, top->top_clks_num, top->top_clks); in jh7110_ispcrg_probe()
138 return dev_err_probe(priv->dev, ret, "failed to get main clocks\n"); in jh7110_ispcrg_probe()
139 dev_set_drvdata(priv->dev, top); in jh7110_ispcrg_probe()
142 pm_runtime_enable(priv->dev); in jh7110_ispcrg_probe()
143 ret = pm_runtime_get_sync(priv->dev); in jh7110_ispcrg_probe()
145 return dev_err_probe(priv->dev, ret, "failed to turn on power\n"); in jh7110_ispcrg_probe()
162 struct jh71x0_clk *clk = &priv->reg[idx]; in jh7110_ispcrg_probe()
164 const char *fw_name[JH7110_ISPCLK_EXT_END - JH7110_ISPCLK_END] = { in jh7110_ispcrg_probe()
175 parents[i].hw = &priv->reg[pidx].hw; in jh7110_ispcrg_probe()
177 parents[i].fw_name = fw_name[pidx - JH7110_ISPCLK_END]; in jh7110_ispcrg_probe()
180 clk->hw.init = &init; in jh7110_ispcrg_probe()
181 clk->idx = idx; in jh7110_ispcrg_probe()
182 clk->max_div = max & JH71X0_CLK_DIV_MASK; in jh7110_ispcrg_probe()
184 ret = devm_clk_hw_register(&pdev->dev, &clk->hw); in jh7110_ispcrg_probe()
189 ret = devm_of_clk_add_hw_provider(&pdev->dev, jh7110_ispclk_get, priv); in jh7110_ispcrg_probe()
193 ret = jh7110_reset_controller_register(priv, "rst-isp", 3); in jh7110_ispcrg_probe()
200 pm_runtime_put_sync(priv->dev); in jh7110_ispcrg_probe()
201 pm_runtime_disable(priv->dev); in jh7110_ispcrg_probe()
207 pm_runtime_put_sync(&pdev->dev); in jh7110_ispcrg_remove()
208 pm_runtime_disable(&pdev->dev); in jh7110_ispcrg_remove()
212 { .compatible = "starfive,jh7110-ispcrg" },
221 .name = "clk-starfive-jh7110-isp",
229 MODULE_DESCRIPTION("StarFive JH7110 Image-Signal-Process clock driver");