OMAPDSS: Remove manager->device references

With the introduction of output entities, managers will now connect to outputs.
Create helper ops for overlays and managers named get_device. This will abstract
away the information on how to get the device from an overlay or an overlay
manager. The get_device ops currently retrieve the output via a
ovl->manager->device reference. This will be later replaced by
ovl->manager->output->device references.

Signed-off-by: Archit Taneja <archit@ti.com>
This commit is contained in:
Archit Taneja 2012-09-07 17:44:51 +05:30 committed by Tomi Valkeinen
parent 97f01b3a2e
commit 794bc4eefa
6 changed files with 33 additions and 10 deletions

View file

@ -1464,7 +1464,7 @@ int dss_ovl_enable(struct omap_overlay *ovl)
goto err1; goto err1;
} }
if (ovl->manager == NULL || ovl->manager->device == NULL) { if (ovl->get_device(ovl) == NULL) {
r = -EINVAL; r = -EINVAL;
goto err1; goto err1;
} }
@ -1514,7 +1514,7 @@ int dss_ovl_disable(struct omap_overlay *ovl)
goto err; goto err;
} }
if (ovl->manager == NULL || ovl->manager->device == NULL) { if (ovl->get_device(ovl) == NULL) {
r = -EINVAL; r = -EINVAL;
goto err; goto err;
} }

View file

@ -3595,7 +3595,7 @@ static void dispc_error_worker(struct work_struct *work)
bit = mgr_desc[i].sync_lost_irq; bit = mgr_desc[i].sync_lost_irq;
if (bit & errors) { if (bit & errors) {
struct omap_dss_device *dssdev = mgr->device; struct omap_dss_device *dssdev = mgr->get_device(mgr);
bool enable; bool enable;
DSSERR("SYNC_LOST on channel %s, restarting the output " DSSERR("SYNC_LOST on channel %s, restarting the output "
@ -3626,9 +3626,13 @@ static void dispc_error_worker(struct work_struct *work)
DSSERR("OCP_ERR\n"); DSSERR("OCP_ERR\n");
for (i = 0; i < omap_dss_get_num_overlay_managers(); ++i) { for (i = 0; i < omap_dss_get_num_overlay_managers(); ++i) {
struct omap_overlay_manager *mgr; struct omap_overlay_manager *mgr;
struct omap_dss_device *dssdev;
mgr = omap_dss_get_overlay_manager(i); mgr = omap_dss_get_overlay_manager(i);
if (mgr->device && mgr->device->driver) dssdev = mgr->get_device(mgr);
mgr->device->driver->disable(mgr->device);
if (dssdev && dssdev->driver)
dssdev->driver->disable(dssdev);
} }
} }

View file

@ -38,8 +38,10 @@ static ssize_t manager_name_show(struct omap_overlay_manager *mgr, char *buf)
static ssize_t manager_display_show(struct omap_overlay_manager *mgr, char *buf) static ssize_t manager_display_show(struct omap_overlay_manager *mgr, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%s\n", struct omap_dss_device *dssdev = mgr->get_device(mgr);
mgr->device ? mgr->device->name : "<none>");
return snprintf(buf, PAGE_SIZE, "%s\n", dssdev ?
dssdev->name : "<none>");
} }
static ssize_t manager_display_store(struct omap_overlay_manager *mgr, static ssize_t manager_display_store(struct omap_overlay_manager *mgr,
@ -67,7 +69,7 @@ static ssize_t manager_display_store(struct omap_overlay_manager *mgr,
if (dssdev) if (dssdev)
DSSDBG("display %s found\n", dssdev->name); DSSDBG("display %s found\n", dssdev->name);
if (mgr->device) { if (mgr->get_device(mgr)) {
r = mgr->unset_device(mgr); r = mgr->unset_device(mgr);
if (r) { if (r) {
DSSERR("failed to unset display\n"); DSSERR("failed to unset display\n");

View file

@ -36,9 +36,15 @@
static int num_managers; static int num_managers;
static struct omap_overlay_manager *managers; static struct omap_overlay_manager *managers;
static inline struct omap_dss_device *dss_mgr_get_device(struct omap_overlay_manager *mgr)
{
return mgr->device;
}
static int dss_mgr_wait_for_vsync(struct omap_overlay_manager *mgr) static int dss_mgr_wait_for_vsync(struct omap_overlay_manager *mgr)
{ {
unsigned long timeout = msecs_to_jiffies(500); unsigned long timeout = msecs_to_jiffies(500);
struct omap_dss_device *dssdev = mgr->get_device(mgr);
u32 irq; u32 irq;
int r; int r;
@ -46,9 +52,9 @@ static int dss_mgr_wait_for_vsync(struct omap_overlay_manager *mgr)
if (r) if (r)
return r; return r;
if (mgr->device->type == OMAP_DISPLAY_TYPE_VENC) if (dssdev->type == OMAP_DISPLAY_TYPE_VENC)
irq = DISPC_IRQ_EVSYNC_ODD; irq = DISPC_IRQ_EVSYNC_ODD;
else if (mgr->device->type == OMAP_DISPLAY_TYPE_HDMI) else if (dssdev->type == OMAP_DISPLAY_TYPE_HDMI)
irq = DISPC_IRQ_EVSYNC_EVEN; irq = DISPC_IRQ_EVSYNC_EVEN;
else else
irq = dispc_mgr_get_vsync_irq(mgr->id); irq = dispc_mgr_get_vsync_irq(mgr->id);
@ -102,6 +108,7 @@ int dss_init_overlay_managers(struct platform_device *pdev)
mgr->get_manager_info = &dss_mgr_get_info; mgr->get_manager_info = &dss_mgr_get_info;
mgr->wait_for_go = &dss_mgr_wait_for_go; mgr->wait_for_go = &dss_mgr_wait_for_go;
mgr->wait_for_vsync = &dss_mgr_wait_for_vsync; mgr->wait_for_vsync = &dss_mgr_wait_for_vsync;
mgr->get_device = &dss_mgr_get_device;
mgr->caps = 0; mgr->caps = 0;
mgr->supported_displays = mgr->supported_displays =

View file

@ -38,6 +38,11 @@
static int num_overlays; static int num_overlays;
static struct omap_overlay *overlays; static struct omap_overlay *overlays;
static inline struct omap_dss_device *dss_ovl_get_device(struct omap_overlay *ovl)
{
return ovl->manager ? ovl->manager->device : NULL;
}
int omap_dss_get_num_overlays(void) int omap_dss_get_num_overlays(void)
{ {
return num_overlays; return num_overlays;
@ -94,6 +99,7 @@ void dss_init_overlays(struct platform_device *pdev)
ovl->set_overlay_info = &dss_ovl_set_info; ovl->set_overlay_info = &dss_ovl_set_info;
ovl->get_overlay_info = &dss_ovl_get_info; ovl->get_overlay_info = &dss_ovl_get_info;
ovl->wait_for_go = &dss_mgr_wait_for_go_ovl; ovl->wait_for_go = &dss_mgr_wait_for_go_ovl;
ovl->get_device = &dss_ovl_get_device;
ovl->caps = dss_feat_get_overlay_caps(ovl->id); ovl->caps = dss_feat_get_overlay_caps(ovl->id);
ovl->supported_modes = ovl->supported_modes =

View file

@ -435,6 +435,8 @@ struct omap_overlay {
struct omap_overlay_info *info); struct omap_overlay_info *info);
int (*wait_for_go)(struct omap_overlay *ovl); int (*wait_for_go)(struct omap_overlay *ovl);
struct omap_dss_device *(*get_device)(struct omap_overlay *ovl);
}; };
struct omap_overlay_manager_info { struct omap_overlay_manager_info {
@ -491,6 +493,8 @@ struct omap_overlay_manager {
int (*apply)(struct omap_overlay_manager *mgr); int (*apply)(struct omap_overlay_manager *mgr);
int (*wait_for_go)(struct omap_overlay_manager *mgr); int (*wait_for_go)(struct omap_overlay_manager *mgr);
int (*wait_for_vsync)(struct omap_overlay_manager *mgr); int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
struct omap_dss_device *(*get_device)(struct omap_overlay_manager *mgr);
}; };
/* 22 pins means 1 clk lane and 10 data lanes */ /* 22 pins means 1 clk lane and 10 data lanes */