|
@@ -71,7 +71,6 @@ struct cdce706_hw_data {
|
|
struct cdce706_dev_data *dev_data;
|
|
struct cdce706_dev_data *dev_data;
|
|
unsigned idx;
|
|
unsigned idx;
|
|
unsigned parent;
|
|
unsigned parent;
|
|
- struct clk *clk;
|
|
|
|
struct clk_hw hw;
|
|
struct clk_hw hw;
|
|
unsigned div;
|
|
unsigned div;
|
|
unsigned mul;
|
|
unsigned mul;
|
|
@@ -81,8 +80,6 @@ struct cdce706_hw_data {
|
|
struct cdce706_dev_data {
|
|
struct cdce706_dev_data {
|
|
struct i2c_client *client;
|
|
struct i2c_client *client;
|
|
struct regmap *regmap;
|
|
struct regmap *regmap;
|
|
- struct clk_onecell_data onecell;
|
|
|
|
- struct clk *clks[6];
|
|
|
|
struct clk *clkin_clk[2];
|
|
struct clk *clkin_clk[2];
|
|
const char *clkin_name[2];
|
|
const char *clkin_name[2];
|
|
struct cdce706_hw_data clkin[1];
|
|
struct cdce706_hw_data clkin[1];
|
|
@@ -455,18 +452,19 @@ static int cdce706_register_hw(struct cdce706_dev_data *cdce,
|
|
struct clk_init_data *init)
|
|
struct clk_init_data *init)
|
|
{
|
|
{
|
|
unsigned i;
|
|
unsigned i;
|
|
|
|
+ int ret;
|
|
|
|
|
|
for (i = 0; i < num_hw; ++i, ++hw) {
|
|
for (i = 0; i < num_hw; ++i, ++hw) {
|
|
init->name = clk_names[i];
|
|
init->name = clk_names[i];
|
|
hw->dev_data = cdce;
|
|
hw->dev_data = cdce;
|
|
hw->idx = i;
|
|
hw->idx = i;
|
|
hw->hw.init = init;
|
|
hw->hw.init = init;
|
|
- hw->clk = devm_clk_register(&cdce->client->dev,
|
|
|
|
|
|
+ ret = devm_clk_hw_register(&cdce->client->dev,
|
|
&hw->hw);
|
|
&hw->hw);
|
|
- if (IS_ERR(hw->clk)) {
|
|
|
|
|
|
+ if (ret) {
|
|
dev_err(&cdce->client->dev, "Failed to register %s\n",
|
|
dev_err(&cdce->client->dev, "Failed to register %s\n",
|
|
clk_names[i]);
|
|
clk_names[i]);
|
|
- return PTR_ERR(hw->clk);
|
|
|
|
|
|
+ return ret;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
@@ -613,13 +611,23 @@ static int cdce706_register_clkouts(struct cdce706_dev_data *cdce)
|
|
cdce->clkout[i].parent);
|
|
cdce->clkout[i].parent);
|
|
}
|
|
}
|
|
|
|
|
|
- ret = cdce706_register_hw(cdce, cdce->clkout,
|
|
|
|
- ARRAY_SIZE(cdce->clkout),
|
|
|
|
- cdce706_clkout_name, &init);
|
|
|
|
- for (i = 0; i < ARRAY_SIZE(cdce->clkout); ++i)
|
|
|
|
- cdce->clks[i] = cdce->clkout[i].clk;
|
|
|
|
|
|
+ return cdce706_register_hw(cdce, cdce->clkout,
|
|
|
|
+ ARRAY_SIZE(cdce->clkout),
|
|
|
|
+ cdce706_clkout_name, &init);
|
|
|
|
+}
|
|
|
|
|
|
- return ret;
|
|
|
|
|
|
+static struct clk_hw *
|
|
|
|
+of_clk_cdce_get(struct of_phandle_args *clkspec, void *data)
|
|
|
|
+{
|
|
|
|
+ struct cdce706_dev_data *cdce = data;
|
|
|
|
+ unsigned int idx = clkspec->args[0];
|
|
|
|
+
|
|
|
|
+ if (idx >= ARRAY_SIZE(cdce->clkout)) {
|
|
|
|
+ pr_err("%s: invalid index %u\n", __func__, idx);
|
|
|
|
+ return ERR_PTR(-EINVAL);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return &cdce->clkout[idx].hw;
|
|
}
|
|
}
|
|
|
|
|
|
static int cdce706_probe(struct i2c_client *client,
|
|
static int cdce706_probe(struct i2c_client *client,
|
|
@@ -657,12 +665,8 @@ static int cdce706_probe(struct i2c_client *client,
|
|
ret = cdce706_register_clkouts(cdce);
|
|
ret = cdce706_register_clkouts(cdce);
|
|
if (ret < 0)
|
|
if (ret < 0)
|
|
return ret;
|
|
return ret;
|
|
- cdce->onecell.clks = cdce->clks;
|
|
|
|
- cdce->onecell.clk_num = ARRAY_SIZE(cdce->clks);
|
|
|
|
- ret = of_clk_add_provider(client->dev.of_node, of_clk_src_onecell_get,
|
|
|
|
- &cdce->onecell);
|
|
|
|
-
|
|
|
|
- return ret;
|
|
|
|
|
|
+ return of_clk_add_hw_provider(client->dev.of_node, of_clk_cdce_get,
|
|
|
|
+ cdce);
|
|
}
|
|
}
|
|
|
|
|
|
static int cdce706_remove(struct i2c_client *client)
|
|
static int cdce706_remove(struct i2c_client *client)
|