Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 344593
b: refs/heads/master
c: 5d89bcc
h: refs/heads/master
i:
  344591: 4b88823
v: v3
  • Loading branch information
Tomi Valkeinen committed Oct 29, 2012
1 parent 7a654b2 commit f334273
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 83 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2bbcce5e0b47e0de83a1b799b9e164f8c5b9b634
refs/heads/master: 5d89bcc341771d95e3a2996218e5949a6627f59e
78 changes: 7 additions & 71 deletions trunk/drivers/video/omap2/dss/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,86 +320,21 @@ void omapdss_default_get_timings(struct omap_dss_device *dssdev,
}
EXPORT_SYMBOL(omapdss_default_get_timings);

/*
* Connect dssdev to a manager if the manager is free or if force is specified.
* Connect all overlays to that manager if they are free or if force is
* specified.
*/
static int dss_init_connections(struct omap_dss_device *dssdev, bool force)
int dss_init_device(struct platform_device *pdev,
struct omap_dss_device *dssdev)
{
struct device_attribute *attr;
struct omap_dss_output *out;
struct omap_overlay_manager *mgr;
int i, r;

out = omapdss_get_output_from_dssdev(dssdev);

WARN_ON(dssdev->output);
WARN_ON(out->device);

r = omapdss_output_set_device(out, dssdev);
if (r) {
DSSERR("failed to connect output to new device\n");
return r;
}

mgr = omap_dss_get_overlay_manager(dssdev->channel);

if (mgr->output && !force)
return 0;

if (mgr->output)
mgr->unset_output(mgr);

r = mgr->set_output(mgr, out);
if (r) {
DSSERR("failed to connect manager to output of new device\n");

/* remove the output-device connection we just made */
omapdss_output_unset_device(out);
return r;
}

for (i = 0; i < omap_dss_get_num_overlays(); ++i) {
struct omap_overlay *ovl = omap_dss_get_overlay(i);

if (!ovl->manager || force) {
if (ovl->manager)
ovl->unset_manager(ovl);

r = ovl->set_manager(ovl, mgr);
if (r) {
DSSERR("failed to set initial overlay\n");
return r;
}
}
}

return 0;
}

static void dss_uninit_connections(struct omap_dss_device *dssdev)
{
if (dssdev->output) {
struct omap_overlay_manager *mgr = dssdev->output->manager;

if (mgr)
mgr->unset_output(mgr);

omapdss_output_unset_device(dssdev->output);
}
}

int dss_init_device(struct platform_device *pdev,
struct omap_dss_device *dssdev)
{
struct device_attribute *attr;
int i, r;
const char *def_disp_name = omapdss_get_default_display_name();
bool force;

force = def_disp_name && strcmp(def_disp_name, dssdev->name) == 0;
dss_init_connections(dssdev, force);

/* create device sysfs files */
i = 0;
while ((attr = display_sysfs_attrs[i++]) != NULL) {
Expand All @@ -410,7 +345,7 @@ int dss_init_device(struct platform_device *pdev,
device_remove_file(&dssdev->dev, attr);
}

dss_uninit_connections(dssdev);
omapdss_output_unset_device(dssdev->output);

DSSERR("failed to create sysfs file\n");
return r;
Expand All @@ -424,7 +359,7 @@ int dss_init_device(struct platform_device *pdev,
while ((attr = display_sysfs_attrs[i++]) != NULL)
device_remove_file(&dssdev->dev, attr);

dss_uninit_connections(dssdev);
omapdss_output_unset_device(dssdev->output);

DSSERR("failed to create sysfs display link\n");
return r;
Expand All @@ -444,7 +379,8 @@ void dss_uninit_device(struct platform_device *pdev,
while ((attr = display_sysfs_attrs[i++]) != NULL)
device_remove_file(&dssdev->dev, attr);

dss_uninit_connections(dssdev);
if (dssdev->output)
omapdss_output_unset_device(dssdev->output);
}

static int dss_suspend_device(struct device *dev, void *data)
Expand Down
77 changes: 66 additions & 11 deletions trunk/drivers/video/omap2/omapfb/omapfb-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2369,15 +2369,52 @@ static int omapfb_init_display(struct omapfb2_device *fbdev,
return 0;
}

static int omapfb_init_connections(struct omapfb2_device *fbdev,
struct omap_dss_device *dssdev)
{
int i, r;
struct omap_overlay_manager *mgr = NULL;

for (i = 0; i < fbdev->num_managers; i++) {
mgr = fbdev->managers[i];

if (dssdev->channel == mgr->id)
break;
}

if (i == fbdev->num_managers)
return -ENODEV;

if (mgr->output)
mgr->unset_output(mgr);

r = mgr->set_output(mgr, dssdev->output);
if (r)
return r;

for (i = 0; i < fbdev->num_overlays; i++) {
struct omap_overlay *ovl = fbdev->overlays[i];

if (ovl->manager)
ovl->unset_manager(ovl);

r = ovl->set_manager(ovl, mgr);
if (r)
dev_warn(fbdev->dev,
"failed to connect overlay %s to manager %s\n",
ovl->name, mgr->name);
}

return 0;
}

static int __init omapfb_probe(struct platform_device *pdev)
{
struct omapfb2_device *fbdev = NULL;
int r = 0;
int i;
struct omap_overlay *ovl;
struct omap_dss_device *def_display;
struct omap_dss_device *dssdev;
struct omap_dss_device *ovl_device;

DBG("omapfb_probe\n");

Expand Down Expand Up @@ -2445,15 +2482,33 @@ static int __init omapfb_probe(struct platform_device *pdev)
for (i = 0; i < fbdev->num_managers; i++)
fbdev->managers[i] = omap_dss_get_overlay_manager(i);

/* gfx overlay should be the default one. find a display
* connected to that, and use it as default display */
ovl = omap_dss_get_overlay(0);
ovl_device = ovl->get_device(ovl);
if (ovl_device) {
def_display = ovl_device;
} else {
dev_warn(&pdev->dev, "cannot find default display\n");
def_display = NULL;
def_display = NULL;

for (i = 0; i < fbdev->num_displays; ++i) {
struct omap_dss_device *dssdev;
const char *def_name;

def_name = omapdss_get_default_display_name();

dssdev = fbdev->displays[i].dssdev;

if (def_name == NULL ||
(dssdev->name && strcmp(def_name, dssdev->name) == 0)) {
def_display = dssdev;
break;
}
}

if (def_display == NULL) {
dev_err(fbdev->dev, "failed to find default display\n");
r = -EINVAL;
goto cleanup;
}

r = omapfb_init_connections(fbdev, def_display);
if (r) {
dev_err(fbdev->dev, "failed to init overlay connections\n");
goto cleanup;
}

if (def_mode && strlen(def_mode) > 0) {
Expand Down

0 comments on commit f334273

Please sign in to comment.