1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * Copyright (c) 2023 Neil Armstrong <neil.armstrong@linaro.org> 4 */ 5 6 #include <linux/of_device.h> 7 #include <linux/clk-provider.h> 8 #include <linux/module.h> 9 #include "meson-clkc-utils.h" 10 11 struct clk_hw *meson_clk_hw_get(struct of_phandle_args *clkspec, void *clk_hw_data) 12 { 13 const struct meson_clk_hw_data *data = clk_hw_data; 14 unsigned int idx = clkspec->args[0]; 15 16 if (idx >= data->num) { 17 pr_err("%s: invalid index %u\n", __func__, idx); 18 return ERR_PTR(-EINVAL); 19 } 20 21 return data->hws[idx]; 22 } 23 EXPORT_SYMBOL_GPL(meson_clk_hw_get); 24 25 MODULE_DESCRIPTION("Amlogic Clock Controller Utilities"); 26 MODULE_LICENSE("GPL"); 27