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