#include <linux/of_device.h>
#include <linux/of_graph.h>
#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
#include <linux/reset.h>
#include <linux/clk.h>
struct clk *pclk;
struct regmap *grf;
struct reset_control *rst;
+ struct regulator *vcc_supply;
+ struct regulator *vccio_supply;
const struct rockchip_dp_chip_data *data;
struct rockchip_dp_device *dp = to_dp(plat_data);
int ret;
+ if (!IS_ERR(dp->vcc_supply)) {
+ ret = regulator_enable(dp->vcc_supply);
+ if (ret) {
+ dev_err(dp->dev,
+ "failed to enable vcc regulator: %d\n", ret);
+ return ret;
+ }
+ }
+
+ if (!IS_ERR(dp->vccio_supply)) {
+ ret = regulator_enable(dp->vccio_supply);
+ if (ret) {
+ dev_err(dp->dev,
+ "failed to enable vccio regulator: %d\n", ret);
+ return ret;
+ }
+ }
+
ret = clk_prepare_enable(dp->pclk);
if (ret < 0) {
dev_err(dp->dev, "failed to enable pclk %d\n", ret);
clk_disable_unprepare(dp->pclk);
+ if (!IS_ERR(dp->vccio_supply))
+ regulator_disable(dp->vccio_supply);
+ if (!IS_ERR(dp->vcc_supply))
+ regulator_disable(dp->vcc_supply);
+
return 0;
}
return PTR_ERR(dp->rst);
}
+ dp->vcc_supply = devm_regulator_get_optional(dev, "vcc");
+ dp->vccio_supply = devm_regulator_get_optional(dev, "vccio");
+
+ if (IS_ERR(dp->vcc_supply)) {
+ dev_err(dev, "failed to get vcc regulator: %ld\n",
+ PTR_ERR(dp->vcc_supply));
+ } else {
+ ret = regulator_enable(dp->vcc_supply);
+ if (ret) {
+ dev_err(dev,
+ "failed to enable vcc regulator: %d\n", ret);
+ return ret;
+ }
+ }
+ if (IS_ERR(dp->vccio_supply)) {
+ dev_err(dev, "failed to get vccio regulator: %ld\n",
+ PTR_ERR(dp->vccio_supply));
+ } else {
+ ret = regulator_enable(dp->vccio_supply);
+ if (ret) {
+ dev_err(dev,
+ "failed to enable vccio regulator: %d\n", ret);
+ return ret;
+ }
+ }
+
ret = clk_prepare_enable(dp->pclk);
if (ret < 0) {
dev_err(dp->dev, "failed to enable pclk %d\n", ret);