Lines Matching full:clk

10 #include <linux/clk-provider.h>
18 #include "clk-scu.h"
80 * @clk: clk type of this resource
88 u8 clk; member
93 u8 clk; member
129 u8 clk; member
147 u8 clk; member
155 * @clk: clk type of this resource
164 u8 clk; member
230 struct clk_scu *clk = to_clk_scu(hw); in clk_scu_recalc_rate() local
240 msg.data.req.resource = cpu_to_le16(clk->rsrc_id); in clk_scu_recalc_rate()
241 msg.data.req.clk = clk->clk_type; in clk_scu_recalc_rate()
274 struct clk_scu *clk = to_clk_scu(hw); in clk_scu_atf_set_cpu_rate() local
278 if (clk->rsrc_id == IMX_SC_R_A35 || clk->rsrc_id == IMX_SC_R_A53) in clk_scu_atf_set_cpu_rate()
280 else if (clk->rsrc_id == IMX_SC_R_A72) in clk_scu_atf_set_cpu_rate()
304 struct clk_scu *clk = to_clk_scu(hw); in clk_scu_set_rate() local
314 msg.resource = cpu_to_le16(clk->rsrc_id); in clk_scu_set_rate()
315 msg.clk = clk->clk_type; in clk_scu_set_rate()
322 struct clk_scu *clk = to_clk_scu(hw); in clk_scu_get_parent() local
332 msg.data.req.resource = cpu_to_le16(clk->rsrc_id); in clk_scu_get_parent()
333 msg.data.req.clk = clk->clk_type; in clk_scu_get_parent()
342 clk->parent_index = msg.data.resp.parent; in clk_scu_get_parent()
349 struct clk_scu *clk = to_clk_scu(hw); in clk_scu_set_parent() local
359 msg.resource = cpu_to_le16(clk->rsrc_id); in clk_scu_set_parent()
360 msg.clk = clk->clk_type; in clk_scu_set_parent()
370 clk->parent_index = index; in clk_scu_set_parent()
376 u8 clk, bool enable, bool autog) in sc_pm_clock_enable() argument
387 msg.clk = clk; in sc_pm_clock_enable()
402 struct clk_scu *clk = to_clk_scu(hw); in clk_scu_prepare() local
404 return sc_pm_clock_enable(ccm_ipc_handle, clk->rsrc_id, in clk_scu_prepare()
405 clk->clk_type, true, false); in clk_scu_prepare()
416 struct clk_scu *clk = to_clk_scu(hw); in clk_scu_unprepare() local
419 ret = sc_pm_clock_enable(ccm_ipc_handle, clk->rsrc_id, in clk_scu_unprepare()
420 clk->clk_type, false, false); in clk_scu_unprepare()
422 pr_warn("%s: clk unprepare failed %d\n", clk_hw_get_name(hw), in clk_scu_unprepare()
455 struct clk_scu *clk; in __imx_clk_scu() local
459 clk = kzalloc(sizeof(*clk), GFP_KERNEL); in __imx_clk_scu()
460 if (!clk) in __imx_clk_scu()
463 clk->rsrc_id = rsrc_id; in __imx_clk_scu()
464 clk->clk_type = clk_type; in __imx_clk_scu()
485 clk->hw.init = &init; in __imx_clk_scu()
487 hw = &clk->hw; in __imx_clk_scu()
490 kfree(clk); in __imx_clk_scu()
496 dev_set_drvdata(dev, clk); in __imx_clk_scu()
507 struct imx_scu_clk_node *clk; in imx_scu_of_clk_src_get() local
509 list_for_each_entry(clk, &scu_clks[rsrc], node) { in imx_scu_of_clk_src_get()
510 if (clk->clk_type == idx) in imx_scu_of_clk_src_get()
511 return clk->hw; in imx_scu_of_clk_src_get()
520 struct imx_scu_clk_node *clk = dev_get_platdata(dev); in imx_clk_scu_probe() local
524 if (!((clk->rsrc == IMX_SC_R_A35) || (clk->rsrc == IMX_SC_R_A53) || in imx_clk_scu_probe()
525 (clk->rsrc == IMX_SC_R_A72))) { in imx_clk_scu_probe()
539 hw = __imx_clk_scu(dev, clk->name, clk->parents, clk->num_parents, in imx_clk_scu_probe()
540 clk->rsrc, clk->clk_type); in imx_clk_scu_probe()
546 clk->hw = hw; in imx_clk_scu_probe()
547 list_add_tail(&clk->node, &imx_scu_clks[clk->rsrc]); in imx_clk_scu_probe()
549 if (!((clk->rsrc == IMX_SC_R_A35) || (clk->rsrc == IMX_SC_R_A53) || in imx_clk_scu_probe()
550 (clk->rsrc == IMX_SC_R_A72))) { in imx_clk_scu_probe()
555 dev_dbg(dev, "register SCU clock rsrc:%d type:%d\n", clk->rsrc, in imx_clk_scu_probe()
556 clk->clk_type); in imx_clk_scu_probe()
563 struct clk_scu *clk = dev_get_drvdata(dev); in imx_clk_scu_suspend() local
564 u32 rsrc_id = clk->rsrc_id; in imx_clk_scu_suspend()
570 clk->parent = clk_hw_get_parent(&clk->hw); in imx_clk_scu_suspend()
573 if (clk->rsrc_id == IMX_SC_R_DC_0_VIDEO0 || in imx_clk_scu_suspend()
574 clk->rsrc_id == IMX_SC_R_DC_0_VIDEO1 || in imx_clk_scu_suspend()
575 clk->rsrc_id == IMX_SC_R_DC_1_VIDEO0 || in imx_clk_scu_suspend()
576 clk->rsrc_id == IMX_SC_R_DC_1_VIDEO1) in imx_clk_scu_suspend()
577 clk->rate = clk_scu_recalc_rate(&clk->hw, 0); in imx_clk_scu_suspend()
579 clk->rate = clk_hw_get_rate(&clk->hw); in imx_clk_scu_suspend()
580 clk->is_enabled = clk_hw_is_enabled(&clk->hw); in imx_clk_scu_suspend()
582 if (clk->parent) in imx_clk_scu_suspend()
583 dev_dbg(dev, "save parent %s idx %u\n", clk_hw_get_name(clk->parent), in imx_clk_scu_suspend()
584 clk->parent_index); in imx_clk_scu_suspend()
586 if (clk->rate) in imx_clk_scu_suspend()
587 dev_dbg(dev, "save rate %d\n", clk->rate); in imx_clk_scu_suspend()
589 if (clk->is_enabled) in imx_clk_scu_suspend()
597 struct clk_scu *clk = dev_get_drvdata(dev); in imx_clk_scu_resume() local
598 u32 rsrc_id = clk->rsrc_id; in imx_clk_scu_resume()
605 if (clk->parent) { in imx_clk_scu_resume()
606 ret = clk_scu_set_parent(&clk->hw, clk->parent_index); in imx_clk_scu_resume()
608 clk_hw_get_name(clk->parent), in imx_clk_scu_resume()
609 clk->parent_index, !ret ? "success" : "failed"); in imx_clk_scu_resume()
612 if (clk->rate) { in imx_clk_scu_resume()
613 ret = clk_scu_set_rate(&clk->hw, clk->rate, 0); in imx_clk_scu_resume()
614 dev_dbg(dev, "restore rate %d %s\n", clk->rate, in imx_clk_scu_resume()
618 if (clk->is_enabled && rsrc_id != IMX_SC_R_PI_0_PLL) { in imx_clk_scu_resume()
619 ret = clk_scu_prepare(&clk->hw); in imx_clk_scu_resume()
634 .name = "imx-scu-clk",
660 struct imx_scu_clk_node clk = { in imx_clk_scu_alloc_dev() local
675 pr_err("%s: failed to allocate scu clk dev rsrc %d type %d\n", in imx_clk_scu_alloc_dev()
680 ret = platform_device_add_data(pdev, &clk, sizeof(clk)); in imx_clk_scu_alloc_dev()
687 "imx-scu-clk", strlen("imx-scu-clk")); in imx_clk_scu_alloc_dev()
710 struct imx_scu_clk_node *clk; in imx_clk_scu_unregister() local
714 list_for_each_entry(clk, &imx_scu_clks[i], node) { in imx_clk_scu_unregister()
715 clk_hw_unregister(clk->hw); in imx_clk_scu_unregister()
716 kfree(clk); in imx_clk_scu_unregister()
724 struct clk_gpr_scu *clk = to_clk_gpr_scu(hw); in clk_gpr_div_scu_recalc_rate() local
729 err = imx_sc_misc_get_control(ccm_ipc_handle, clk->rsrc_id, in clk_gpr_div_scu_recalc_rate()
730 clk->gpr_id, &val); in clk_gpr_div_scu_recalc_rate()
751 struct clk_gpr_scu *clk = to_clk_gpr_scu(hw); in clk_gpr_div_scu_set_rate() local
756 err = imx_sc_misc_set_control(ccm_ipc_handle, clk->rsrc_id, in clk_gpr_div_scu_set_rate()
757 clk->gpr_id, val); in clk_gpr_div_scu_set_rate()
770 struct clk_gpr_scu *clk = to_clk_gpr_scu(hw); in clk_gpr_mux_scu_get_parent() local
773 imx_sc_misc_get_control(ccm_ipc_handle, clk->rsrc_id, in clk_gpr_mux_scu_get_parent()
774 clk->gpr_id, &val); in clk_gpr_mux_scu_get_parent()
781 struct clk_gpr_scu *clk = to_clk_gpr_scu(hw); in clk_gpr_mux_scu_set_parent() local
783 return imx_sc_misc_set_control(ccm_ipc_handle, clk->rsrc_id, in clk_gpr_mux_scu_set_parent()
784 clk->gpr_id, index); in clk_gpr_mux_scu_set_parent()
794 struct clk_gpr_scu *clk = to_clk_gpr_scu(hw); in clk_gpr_gate_scu_prepare() local
796 return imx_sc_misc_set_control(ccm_ipc_handle, clk->rsrc_id, in clk_gpr_gate_scu_prepare()
797 clk->gpr_id, !clk->gate_invert); in clk_gpr_gate_scu_prepare()
802 struct clk_gpr_scu *clk = to_clk_gpr_scu(hw); in clk_gpr_gate_scu_unprepare() local
805 ret = imx_sc_misc_set_control(ccm_ipc_handle, clk->rsrc_id, in clk_gpr_gate_scu_unprepare()
806 clk->gpr_id, clk->gate_invert); in clk_gpr_gate_scu_unprepare()
808 pr_err("%s: clk unprepare failed %d\n", clk_hw_get_name(hw), in clk_gpr_gate_scu_unprepare()
814 struct clk_gpr_scu *clk = to_clk_gpr_scu(hw); in clk_gpr_gate_scu_is_prepared() local
818 ret = imx_sc_misc_get_control(ccm_ipc_handle, clk->rsrc_id, in clk_gpr_gate_scu_is_prepared()
819 clk->gpr_id, &val); in clk_gpr_gate_scu_is_prepared()
823 return clk->gate_invert ? !val : val; in clk_gpr_gate_scu_is_prepared()
837 struct clk_gpr_scu *clk; in __imx_clk_gpr_scu() local
854 clk = kzalloc(sizeof(*clk), GFP_KERNEL); in __imx_clk_gpr_scu()
855 if (!clk) { in __imx_clk_gpr_scu()
860 clk->rsrc_id = rsrc_id; in __imx_clk_gpr_scu()
861 clk->gpr_id = gpr_id; in __imx_clk_gpr_scu()
862 clk->flags = flags; in __imx_clk_gpr_scu()
863 clk->gate_invert = invert; in __imx_clk_gpr_scu()
879 clk->hw.init = &init; in __imx_clk_gpr_scu()
881 hw = &clk->hw; in __imx_clk_gpr_scu()
884 kfree(clk); in __imx_clk_gpr_scu()