switch (hwid) { case S2MPS11X:
s2mps11_reg = S2MPS11_REG_RTC_CTRL; break; case S2MPS13X:
s2mps11_reg = S2MPS13_REG_RTCCTRL; break; case S2MPS14X:
s2mps11_reg = S2MPS14_REG_RTCCTRL; break; case S5M8767X:
s2mps11_reg = S5M8767_REG_CTRL1; break; default:
dev_err(&pdev->dev, "Invalid device type\n"); return -EINVAL;
}
/* Store clocks of_node in first element of s2mps11_clks array */
s2mps11_clks->clk_np = s2mps11_clk_parse_dt(pdev, s2mps11_clks_init); if (IS_ERR(s2mps11_clks->clk_np)) return PTR_ERR(s2mps11_clks->clk_np);
for (i = 0; i < S2MPS11_CLKS_NUM; i++) { if (i == S2MPS11_CLK_CP && hwid == S2MPS14X) continue; /* Skip clocks not present in some devices */
s2mps11_clks[i].iodev = iodev;
s2mps11_clks[i].hw.init = &s2mps11_clks_init[i];
s2mps11_clks[i].mask = 1 << i;
s2mps11_clks[i].reg = s2mps11_reg;
s2mps11_clks[i].clk = devm_clk_register(&pdev->dev,
&s2mps11_clks[i].hw); if (IS_ERR(s2mps11_clks[i].clk)) {
dev_err(&pdev->dev, "Fail to register : %s\n",
s2mps11_clks_init[i].name);
ret = PTR_ERR(s2mps11_clks[i].clk); goto err_reg;
}
s2mps11_clks[i].lookup = clkdev_hw_create(&s2mps11_clks[i].hw,
s2mps11_clks_init[i].name, NULL); if (!s2mps11_clks[i].lookup) {
ret = -ENOMEM; goto err_reg;
}
clk_data->hws[i] = &s2mps11_clks[i].hw;
}
of_clk_del_provider(s2mps11_clks[0].clk_np); /* Drop the reference obtained in s2mps11_clk_parse_dt */
of_node_put(s2mps11_clks[0].clk_np);
for (i = 0; i < S2MPS11_CLKS_NUM; i++) { /* Skip clocks not present on S2MPS14 */ if (!s2mps11_clks[i].lookup) continue;
clkdev_drop(s2mps11_clks[i].lookup);
}
}
#ifdef CONFIG_OF /* * Device is instantiated through parent MFD device and device matching is done * through platform_device_id. * * However if device's DT node contains proper clock compatible and driver is * built as a module, then the *module* matching will be done through DT aliases. * This requires of_device_id table. In the same time this will not change the * actual *device* matching so do not add .of_match_table.
*/ staticconststruct of_device_id s2mps11_dt_match[] __used = {
{
.compatible = "samsung,s2mps11-clk",
.data = (void *)S2MPS11X,
}, {
.compatible = "samsung,s2mps13-clk",
.data = (void *)S2MPS13X,
}, {
.compatible = "samsung,s2mps14-clk",
.data = (void *)S2MPS14X,
}, {
.compatible = "samsung,s5m8767-clk",
.data = (void *)S5M8767X,
}, { /* Sentinel */
},
};
MODULE_DEVICE_TABLE(of, s2mps11_dt_match); #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.