|
16 | 16 | #include <linux/platform_device.h>
|
17 | 17 | #include <linux/pm_runtime.h>
|
18 | 18 | #include <linux/regmap.h>
|
| 19 | +#include <linux/regulator/consumer.h> |
19 | 20 | #include <linux/reset.h>
|
20 | 21 | #include <linux/slab.h>
|
21 | 22 |
|
@@ -1099,6 +1100,12 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
|
1099 | 1100 | return PTR_ERR(base);
|
1100 | 1101 | }
|
1101 | 1102 |
|
| 1103 | + dsi->regulator = devm_regulator_get(dev, "vcc-dsi"); |
| 1104 | + if (IS_ERR(dsi->regulator)) { |
| 1105 | + dev_err(dev, "Couldn't get VCC-DSI supply\n"); |
| 1106 | + return PTR_ERR(dsi->regulator); |
| 1107 | + } |
| 1108 | + |
1102 | 1109 | dsi->regs = devm_regmap_init_mmio_clk(dev, "bus", base,
|
1103 | 1110 | &sun6i_dsi_regmap_config);
|
1104 | 1111 | if (IS_ERR(dsi->regs)) {
|
@@ -1172,6 +1179,13 @@ static int sun6i_dsi_remove(struct platform_device *pdev)
|
1172 | 1179 | static int __maybe_unused sun6i_dsi_runtime_resume(struct device *dev)
|
1173 | 1180 | {
|
1174 | 1181 | struct sun6i_dsi *dsi = dev_get_drvdata(dev);
|
| 1182 | + int err; |
| 1183 | + |
| 1184 | + err = regulator_enable(dsi->regulator); |
| 1185 | + if (err) { |
| 1186 | + dev_err(dsi->dev, "failed to enable VCC-DSI supply: %d\n", err); |
| 1187 | + return err; |
| 1188 | + } |
1175 | 1189 |
|
1176 | 1190 | reset_control_deassert(dsi->reset);
|
1177 | 1191 | clk_prepare_enable(dsi->mod_clk);
|
@@ -1204,6 +1218,7 @@ static int __maybe_unused sun6i_dsi_runtime_suspend(struct device *dev)
|
1204 | 1218 |
|
1205 | 1219 | clk_disable_unprepare(dsi->mod_clk);
|
1206 | 1220 | reset_control_assert(dsi->reset);
|
| 1221 | + regulator_disable(dsi->regulator); |
1207 | 1222 |
|
1208 | 1223 | return 0;
|
1209 | 1224 | }
|
|
0 commit comments