From patchwork Thu May 8 09:15:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: archit taneja X-Patchwork-Id: 4134001 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3D687BFF02 for ; Thu, 8 May 2014 09:16:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2FE002025B for ; Thu, 8 May 2014 09:16:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E819120253 for ; Thu, 8 May 2014 09:16:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753396AbaEHJQa (ORCPT ); Thu, 8 May 2014 05:16:30 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:58734 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752459AbaEHJQ2 (ORCPT ); Thu, 8 May 2014 05:16:28 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s489GSCT011396; Thu, 8 May 2014 04:16:28 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s489GSUO012272; Thu, 8 May 2014 04:16:28 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Thu, 8 May 2014 04:16:27 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s489GRtA027039; Thu, 8 May 2014 04:16:27 -0500 Received: from localhost (a0393947pc.apr.dhcp.ti.com [172.24.145.166]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id s489GQt15298; Thu, 8 May 2014 04:16:26 -0500 (CDT) From: Archit Taneja To: CC: , , Archit Taneja Subject: [RFC 2/6] omapdss: add init port functions for different omap revs Date: Thu, 8 May 2014 14:45:13 +0530 Message-ID: <1399540517-17883-2-git-send-email-archit@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1399540517-17883-1-git-send-email-archit@ti.com> References: <1399540517-17883-1-git-send-email-archit@ti.com> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The init/uninit port functions are used to set up the DPI and SDI outputs under the dss platform device. A 'reg' property is used to determine whether the node is DPI or SDI for OMAP34xx DSS revision. For other DSS revisions, only DPI output exists. For multiple DPI output instances(introduced in DRA7xx DSS), we would use the 'reg' property to specify the DPI output number. The current functions work fine if there is only one DPI output instance in DSS. For multiple DPI instances, it would get complicated to figure out whether 'reg' is used to specify whether the output is SDI, or a later DPI instance. Create DSS revision specific init/uninit_port functions such that we have a separate functions for OMAP34xx, this helps us deal with the SDI case separately. Also, make the uninit_port functions iterative since we will have multiple DPI ports in the future. dpi_uninit_port/sdi_uninit_port functions have to be removed from the exit section as dss_features(which is initconst data) uses it, this prevents the section mismatch. Signed-off-by: Archit Taneja --- drivers/video/fbdev/omap2/dss/dpi.c | 2 +- drivers/video/fbdev/omap2/dss/dss.c | 88 ++++++++++++++++++++++++++++++++++--- drivers/video/fbdev/omap2/dss/dss.h | 4 +- drivers/video/fbdev/omap2/dss/sdi.c | 2 +- 4 files changed, 86 insertions(+), 10 deletions(-) diff --git a/drivers/video/fbdev/omap2/dss/dpi.c b/drivers/video/fbdev/omap2/dss/dpi.c index 157921d..6593c8b 100644 --- a/drivers/video/fbdev/omap2/dss/dpi.c +++ b/drivers/video/fbdev/omap2/dss/dpi.c @@ -765,7 +765,7 @@ err_datalines: return r; } -void __exit dpi_uninit_port(void) +void dpi_uninit_port(struct platform_device *pdev, struct device_node *port) { if (!dpi.port_initialized) return; diff --git a/drivers/video/fbdev/omap2/dss/dss.c b/drivers/video/fbdev/omap2/dss/dss.c index 31ef262..c415029 100644 --- a/drivers/video/fbdev/omap2/dss/dss.c +++ b/drivers/video/fbdev/omap2/dss/dss.c @@ -65,12 +65,18 @@ struct dss_reg { static int dss_runtime_get(void); static void dss_runtime_put(void); +static int __init dss_init_ports(struct platform_device *pdev); +static int __init dss_init_ports_omap34xx(struct platform_device *pdev); +static void dss_uninit_ports(struct platform_device *pdev); +static void dss_uninit_ports_omap34xx(struct platform_device *pdev); struct dss_features { u8 fck_div_max; u8 dss_fck_multiplier; const char *parent_clk_name; int (*dpi_select_source)(enum omap_channel channel); + int (*init_ports)(struct platform_device *pdev); + void (*uninit_ports)(struct platform_device *pdev); }; static struct { @@ -698,6 +704,8 @@ static const struct dss_features omap24xx_dss_feats __initconst = { .dss_fck_multiplier = 2, .parent_clk_name = "core_ck", .dpi_select_source = &dss_dpi_select_source_omap2_omap3, + .init_ports = &dss_init_ports, + .uninit_ports = &dss_uninit_ports, }; static const struct dss_features omap34xx_dss_feats __initconst = { @@ -705,6 +713,8 @@ static const struct dss_features omap34xx_dss_feats __initconst = { .dss_fck_multiplier = 2, .parent_clk_name = "dpll4_ck", .dpi_select_source = &dss_dpi_select_source_omap2_omap3, + .init_ports = &dss_init_ports_omap34xx, + .uninit_ports = &dss_uninit_ports_omap34xx, }; static const struct dss_features omap3630_dss_feats __initconst = { @@ -712,6 +722,8 @@ static const struct dss_features omap3630_dss_feats __initconst = { .dss_fck_multiplier = 1, .parent_clk_name = "dpll4_ck", .dpi_select_source = &dss_dpi_select_source_omap2_omap3, + .init_ports = &dss_init_ports, + .uninit_ports = &dss_uninit_ports, }; static const struct dss_features omap44xx_dss_feats __initconst = { @@ -719,6 +731,8 @@ static const struct dss_features omap44xx_dss_feats __initconst = { .dss_fck_multiplier = 1, .parent_clk_name = "dpll_per_x2_ck", .dpi_select_source = &dss_dpi_select_source_omap4, + .init_ports = &dss_init_ports, + .uninit_ports = &dss_uninit_ports, }; static const struct dss_features omap54xx_dss_feats __initconst = { @@ -726,6 +740,8 @@ static const struct dss_features omap54xx_dss_feats __initconst = { .dss_fck_multiplier = 1, .parent_clk_name = "dpll_per_x2_ck", .dpi_select_source = &dss_dpi_select_source_omap5, + .init_ports = &dss_init_ports, + .uninit_ports = &dss_uninit_ports, }; static int __init dss_init_features(struct platform_device *pdev) @@ -774,7 +790,7 @@ static int __init dss_init_features(struct platform_device *pdev) return 0; } -static int __init dss_init_ports(struct platform_device *pdev) +static int __init dss_init_ports_omap34xx(struct platform_device *pdev) { struct device_node *parent = pdev->dev.of_node; struct device_node *port; @@ -809,15 +825,75 @@ static int __init dss_init_ports(struct platform_device *pdev) return 0; } -static void dss_uninit_ports(void) +static int __init dss_init_ports(struct platform_device *pdev) { + struct device_node *parent = pdev->dev.of_node; + struct device_node *port; + + if (parent == NULL) + return 0; + + port = omapdss_of_get_next_port(parent, NULL); + if (!port) + return 0; + + do { #ifdef CONFIG_OMAP2_DSS_DPI - dpi_uninit_port(); + dpi_init_port(pdev, port); +#endif + } while ((port = omapdss_of_get_next_port(parent, port)) != NULL); + + return 0; +} + +static void dss_uninit_ports_omap34xx(struct platform_device *pdev) +{ + struct device_node *parent = pdev->dev.of_node; + struct device_node *port; + int r; + + if (parent == NULL) + return; + + port = omapdss_of_get_next_port(parent, NULL); + if (!port) + return; + + do { + u32 reg; + + r = of_property_read_u32(port, "reg", ®); + if (r) + reg = 0; + +#ifdef CONFIG_OMAP2_DSS_DPI + if (reg == 0) + dpi_uninit_port(pdev, port); #endif #ifdef CONFIG_OMAP2_DSS_SDI - sdi_uninit_port(); + if (reg == 1) + sdi_uninit_port(); #endif + } while ((port = omapdss_of_get_next_port(parent, port)) != NULL); +} + +static void dss_uninit_ports(struct platform_device *pdev) +{ + struct device_node *parent = pdev->dev.of_node; + struct device_node *port; + + if (parent == NULL) + return; + + port = omapdss_of_get_next_port(parent, NULL); + if (!port) + return; + do { +#ifdef CONFIG_OMAP2_DSS_DPI + dpi_uninit_port(pdev, port); +#endif + } while ((port = omapdss_of_get_next_port(parent, port)) != NULL); } /* DSS HW IP initialisation */ @@ -878,7 +954,7 @@ static int __init omap_dsshw_probe(struct platform_device *pdev) dss.lcd_clk_source[0] = OMAP_DSS_CLK_SRC_FCK; dss.lcd_clk_source[1] = OMAP_DSS_CLK_SRC_FCK; - dss_init_ports(pdev); + dss.feat->init_ports(pdev); rev = dss_read_reg(DSS_REVISION); printk(KERN_INFO "OMAP DSS rev %d.%d\n", @@ -899,7 +975,7 @@ err_setup_clocks: static int __exit omap_dsshw_remove(struct platform_device *pdev) { - dss_uninit_ports(); + dss.feat->uninit_ports(pdev); pm_runtime_disable(&pdev->dev); diff --git a/drivers/video/fbdev/omap2/dss/dss.h b/drivers/video/fbdev/omap2/dss/dss.h index 560078f..9f4ee49 100644 --- a/drivers/video/fbdev/omap2/dss/dss.h +++ b/drivers/video/fbdev/omap2/dss/dss.h @@ -245,7 +245,7 @@ int sdi_init_platform_driver(void) __init; void sdi_uninit_platform_driver(void) __exit; int sdi_init_port(struct platform_device *pdev, struct device_node *port) __init; -void sdi_uninit_port(void) __exit; +void sdi_uninit_port(void); /* DSI */ @@ -359,7 +359,7 @@ int dpi_init_platform_driver(void) __init; void dpi_uninit_platform_driver(void) __exit; int dpi_init_port(struct platform_device *pdev, struct device_node *port) __init; -void dpi_uninit_port(void) __exit; +void dpi_uninit_port(struct platform_device *pdev, struct device_node *port); /* DISPC */ int dispc_init_platform_driver(void) __init; diff --git a/drivers/video/fbdev/omap2/dss/sdi.c b/drivers/video/fbdev/omap2/dss/sdi.c index 911dcc9..71a3083 100644 --- a/drivers/video/fbdev/omap2/dss/sdi.c +++ b/drivers/video/fbdev/omap2/dss/sdi.c @@ -424,7 +424,7 @@ err_datapairs: return r; } -void __exit sdi_uninit_port(void) +void sdi_uninit_port(void) { if (!sdi.port_initialized) return;