Lines Matching refs:clk_data

21 static void mtk_init_clk_data(struct clk_hw_onecell_data *clk_data,  in mtk_init_clk_data()  argument
26 clk_data->num = clk_num; in mtk_init_clk_data()
29 clk_data->hws[i] = ERR_PTR(-ENOENT); in mtk_init_clk_data()
35 struct clk_hw_onecell_data *clk_data; in mtk_devm_alloc_clk_data() local
37 clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, clk_num), in mtk_devm_alloc_clk_data()
39 if (!clk_data) in mtk_devm_alloc_clk_data()
42 mtk_init_clk_data(clk_data, clk_num); in mtk_devm_alloc_clk_data()
44 return clk_data; in mtk_devm_alloc_clk_data()
50 struct clk_hw_onecell_data *clk_data; in mtk_alloc_clk_data() local
52 clk_data = kzalloc(struct_size(clk_data, hws, clk_num), GFP_KERNEL); in mtk_alloc_clk_data()
53 if (!clk_data) in mtk_alloc_clk_data()
56 mtk_init_clk_data(clk_data, clk_num); in mtk_alloc_clk_data()
58 return clk_data; in mtk_alloc_clk_data()
62 void mtk_free_clk_data(struct clk_hw_onecell_data *clk_data) in mtk_free_clk_data() argument
64 kfree(clk_data); in mtk_free_clk_data()
69 struct clk_hw_onecell_data *clk_data) in mtk_clk_register_fixed_clks() argument
74 if (!clk_data) in mtk_clk_register_fixed_clks()
80 if (!IS_ERR_OR_NULL(clk_data->hws[rc->id])) { in mtk_clk_register_fixed_clks()
94 clk_data->hws[rc->id] = hw; in mtk_clk_register_fixed_clks()
103 if (IS_ERR_OR_NULL(clk_data->hws[rc->id])) in mtk_clk_register_fixed_clks()
106 clk_hw_unregister_fixed_rate(clk_data->hws[rc->id]); in mtk_clk_register_fixed_clks()
107 clk_data->hws[rc->id] = ERR_PTR(-ENOENT); in mtk_clk_register_fixed_clks()
115 struct clk_hw_onecell_data *clk_data) in mtk_clk_unregister_fixed_clks() argument
119 if (!clk_data) in mtk_clk_unregister_fixed_clks()
125 if (IS_ERR_OR_NULL(clk_data->hws[rc->id])) in mtk_clk_unregister_fixed_clks()
128 clk_hw_unregister_fixed_rate(clk_data->hws[rc->id]); in mtk_clk_unregister_fixed_clks()
129 clk_data->hws[rc->id] = ERR_PTR(-ENOENT); in mtk_clk_unregister_fixed_clks()
135 struct clk_hw_onecell_data *clk_data) in mtk_clk_register_factors() argument
140 if (!clk_data) in mtk_clk_register_factors()
146 if (!IS_ERR_OR_NULL(clk_data->hws[ff->id])) { in mtk_clk_register_factors()
160 clk_data->hws[ff->id] = hw; in mtk_clk_register_factors()
169 if (IS_ERR_OR_NULL(clk_data->hws[ff->id])) in mtk_clk_register_factors()
172 clk_hw_unregister_fixed_factor(clk_data->hws[ff->id]); in mtk_clk_register_factors()
173 clk_data->hws[ff->id] = ERR_PTR(-ENOENT); in mtk_clk_register_factors()
181 struct clk_hw_onecell_data *clk_data) in mtk_clk_unregister_factors() argument
185 if (!clk_data) in mtk_clk_unregister_factors()
191 if (IS_ERR_OR_NULL(clk_data->hws[ff->id])) in mtk_clk_unregister_factors()
194 clk_hw_unregister_fixed_factor(clk_data->hws[ff->id]); in mtk_clk_unregister_factors()
195 clk_data->hws[ff->id] = ERR_PTR(-ENOENT); in mtk_clk_unregister_factors()
313 struct clk_hw_onecell_data *clk_data) in mtk_clk_register_composites() argument
318 if (!clk_data) in mtk_clk_register_composites()
324 if (!IS_ERR_OR_NULL(clk_data->hws[mc->id])) { in mtk_clk_register_composites()
338 clk_data->hws[mc->id] = hw; in mtk_clk_register_composites()
347 if (IS_ERR_OR_NULL(clk_data->hws[mcs->id])) in mtk_clk_register_composites()
350 mtk_clk_unregister_composite(clk_data->hws[mc->id]); in mtk_clk_register_composites()
351 clk_data->hws[mc->id] = ERR_PTR(-ENOENT); in mtk_clk_register_composites()
359 struct clk_hw_onecell_data *clk_data) in mtk_clk_unregister_composites() argument
363 if (!clk_data) in mtk_clk_unregister_composites()
369 if (IS_ERR_OR_NULL(clk_data->hws[mc->id])) in mtk_clk_unregister_composites()
372 mtk_clk_unregister_composite(clk_data->hws[mc->id]); in mtk_clk_unregister_composites()
373 clk_data->hws[mc->id] = ERR_PTR(-ENOENT); in mtk_clk_unregister_composites()
380 struct clk_hw_onecell_data *clk_data) in mtk_clk_register_dividers() argument
385 if (!clk_data) in mtk_clk_register_dividers()
391 if (!IS_ERR_OR_NULL(clk_data->hws[mcd->id])) { in mtk_clk_register_dividers()
407 clk_data->hws[mcd->id] = hw; in mtk_clk_register_dividers()
416 if (IS_ERR_OR_NULL(clk_data->hws[mcd->id])) in mtk_clk_register_dividers()
419 clk_hw_unregister_divider(clk_data->hws[mcd->id]); in mtk_clk_register_dividers()
420 clk_data->hws[mcd->id] = ERR_PTR(-ENOENT); in mtk_clk_register_dividers()
428 struct clk_hw_onecell_data *clk_data) in mtk_clk_unregister_dividers() argument
432 if (!clk_data) in mtk_clk_unregister_dividers()
438 if (IS_ERR_OR_NULL(clk_data->hws[mcd->id])) in mtk_clk_unregister_dividers()
441 clk_hw_unregister_divider(clk_data->hws[mcd->id]); in mtk_clk_unregister_dividers()
442 clk_data->hws[mcd->id] = ERR_PTR(-ENOENT); in mtk_clk_unregister_dividers()
450 struct clk_hw_onecell_data *clk_data; in mtk_clk_simple_probe() local
458 clk_data = mtk_alloc_clk_data(mcd->num_clks); in mtk_clk_simple_probe()
459 if (!clk_data) in mtk_clk_simple_probe()
463 clk_data, &pdev->dev); in mtk_clk_simple_probe()
467 r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); in mtk_clk_simple_probe()
471 platform_set_drvdata(pdev, clk_data); in mtk_clk_simple_probe()
483 mtk_clk_unregister_gates(mcd->clks, mcd->num_clks, clk_data); in mtk_clk_simple_probe()
485 mtk_free_clk_data(clk_data); in mtk_clk_simple_probe()
493 struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev); in mtk_clk_simple_remove() local
497 mtk_clk_unregister_gates(mcd->clks, mcd->num_clks, clk_data); in mtk_clk_simple_remove()
498 mtk_free_clk_data(clk_data); in mtk_clk_simple_remove()