Lines Matching +full:init +full:- +full:delay

1 // SPDX-License-Identifier: GPL-2.0
6 * Copyright (c) 2013-2014 Texas Instruments, Inc.
13 #include <linux/clk-provider.h>
30 int delay; member
57 ret = palmas_update_bits(cinfo->palmas, PALMAS_RESOURCE_BASE, in palmas_clks_prepare()
58 cinfo->clk_desc->control_reg, in palmas_clks_prepare()
59 cinfo->clk_desc->enable_mask, in palmas_clks_prepare()
60 cinfo->clk_desc->enable_mask); in palmas_clks_prepare()
62 dev_err(cinfo->dev, "Reg 0x%02x update failed, %d\n", in palmas_clks_prepare()
63 cinfo->clk_desc->control_reg, ret); in palmas_clks_prepare()
64 else if (cinfo->clk_desc->delay) in palmas_clks_prepare()
65 udelay(cinfo->clk_desc->delay); in palmas_clks_prepare()
79 if (cinfo->ext_control_pin) in palmas_clks_unprepare()
82 ret = palmas_update_bits(cinfo->palmas, PALMAS_RESOURCE_BASE, in palmas_clks_unprepare()
83 cinfo->clk_desc->control_reg, in palmas_clks_unprepare()
84 cinfo->clk_desc->enable_mask, 0); in palmas_clks_unprepare()
86 dev_err(cinfo->dev, "Reg 0x%02x update failed, %d\n", in palmas_clks_unprepare()
87 cinfo->clk_desc->control_reg, ret); in palmas_clks_unprepare()
96 if (cinfo->ext_control_pin) in palmas_clks_is_prepared()
99 ret = palmas_read(cinfo->palmas, PALMAS_RESOURCE_BASE, in palmas_clks_is_prepared()
100 cinfo->clk_desc->control_reg, &val); in palmas_clks_is_prepared()
102 dev_err(cinfo->dev, "Reg 0x%02x read failed, %d\n", in palmas_clks_is_prepared()
103 cinfo->clk_desc->control_reg, ret); in palmas_clks_is_prepared()
106 return !!(val & cinfo->clk_desc->enable_mask); in palmas_clks_is_prepared()
117 struct clk_init_data init; member
122 .init = {
133 .delay = 200,
138 .init = {
149 .delay = 200,
155 .compatible = "ti,palmas-clk32kg",
159 .compatible = "ti,palmas-clk32kgaudio",
169 struct device_node *node = pdev->dev.of_node; in palmas_clks_get_clk_data()
173 ret = of_property_read_u32(node, "ti,external-sleep-control", in palmas_clks_get_clk_data()
189 dev_warn(&pdev->dev, "%pOFn: Invalid ext control option: %u\n", in palmas_clks_get_clk_data()
194 cinfo->ext_control_pin = prop; in palmas_clks_get_clk_data()
201 ret = palmas_update_bits(cinfo->palmas, PALMAS_RESOURCE_BASE, in palmas_clks_init_configure()
202 cinfo->clk_desc->control_reg, in palmas_clks_init_configure()
203 cinfo->clk_desc->sleep_mask, 0); in palmas_clks_init_configure()
205 dev_err(cinfo->dev, "Reg 0x%02x update failed, %d\n", in palmas_clks_init_configure()
206 cinfo->clk_desc->control_reg, ret); in palmas_clks_init_configure()
210 if (cinfo->ext_control_pin) { in palmas_clks_init_configure()
211 ret = clk_prepare(cinfo->hw.clk); in palmas_clks_init_configure()
213 dev_err(cinfo->dev, "Clock prep failed, %d\n", ret); in palmas_clks_init_configure()
217 ret = palmas_ext_control_req_config(cinfo->palmas, in palmas_clks_init_configure()
218 cinfo->clk_desc->sleep_reqstr_id, in palmas_clks_init_configure()
219 cinfo->ext_control_pin, true); in palmas_clks_init_configure()
221 dev_err(cinfo->dev, "Ext config for %s failed, %d\n", in palmas_clks_init_configure()
222 cinfo->clk_desc->clk_name, ret); in palmas_clks_init_configure()
223 clk_unprepare(cinfo->hw.clk); in palmas_clks_init_configure()
232 struct palmas *palmas = dev_get_drvdata(pdev->dev.parent); in palmas_clks_probe()
233 struct device_node *node = pdev->dev.of_node; in palmas_clks_probe()
238 match_data = of_device_get_match_data(&pdev->dev); in palmas_clks_probe()
242 cinfo = devm_kzalloc(&pdev->dev, sizeof(*cinfo), GFP_KERNEL); in palmas_clks_probe()
244 return -ENOMEM; in palmas_clks_probe()
249 cinfo->dev = &pdev->dev; in palmas_clks_probe()
250 cinfo->palmas = palmas; in palmas_clks_probe()
252 cinfo->clk_desc = &match_data->desc; in palmas_clks_probe()
253 cinfo->hw.init = &match_data->init; in palmas_clks_probe()
254 ret = devm_clk_hw_register(&pdev->dev, &cinfo->hw); in palmas_clks_probe()
256 dev_err(&pdev->dev, "Fail to register clock %s, %d\n", in palmas_clks_probe()
257 match_data->desc.clk_name, ret); in palmas_clks_probe()
263 dev_err(&pdev->dev, "Clock config failed, %d\n", ret); in palmas_clks_probe()
267 ret = of_clk_add_hw_provider(node, of_clk_hw_simple_get, &cinfo->hw); in palmas_clks_probe()
269 dev_err(&pdev->dev, "Fail to add clock driver, %d\n", ret); in palmas_clks_probe()
275 of_clk_del_provider(pdev->dev.of_node); in palmas_clks_remove()
280 .name = "palmas-clk",
290 MODULE_ALIAS("platform:palmas-clk");