Lines Matching full:clk

10 #include <linux/clk-provider.h>
20 #include "clk-scu.h"
82 * @clk: clk type of this resource
90 u8 clk; member
95 u8 clk; member
131 u8 clk; member
149 u8 clk; member
157 * @clk: clk type of this resource
166 u8 clk; member
232 struct clk_scu *clk = to_clk_scu(hw); in clk_scu_recalc_rate() local
242 msg.data.req.resource = cpu_to_le16(clk->rsrc_id); in clk_scu_recalc_rate()
243 msg.data.req.clk = clk->clk_type; in clk_scu_recalc_rate()
293 struct clk_scu *clk = to_clk_scu(hw); in clk_scu_atf_set_cpu_rate() local
297 if (clk->rsrc_id == IMX_SC_R_A35 || clk->rsrc_id == IMX_SC_R_A53) in clk_scu_atf_set_cpu_rate()
299 else if (clk->rsrc_id == IMX_SC_R_A72) in clk_scu_atf_set_cpu_rate()
323 struct clk_scu *clk = to_clk_scu(hw); in clk_scu_set_rate() local
333 msg.resource = cpu_to_le16(clk->rsrc_id); in clk_scu_set_rate()
334 msg.clk = clk->clk_type; in clk_scu_set_rate()
341 struct clk_scu *clk = to_clk_scu(hw); in clk_scu_get_parent() local
351 msg.data.req.resource = cpu_to_le16(clk->rsrc_id); in clk_scu_get_parent()
352 msg.data.req.clk = clk->clk_type; in clk_scu_get_parent()
361 clk->parent_index = msg.data.resp.parent; in clk_scu_get_parent()
368 struct clk_scu *clk = to_clk_scu(hw); in clk_scu_set_parent() local
378 msg.resource = cpu_to_le16(clk->rsrc_id); in clk_scu_set_parent()
379 msg.clk = clk->clk_type; in clk_scu_set_parent()
389 clk->parent_index = index; in clk_scu_set_parent()
395 u8 clk, bool enable, bool autog) in sc_pm_clock_enable() argument
406 msg.clk = clk; in sc_pm_clock_enable()
421 struct clk_scu *clk = to_clk_scu(hw); in clk_scu_prepare() local
423 return sc_pm_clock_enable(ccm_ipc_handle, clk->rsrc_id, in clk_scu_prepare()
424 clk->clk_type, true, false); in clk_scu_prepare()
435 struct clk_scu *clk = to_clk_scu(hw); in clk_scu_unprepare() local
438 ret = sc_pm_clock_enable(ccm_ipc_handle, clk->rsrc_id, in clk_scu_unprepare()
439 clk->clk_type, false, false); in clk_scu_unprepare()
441 pr_warn("%s: clk unprepare failed %d\n", clk_hw_get_name(hw), in clk_scu_unprepare()
474 struct clk_scu *clk; in __imx_clk_scu() local
478 clk = kzalloc(sizeof(*clk), GFP_KERNEL); in __imx_clk_scu()
479 if (!clk) in __imx_clk_scu()
482 clk->rsrc_id = rsrc_id; in __imx_clk_scu()
483 clk->clk_type = clk_type; in __imx_clk_scu()
504 clk->hw.init = &init; in __imx_clk_scu()
506 hw = &clk->hw; in __imx_clk_scu()
509 kfree(clk); in __imx_clk_scu()
515 dev_set_drvdata(dev, clk); in __imx_clk_scu()
526 struct imx_scu_clk_node *clk; in imx_scu_of_clk_src_get() local
528 list_for_each_entry(clk, &scu_clks[rsrc], node) { in imx_scu_of_clk_src_get()
529 if (clk->clk_type == idx) in imx_scu_of_clk_src_get()
530 return clk->hw; in imx_scu_of_clk_src_get()
539 struct imx_scu_clk_node *clk = dev_get_platdata(dev); in imx_clk_scu_probe() local
543 if (!((clk->rsrc == IMX_SC_R_A35) || (clk->rsrc == IMX_SC_R_A53) || in imx_clk_scu_probe()
544 (clk->rsrc == IMX_SC_R_A72))) { in imx_clk_scu_probe()
558 hw = __imx_clk_scu(dev, clk->name, clk->parents, clk->num_parents, in imx_clk_scu_probe()
559 clk->rsrc, clk->clk_type); in imx_clk_scu_probe()
565 clk->hw = hw; in imx_clk_scu_probe()
566 list_add_tail(&clk->node, &imx_scu_clks[clk->rsrc]); in imx_clk_scu_probe()
568 if (!((clk->rsrc == IMX_SC_R_A35) || (clk->rsrc == IMX_SC_R_A53) || in imx_clk_scu_probe()
569 (clk->rsrc == IMX_SC_R_A72))) { in imx_clk_scu_probe()
574 dev_dbg(dev, "register SCU clock rsrc:%d type:%d\n", clk->rsrc, in imx_clk_scu_probe()
575 clk->clk_type); in imx_clk_scu_probe()
582 struct clk_scu *clk = dev_get_drvdata(dev); in imx_clk_scu_suspend() local
583 u32 rsrc_id = clk->rsrc_id; in imx_clk_scu_suspend()
589 clk->parent = clk_hw_get_parent(&clk->hw); in imx_clk_scu_suspend()
592 if (clk->rsrc_id == IMX_SC_R_DC_0_VIDEO0 || in imx_clk_scu_suspend()
593 clk->rsrc_id == IMX_SC_R_DC_0_VIDEO1 || in imx_clk_scu_suspend()
594 clk->rsrc_id == IMX_SC_R_DC_1_VIDEO0 || in imx_clk_scu_suspend()
595 clk->rsrc_id == IMX_SC_R_DC_1_VIDEO1) in imx_clk_scu_suspend()
596 clk->rate = clk_scu_recalc_rate(&clk->hw, 0); in imx_clk_scu_suspend()
598 clk->rate = clk_hw_get_rate(&clk->hw); in imx_clk_scu_suspend()
599 clk->is_enabled = clk_hw_is_enabled(&clk->hw); in imx_clk_scu_suspend()
601 if (clk->parent) in imx_clk_scu_suspend()
602 dev_dbg(dev, "save parent %s idx %u\n", clk_hw_get_name(clk->parent), in imx_clk_scu_suspend()
603 clk->parent_index); in imx_clk_scu_suspend()
605 if (clk->rate) in imx_clk_scu_suspend()
606 dev_dbg(dev, "save rate %d\n", clk->rate); in imx_clk_scu_suspend()
608 if (clk->is_enabled) in imx_clk_scu_suspend()
616 struct clk_scu *clk = dev_get_drvdata(dev); in imx_clk_scu_resume() local
617 u32 rsrc_id = clk->rsrc_id; in imx_clk_scu_resume()
624 if (clk->parent) { in imx_clk_scu_resume()
625 ret = clk_scu_set_parent(&clk->hw, clk->parent_index); in imx_clk_scu_resume()
627 clk_hw_get_name(clk->parent), in imx_clk_scu_resume()
628 clk->parent_index, !ret ? "success" : "failed"); in imx_clk_scu_resume()
631 if (clk->rate) { in imx_clk_scu_resume()
632 ret = clk_scu_set_rate(&clk->hw, clk->rate, 0); in imx_clk_scu_resume()
633 dev_dbg(dev, "restore rate %d %s\n", clk->rate, in imx_clk_scu_resume()
637 if (clk->is_enabled && rsrc_id != IMX_SC_R_PI_0_PLL) { in imx_clk_scu_resume()
638 ret = clk_scu_prepare(&clk->hw); in imx_clk_scu_resume()
653 .name = "imx-scu-clk",
691 struct imx_scu_clk_node clk = { in imx_clk_scu_alloc_dev() local
709 pr_err("%s: failed to allocate scu clk dev rsrc %d type %d\n", in imx_clk_scu_alloc_dev()
714 ret = platform_device_add_data(pdev, &clk, sizeof(clk)); in imx_clk_scu_alloc_dev()
719 "imx-scu-clk", strlen("imx-scu-clk")); in imx_clk_scu_alloc_dev()
742 struct imx_scu_clk_node *clk, *n; in imx_clk_scu_unregister() local
746 list_for_each_entry_safe(clk, n, &imx_scu_clks[i], node) { in imx_clk_scu_unregister()
747 clk_hw_unregister(clk->hw); in imx_clk_scu_unregister()
748 kfree(clk); in imx_clk_scu_unregister()
756 struct clk_gpr_scu *clk = to_clk_gpr_scu(hw); in clk_gpr_div_scu_recalc_rate() local
761 err = imx_sc_misc_get_control(ccm_ipc_handle, clk->rsrc_id, in clk_gpr_div_scu_recalc_rate()
762 clk->gpr_id, &val); in clk_gpr_div_scu_recalc_rate()
783 struct clk_gpr_scu *clk = to_clk_gpr_scu(hw); in clk_gpr_div_scu_set_rate() local
788 err = imx_sc_misc_set_control(ccm_ipc_handle, clk->rsrc_id, in clk_gpr_div_scu_set_rate()
789 clk->gpr_id, val); in clk_gpr_div_scu_set_rate()
802 struct clk_gpr_scu *clk = to_clk_gpr_scu(hw); in clk_gpr_mux_scu_get_parent() local
805 imx_sc_misc_get_control(ccm_ipc_handle, clk->rsrc_id, in clk_gpr_mux_scu_get_parent()
806 clk->gpr_id, &val); in clk_gpr_mux_scu_get_parent()
813 struct clk_gpr_scu *clk = to_clk_gpr_scu(hw); in clk_gpr_mux_scu_set_parent() local
815 return imx_sc_misc_set_control(ccm_ipc_handle, clk->rsrc_id, in clk_gpr_mux_scu_set_parent()
816 clk->gpr_id, index); in clk_gpr_mux_scu_set_parent()
827 struct clk_gpr_scu *clk = to_clk_gpr_scu(hw); in clk_gpr_gate_scu_prepare() local
829 return imx_sc_misc_set_control(ccm_ipc_handle, clk->rsrc_id, in clk_gpr_gate_scu_prepare()
830 clk->gpr_id, !clk->gate_invert); in clk_gpr_gate_scu_prepare()
835 struct clk_gpr_scu *clk = to_clk_gpr_scu(hw); in clk_gpr_gate_scu_unprepare() local
838 ret = imx_sc_misc_set_control(ccm_ipc_handle, clk->rsrc_id, in clk_gpr_gate_scu_unprepare()
839 clk->gpr_id, clk->gate_invert); in clk_gpr_gate_scu_unprepare()
841 pr_err("%s: clk unprepare failed %d\n", clk_hw_get_name(hw), in clk_gpr_gate_scu_unprepare()
847 struct clk_gpr_scu *clk = to_clk_gpr_scu(hw); in clk_gpr_gate_scu_is_prepared() local
851 ret = imx_sc_misc_get_control(ccm_ipc_handle, clk->rsrc_id, in clk_gpr_gate_scu_is_prepared()
852 clk->gpr_id, &val); in clk_gpr_gate_scu_is_prepared()
856 return clk->gate_invert ? !val : val; in clk_gpr_gate_scu_is_prepared()
870 struct clk_gpr_scu *clk; in __imx_clk_gpr_scu() local
892 clk = kzalloc(sizeof(*clk), GFP_KERNEL); in __imx_clk_gpr_scu()
893 if (!clk) { in __imx_clk_gpr_scu()
898 clk->rsrc_id = rsrc_id; in __imx_clk_gpr_scu()
899 clk->gpr_id = gpr_id; in __imx_clk_gpr_scu()
900 clk->flags = flags; in __imx_clk_gpr_scu()
901 clk->gate_invert = invert; in __imx_clk_gpr_scu()
917 clk->hw.init = &init; in __imx_clk_gpr_scu()
919 hw = &clk->hw; in __imx_clk_gpr_scu()
922 kfree(clk); in __imx_clk_gpr_scu()