Commit 7269fde4 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen

drm/omap: displays: Remove input omap_dss_device from panel data

All connectors, encoders and panels store a pointer to their input
omap_dss_device in the panel driver data structure. This duplicates the
src field in the omap_dss_device structure. Remove the private copy and
use the src field.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent fb557171
......@@ -18,7 +18,6 @@
struct panel_drv_data {
struct omap_dss_device dssdev;
struct omap_dss_device *in;
struct device *dev;
......@@ -45,40 +44,37 @@ static const struct videomode tvc_pal_vm = {
static int tvc_connect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in;
struct omap_dss_device *src;
int r;
in = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
if (IS_ERR(in)) {
src = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
if (IS_ERR(src)) {
dev_err(ddata->dev, "failed to find video source\n");
return PTR_ERR(in);
return PTR_ERR(src);
}
r = omapdss_device_connect(in, dssdev);
r = omapdss_device_connect(src, dssdev);
if (r) {
omap_dss_put_device(in);
omap_dss_put_device(src);
return r;
}
ddata->in = in;
return 0;
}
static void tvc_disconnect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
omapdss_device_disconnect(in, dssdev);
omapdss_device_disconnect(src, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
omap_dss_put_device(src);
}
static int tvc_enable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
dev_dbg(ddata->dev, "enable\n");
......@@ -89,9 +85,9 @@ static int tvc_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops->set_timings(in, &ddata->vm);
src->ops->set_timings(src, &ddata->vm);
r = in->ops->enable(in);
r = src->ops->enable(src);
if (r)
return r;
......@@ -103,14 +99,14 @@ static int tvc_enable(struct omap_dss_device *dssdev)
static void tvc_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
dev_dbg(ddata->dev, "disable\n");
if (!omapdss_device_is_enabled(dssdev))
return;
in->ops->disable(in);
src->ops->disable(src);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -119,11 +115,11 @@ static void tvc_set_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
ddata->vm = *vm;
in->ops->set_timings(in, vm);
src->ops->set_timings(src, vm);
}
static void tvc_get_timings(struct omap_dss_device *dssdev,
......@@ -137,10 +133,9 @@ static void tvc_get_timings(struct omap_dss_device *dssdev,
static int tvc_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
return in->ops->check_timings(in, vm);
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_driver tvc_driver = {
......
......@@ -40,7 +40,6 @@ static const struct videomode dvic_default_vm = {
struct panel_drv_data {
struct omap_dss_device dssdev;
struct omap_dss_device *in;
struct videomode vm;
......@@ -59,41 +58,37 @@ struct panel_drv_data {
static int dvic_connect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in;
struct omap_dss_device *src;
int r;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(src)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
return PTR_ERR(src);
}
r = omapdss_device_connect(in, dssdev);
r = omapdss_device_connect(src, dssdev);
if (r) {
omap_dss_put_device(in);
omap_dss_put_device(src);
return r;
}
ddata->in = in;
return 0;
}
static void dvic_disconnect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
omapdss_device_disconnect(in, dssdev);
omapdss_device_disconnect(src, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
omap_dss_put_device(src);
}
static int dvic_enable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
if (!omapdss_device_is_connected(dssdev))
......@@ -102,9 +97,9 @@ static int dvic_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops->set_timings(in, &ddata->vm);
src->ops->set_timings(src, &ddata->vm);
r = in->ops->enable(in);
r = src->ops->enable(src);
if (r)
return r;
......@@ -115,13 +110,12 @@ static int dvic_enable(struct omap_dss_device *dssdev)
static void dvic_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
in->ops->disable(in);
src->ops->disable(src);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -130,11 +124,11 @@ static void dvic_set_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
ddata->vm = *vm;
in->ops->set_timings(in, vm);
src->ops->set_timings(src, vm);
}
static void dvic_get_timings(struct omap_dss_device *dssdev,
......@@ -148,10 +142,9 @@ static void dvic_get_timings(struct omap_dss_device *dssdev,
static int dvic_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
return in->ops->check_timings(in, vm);
return src->ops->check_timings(src, vm);
}
static int dvic_ddc_read(struct i2c_adapter *adapter,
......
......@@ -37,7 +37,6 @@ static const struct videomode hdmic_default_vm = {
struct panel_drv_data {
struct omap_dss_device dssdev;
struct omap_dss_device *in;
void (*hpd_cb)(void *cb_data, enum drm_connector_status status);
void *hpd_cb_data;
bool hpd_enabled;
......@@ -55,40 +54,37 @@ struct panel_drv_data {
static int hdmic_connect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in;
struct omap_dss_device *src;
int r;
in = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
if (IS_ERR(in)) {
src = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
if (IS_ERR(src)) {
dev_err(ddata->dev, "failed to find video source\n");
return PTR_ERR(in);
return PTR_ERR(src);
}
r = omapdss_device_connect(in, dssdev);
r = omapdss_device_connect(src, dssdev);
if (r) {
omap_dss_put_device(in);
omap_dss_put_device(src);
return r;
}
ddata->in = in;
return 0;
}
static void hdmic_disconnect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
omapdss_device_disconnect(in, dssdev);
omapdss_device_disconnect(src, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
omap_dss_put_device(src);
}
static int hdmic_enable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
dev_dbg(ddata->dev, "enable\n");
......@@ -99,9 +95,9 @@ static int hdmic_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops->set_timings(in, &ddata->vm);
src->ops->set_timings(src, &ddata->vm);
r = in->ops->enable(in);
r = src->ops->enable(src);
if (r)
return r;
......@@ -113,14 +109,14 @@ static int hdmic_enable(struct omap_dss_device *dssdev)
static void hdmic_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
dev_dbg(ddata->dev, "disable\n");
if (!omapdss_device_is_enabled(dssdev))
return;
in->ops->disable(in);
src->ops->disable(src);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -129,11 +125,11 @@ static void hdmic_set_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
ddata->vm = *vm;
in->ops->set_timings(in, vm);
src->ops->set_timings(src, vm);
}
static void hdmic_get_timings(struct omap_dss_device *dssdev,
......@@ -147,33 +143,31 @@ static void hdmic_get_timings(struct omap_dss_device *dssdev,
static int hdmic_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
return in->ops->check_timings(in, vm);
return src->ops->check_timings(src, vm);
}
static int hdmic_read_edid(struct omap_dss_device *dssdev,
u8 *edid, int len)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
return in->ops->hdmi.read_edid(in, edid, len);
return src->ops->hdmi.read_edid(src, edid, len);
}
static bool hdmic_detect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
bool connected;
if (gpio_is_valid(ddata->hpd_gpio))
connected = gpio_get_value_cansleep(ddata->hpd_gpio);
else
connected = in->ops->hdmi.detect(in);
if (!connected && in->ops->hdmi.lost_hotplug)
in->ops->hdmi.lost_hotplug(in);
connected = src->ops->hdmi.detect(src);
if (!connected && src->ops->hdmi.lost_hotplug)
src->ops->hdmi.lost_hotplug(src);
return connected;
}
......@@ -183,7 +177,7 @@ static int hdmic_register_hpd_cb(struct omap_dss_device *dssdev,
void *cb_data)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
if (gpio_is_valid(ddata->hpd_gpio)) {
mutex_lock(&ddata->hpd_lock);
......@@ -191,8 +185,8 @@ static int hdmic_register_hpd_cb(struct omap_dss_device *dssdev,
ddata->hpd_cb_data = cb_data;
mutex_unlock(&ddata->hpd_lock);
return 0;
} else if (in->ops->hdmi.register_hpd_cb) {
return in->ops->hdmi.register_hpd_cb(in, cb, cb_data);
} else if (src->ops->hdmi.register_hpd_cb) {
return src->ops->hdmi.register_hpd_cb(src, cb, cb_data);
}
return -ENOTSUPP;
......@@ -201,61 +195,59 @@ static int hdmic_register_hpd_cb(struct omap_dss_device *dssdev,
static void hdmic_unregister_hpd_cb(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
if (gpio_is_valid(ddata->hpd_gpio)) {
mutex_lock(&ddata->hpd_lock);
ddata->hpd_cb = NULL;
ddata->hpd_cb_data = NULL;
mutex_unlock(&ddata->hpd_lock);
} else if (in->ops->hdmi.unregister_hpd_cb) {
in->ops->hdmi.unregister_hpd_cb(in);
} else if (src->ops->hdmi.unregister_hpd_cb) {
src->ops->hdmi.unregister_hpd_cb(src);
}
}
static void hdmic_enable_hpd(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
if (gpio_is_valid(ddata->hpd_gpio)) {
mutex_lock(&ddata->hpd_lock);
ddata->hpd_enabled = true;
mutex_unlock(&ddata->hpd_lock);
} else if (in->ops->hdmi.enable_hpd) {
in->ops->hdmi.enable_hpd(in);
} else if (src->ops->hdmi.enable_hpd) {
src->ops->hdmi.enable_hpd(src);
}
}
static void hdmic_disable_hpd(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
if (gpio_is_valid(ddata->hpd_gpio)) {
mutex_lock(&ddata->hpd_lock);
ddata->hpd_enabled = false;
mutex_unlock(&ddata->hpd_lock);
} else if (in->ops->hdmi.disable_hpd) {
in->ops->hdmi.disable_hpd(in);
} else if (src->ops->hdmi.disable_hpd) {
src->ops->hdmi.disable_hpd(src);
}
}
static int hdmic_set_hdmi_mode(struct omap_dss_device *dssdev, bool hdmi_mode)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
return in->ops->hdmi.set_hdmi_mode(in, hdmi_mode);
return src->ops->hdmi.set_hdmi_mode(src, hdmi_mode);
}
static int hdmic_set_infoframe(struct omap_dss_device *dssdev,
const struct hdmi_avi_infoframe *avi)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
return in->ops->hdmi.set_infoframe(in, avi);
return src->ops->hdmi.set_infoframe(src, avi);
}
static const struct omap_dss_driver hdmic_driver = {
......
......@@ -23,7 +23,6 @@
struct panel_drv_data {
struct omap_dss_device dssdev;
struct omap_dss_device *in;
struct gpio_desc *enable_gpio;
......@@ -35,23 +34,21 @@ struct panel_drv_data {
static int opa362_connect(struct omap_dss_device *dssdev,
struct omap_dss_device *dst)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in;
struct omap_dss_device *src;
int r;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(src)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
return PTR_ERR(src);
}
r = omapdss_device_connect(in, dssdev);
r = omapdss_device_connect(src, dssdev);
if (r) {
omap_dss_put_device(in);
omap_dss_put_device(src);
return r;
}
ddata->in = in;
return 0;
}
......@@ -59,18 +56,17 @@ static void opa362_disconnect(struct omap_dss_device *dssdev,
struct omap_dss_device *dst)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
omapdss_device_disconnect(in, &ddata->dssdev);
omapdss_device_disconnect(src, &ddata->dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
omap_dss_put_device(src);
}
static int opa362_enable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
dev_dbg(dssdev->dev, "enable\n");
......@@ -81,9 +77,9 @@ static int opa362_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops->set_timings(in, &ddata->vm);
src->ops->set_timings(src, &ddata->vm);
r = in->ops->enable(in);
r = src->ops->enable(src);
if (r)
return r;
......@@ -98,7 +94,7 @@ static int opa362_enable(struct omap_dss_device *dssdev)
static void opa362_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
dev_dbg(dssdev->dev, "disable\n");
......@@ -108,7 +104,7 @@ static void opa362_disable(struct omap_dss_device *dssdev)
if (ddata->enable_gpio)
gpiod_set_value_cansleep(ddata->enable_gpio, 0);
in->ops->disable(in);
src->ops->disable(src);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -117,24 +113,23 @@ static void opa362_set_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
dev_dbg(dssdev->dev, "set_timings\n");
ddata->vm = *vm;
in->ops->set_timings(in, vm);
src->ops->set_timings(src, vm);
}
static int opa362_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
dev_dbg(dssdev->dev, "check_timings\n");
return in->ops->check_timings(in, vm);
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_device_ops opa362_ops = {
......
......@@ -19,7 +19,6 @@
struct panel_drv_data {
struct omap_dss_device dssdev;
struct omap_dss_device *in;
int pd_gpio;
......@@ -31,23 +30,21 @@ struct panel_drv_data {
static int tfp410_connect(struct omap_dss_device *dssdev,
struct omap_dss_device *dst)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in;
struct omap_dss_device *src;
int r;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(src)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
return PTR_ERR(src);
}
r = omapdss_device_connect(in, dssdev);
r = omapdss_device_connect(src, dssdev);
if (r) {
omap_dss_put_device(in);
omap_dss_put_device(src);
return r;
}
ddata->in = in;
return 0;
}
......@@ -55,18 +52,17 @@ static void tfp410_disconnect(struct omap_dss_device *dssdev,
struct omap_dss_device *dst)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
omapdss_device_disconnect(in, &ddata->dssdev);
omapdss_device_disconnect(src, &ddata->dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
omap_dss_put_device(src);
}
static int tfp410_enable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
if (!omapdss_device_is_connected(dssdev))
......@@ -75,9 +71,9 @@ static int tfp410_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops->set_timings(in, &ddata->vm);
src->ops->set_timings(src, &ddata->vm);
r = in->ops->enable(in);
r = src->ops->enable(src);
if (r)
return r;
......@@ -92,7 +88,7 @@ static int tfp410_enable(struct omap_dss_device *dssdev)
static void tfp410_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
......@@ -100,7 +96,7 @@ static void tfp410_disable(struct omap_dss_device *dssdev)
if (gpio_is_valid(ddata->pd_gpio))
gpio_set_value_cansleep(ddata->pd_gpio, 0);
in->ops->disable(in);
src->ops->disable(src);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -115,24 +111,23 @@ static void tfp410_set_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
tfp410_fix_timings(vm);
ddata->vm = *vm;
in->ops->set_timings(in, vm);
src->ops->set_timings(src, vm);
}
static int tfp410_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
tfp410_fix_timings(vm);
return in->ops->check_timings(in, vm);
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_device_ops tfp410_ops = {
......
......@@ -21,7 +21,6 @@
struct panel_drv_data {
struct omap_dss_device dssdev;
struct omap_dss_device *in;
void (*hpd_cb)(void *cb_data, enum drm_connector_status status);
void *hpd_cb_data;
bool hpd_enabled;
......@@ -40,18 +39,18 @@ static int tpd_connect(struct omap_dss_device *dssdev,
struct omap_dss_device *dst)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in;
struct omap_dss_device *src;
int r;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(src)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
return PTR_ERR(src);
}
r = omapdss_device_connect(in, dssdev);
r = omapdss_device_connect(src, dssdev);
if (r) {
omap_dss_put_device(in);
omap_dss_put_device(src);
return r;
}
......@@ -61,7 +60,6 @@ static int tpd_connect(struct omap_dss_device *dssdev,
/* DC-DC converter needs at max 300us to get to 90% of 5V */
udelay(300);
ddata->in = in;
return 0;
}
......@@ -69,29 +67,28 @@ static void tpd_disconnect(struct omap_dss_device *dssdev,
struct omap_dss_device *dst)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
gpiod_set_value_cansleep(ddata->ct_cp_hpd_gpio, 0);
gpiod_set_value_cansleep(ddata->ls_oe_gpio, 0);
omapdss_device_disconnect(in, &ddata->dssdev);
omapdss_device_disconnect(src, &ddata->dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
omap_dss_put_device(src);
}
static int tpd_enable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
return 0;
in->ops->set_timings(in, &ddata->vm);
src->ops->set_timings(src, &ddata->vm);
r = in->ops->enable(in);
r = src->ops->enable(src);
if (r)
return r;
......@@ -102,13 +99,12 @@ static int tpd_enable(struct omap_dss_device *dssdev)
static void tpd_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
return;
in->ops->disable(in);
src->ops->disable(src);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -117,45 +113,41 @@ static void tpd_set_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
ddata->vm = *vm;
in->ops->set_timings(in, vm);
src->ops->set_timings(src, vm);
}
static int tpd_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
int r;
r = in->ops->check_timings(in, vm);
struct omap_dss_device *src = dssdev->src;
return r;
return src->ops->check_timings(src, vm);
}
static int tpd_read_edid(struct omap_dss_device *dssdev,
u8 *edid, int len)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
if (!gpiod_get_value_cansleep(ddata->hpd_gpio))
return -ENODEV;
return in->ops->hdmi.read_edid(in, edid, len);
return src->ops->hdmi.read_edid(src, edid, len);
}
static bool tpd_detect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
bool connected = gpiod_get_value_cansleep(ddata->hpd_gpio);
if (!connected && in->ops->hdmi.lost_hotplug)
in->ops->hdmi.lost_hotplug(in);
if (!connected && src->ops->hdmi.lost_hotplug)
src->ops->hdmi.lost_hotplug(src);
return connected;
}
......@@ -205,19 +197,17 @@ static void tpd_disable_hpd(struct omap_dss_device *dssdev)
static int tpd_set_infoframe(struct omap_dss_device *dssdev,
const struct hdmi_avi_infoframe *avi)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
return in->ops->hdmi.set_infoframe(in, avi);
return src->ops->hdmi.set_infoframe(src, avi);
}
static int tpd_set_hdmi_mode(struct omap_dss_device *dssdev,
bool hdmi_mode)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
return in->ops->hdmi.set_hdmi_mode(in, hdmi_mode);
return src->ops->hdmi.set_hdmi_mode(src, hdmi_mode);
}
static const struct omap_dss_device_ops tpd_ops = {
......@@ -262,7 +252,7 @@ static irqreturn_t tpd_hpd_isr(int irq, void *data)
static int tpd_probe(struct platform_device *pdev)
{
struct omap_dss_device *in, *dssdev;
struct omap_dss_device *dssdev;
struct panel_drv_data *ddata;
int r;
struct gpio_desc *gpio;
......@@ -311,8 +301,6 @@ static int tpd_probe(struct platform_device *pdev)
dssdev->owner = THIS_MODULE;
dssdev->port_num = 1;
in = ddata->in;
r = omapdss_register_output(dssdev);
if (r) {
dev_err(&pdev->dev, "Failed to register output\n");
......
......@@ -23,7 +23,6 @@
struct panel_drv_data {
struct omap_dss_device dssdev;
struct omap_dss_device *in;
struct videomode vm;
......@@ -37,41 +36,37 @@ struct panel_drv_data {
static int panel_dpi_connect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in;
struct omap_dss_device *src;
int r;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(src)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
return PTR_ERR(src);
}
r = omapdss_device_connect(in, dssdev);
r = omapdss_device_connect(src, dssdev);
if (r) {
omap_dss_put_device(in);
omap_dss_put_device(src);
return r;
}
ddata->in = in;
return 0;
}
static void panel_dpi_disconnect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
omapdss_device_disconnect(in, dssdev);
omapdss_device_disconnect(src, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
omap_dss_put_device(src);
}
static int panel_dpi_enable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
if (!omapdss_device_is_connected(dssdev))
......@@ -80,15 +75,15 @@ static int panel_dpi_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops->set_timings(in, &ddata->vm);
src->ops->set_timings(src, &ddata->vm);
r = in->ops->enable(in);
r = src->ops->enable(src);
if (r)
return r;
r = regulator_enable(ddata->vcc_supply);
if (r) {
in->ops->disable(in);
src->ops->disable(src);
return r;
}
......@@ -103,7 +98,7 @@ static int panel_dpi_enable(struct omap_dss_device *dssdev)
static void panel_dpi_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
......@@ -113,7 +108,7 @@ static void panel_dpi_disable(struct omap_dss_device *dssdev)
gpiod_set_value_cansleep(ddata->enable_gpio, 0);
regulator_disable(ddata->vcc_supply);
in->ops->disable(in);
src->ops->disable(src);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -122,11 +117,11 @@ static void panel_dpi_set_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
ddata->vm = *vm;
in->ops->set_timings(in, vm);
src->ops->set_timings(src, vm);
}
static void panel_dpi_get_timings(struct omap_dss_device *dssdev,
......@@ -140,10 +135,9 @@ static void panel_dpi_get_timings(struct omap_dss_device *dssdev,
static int panel_dpi_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
return in->ops->check_timings(in, vm);
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_driver panel_dpi_ops = {
......
......@@ -41,7 +41,6 @@
struct panel_drv_data {
struct omap_dss_device dssdev;
struct omap_dss_device *in;
struct videomode vm;
......@@ -142,11 +141,11 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
{
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
int r;
u8 buf[1];
r = in->ops->dsi.dcs_read(in, ddata->channel, dcs_cmd, buf, 1);
r = src->ops->dsi.dcs_read(src, ddata->channel, dcs_cmd, buf, 1);
if (r < 0)
return r;
......@@ -158,29 +157,30 @@ static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
{
struct omap_dss_device *in = ddata->in;
return in->ops->dsi.dcs_write(in, ddata->channel, &dcs_cmd, 1);
struct omap_dss_device *src = ddata->dssdev.src;
return src->ops->dsi.dcs_write(src, ddata->channel, &dcs_cmd, 1);
}
static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
{
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
u8 buf[2] = { dcs_cmd, param };
return in->ops->dsi.dcs_write(in, ddata->channel, buf, 2);
return src->ops->dsi.dcs_write(src, ddata->channel, buf, 2);
}
static int dsicm_sleep_in(struct panel_drv_data *ddata)
{
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
u8 cmd;
int r;
hw_guard_wait(ddata);
cmd = MIPI_DCS_ENTER_SLEEP_MODE;
r = in->ops->dsi.dcs_write_nosync(in, ddata->channel, &cmd, 1);
r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, &cmd, 1);
if (r)
return r;
......@@ -228,7 +228,7 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
static int dsicm_set_update_window(struct panel_drv_data *ddata,
u16 x, u16 y, u16 w, u16 h)
{
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
int r;
u16 x1 = x;
u16 x2 = x + w - 1;
......@@ -242,7 +242,7 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
buf[3] = (x2 >> 8) & 0xff;
buf[4] = (x2 >> 0) & 0xff;
r = in->ops->dsi.dcs_write_nosync(in, ddata->channel, buf, sizeof(buf));
r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, buf, sizeof(buf));
if (r)
return r;
......@@ -252,11 +252,11 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
buf[3] = (y2 >> 8) & 0xff;
buf[4] = (y2 >> 0) & 0xff;
r = in->ops->dsi.dcs_write_nosync(in, ddata->channel, buf, sizeof(buf));
r = src->ops->dsi.dcs_write_nosync(src, ddata->channel, buf, sizeof(buf));
if (r)
return r;
in->ops->dsi.bta_sync(in, ddata->channel);
src->ops->dsi.bta_sync(src, ddata->channel);
return r;
}
......@@ -275,7 +275,7 @@ static void dsicm_cancel_ulps_work(struct panel_drv_data *ddata)
static int dsicm_enter_ulps(struct panel_drv_data *ddata)
{
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
int r;
if (ddata->ulps_enabled)
......@@ -290,7 +290,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
if (ddata->ext_te_gpio)
disable_irq(gpiod_to_irq(ddata->ext_te_gpio));
in->ops->dsi.disable(in, false, true);
src->ops->dsi.disable(src, false, true);
ddata->ulps_enabled = true;
......@@ -309,19 +309,19 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
static int dsicm_exit_ulps(struct panel_drv_data *ddata)
{
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
int r;
if (!ddata->ulps_enabled)
return 0;
r = in->ops->enable(in);
r = src->ops->enable(src);
if (r) {
dev_err(&ddata->pdev->dev, "failed to enable DSI\n");
goto err1;
}
in->ops->dsi.enable_hs(in, ddata->channel, true);
src->ops->dsi.enable_hs(src, ddata->channel, true);
r = _dsicm_enable_te(ddata, true);
if (r) {
......@@ -366,7 +366,7 @@ static int dsicm_wake_up(struct panel_drv_data *ddata)
static int dsicm_bl_update_status(struct backlight_device *dev)
{
struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
int r = 0;
int level;
......@@ -381,13 +381,13 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
mutex_lock(&ddata->lock);
if (ddata->enabled) {
in->ops->dsi.bus_lock(in);
src->ops->dsi.bus_lock(src);
r = dsicm_wake_up(ddata);
if (!r)
r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, level);
in->ops->dsi.bus_unlock(in);
src->ops->dsi.bus_unlock(src);
}
mutex_unlock(&ddata->lock);
......@@ -414,21 +414,21 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
{
struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
u8 errors = 0;
int r;
mutex_lock(&ddata->lock);
if (ddata->enabled) {
in->ops->dsi.bus_lock(in);
src->ops->dsi.bus_lock(src);
r = dsicm_wake_up(ddata);
if (!r)
r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
&errors);
in->ops->dsi.bus_unlock(in);
src->ops->dsi.bus_unlock(src);
} else {
r = -ENODEV;
}
......@@ -446,20 +446,20 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
{
struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
u8 id1, id2, id3;
int r;
mutex_lock(&ddata->lock);
if (ddata->enabled) {
in->ops->dsi.bus_lock(in);
src->ops->dsi.bus_lock(src);
r = dsicm_wake_up(ddata);
if (!r)
r = dsicm_get_id(ddata, &id1, &id2, &id3);
in->ops->dsi.bus_unlock(in);
src->ops->dsi.bus_unlock(src);
} else {
r = -ENODEV;
}
......@@ -478,7 +478,7 @@ static ssize_t dsicm_store_ulps(struct device *dev,
{
struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
unsigned long t;
int r;
......@@ -489,14 +489,14 @@ static ssize_t dsicm_store_ulps(struct device *dev,
mutex_lock(&ddata->lock);
if (ddata->enabled) {
in->ops->dsi.bus_lock(in);
src->ops->dsi.bus_lock(src);
if (t)
r = dsicm_enter_ulps(ddata);
else
r = dsicm_wake_up(ddata);
in->ops->dsi.bus_unlock(in);
src->ops->dsi.bus_unlock(src);
}
mutex_unlock(&ddata->lock);
......@@ -528,7 +528,7 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
{
struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
unsigned long t;
int r;
......@@ -541,9 +541,9 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
if (ddata->enabled) {
/* dsicm_wake_up will restart the timer */
in->ops->dsi.bus_lock(in);
src->ops->dsi.bus_lock(src);
r = dsicm_wake_up(ddata);
in->ops->dsi.bus_unlock(in);
src->ops->dsi.bus_unlock(src);
}
mutex_unlock(&ddata->lock);
......@@ -603,7 +603,7 @@ static void dsicm_hw_reset(struct panel_drv_data *ddata)
static int dsicm_power_on(struct panel_drv_data *ddata)
{
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
u8 id1, id2, id3;
int r;
struct omap_dss_dsi_config dsi_config = {
......@@ -635,7 +635,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
}
if (ddata->pin_config.num_pins > 0) {
r = in->ops->dsi.configure_pins(in, &ddata->pin_config);
r = src->ops->dsi.configure_pins(src, &ddata->pin_config);
if (r) {
dev_err(&ddata->pdev->dev,
"failed to configure DSI pins\n");
......@@ -643,13 +643,13 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
}
}
r = in->ops->dsi.set_config(in, &dsi_config);
r = src->ops->dsi.set_config(src, &dsi_config);
if (r) {
dev_err(&ddata->pdev->dev, "failed to configure DSI\n");
goto err_vddi;
}
r = in->ops->enable(in);
r = src->ops->enable(src);
if (r) {
dev_err(&ddata->pdev->dev, "failed to enable DSI\n");
goto err_vddi;
......@@ -657,7 +657,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
dsicm_hw_reset(ddata);
in->ops->dsi.enable_hs(in, ddata->channel, false);
src->ops->dsi.enable_hs(src, ddata->channel, false);
r = dsicm_sleep_out(ddata);
if (r)
......@@ -689,7 +689,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
if (r)
goto err;
r = in->ops->dsi.enable_video_output(in, ddata->channel);
r = src->ops->dsi.enable_video_output(src, ddata->channel);
if (r)
goto err;
......@@ -701,7 +701,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
ddata->intro_printed = true;
}
in->ops->dsi.enable_hs(in, ddata->channel, true);
src->ops->dsi.enable_hs(src, ddata->channel, true);
return 0;
err:
......@@ -709,7 +709,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
dsicm_hw_reset(ddata);
in->ops->dsi.disable(in, true, false);
src->ops->dsi.disable(src, true, false);
err_vddi:
if (ddata->vddi)
regulator_disable(ddata->vddi);
......@@ -722,10 +722,10 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
static void dsicm_power_off(struct panel_drv_data *ddata)
{
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
int r;
in->ops->dsi.disable_video_output(in, ddata->channel);
src->ops->dsi.disable_video_output(src, ddata->channel);
r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_DISPLAY_OFF);
if (!r)
......@@ -737,7 +737,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
dsicm_hw_reset(ddata);
}
in->ops->dsi.disable(in, true, false);
src->ops->dsi.disable(src, true, false);
if (ddata->vddi)
regulator_disable(ddata->vddi);
......@@ -760,61 +760,59 @@ static int dsicm_connect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct device *dev = &ddata->pdev->dev;
struct omap_dss_device *in;
struct omap_dss_device *src;
int r;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(src)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
return PTR_ERR(src);
}
r = omapdss_device_connect(in, dssdev);
r = omapdss_device_connect(src, dssdev);
if (r) {
dev_err(dev, "Failed to connect to video source\n");
goto err_connect;
}
r = in->ops->dsi.request_vc(in, &ddata->channel);
r = src->ops->dsi.request_vc(src, &ddata->channel);
if (r) {
dev_err(dev, "failed to get virtual channel\n");
goto err_req_vc;
}
r = in->ops->dsi.set_vc_id(in, ddata->channel, TCH);
r = src->ops->dsi.set_vc_id(src, ddata->channel, TCH);
if (r) {
dev_err(dev, "failed to set VC_ID\n");
goto err_vc_id;
}
ddata->in = in;
return 0;
err_vc_id:
in->ops->dsi.release_vc(in, ddata->channel);
src->ops->dsi.release_vc(src, ddata->channel);
err_req_vc:
omapdss_device_disconnect(in, dssdev);
omapdss_device_disconnect(src, dssdev);
err_connect:
omap_dss_put_device(in);
omap_dss_put_device(src);
return r;
}
static void dsicm_disconnect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
in->ops->dsi.release_vc(in, ddata->channel);
omapdss_device_disconnect(in, dssdev);
src->ops->dsi.release_vc(src, ddata->channel);
omapdss_device_disconnect(src, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
omap_dss_put_device(src);
}
static int dsicm_enable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
dev_dbg(&ddata->pdev->dev, "enable\n");
......@@ -831,11 +829,11 @@ static int dsicm_enable(struct omap_dss_device *dssdev)
goto err;
}
in->ops->dsi.bus_lock(in);
src->ops->dsi.bus_lock(src);
r = dsicm_power_on(ddata);
in->ops->dsi.bus_unlock(in);
src->ops->dsi.bus_unlock(src);
if (r)
goto err;
......@@ -856,7 +854,7 @@ static int dsicm_enable(struct omap_dss_device *dssdev)
static void dsicm_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
dev_dbg(&ddata->pdev->dev, "disable\n");
......@@ -867,7 +865,7 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
dsicm_cancel_ulps_work(ddata);
in->ops->dsi.bus_lock(in);
src->ops->dsi.bus_lock(src);
if (omapdss_device_is_enabled(dssdev)) {
r = dsicm_wake_up(ddata);
......@@ -875,7 +873,7 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
dsicm_power_off(ddata);
}
in->ops->dsi.bus_unlock(in);
src->ops->dsi.bus_unlock(src);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
......@@ -885,16 +883,16 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
static void dsicm_framedone_cb(int err, void *data)
{
struct panel_drv_data *ddata = data;
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
dev_dbg(&ddata->pdev->dev, "framedone, err %d\n", err);
in->ops->dsi.bus_unlock(ddata->in);
src->ops->dsi.bus_unlock(src);
}
static irqreturn_t dsicm_te_isr(int irq, void *data)
{
struct panel_drv_data *ddata = data;
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
int old;
int r;
......@@ -903,7 +901,7 @@ static irqreturn_t dsicm_te_isr(int irq, void *data)
if (old) {
cancel_delayed_work(&ddata->te_timeout_work);
r = in->ops->dsi.update(in, ddata->channel, dsicm_framedone_cb,
r = src->ops->dsi.update(src, ddata->channel, dsicm_framedone_cb,
ddata);
if (r)
goto err;
......@@ -912,7 +910,7 @@ static irqreturn_t dsicm_te_isr(int irq, void *data)
return IRQ_HANDLED;
err:
dev_err(&ddata->pdev->dev, "start update failed\n");
in->ops->dsi.bus_unlock(in);
src->ops->dsi.bus_unlock(src);
return IRQ_HANDLED;
}
......@@ -920,25 +918,25 @@ static void dsicm_te_timeout_work_callback(struct work_struct *work)
{
struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
te_timeout_work.work);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
dev_err(&ddata->pdev->dev, "TE not received for 250ms!\n");
atomic_set(&ddata->do_update, 0);
in->ops->dsi.bus_unlock(in);
src->ops->dsi.bus_unlock(src);
}
static int dsicm_update(struct omap_dss_device *dssdev,
u16 x, u16 y, u16 w, u16 h)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
dev_dbg(&ddata->pdev->dev, "update %d, %d, %d x %d\n", x, y, w, h);
mutex_lock(&ddata->lock);
in->ops->dsi.bus_lock(in);
src->ops->dsi.bus_lock(src);
r = dsicm_wake_up(ddata);
if (r)
......@@ -960,17 +958,17 @@ static int dsicm_update(struct omap_dss_device *dssdev,
msecs_to_jiffies(250));
atomic_set(&ddata->do_update, 1);
} else {
r = in->ops->dsi.update(in, ddata->channel, dsicm_framedone_cb,
r = src->ops->dsi.update(src, ddata->channel, dsicm_framedone_cb,
ddata);
if (r)
goto err;
}
/* note: no bus_unlock here. unlock is in framedone_cb */
/* note: no bus_unlock here. unlock is src framedone_cb */
mutex_unlock(&ddata->lock);
return 0;
err:
in->ops->dsi.bus_unlock(in);
src->ops->dsi.bus_unlock(src);
mutex_unlock(&ddata->lock);
return r;
}
......@@ -978,13 +976,13 @@ static int dsicm_update(struct omap_dss_device *dssdev,
static int dsicm_sync(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
dev_dbg(&ddata->pdev->dev, "sync\n");
mutex_lock(&ddata->lock);
in->ops->dsi.bus_lock(in);
in->ops->dsi.bus_unlock(in);
src->ops->dsi.bus_lock(src);
src->ops->dsi.bus_unlock(src);
mutex_unlock(&ddata->lock);
dev_dbg(&ddata->pdev->dev, "sync done\n");
......@@ -994,7 +992,7 @@ static int dsicm_sync(struct omap_dss_device *dssdev)
static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
{
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = ddata->dssdev.src;
int r;
if (enable)
......@@ -1003,7 +1001,7 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
r = dsicm_dcs_write_0(ddata, MIPI_DCS_SET_TEAR_OFF);
if (!ddata->ext_te_gpio)
in->ops->dsi.enable_te(in, enable);
src->ops->dsi.enable_te(src, enable);
/* possible panel bug */
msleep(100);
......@@ -1014,7 +1012,7 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
static int dsicm_enable_te(struct omap_dss_device *dssdev, bool enable)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
mutex_lock(&ddata->lock);
......@@ -1022,7 +1020,7 @@ static int dsicm_enable_te(struct omap_dss_device *dssdev, bool enable)
if (ddata->te_enabled == enable)
goto end;
in->ops->dsi.bus_lock(in);
src->ops->dsi.bus_lock(src);
if (ddata->enabled) {
r = dsicm_wake_up(ddata);
......@@ -1036,13 +1034,13 @@ static int dsicm_enable_te(struct omap_dss_device *dssdev, bool enable)
ddata->te_enabled = enable;
in->ops->dsi.bus_unlock(in);
src->ops->dsi.bus_unlock(src);
end:
mutex_unlock(&ddata->lock);
return 0;
err:
in->ops->dsi.bus_unlock(in);
src->ops->dsi.bus_unlock(src);
mutex_unlock(&ddata->lock);
return r;
......@@ -1065,7 +1063,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
u16 x, u16 y, u16 w, u16 h)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
int first = 1;
int plen;
......@@ -1084,7 +1082,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
size = min((u32)w * h * 3,
ddata->vm.hactive * ddata->vm.vactive * 3);
in->ops->dsi.bus_lock(in);
src->ops->dsi.bus_lock(src);
r = dsicm_wake_up(ddata);
if (r)
......@@ -1100,7 +1098,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
dsicm_set_update_window(ddata, x, y, w, h);
r = in->ops->dsi.set_max_rx_packet_size(in, ddata->channel, plen);
r = src->ops->dsi.set_max_rx_packet_size(src, ddata->channel, plen);
if (r)
goto err2;
......@@ -1108,7 +1106,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
u8 dcs_cmd = first ? 0x2e : 0x3e;
first = 0;
r = in->ops->dsi.dcs_read(in, ddata->channel, dcs_cmd,
r = src->ops->dsi.dcs_read(src, ddata->channel, dcs_cmd,
buf + buf_used, size - buf_used);
if (r < 0) {
......@@ -1134,9 +1132,9 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
r = buf_used;
err3:
in->ops->dsi.set_max_rx_packet_size(in, ddata->channel, 1);
src->ops->dsi.set_max_rx_packet_size(src, ddata->channel, 1);
err2:
in->ops->dsi.bus_unlock(in);
src->ops->dsi.bus_unlock(src);
err1:
mutex_unlock(&ddata->lock);
return r;
......@@ -1147,7 +1145,7 @@ static void dsicm_ulps_work(struct work_struct *work)
struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
ulps_work.work);
struct omap_dss_device *dssdev = &ddata->dssdev;
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
mutex_lock(&ddata->lock);
......@@ -1156,11 +1154,11 @@ static void dsicm_ulps_work(struct work_struct *work)
return;
}
in->ops->dsi.bus_lock(in);
src->ops->dsi.bus_lock(src);
dsicm_enter_ulps(ddata);
in->ops->dsi.bus_unlock(in);
src->ops->dsi.bus_unlock(src);
mutex_unlock(&ddata->lock);
}
......
......@@ -45,7 +45,6 @@ static const struct videomode lb035q02_vm = {
struct panel_drv_data {
struct omap_dss_device dssdev;
struct omap_dss_device *in;
struct spi_device *spi;
......@@ -119,42 +118,39 @@ static void init_lb035q02_panel(struct spi_device *spi)
static int lb035q02_connect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in;
struct omap_dss_device *src;
int r;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(src)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
return PTR_ERR(src);
}
r = omapdss_device_connect(in, dssdev);
r = omapdss_device_connect(src, dssdev);
if (r) {
omap_dss_put_device(in);
omap_dss_put_device(src);
return r;
}
init_lb035q02_panel(ddata->spi);
ddata->in = in;
return 0;
}
static void lb035q02_disconnect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
omapdss_device_disconnect(in, dssdev);
omapdss_device_disconnect(src, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
omap_dss_put_device(src);
}
static int lb035q02_enable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
if (!omapdss_device_is_connected(dssdev))
......@@ -163,9 +159,9 @@ static int lb035q02_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops->set_timings(in, &ddata->vm);
src->ops->set_timings(src, &ddata->vm);
r = in->ops->enable(in);
r = src->ops->enable(src);
if (r)
return r;
......@@ -180,7 +176,7 @@ static int lb035q02_enable(struct omap_dss_device *dssdev)
static void lb035q02_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
......@@ -188,7 +184,7 @@ static void lb035q02_disable(struct omap_dss_device *dssdev)
if (ddata->enable_gpio)
gpiod_set_value_cansleep(ddata->enable_gpio, 0);
in->ops->disable(in);
src->ops->disable(src);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -197,11 +193,11 @@ static void lb035q02_set_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
ddata->vm = *vm;
in->ops->set_timings(in, vm);
src->ops->set_timings(src, vm);
}
static void lb035q02_get_timings(struct omap_dss_device *dssdev,
......@@ -215,10 +211,9 @@ static void lb035q02_get_timings(struct omap_dss_device *dssdev,
static int lb035q02_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
return in->ops->check_timings(in, vm);
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_driver lb035q02_ops = {
......
......@@ -21,7 +21,6 @@
struct panel_drv_data {
struct omap_dss_device dssdev;
struct omap_dss_device *in;
struct videomode vm;
......@@ -114,41 +113,37 @@ static int init_nec_8048_wvga_lcd(struct spi_device *spi)
static int nec_8048_connect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in;
struct omap_dss_device *src;
int r;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(src)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
return PTR_ERR(src);
}
r = omapdss_device_connect(in, dssdev);
r = omapdss_device_connect(src, dssdev);
if (r) {
omap_dss_put_device(in);
omap_dss_put_device(src);
return r;
}
ddata->in = in;
return 0;
}
static void nec_8048_disconnect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
omapdss_device_disconnect(in, dssdev);
omapdss_device_disconnect(src, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
omap_dss_put_device(src);
}
static int nec_8048_enable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
if (!omapdss_device_is_connected(dssdev))
......@@ -157,9 +152,9 @@ static int nec_8048_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops->set_timings(in, &ddata->vm);
src->ops->set_timings(src, &ddata->vm);
r = in->ops->enable(in);
r = src->ops->enable(src);
if (r)
return r;
......@@ -174,7 +169,7 @@ static int nec_8048_enable(struct omap_dss_device *dssdev)
static void nec_8048_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
......@@ -182,7 +177,7 @@ static void nec_8048_disable(struct omap_dss_device *dssdev)
if (gpio_is_valid(ddata->res_gpio))
gpio_set_value_cansleep(ddata->res_gpio, 0);
in->ops->disable(in);
src->ops->disable(src);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -191,11 +186,11 @@ static void nec_8048_set_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
ddata->vm = *vm;
in->ops->set_timings(in, vm);
src->ops->set_timings(src, vm);
}
static void nec_8048_get_timings(struct omap_dss_device *dssdev,
......@@ -209,10 +204,9 @@ static void nec_8048_get_timings(struct omap_dss_device *dssdev,
static int nec_8048_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
return in->ops->check_timings(in, vm);
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_driver nec_8048_ops = {
......
......@@ -21,7 +21,6 @@
struct panel_drv_data {
struct omap_dss_device dssdev;
struct omap_dss_device *in;
struct regulator *vcc;
struct videomode vm;
......@@ -60,41 +59,37 @@ static const struct videomode sharp_ls_vm = {
static int sharp_ls_connect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in;
struct omap_dss_device *src;
int r;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(src)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
return PTR_ERR(src);
}
r = omapdss_device_connect(in, dssdev);
r = omapdss_device_connect(src, dssdev);
if (r) {
omap_dss_put_device(in);
omap_dss_put_device(src);
return r;
}
ddata->in = in;
return 0;
}
static void sharp_ls_disconnect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
omapdss_device_disconnect(in, dssdev);
omapdss_device_disconnect(src, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
omap_dss_put_device(src);
}
static int sharp_ls_enable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
if (!omapdss_device_is_connected(dssdev))
......@@ -103,7 +98,7 @@ static int sharp_ls_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops->set_timings(in, &ddata->vm);
src->ops->set_timings(src, &ddata->vm);
if (ddata->vcc) {
r = regulator_enable(ddata->vcc);
......@@ -111,7 +106,7 @@ static int sharp_ls_enable(struct omap_dss_device *dssdev)
return r;
}
r = in->ops->enable(in);
r = src->ops->enable(src);
if (r) {
regulator_disable(ddata->vcc);
return r;
......@@ -134,7 +129,7 @@ static int sharp_ls_enable(struct omap_dss_device *dssdev)
static void sharp_ls_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
......@@ -149,7 +144,7 @@ static void sharp_ls_disable(struct omap_dss_device *dssdev)
msleep(100);
in->ops->disable(in);
src->ops->disable(src);
if (ddata->vcc)
regulator_disable(ddata->vcc);
......@@ -161,11 +156,11 @@ static void sharp_ls_set_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
ddata->vm = *vm;
in->ops->set_timings(in, vm);
src->ops->set_timings(src, vm);
}
static void sharp_ls_get_timings(struct omap_dss_device *dssdev,
......@@ -179,10 +174,9 @@ static void sharp_ls_get_timings(struct omap_dss_device *dssdev,
static int sharp_ls_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
return in->ops->check_timings(in, vm);
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_driver sharp_ls_ops = {
......
......@@ -64,7 +64,6 @@
struct panel_drv_data {
struct omap_dss_device dssdev;
struct omap_dss_device *in;
int reset_gpio;
......@@ -509,48 +508,44 @@ static const struct attribute_group bldev_attr_group = {
static int acx565akm_connect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in;
struct omap_dss_device *src;
int r;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(src)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
return PTR_ERR(src);
}
r = omapdss_device_connect(in, dssdev);
r = omapdss_device_connect(src, dssdev);
if (r) {
omap_dss_put_device(in);
omap_dss_put_device(src);
return r;
}
ddata->in = in;
return 0;
}
static void acx565akm_disconnect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
omapdss_device_disconnect(in, dssdev);
omapdss_device_disconnect(src, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
omap_dss_put_device(src);
}
static int acx565akm_panel_power_on(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
dev_dbg(&ddata->spi->dev, "%s\n", __func__);
in->ops->set_timings(in, &ddata->vm);
src->ops->set_timings(src, &ddata->vm);
r = in->ops->enable(in);
r = src->ops->enable(src);
if (r) {
pr_err("%s sdi enable failed\n", __func__);
return r;
......@@ -591,7 +586,7 @@ static int acx565akm_panel_power_on(struct omap_dss_device *dssdev)
static void acx565akm_panel_power_off(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
dev_dbg(dssdev->dev, "%s\n", __func__);
......@@ -615,7 +610,7 @@ static void acx565akm_panel_power_off(struct omap_dss_device *dssdev)
/* FIXME need to tweak this delay */
msleep(100);
in->ops->disable(in);
src->ops->disable(src);
}
static int acx565akm_enable(struct omap_dss_device *dssdev)
......@@ -662,11 +657,11 @@ static void acx565akm_set_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
ddata->vm = *vm;
in->ops->set_timings(in, vm);
src->ops->set_timings(src, vm);
}
static void acx565akm_get_timings(struct omap_dss_device *dssdev,
......@@ -680,10 +675,9 @@ static void acx565akm_get_timings(struct omap_dss_device *dssdev,
static int acx565akm_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
return in->ops->check_timings(in, vm);
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_driver acx565akm_ops = {
......
......@@ -33,7 +33,6 @@
struct panel_drv_data {
struct omap_dss_device dssdev;
struct omap_dss_device *in;
struct videomode vm;
......@@ -168,41 +167,37 @@ enum jbt_register {
static int td028ttec1_panel_connect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in;
struct omap_dss_device *src;
int r;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(src)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
return PTR_ERR(src);
}
r = omapdss_device_connect(in, dssdev);
r = omapdss_device_connect(src, dssdev);
if (r) {
omap_dss_put_device(in);
omap_dss_put_device(src);
return r;
}
ddata->in = in;
return 0;
}
static void td028ttec1_panel_disconnect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
omapdss_device_disconnect(in, dssdev);
omapdss_device_disconnect(src, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
omap_dss_put_device(src);
}
static int td028ttec1_panel_enable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
if (!omapdss_device_is_connected(dssdev))
......@@ -211,9 +206,9 @@ static int td028ttec1_panel_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops->set_timings(in, &ddata->vm);
src->ops->set_timings(src, &ddata->vm);
r = in->ops->enable(in);
r = src->ops->enable(src);
if (r)
return r;
......@@ -310,7 +305,7 @@ static int td028ttec1_panel_enable(struct omap_dss_device *dssdev)
static void td028ttec1_panel_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
......@@ -322,7 +317,7 @@ static void td028ttec1_panel_disable(struct omap_dss_device *dssdev)
jbt_ret_write_0(ddata, JBT_REG_SLEEP_IN);
jbt_reg_write_1(ddata, JBT_REG_POWER_ON_OFF, 0x00);
in->ops->disable(in);
src->ops->disable(src);
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
}
......@@ -331,11 +326,11 @@ static void td028ttec1_panel_set_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
ddata->vm = *vm;
in->ops->set_timings(in, vm);
src->ops->set_timings(src, vm);
}
static void td028ttec1_panel_get_timings(struct omap_dss_device *dssdev,
......@@ -349,10 +344,9 @@ static void td028ttec1_panel_get_timings(struct omap_dss_device *dssdev,
static int td028ttec1_panel_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
return in->ops->check_timings(in, vm);
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_driver td028ttec1_ops = {
......
......@@ -54,7 +54,6 @@ static const u16 tpo_td043_def_gamma[12] = {
struct panel_drv_data {
struct omap_dss_device dssdev;
struct omap_dss_device *in;
struct videomode vm;
......@@ -339,41 +338,37 @@ static void tpo_td043_power_off(struct panel_drv_data *ddata)
static int tpo_td043_connect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in;
struct omap_dss_device *src;
int r;
in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(in)) {
src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
if (IS_ERR(src)) {
dev_err(dssdev->dev, "failed to find video source\n");
return PTR_ERR(in);
return PTR_ERR(src);
}
r = omapdss_device_connect(in, dssdev);
r = omapdss_device_connect(src, dssdev);
if (r) {
omap_dss_put_device(in);
omap_dss_put_device(src);
return r;
}
ddata->in = in;
return 0;
}
static void tpo_td043_disconnect(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
omapdss_device_disconnect(in, dssdev);
omapdss_device_disconnect(src, dssdev);
omap_dss_put_device(in);
ddata->in = NULL;
omap_dss_put_device(src);
}
static int tpo_td043_enable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
int r;
if (!omapdss_device_is_connected(dssdev))
......@@ -382,9 +377,9 @@ static int tpo_td043_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
in->ops->set_timings(in, &ddata->vm);
src->ops->set_timings(src, &ddata->vm);
r = in->ops->enable(in);
r = src->ops->enable(src);
if (r)
return r;
......@@ -395,7 +390,7 @@ static int tpo_td043_enable(struct omap_dss_device *dssdev)
if (!ddata->spi_suspended) {
r = tpo_td043_power_on(ddata);
if (r) {
in->ops->disable(in);
src->ops->disable(src);
return r;
}
}
......@@ -408,12 +403,12 @@ static int tpo_td043_enable(struct omap_dss_device *dssdev)
static void tpo_td043_disable(struct omap_dss_device *dssdev)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
if (!omapdss_device_is_enabled(dssdev))
return;
in->ops->disable(in);
src->ops->disable(src);
if (!ddata->spi_suspended)
tpo_td043_power_off(ddata);
......@@ -425,11 +420,11 @@ static void tpo_td043_set_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
ddata->vm = *vm;
in->ops->set_timings(in, vm);
src->ops->set_timings(src, vm);
}
static void tpo_td043_get_timings(struct omap_dss_device *dssdev,
......@@ -443,10 +438,9 @@ static void tpo_td043_get_timings(struct omap_dss_device *dssdev,
static int tpo_td043_check_timings(struct omap_dss_device *dssdev,
struct videomode *vm)
{
struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *in = ddata->in;
struct omap_dss_device *src = dssdev->src;
return in->ops->check_timings(in, vm);
return src->ops->check_timings(src, vm);
}
static const struct omap_dss_driver tpo_td043_ops = {
......
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