From patchwork Fri Sep 28 10:35:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 1518451 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 81AC3DF283 for ; Fri, 28 Sep 2012 10:35:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754012Ab2I1Kfx (ORCPT ); Fri, 28 Sep 2012 06:35:53 -0400 Received: from na3sys009aog127.obsmtp.com ([74.125.149.107]:53510 "EHLO na3sys009aog127.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753250Ab2I1Kfv (ORCPT ); Fri, 28 Sep 2012 06:35:51 -0400 Received: from mail-la0-f46.google.com ([209.85.215.46]) (using TLSv1) by na3sys009aob127.postini.com ([74.125.148.12]) with SMTP ID DSNKUGV9hiHEB4nJBUlBSUD0CEndcceiYG2y@postini.com; Fri, 28 Sep 2012 03:35:51 PDT Received: by lagh6 with SMTP id h6so966719lag.19 for ; Fri, 28 Sep 2012 03:35:49 -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=xPDfPW/FIZeENvd+lOyfisLcJgWuMXVwZe9n8rK7mmc=; b=VYCo5DBBswq6JfMkeQ1HkMhRR+tDStua4TG0ATTTfHySzdZpfPYqz53z/Aci+KYIMi rIFz1YjnqqbkjM4HSUShyDIc78rwm3H1Fci6Y4CBhgr/fo0x3qUtQ7ZI+2fX1c9DzJzy HJVP+52o+xIcMr30eqEYupxOE4xAyV6IIJ+siy8zohrX3ZE9QdePmn5YVuaa1WTbJ/v6 QcX2GEgQZleulYkaLSiR40mdC9TRwV5JyBigQqAjg3Qb8nGL7WKRQV7M1mbEbcbGaivJ l6/fieSOA8pkK4qMDaGXC8dywMjSCrdLOXXwK8lhMw7XH/jFYlvuJ/UmSlp1a+BDgdvH WO8g== Received: by 10.152.106.237 with SMTP id gx13mr5450258lab.46.1348828548976; Fri, 28 Sep 2012 03:35:48 -0700 (PDT) Received: from localhost.localdomain (a91-156-160-115.elisa-laajakaista.fi. [91.156.160.115]) by mx.google.com with ESMTPS id pi16sm2394521lab.7.2012.09.28.03.35.47 (version=SSLv3 cipher=OTHER); Fri, 28 Sep 2012 03:35:48 -0700 (PDT) From: Tomi Valkeinen To: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org Cc: Archit Taneja , Chandrabhanu Mahapatra , =?UTF-8?q?Rapha=C3=ABl=20Ass=C3=A9nat?= , Tony Lindgren , Tomi Valkeinen Subject: [PATCH 1/6] OMAPDSS: add omapdss_version Date: Fri, 28 Sep 2012 13:35:22 +0300 Message-Id: <1348828527-13309-2-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1348828527-13309-1-git-send-email-tomi.valkeinen@ti.com> References: <1348828527-13309-1-git-send-email-tomi.valkeinen@ti.com> X-Gm-Message-State: ALoCoQkfEwlHPYyIRpI3P7Yd6u0SOa/PtyT/+9/2gkntHUR2yNcQZ09BDaAAbmmUYqTEvEoyNjX2 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Add new enum, omapdss_version, that is used to tell which DSS hardware version the SoC has. This enum is initialized during platform init, and passed in the platform data to omapdss driver. Note that the versions are not "continuous", that is, you cannot check if the version is less or greater than something, but you need to check for exact version match. In other words, this is invalid: /* test if DSS is 3630 or earlier */ if (ver <= OMAPDSS_VER_OMAP3630) ... Signed-off-by: Tomi Valkeinen --- arch/arm/mach-omap2/display.c | 38 ++++++++++++++++++++++++++++++++++++++ include/video/omapdss.h | 14 ++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index ee40739..33555da 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c @@ -284,6 +284,35 @@ err: return ERR_PTR(r); } +static enum omapdss_version omap_display_get_version(void) +{ + if (cpu_is_omap24xx()) + return OMAPDSS_VER_OMAP24xx; + else if (cpu_is_omap3630()) + return OMAPDSS_VER_OMAP3630; + else if (cpu_is_omap34xx()) { + if (soc_is_am35xx()) { + return OMAPDSS_VER_AM35xx; + } else { + if (omap_rev() < OMAP3430_REV_ES3_0) + return OMAPDSS_VER_OMAP34xx_ES1; + else + return OMAPDSS_VER_OMAP34xx_ES3; + } + } else if (omap_rev() == OMAP4430_REV_ES1_0) + return OMAPDSS_VER_OMAP4430_ES1; + else if (omap_rev() == OMAP4430_REV_ES2_0 || + omap_rev() == OMAP4430_REV_ES2_1 || + omap_rev() == OMAP4430_REV_ES2_2) + return OMAPDSS_VER_OMAP4430_ES2; + else if (cpu_is_omap44xx()) + return OMAPDSS_VER_OMAP4; + else if (soc_is_omap54xx()) + return OMAPDSS_VER_OMAP5; + else + return OMAPDSS_VER_UNKNOWN +} + int __init omap_display_init(struct omap_dss_board_info *board_data) { int r = 0; @@ -291,9 +320,18 @@ int __init omap_display_init(struct omap_dss_board_info *board_data) int i, oh_count; const struct omap_dss_hwmod_data *curr_dss_hwmod; struct platform_device *dss_pdev; + enum omapdss_version ver; /* create omapdss device */ + ver = omap_display_get_version(); + + if (ver == OMAPDSS_VER_UNKNOWN) { + pr_err("DSS not supported on this SoC\n"); + return -ENODEV; + } + + board_data->version = ver; board_data->dsi_enable_pads = omap_dsi_enable_pads; board_data->dsi_disable_pads = omap_dsi_disable_pads; board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count; diff --git a/include/video/omapdss.h b/include/video/omapdss.h index 3729173..88c8294 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h @@ -314,6 +314,19 @@ int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel); int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel); void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel); +enum omapdss_version { + OMAPDSS_VER_UNKNOWN = 0, + OMAPDSS_VER_OMAP24xx, + OMAPDSS_VER_OMAP34xx_ES1, /* OMAP3430 ES1.0, 2.0 */ + OMAPDSS_VER_OMAP34xx_ES3, /* OMAP3430 ES3.0+ */ + OMAPDSS_VER_OMAP3630, + OMAPDSS_VER_AM35xx, + OMAPDSS_VER_OMAP4430_ES1, /* OMAP4430 ES1.0 */ + OMAPDSS_VER_OMAP4430_ES2, /* OMAP4430 ES2.0, 2.1, 2.2 */ + OMAPDSS_VER_OMAP4, /* All other OMAP4s */ + OMAPDSS_VER_OMAP5, +}; + /* Board specific data */ struct omap_dss_board_info { int (*get_context_loss_count)(struct device *dev); @@ -323,6 +336,7 @@ struct omap_dss_board_info { int (*dsi_enable_pads)(int dsi_id, unsigned lane_mask); void (*dsi_disable_pads)(int dsi_id, unsigned lane_mask); int (*set_min_bus_tput)(struct device *dev, unsigned long r); + enum omapdss_version version; }; /* Init with the board info */