From patchwork Thu Nov 15 15:58:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 1750331 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 D48633FC8A for ; Thu, 15 Nov 2012 15:59:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1768279Ab2KOP7i (ORCPT ); Thu, 15 Nov 2012 10:59:38 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:56256 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1768251Ab2KOP7g (ORCPT ); Thu, 15 Nov 2012 10:59:36 -0500 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id qAFFxa6D021122; Thu, 15 Nov 2012 09:59:36 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id qAFFxakQ029895; Thu, 15 Nov 2012 09:59:36 -0600 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Thu, 15 Nov 2012 09:59:36 -0600 Received: from deskari.tieu.ti.com (h68-10.vpn.ti.com [172.24.68.10]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id qAFFx6vD025421; Thu, 15 Nov 2012 09:59:34 -0600 From: Tomi Valkeinen To: Archit Taneja , Rob Clark CC: , , Tomi Valkeinen Subject: [PATCH 16/32] OMAPDSS: add omapdss_compat_init() Date: Thu, 15 Nov 2012 17:58:24 +0200 Message-ID: <1352995120-3288-17-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1352995120-3288-1-git-send-email-tomi.valkeinen@ti.com> References: <1352995120-3288-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Add two new exported functions, omapdss_compat_init and omapdss_compat_uninit, which are to be used by omapfb, omap_vout to enable compatibility mode for omapdss. The functions are called by omapdss internally for now, and moved to other drivers later. The compatibility mode is implemented fully in the following patches. For now, enabling compat mode only sets up the private data in apply.c. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/dss/apply.c | 32 +++++++++++++++++++++++++++++++- drivers/video/omap2/dss/core.c | 4 +++- drivers/video/omap2/dss/dss.h | 1 - include/video/omapdss.h | 3 +++ 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c index 4a5cc5c..816de17 100644 --- a/drivers/video/omap2/dss/apply.c +++ b/drivers/video/omap2/dss/apply.c @@ -18,6 +18,7 @@ #define DSS_SUBSYS_NAME "APPLY" #include +#include #include #include #include @@ -131,7 +132,7 @@ static struct mgr_priv_data *get_mgr_priv(struct omap_overlay_manager *mgr) return &dss_data.mgr_priv_data_array[mgr->id]; } -void dss_apply_init(void) +static void apply_init_priv(void) { const int num_ovls = dss_feat_get_num_ovls(); struct mgr_priv_data *mp; @@ -1463,3 +1464,32 @@ err: return r; } +static int compat_refcnt; + +int omapdss_compat_init(void) +{ + mutex_lock(&apply_lock); + + if (compat_refcnt++ > 0) + goto out; + + apply_init_priv(); + +out: + mutex_unlock(&apply_lock); + + return 0; +} +EXPORT_SYMBOL(omapdss_compat_init); + +void omapdss_compat_uninit(void) +{ + mutex_lock(&apply_lock); + + if (--compat_refcnt > 0) + goto out; + +out: + mutex_unlock(&apply_lock); +} +EXPORT_SYMBOL(omapdss_compat_uninit); diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index 8c30831..346638e 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c @@ -247,7 +247,7 @@ static int __init omap_dss_probe(struct platform_device *pdev) dss_features_init(omapdss_get_version()); - dss_apply_init(); + omapdss_compat_init(); dss_init_overlay_managers(pdev); dss_init_overlays(pdev); @@ -279,6 +279,8 @@ static int omap_dss_remove(struct platform_device *pdev) dss_uninit_overlays(pdev); dss_uninit_overlay_managers(pdev); + omapdss_compat_uninit(); + return 0; } diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 9ee3c88..9cbcd8e 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -179,7 +179,6 @@ void dss_copy_device_pdata(struct omap_dss_device *dst, const struct omap_dss_device *src); /* apply */ -void dss_apply_init(void); int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr); int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl); void dss_mgr_start_update(struct omap_overlay_manager *mgr); diff --git a/include/video/omapdss.h b/include/video/omapdss.h index b1248c2..a940236 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h @@ -836,4 +836,7 @@ void omapdss_rfbi_set_data_lines(struct omap_dss_device *dssdev, void omapdss_rfbi_set_interface_timings(struct omap_dss_device *dssdev, struct rfbi_timings *timings); +int omapdss_compat_init(void); +void omapdss_compat_uninit(void); + #endif