From patchwork Mon Jan 24 06:21:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Semwal X-Patchwork-Id: 500281 X-Patchwork-Delegate: tomi.valkeinen@nokia.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0O6MObh028727 for ; Mon, 24 Jan 2011 06:24:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751861Ab1AXGXF (ORCPT ); Mon, 24 Jan 2011 01:23:05 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:58761 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751734Ab1AXGXE (ORCPT ); Mon, 24 Jan 2011 01:23:04 -0500 Received: from dlep34.itg.ti.com ([157.170.170.115]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id p0O6Mx7T016378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 24 Jan 2011 00:22:59 -0600 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id p0O6MuHG006015; Mon, 24 Jan 2011 00:22:56 -0600 (CST) Received: from localhost (a0876505ubnlt.apr.dhcp.ti.com [172.24.136.255]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id p0O6Mrf13625; Mon, 24 Jan 2011 00:22:53 -0600 (CST) From: Sumit Semwal To: tomi.valkeinen@nokia.com, paul@pwsan.com, khilman@ti.com, hvaibhav@ti.com, linux-omap@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Senthilvadivu Guruswamy , Sumit Semwal Subject: [PATCH v10 10/18] OMAP2, 3: DSS2: DSS: create platform_driver, move init, exit to driver Date: Mon, 24 Jan 2011 11:51:57 +0530 Message-Id: <1295850125-21405-11-git-send-email-sumit.semwal@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1295850125-21405-1-git-send-email-sumit.semwal@ti.com> References: <1295850125-21405-1-git-send-email-sumit.semwal@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 24 Jan 2011 06:24:04 +0000 (UTC) diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index 1bbc004..1aace9e 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c @@ -517,15 +517,9 @@ static int omap_dss_probe(struct platform_device *pdev) core.ctx_id = dss_get_ctx_id(); DSSDBG("initial ctx id %u\n", core.ctx_id); -#ifdef CONFIG_FB_OMAP_BOOTLOADER_INIT - /* DISPC_CONTROL */ - if (omap_readl(0x48050440) & 1) /* LCD enabled? */ - skip_init = 1; -#endif - - r = dss_init(skip_init); + r = dss_init_platform_driver(); if (r) { - DSSERR("Failed to initialize DSS\n"); + DSSERR("Failed to initialize DSS platform driver\n"); goto err_dss; } @@ -553,6 +547,11 @@ static int omap_dss_probe(struct platform_device *pdev) goto err_venc; } +#ifdef CONFIG_FB_OMAP_BOOTLOADER_INIT + /* DISPC_CONTROL */ + if (omap_readl(0x48050440) & 1) /* LCD enabled? */ + skip_init = 1; +#endif if (cpu_is_omap34xx()) { r = sdi_init(skip_init); if (r) { @@ -610,7 +609,7 @@ err_dispc: err_dpi: rfbi_exit(); err_rfbi: - dss_exit(); + dss_uninit_platform_driver(); err_dss: dss_clk_disable_all_no_ctx(); dss_put_clocks(); @@ -635,7 +634,7 @@ static int omap_dss_remove(struct platform_device *pdev) sdi_exit(); } - dss_exit(); + dss_uninit_platform_driver(); /* * As part of hwmod changes, DSS is not the only controller of dss diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index 77c3621..d130f04 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c @@ -59,6 +59,7 @@ struct dss_reg { dss_write_reg(idx, FLD_MOD(dss_read_reg(idx), val, start, end)) static struct { + struct platform_device *pdev; void __iomem *base; struct clk *dpll4_m4_ck; @@ -549,7 +550,7 @@ void dss_set_dac_pwrdn_bgz(bool enable) REG_FLD_MOD(DSS_CONTROL, enable, 5, 5); /* DAC Power-Down Control */ } -int dss_init(bool skip_init) +static int dss_init(bool skip_init) { int r; u32 rev; @@ -629,7 +630,7 @@ fail0: return r; } -void dss_exit(void) +static void dss_exit(void) { if (cpu_is_omap34xx()) clk_put(dss.dpll4_m4_ck); @@ -639,3 +640,53 @@ void dss_exit(void) iounmap(dss.base); } +/* DSS HW IP initialisation */ +static int omap_dsshw_probe(struct platform_device *pdev) +{ + int r; + int skip_init = 0; + + dss.pdev = pdev; + +#ifdef CONFIG_FB_OMAP_BOOTLOADER_INIT + /* DISPC_CONTROL */ + if (omap_readl(0x48050440) & 1) /* LCD enabled? */ + skip_init = 1; +#endif + + r = dss_init(skip_init); + if (r) { + DSSERR("Failed to initialize DSS\n"); + goto err_dss; + } + +err_dss: + + return r; +} + +static int omap_dsshw_remove(struct platform_device *pdev) +{ + dss_exit(); + + return 0; +} + +static struct platform_driver omap_dsshw_driver = { + .probe = omap_dsshw_probe, + .remove = omap_dsshw_remove, + .driver = { + .name = "omap_dss", + .owner = THIS_MODULE, + }, +}; + +int dss_init_platform_driver(void) +{ + return platform_driver_register(&omap_dsshw_driver); +} + +void dss_uninit_platform_driver(void) +{ + return platform_driver_unregister(&omap_dsshw_driver); +} diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index b394951..37c4544 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -214,8 +214,8 @@ void dss_overlay_setup_l4_manager(struct omap_overlay_manager *mgr); void dss_recheck_connections(struct omap_dss_device *dssdev, bool force); /* DSS */ -int dss_init(bool skip_init); -void dss_exit(void); +int dss_init_platform_driver(void); +void dss_uninit_platform_driver(void); void dss_save_context(void); void dss_restore_context(void);