Commit 82fa10d4 authored by Sebastian Reichel's avatar Sebastian Reichel Committed by Tomi Valkeinen

drm/omap: panel-dsi-cm: add regulator support

Add support for regulators used by panels found inside
of the Nokia N950, N9 and Motorola Droid 4.
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent e128310d
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
#include <linux/regulator/consumer.h>
#include <video/mipi_display.h> #include <video/mipi_display.h>
#include <video/of_display_timing.h> #include <video/of_display_timing.h>
...@@ -60,6 +61,9 @@ struct panel_drv_data { ...@@ -60,6 +61,9 @@ struct panel_drv_data {
int reset_gpio; int reset_gpio;
int ext_te_gpio; int ext_te_gpio;
struct regulator *vpnl;
struct regulator *vddi;
bool use_dsi_backlight; bool use_dsi_backlight;
struct omap_dsi_pin_config pin_config; struct omap_dsi_pin_config pin_config;
...@@ -590,25 +594,43 @@ static int dsicm_power_on(struct panel_drv_data *ddata) ...@@ -590,25 +594,43 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
.lp_clk_max = 10000000, .lp_clk_max = 10000000,
}; };
if (ddata->vpnl) {
r = regulator_enable(ddata->vpnl);
if (r) {
dev_err(&ddata->pdev->dev,
"failed to enable VPNL: %d\n", r);
return r;
}
}
if (ddata->vddi) {
r = regulator_enable(ddata->vddi);
if (r) {
dev_err(&ddata->pdev->dev,
"failed to enable VDDI: %d\n", r);
goto err_vpnl;
}
}
if (ddata->pin_config.num_pins > 0) { if (ddata->pin_config.num_pins > 0) {
r = in->ops.dsi->configure_pins(in, &ddata->pin_config); r = in->ops.dsi->configure_pins(in, &ddata->pin_config);
if (r) { if (r) {
dev_err(&ddata->pdev->dev, dev_err(&ddata->pdev->dev,
"failed to configure DSI pins\n"); "failed to configure DSI pins\n");
goto err0; goto err_vddi;
} }
} }
r = in->ops.dsi->set_config(in, &dsi_config); r = in->ops.dsi->set_config(in, &dsi_config);
if (r) { if (r) {
dev_err(&ddata->pdev->dev, "failed to configure DSI\n"); dev_err(&ddata->pdev->dev, "failed to configure DSI\n");
goto err0; goto err_vddi;
} }
r = in->ops.dsi->enable(in); r = in->ops.dsi->enable(in);
if (r) { if (r) {
dev_err(&ddata->pdev->dev, "failed to enable DSI\n"); dev_err(&ddata->pdev->dev, "failed to enable DSI\n");
goto err0; goto err_vddi;
} }
dsicm_hw_reset(ddata); dsicm_hw_reset(ddata);
...@@ -666,7 +688,13 @@ static int dsicm_power_on(struct panel_drv_data *ddata) ...@@ -666,7 +688,13 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
dsicm_hw_reset(ddata); dsicm_hw_reset(ddata);
in->ops.dsi->disable(in, true, false); in->ops.dsi->disable(in, true, false);
err0: err_vddi:
if (ddata->vddi)
regulator_disable(ddata->vddi);
err_vpnl:
if (ddata->vpnl)
regulator_disable(ddata->vpnl);
return r; return r;
} }
...@@ -689,6 +717,11 @@ static void dsicm_power_off(struct panel_drv_data *ddata) ...@@ -689,6 +717,11 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
in->ops.dsi->disable(in, true, false); in->ops.dsi->disable(in, true, false);
if (ddata->vddi)
regulator_disable(ddata->vddi);
if (ddata->vpnl)
regulator_disable(ddata->vpnl);
ddata->enabled = 0; ddata->enabled = 0;
} }
...@@ -1189,6 +1222,22 @@ static int dsicm_probe_of(struct platform_device *pdev) ...@@ -1189,6 +1222,22 @@ static int dsicm_probe_of(struct platform_device *pdev)
return PTR_ERR(in); return PTR_ERR(in);
} }
ddata->vpnl = devm_regulator_get_optional(&pdev->dev, "vpnl");
if (IS_ERR(ddata->vpnl)) {
err = PTR_ERR(ddata->vpnl);
if (err == -EPROBE_DEFER)
return err;
ddata->vpnl = NULL;
}
ddata->vddi = devm_regulator_get_optional(&pdev->dev, "vddi");
if (IS_ERR(ddata->vddi)) {
err = PTR_ERR(ddata->vddi);
if (err == -EPROBE_DEFER)
return err;
ddata->vddi = NULL;
}
ddata->in = in; ddata->in = in;
/* TODO: ulps, backlight */ /* TODO: ulps, backlight */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment