From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: archit@ti.com, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH 7/8] OMAPDSS: cleanup dss_recheck_connections further
Date: Wed, 19 Sep 2012 08:30:37 +0000 [thread overview]
Message-ID: <1348043438-2624-8-git-send-email-tomi.valkeinen@ti.com> (raw)
In-Reply-To: <1348043438-2624-1-git-send-email-tomi.valkeinen@ti.com>
Cleanup dss_recheck_connections, move and rename it to a static
dss_init_connections function inside display.c. Improve the function to
return errors, and implement a matching dss_uninit_connections that can
be used to free the mgr->dssdev link.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/core.c | 5 ---
drivers/video/omap2/dss/display.c | 62 +++++++++++++++++++++++++++++++++++--
drivers/video/omap2/dss/dss.h | 1 -
drivers/video/omap2/dss/overlay.c | 32 -------------------
4 files changed, 60 insertions(+), 40 deletions(-)
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 9315ece..c4fd768 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -352,7 +352,6 @@ static int dss_driver_probe(struct device *dev)
int r;
struct omap_dss_driver *dssdrv = to_dss_driver(dev->driver);
struct omap_dss_device *dssdev = to_dss_device(dev);
- bool force;
DSSDBG("driver_probe: dev %s/%s, drv %s\n",
dev_name(dev), dssdev->driver_name,
@@ -362,10 +361,6 @@ static int dss_driver_probe(struct device *dev)
if (r)
return r;
- force = core.default_display_name &&
- strcmp(core.default_display_name, dssdev->name) = 0;
- dss_recheck_connections(dssdev, force);
-
r = dssdrv->probe(dssdev);
if (r) {
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c
index f719010..db83ae8 100644
--- a/drivers/video/omap2/dss/display.c
+++ b/drivers/video/omap2/dss/display.c
@@ -320,11 +320,66 @@ 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)
+{
+ struct omap_overlay_manager *mgr;
+ int i, r;
+
+ WARN_ON(dssdev->manager);
+
+ mgr = omap_dss_get_overlay_manager(dssdev->channel);
+
+ if (mgr->device && !force)
+ return 0;
+
+ if (mgr->device)
+ mgr->unset_device(mgr);
+
+ r = mgr->set_device(mgr, dssdev);
+ if (r) {
+ DSSERR("failed to set initial manager\n");
+ 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->manager)
+ dssdev->manager->unset_device(dssdev->manager);
+}
+
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 = dss_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;
@@ -336,6 +391,8 @@ int dss_init_device(struct platform_device *pdev,
device_remove_file(&dssdev->dev, attr);
}
+ dss_uninit_connections(dssdev);
+
DSSERR("failed to create sysfs file\n");
return r;
}
@@ -348,6 +405,8 @@ 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);
+
DSSERR("failed to create sysfs display link\n");
return r;
}
@@ -366,8 +425,7 @@ void dss_uninit_device(struct platform_device *pdev,
while ((attr = display_sysfs_attrs[i++]) != NULL)
device_remove_file(&dssdev->dev, attr);
- if (dssdev->manager)
- dssdev->manager->unset_device(dssdev->manager);
+ dss_uninit_connections(dssdev);
}
static int dss_suspend_device(struct device *dev, void *data)
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 98e8273..7a3fea6 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -263,7 +263,6 @@ void dss_manager_kobj_uninit(struct omap_overlay_manager *mgr);
void dss_init_overlays(struct platform_device *pdev);
void dss_uninit_overlays(struct platform_device *pdev);
void dss_overlay_setup_dispc_manager(struct omap_overlay_manager *mgr);
-void dss_recheck_connections(struct omap_dss_device *dssdev, bool force);
int dss_ovl_simple_check(struct omap_overlay *ovl,
const struct omap_overlay_info *info);
int dss_ovl_check(struct omap_overlay *ovl, struct omap_overlay_info *info,
diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c
index 1bf05ef..52455a0 100644
--- a/drivers/video/omap2/dss/overlay.c
+++ b/drivers/video/omap2/dss/overlay.c
@@ -105,38 +105,6 @@ void dss_init_overlays(struct platform_device *pdev)
}
}
-/* connect overlays to the new device, if not already connected. if force
- * selected, connect always. */
-void dss_recheck_connections(struct omap_dss_device *dssdev, bool force)
-{
- struct omap_overlay_manager *mgr = NULL;
- int i;
-
- mgr = omap_dss_get_overlay_manager(dssdev->channel);
-
- if (!mgr->device || force) {
- if (mgr->device)
- mgr->unset_device(mgr);
- mgr->set_device(mgr, dssdev);
- }
-
- if (mgr) {
- dispc_runtime_get();
-
- for (i = 0; i < dss_feat_get_num_ovls(); i++) {
- struct omap_overlay *ovl;
- ovl = omap_dss_get_overlay(i);
- if (!ovl->manager || force) {
- if (ovl->manager)
- ovl->unset_manager(ovl);
- ovl->set_manager(ovl, mgr);
- }
- }
-
- dispc_runtime_put();
- }
-}
-
void dss_uninit_overlays(struct platform_device *pdev)
{
int i;
--
1.7.9.5
next prev parent reply other threads:[~2012-09-19 8:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-19 8:30 [PATCH 0/8] OMAPDSS: dss device model changes Tomi Valkeinen
2012-09-19 8:30 ` [PATCH 1/8] OMAPDSS: omap_dss_register_device() doesn't take display index Tomi Valkeinen
2012-09-19 8:30 ` [PATCH 2/8] OMAPDSS: Add dss_get_default_display_name() Tomi Valkeinen
2012-09-19 8:30 ` [PATCH 3/8] OMAPDSS: register only one display device per output Tomi Valkeinen
2012-09-19 8:30 ` [PATCH 4/8] OMAPDSS: explicitely initialize dssdev->channel for new displays Tomi Valkeinen
2012-09-19 8:30 ` [PATCH 5/8] OMAPDSS: handle errors in dss_init_device Tomi Valkeinen
2012-09-19 8:30 ` [PATCH 6/8] OMAPDSS: cleanup dss_recheck_connections Tomi Valkeinen
2012-09-19 8:30 ` Tomi Valkeinen [this message]
2012-09-19 8:30 ` [PATCH 8/8] OMAPDSS: alloc dssdevs dynamically Tomi Valkeinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1348043438-2624-8-git-send-email-tomi.valkeinen@ti.com \
--to=tomi.valkeinen@ti.com \
--cc=archit@ti.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).