From patchwork Thu May 15 08:05:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 4179841 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 B53ACBFF02 for ; Thu, 15 May 2014 08:05:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ACFCB20380 for ; Thu, 15 May 2014 08:05:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FC5C20381 for ; Thu, 15 May 2014 08:05:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753900AbaEOIFp (ORCPT ); Thu, 15 May 2014 04:05:45 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:40816 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751770AbaEOIFm (ORCPT ); Thu, 15 May 2014 04:05:42 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4F85fj6011862; Thu, 15 May 2014 03:05:41 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4F85fcC012177; Thu, 15 May 2014 03:05:41 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Thu, 15 May 2014 03:05:41 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4F85dF7012158; Thu, 15 May 2014 03:05:39 -0500 From: Tomi Valkeinen To: Tony Lindgren CC: , , Archit Taneja , Tomi Valkeinen Subject: [PATCH] OMAPDSS: move 'compatible' converter to omapdss driver Date: Thu, 15 May 2014 11:05:36 +0300 Message-ID: <1400141136-25358-1-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 1.9.1 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 Move the panel/encoder driver compatible-string converter from arch/arm/mach-omap2/display.c to omapdss driver. That is a more logical place for it, as it's really an omapdss internal hack. Signed-off-by: Tomi Valkeinen Acked-by: Tony Lindgren --- arch/arm/mach-omap2/display.c | 56 ----------- drivers/video/fbdev/omap2/Makefile | 2 +- drivers/video/fbdev/omap2/dss/Kconfig | 4 + drivers/video/fbdev/omap2/dss/Makefile | 1 + drivers/video/fbdev/omap2/dss/omapdss-boot-init.c | 112 ++++++++++++++++++++++ 5 files changed, 118 insertions(+), 57 deletions(-) create mode 100644 drivers/video/fbdev/omap2/dss/omapdss-boot-init.c diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index 16d33d831287..519a20fc0432 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c @@ -555,65 +555,9 @@ int omap_dss_reset(struct omap_hwmod *oh) return r; } -/* list of 'compatible' nodes to convert to omapdss specific */ -static const char * const dss_compat_conv_list[] __initconst = { - "composite-connector", - "dvi-connector", - "hdmi-connector", - "panel-dpi", - "panel-dsi-cm", - "sony,acx565akm", - "svideo-connector", - "ti,tfp410", - "ti,tpd12s015", -}; - -/* prepend compatible string with "omapdss," */ -static __init void omapdss_omapify_node(struct device_node *node, - const char *compat) -{ - char *new_compat; - struct property *prop; - - new_compat = kasprintf(GFP_KERNEL, "omapdss,%s", compat); - - prop = kzalloc(sizeof(*prop), GFP_KERNEL); - - if (!prop) { - pr_err("omapdss_omapify_node: kzalloc failed\n"); - return; - } - - prop->name = "compatible"; - prop->value = new_compat; - prop->length = strlen(new_compat) + 1; - - of_update_property(node, prop); -} - -/* - * As omapdss panel drivers are omapdss specific, but we want to define the - * DT-data in generic manner, we convert the compatible strings of the panel - * nodes from "panel-foo" to "omapdss,panel-foo". This way we can have both - * correct DT data and omapdss specific drivers. - * - * When we get generic panel drivers to the kernel, this will be removed. - */ void __init omapdss_early_init_of(void) { - int i; - - for (i = 0; i < ARRAY_SIZE(dss_compat_conv_list); ++i) { - const char *compat = dss_compat_conv_list[i]; - struct device_node *node = NULL; - - while ((node = of_find_compatible_node(node, NULL, compat))) { - if (!of_device_is_available(node)) - continue; - omapdss_omapify_node(node, compat); - } - } } struct device_node * __init omapdss_find_dss_of_node(void) diff --git a/drivers/video/fbdev/omap2/Makefile b/drivers/video/fbdev/omap2/Makefile index bf8127df8c71..f8745ec369cc 100644 --- a/drivers/video/fbdev/omap2/Makefile +++ b/drivers/video/fbdev/omap2/Makefile @@ -1,5 +1,5 @@ obj-$(CONFIG_OMAP2_VRFB) += vrfb.o -obj-$(CONFIG_OMAP2_DSS) += dss/ +obj-y += dss/ obj-y += displays-new/ obj-$(CONFIG_FB_OMAP2) += omapfb/ diff --git a/drivers/video/fbdev/omap2/dss/Kconfig b/drivers/video/fbdev/omap2/dss/Kconfig index dde4281663b1..a28f3a39ab1b 100644 --- a/drivers/video/fbdev/omap2/dss/Kconfig +++ b/drivers/video/fbdev/omap2/dss/Kconfig @@ -1,6 +1,10 @@ +config OMAP2_DSS_INIT + bool + menuconfig OMAP2_DSS tristate "OMAP2+ Display Subsystem support" select VIDEOMODE_HELPERS + select OMAP2_DSS_INIT help OMAP2+ Display Subsystem support. diff --git a/drivers/video/fbdev/omap2/dss/Makefile b/drivers/video/fbdev/omap2/dss/Makefile index 8aec8bda27cc..3b79ad74f2e1 100644 --- a/drivers/video/fbdev/omap2/dss/Makefile +++ b/drivers/video/fbdev/omap2/dss/Makefile @@ -1,3 +1,4 @@ +obj-$(CONFIG_OMAP2_DSS_INIT) += omapdss-boot-init.o obj-$(CONFIG_OMAP2_DSS) += omapdss.o # Core DSS files omapdss-y := core.o dss.o dss_features.o dispc.o dispc_coefs.o display.o \ diff --git a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c new file mode 100644 index 000000000000..468f6eff370c --- /dev/null +++ b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2014 Texas Instruments + * Author: Tomi Valkeinen + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#include +#include +#include + +/* list of 'compatible' nodes to convert to omapdss specific */ +static const char * const dss_compat_conv_list[] __initconst = { + "composite-connector", + "dvi-connector", + "hdmi-connector", + "panel-dpi", + "panel-dsi-cm", + "sony,acx565akm", + "svideo-connector", + "ti,tfp410", + "ti,tpd12s015", +}; + +/* prepend compatible string with "omapdss," */ +static __init void omapdss_omapify_node(struct device_node *node, + const char *compat) +{ + char *new_compat; + struct property *prop; + + new_compat = kasprintf(GFP_KERNEL, "omapdss,%s", compat); + + prop = kzalloc(sizeof(*prop), GFP_KERNEL); + + if (!prop) { + pr_err("omapdss_omapify_node: kzalloc failed\n"); + return; + } + + prop->name = "compatible"; + prop->value = new_compat; + prop->length = strlen(new_compat) + 1; + + of_update_property(node, prop); +} + +static struct device_node * __init omapdss_find_dss_of_node(void) +{ + struct device_node *node; + + node = of_find_compatible_node(NULL, NULL, "ti,omap2-dss"); + if (node) + return node; + + node = of_find_compatible_node(NULL, NULL, "ti,omap3-dss"); + if (node) + return node; + + node = of_find_compatible_node(NULL, NULL, "ti,omap4-dss"); + if (node) + return node; + + node = of_find_compatible_node(NULL, NULL, "ti,omap5-dss"); + if (node) + return node; + + return NULL; +} + +/* + * As omapdss panel drivers are omapdss specific, but we want to define the + * DT-data in generic manner, we convert the compatible strings of the panel + * nodes from "panel-foo" to "omapdss,panel-foo". This way we can have both + * correct DT data and omapdss specific drivers. + * + * When we get generic panel drivers to the kernel, this will be removed. + */ +static int __init omap_dss_boot_init(void) +{ + int i; + + /* do we have omapdss device? */ + if (omapdss_find_dss_of_node() == NULL) + return 0; + + for (i = 0; i < ARRAY_SIZE(dss_compat_conv_list); ++i) { + const char *compat = dss_compat_conv_list[i]; + struct device_node *node = NULL; + + while ((node = of_find_compatible_node(node, NULL, compat))) { + if (!of_device_is_available(node)) + continue; + + omapdss_omapify_node(node, compat); + } + } + + return 0; +} + +subsys_initcall(omap_dss_boot_init);