Skip to content

Commit

Permalink
OMAPDSS: manage output-dssdev connection in output drivers
Browse files Browse the repository at this point in the history
We currently attach an output to a dssdev in the initialization code for
dssdevices in display.c. This works, but doesn't quite make sense: an
output entity represents (surprisingly) an output of DSS, which is
managed by an output driver. The output driver also handles adding new
dssdev's for that particular output.

It makes more sense to make the output-dssdev connection in the output
driver. This is also in line with common display framework.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
  • Loading branch information
Tomi Valkeinen committed Dec 7, 2012
1 parent 09a8c45 commit 486c0e1
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 46 deletions.
12 changes: 0 additions & 12 deletions drivers/video/omap2/dss/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,8 @@ EXPORT_SYMBOL(omapdss_default_get_timings);
int dss_init_device(struct platform_device *pdev,
struct omap_dss_device *dssdev)
{
struct omap_dss_output *out;
int r;

out = omapdss_get_output_from_dssdev(dssdev);

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

r = display_init_sysfs(pdev, dssdev);
if (r) {
omapdss_output_unset_device(dssdev->output);
Expand All @@ -103,9 +94,6 @@ void dss_uninit_device(struct platform_device *pdev,
struct omap_dss_device *dssdev)
{
display_uninit_sysfs(pdev, dssdev);

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

static int dss_suspend_device(struct device *dev, void *data)
Expand Down
9 changes: 9 additions & 0 deletions drivers/video/omap2/dss/dpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,18 @@ static void __init dpi_probe_pdata(struct platform_device *dpidev)
return;
}

r = omapdss_output_set_device(&dpi.output, dssdev);
if (r) {
DSSERR("failed to connect output to new device: %s\n",
dssdev->name);
dss_put_device(dssdev);
return;
}

r = dss_add_device(dssdev);
if (r) {
DSSERR("device %s register failed: %d\n", dssdev->name, r);
omapdss_output_unset_device(&dpi.output);
dss_put_device(dssdev);
return;
}
Expand Down
10 changes: 10 additions & 0 deletions drivers/video/omap2/dss/dsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -5146,6 +5146,7 @@ static struct omap_dss_device * __init dsi_find_dssdev(struct platform_device *p

static void __init dsi_probe_pdata(struct platform_device *dsidev)
{
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
struct omap_dss_device *plat_dssdev;
struct omap_dss_device *dssdev;
int r;
Expand All @@ -5168,9 +5169,18 @@ static void __init dsi_probe_pdata(struct platform_device *dsidev)
return;
}

r = omapdss_output_set_device(&dsi->output, dssdev);
if (r) {
DSSERR("failed to connect output to new device: %s\n",
dssdev->name);
dss_put_device(dssdev);
return;
}

r = dss_add_device(dssdev);
if (r) {
DSSERR("device %s register failed: %d\n", dssdev->name, r);
omapdss_output_unset_device(&dsi->output);
dss_put_device(dssdev);
return;
}
Expand Down
1 change: 0 additions & 1 deletion drivers/video/omap2/dss/dss.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ int dss_ovl_unset_manager(struct omap_overlay *ovl);
/* output */
void dss_register_output(struct omap_dss_output *out);
void dss_unregister_output(struct omap_dss_output *out);
struct omap_dss_output *omapdss_get_output_from_dssdev(struct omap_dss_device *dssdev);

/* display */
int dss_suspend_all_devices(void);
Expand Down
9 changes: 9 additions & 0 deletions drivers/video/omap2/dss/hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,9 +1026,18 @@ static void __init hdmi_probe_pdata(struct platform_device *pdev)
return;
}

r = omapdss_output_set_device(&hdmi.output, dssdev);
if (r) {
DSSERR("failed to connect output to new device: %s\n",
dssdev->name);
dss_put_device(dssdev);
return;
}

r = dss_add_device(dssdev);
if (r) {
DSSERR("device %s register failed: %d\n", dssdev->name, r);
omapdss_output_unset_device(&hdmi.output);
hdmi_uninit_display(dssdev);
dss_put_device(dssdev);
return;
Expand Down
33 changes: 0 additions & 33 deletions drivers/video/omap2/dss/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,36 +113,3 @@ struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id)

return NULL;
}

struct omap_dss_output *omapdss_get_output_from_dssdev(struct omap_dss_device *dssdev)
{
struct omap_dss_output *out = NULL;
enum omap_dss_output_id id;

switch (dssdev->type) {
case OMAP_DISPLAY_TYPE_DPI:
out = omap_dss_get_output(OMAP_DSS_OUTPUT_DPI);
break;
case OMAP_DISPLAY_TYPE_DBI:
out = omap_dss_get_output(OMAP_DSS_OUTPUT_DBI);
break;
case OMAP_DISPLAY_TYPE_SDI:
out = omap_dss_get_output(OMAP_DSS_OUTPUT_SDI);
break;
case OMAP_DISPLAY_TYPE_VENC:
out = omap_dss_get_output(OMAP_DSS_OUTPUT_VENC);
break;
case OMAP_DISPLAY_TYPE_HDMI:
out = omap_dss_get_output(OMAP_DSS_OUTPUT_HDMI);
break;
case OMAP_DISPLAY_TYPE_DSI:
id = dssdev->phy.dsi.module == 0 ? OMAP_DSS_OUTPUT_DSI1 :
OMAP_DSS_OUTPUT_DSI2;
out = omap_dss_get_output(id);
break;
default:
break;
}

return out;
}
9 changes: 9 additions & 0 deletions drivers/video/omap2/dss/rfbi.c
Original file line number Diff line number Diff line change
Expand Up @@ -999,9 +999,18 @@ static void __init rfbi_probe_pdata(struct platform_device *rfbidev)
return;
}

r = omapdss_output_set_device(&rfbi.output, dssdev);
if (r) {
DSSERR("failed to connect output to new device: %s\n",
dssdev->name);
dss_put_device(dssdev);
return;
}

r = dss_add_device(dssdev);
if (r) {
DSSERR("device %s register failed: %d\n", dssdev->name, r);
omapdss_output_unset_device(&rfbi.output);
dss_put_device(dssdev);
return;
}
Expand Down
9 changes: 9 additions & 0 deletions drivers/video/omap2/dss/sdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,18 @@ static void __init sdi_probe_pdata(struct platform_device *sdidev)
return;
}

r = omapdss_output_set_device(&sdi.output, dssdev);
if (r) {
DSSERR("failed to connect output to new device: %s\n",
dssdev->name);
dss_put_device(dssdev);
return;
}

r = dss_add_device(dssdev);
if (r) {
DSSERR("device %s register failed: %d\n", dssdev->name, r);
omapdss_output_unset_device(&sdi.output);
dss_put_device(dssdev);
return;
}
Expand Down
9 changes: 9 additions & 0 deletions drivers/video/omap2/dss/venc.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,9 +795,18 @@ static void __init venc_probe_pdata(struct platform_device *vencdev)
return;
}

r = omapdss_output_set_device(&venc.output, dssdev);
if (r) {
DSSERR("failed to connect output to new device: %s\n",
dssdev->name);
dss_put_device(dssdev);
return;
}

r = dss_add_device(dssdev);
if (r) {
DSSERR("device %s register failed: %d\n", dssdev->name, r);
omapdss_output_unset_device(&venc.output);
dss_put_device(dssdev);
return;
}
Expand Down

0 comments on commit 486c0e1

Please sign in to comment.