From patchwork Wed Sep 19 08:30:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 1476391 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7BBB43FE4F for ; Wed, 19 Sep 2012 08:32:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755330Ab2ISIbz (ORCPT ); Wed, 19 Sep 2012 04:31:55 -0400 Received: from na3sys009aog126.obsmtp.com ([74.125.149.155]:39375 "EHLO na3sys009aog126.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754023Ab2ISIbQ (ORCPT ); Wed, 19 Sep 2012 04:31:16 -0400 Received: from mail-lpp01m010-f46.google.com ([209.85.215.46]) (using TLSv1) by na3sys009aob126.postini.com ([74.125.148.12]) with SMTP ID DSNKUFmC0/YVpGl/9d6GlVvfa5ZA61CJCUf4@postini.com; Wed, 19 Sep 2012 01:31:15 PDT Received: by lagy9 with SMTP id y9so510675lag.19 for ; Wed, 19 Sep 2012 01:31:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=Mdy0V29xmYNqVcamXX2OcGil8/eeNB/4dQtDDui5NGY=; b=ZWsHsaFU68o5vcTVQVvoMYzGuxc2blled7tAYWWSJbkmguPItBl7v89c32d8dYTxp1 Gcqvt1aFtP15jnushzw4jZC8f2hREt7rQXp31K8gkKt6iGpaE1vTdWGmRU4R0UMCFW4r nxlHXltu44VGhzqc12difRTHkWiFevW1RQTw6Cu0GoyiEkkaq5HYynDpYPawRXF8WN9Q uSa0JwnGD732knzTvUaZ2ecXuqo2xu2aEqbjjXUsnaK+EI0k9waefDbg9crxjvVhC8wq /DwKemFOftkKtlivEIYw8RoZ+BTbVNjorWBiPQB7nqEkr6PnHhERSIUJsajh7fRNXFZA aujg== Received: by 10.112.23.36 with SMTP id j4mr782289lbf.71.1348043473626; Wed, 19 Sep 2012 01:31:13 -0700 (PDT) Received: from localhost.localdomain (a91-156-160-115.elisa-laajakaista.fi. [91.156.160.115]) by mx.google.com with ESMTPS id r8sm589958lba.15.2012.09.19.01.31.12 (version=SSLv3 cipher=OTHER); Wed, 19 Sep 2012 01:31:12 -0700 (PDT) From: Tomi Valkeinen To: archit@ti.com, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org Cc: Tomi Valkeinen Subject: [PATCH 7/8] OMAPDSS: cleanup dss_recheck_connections further Date: Wed, 19 Sep 2012 11:30:37 +0300 Message-Id: <1348043438-2624-8-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1348043438-2624-1-git-send-email-tomi.valkeinen@ti.com> References: <1348043438-2624-1-git-send-email-tomi.valkeinen@ti.com> X-Gm-Message-State: ALoCoQlxXkLhRdUSamOPjRfGRTbIar9G9trWO4zGnZ7jRcnniEAdpqyL2H/s/95jJlpxJYUzQL2f Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org 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 --- 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;