From patchwork Tue Feb 16 22:27:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harry Wentland X-Patchwork-Id: 8332801 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 11DC49F6E7 for ; Tue, 16 Feb 2016 22:28:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 28B372034C for ; Tue, 16 Feb 2016 22:28:35 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B1120202F8 for ; Tue, 16 Feb 2016 22:28:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7130A6E8BA; Tue, 16 Feb 2016 22:28:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0054.outbound.protection.outlook.com [65.55.169.54]) by gabe.freedesktop.org (Postfix) with ESMTPS id C36756E8B9 for ; Tue, 16 Feb 2016 22:28:25 +0000 (UTC) Received: from SN1PR12CA0025.namprd12.prod.outlook.com (10.162.96.163) by DM3PR12MB0860.namprd12.prod.outlook.com (10.164.7.142) with Microsoft SMTP Server (TLS) id 15.1.409.15; Tue, 16 Feb 2016 22:28:23 +0000 Received: from DM3NAM03FT034.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::208) by SN1PR12CA0025.outlook.office365.com (2a01:111:e400:5174::35) with Microsoft SMTP Server (TLS) id 15.1.409.15 via Frontend Transport; Tue, 16 Feb 2016 22:28:23 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from atltwp01.amd.com (165.204.84.221) by DM3NAM03FT034.mail.protection.outlook.com (10.152.82.192) with Microsoft SMTP Server id 15.1.415.6 via Frontend Transport; Tue, 16 Feb 2016 22:28:23 +0000 X-WSS-ID: 0O2NVR9-07-L59-02 X-M-MSG: Received: from satlvexedge01.amd.com (satlvexedge01.amd.com [10.177.96.28]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by atltwp01.amd.com (Axway MailGate 5.3.1) with ESMTPS id 2D0B3CAE812 for ; Tue, 16 Feb 2016 17:28:21 -0500 (EST) Received: from SATLEXDAG06.amd.com (10.181.40.13) by satlvexedge01.amd.com (10.177.96.28) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 16 Feb 2016 16:28:24 -0600 Received: from STOREXDAG02.amd.com (10.1.13.11) by satlexdag06.amd.com (10.181.40.13) with Microsoft SMTP Server (TLS) id 14.3.266.1; Tue, 16 Feb 2016 17:28:21 -0500 Received: from cnhwentlanub.amd.com (172.29.225.36) by storexdag02.amd.com (10.1.13.11) with Microsoft SMTP Server id 14.3.266.1; Tue, 16 Feb 2016 17:28:19 -0500 From: Harry Wentland To: Subject: [PATCH v2 04/26] drm/amd/dal: Asic Capabilities Date: Tue, 16 Feb 2016 17:27:44 -0500 Message-ID: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: <1455211209-26733-1-git-send-email-harry.wentland@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.221; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(199003)(189002)(47776003)(5003600100002)(92566002)(2906002)(1220700001)(1096002)(101416001)(450100001)(50986999)(33646002)(586003)(2950100001)(4326007)(76176999)(118296001)(48376002)(77096005)(5003940100001)(105586002)(19580405001)(36756003)(86362001)(5008740100001)(50466002)(575784001)(19580395003)(189998001)(53416004)(106466001)(2351001)(110136002)(229853001)(50226001)(87936001)(11100500001)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM3PR12MB0860; H:atltwp01.amd.com; FPR:; SPF:None; MLV:sfv; A:1; MX:1; LANG:en; X-MS-Office365-Filtering-Correlation-Id: c222b74f-5c47-41b0-9f9b-08d337207b41 X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0860; 2:Dm2gF48AcKu71ejASRw1XFIywgbN2Plyd+F9dt8YKR5LhhEDrb9u6oCsyhYjKc40235pg8MKPboi3GGb6WiX2jVurPGnfkxcqs9xkehPz6T9a9zbZfI0dwlZtfTjB5WL5Wo20Oxtp8WspjyE4wDXcNXBvP9aZWZCDY5oDSui9moMUklMnfEZ97Jd7iRjIPsz; 3:+KtcO6Y5nBsOmyDPRvtCFgIhd/SvT4DEvxiDdhfWjVsbZdp2RbE9nSYY21K4uJymuHw702lSI4hS7hhRgHGLZ/g9/EEHPbIkKAyfzdrYR0DUxXBlO/z/cMAzkvBulXQkuwFYHWApvuEUq7TaRjB2Nxp82lFm6Ej9E38OF2VK6bGPBH/TfsOdh9PcVycSIdHTUsCnjyiQdU4IW8uaP+YV8bIIFNNAHCQZPo/Y379OsnY=; 25:/zHbgTQll6QsRBPlJHkqepc5QIcLnlsMCovJjAx+uox2+kUyxzduj2nxV1noSHv0SzVipbAK6z1Nrhjvn2btq12e8/jJOcgnKIFQjrO5rvg9TxKPfp68f2EuVrjJc0V7ydOF8RRWPWDvVksRmBh0DDk7hLmmqYR/HYcDX9W6BNAA7/5OVvaWL5S5dxrjov0Yuq11A+in2inkmk6AWMdby/AwXAgEjBoMiyyycvyO3TO3EDq3A/2de/fK9yuD2FaePAkqeGl2VjIYEfvLRJ0BJjW+CHjhPji3yuIdvPuVcMUbon39uhBLYZ/AuvNWphsh X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM3PR12MB0860; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0860; 20:UlERnHu5Q88UcXPmKydUCfuWZlPYEYuaKRRme3XOHtAnJB26bdVl5mW13d4WFk0C3WJ77XI9bcxk/BSyFirptO7nez7JfMZC555es/lZ1vwiOxZMrDFXGBQLBqwVsJTGuvfxKP3BUrNTmG0igfMR+EDCxYkZ1RA3mktz/zC2GI2i8iEJYMBoqu1j5taANY9hSnzGF5rJ2ikTDUefFOEvmp2TKuU76NQztNUbO7zRQzc6c5wSD8gTPJToTDKFWyjZJ1wEDo93kpCFDVd/vRxSLcf9lP6l9wxNR3fserLvPa+FoLm4jUHajbikZ4Qvgt1cGvx9kWm1GTtSuLtknnOS+iiE9sqFfP5K4LtkI6JvFBPTDJmo3+Dsjm+wh3vv5drkVcdN92bNgbjv9eTP3Ropvc8yH4H9oqtaXPWbGb241yiFwBt+jYlXU/ZjZjM68hNGDA0u31I0v98ghO6fVRfc+FfoImFUc/tpeO7pbTVMvFAO+qdzQFhlEAicXCUTeUYc X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13017025)(13015025)(5005006)(13018025)(13023025)(13024025)(8121501046)(10201501046)(3002001); SRVR:DM3PR12MB0860; BCL:0; PCL:0; RULEID:; SRVR:DM3PR12MB0860; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0860; 4:MRv4mS0wlr1xsJp6JJEdf4C8rkMvkSYGbX0gH6MB98ZzJyf6tbNJY0J66EFO5kcKv6Qo3YylehNSTOVhdwxh3+SKWTcBkYFP7VwxY/X6oIoSQBs96t3SKRPodsphplAcqFtlL2Ow2ghdbbgFtIIbJAnmyHCqDLTN0HczXBSGUpoCC2b0zpi4xKMFWvTm8mO++y1CiBym42TOaaievjbIn5KyVLBc+GBrD0ukMDA+Uw4j9wAdNA3X3m3m5EMnn2w7jDqPAPuuob7s7d1KulNnaxE/vCJr3I7I3ziaNAdCySiG/2YbHMuaWnur8JScVKiIgzTojugjTzo3mMSguV3D34OD/WXP/5kVIpzHr6ucr4aOOrr0kHFChbG8/3/nSBHQIwhr63tXjP6WIHed4HkRujFP2YcpVeOPyolnyLRdmgglNfLmvMSmwZYUMdZVTg2iOMImcj7NDpyQuiWqFInVgiHU0LFS8YC1XnxRxX1eS84biLZ+GzxPppMbZDxf2/rR X-Forefront-PRVS: 0854128AF0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM3PR12MB0860; 23:897yYS1Tbp3Wy5T07DWdnhF4Agga8QXz77lJkewNN?= =?us-ascii?Q?iGM6Ico7TXmNeFCuBaPc/LVx6FdBPG6iAwaAiikzrcbTExNw+KIvikdQfFdx?= =?us-ascii?Q?L4F5UOBrCGpnMKN1DL6HQgE1Hy3vG/qMZAxxZEJbEqlG9SwcbU6w0aqZk7SS?= =?us-ascii?Q?3pxUWyTzGNzUisjLMQQxA9zs9bGFJyb89yhddu6otBudTvrnJ7UzPoLrUp2X?= =?us-ascii?Q?rRxMAGxm5gv5SkEzG4HiGhQga/13yCFTYgG0pfaVIiwk40q58i4Nqvj6VNg+?= =?us-ascii?Q?YqKislLTANva7Pe5kVUl4MHlAugsn+s251Yh+UZ//OtxMLWCWTCoH7+skl9Q?= =?us-ascii?Q?irj9hDRPRSJpuBUyRZBwYG8KotTyPMPcf+j031p/7nRuvDGyQ93L3Wy5wGkS?= =?us-ascii?Q?N0x8yNKo209KQ4Jn5rMLgt0dSQHOXJaxUHserKUN1BImxXydfzJQ7pCf979L?= =?us-ascii?Q?msToSB1WceHRntlmCBHiWFHn99r1fC4X25WbDIaZ2RVwfC/SjqhH8G+E3aBB?= =?us-ascii?Q?iL7CW/YUfz5Gdd/KJ2kzhqGZDUOxE9w940n+w3raPG1xiJcZ5OHIcm4uPQ1i?= =?us-ascii?Q?DOmsatPr60ekxwxBtV65PeIjEEX03d38X1w8Z1LV8byiSTTXNNl3NfYpEMTt?= =?us-ascii?Q?rq1aEfEq/OIAePpOBi3ULogABbFPCCcvdJkK0ZLCoVDvK9/oV9e+OS8FlbTB?= =?us-ascii?Q?+PORnhnPyiMiYzxxpcyGoUkgctw5Bo/oOyuCmgGsm52IcPAeorZ7Tq39Z1bI?= =?us-ascii?Q?QGI7i6JRYNDEiOCB3ceie2xHsKZbafaiI0WW0B/QbEG6uDn9cMWWp4gUUlxY?= =?us-ascii?Q?v4+OASBRKdqrpGpI38jQp4SJaAHT97hkt2WVo0/RqgP8be0mianKCMcFPS34?= =?us-ascii?Q?QI+st0Cct+yuGbrKYl+ITF4d4g64oIfr5uJhtrUMeKnJeYRK6BgzMWHzP56z?= =?us-ascii?Q?QaDEiitiHJManQHKFB7FYLUDREW25sdjFaueGB5WGKFtF9ioXNS9+g6fTy3h?= =?us-ascii?Q?xnas2lnT3Jwbd8VLu5hD4L1Laz9UKnpf4gfaexEx/UCmP0H5ORSl+fb8XIYa?= =?us-ascii?Q?uSKN5/AJF34MSW8x8HsiA/xTA7M9qkS7Vqbely4cgQxqIMmwg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0860; 5:aD1F3gkE7VrASNFYbSncJ9qKK4bLwBCSctpjLbbuw5tdWi74ju5ZZMLV593+Qk4Wxdfx2f61ODjtsBhWDq1mCPWXNQaGC9D6tocOMHqfO45mnRTjq3D4uyj8sWEmZhwOlT56JpobO8lgnq1wzbXYrg==; 24:/AnrZyia4hZm58RPyQfFc2FUMkpLSTgP87RIABCQEglSUBnxrkVxBQqd5LDqtWNhbx86+Zb3WpBtRdG5bMZSqRrk7SQ8xKDVfDp4UU1Xr+M=; 20:5FmFrsSpxdR6UDskkxxzJ69oiYbuYFaPkpxp7kxXuNcOLY0s/dj7tTL9X3VrpX3gY1wf3qLsLoLNNbde39COQ0CTydanYdPOPgTxlPl7CPamNiXRCWfbHE/Sn+n1eBslPoar8RsXqzlZWndFMTJ9LCBA597qSGgBroHuIg4/lEJq3LoPCbshKZTMDotFFJE+fo/yWv+qcNzTInR/RSm2F94BFUVFQVm5Mo6pGypPQtv8aei05ZTVgJ5TxPGHSRMf SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2016 22:28:23.4188 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.221]; Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB0860 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, 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 Add a generic way to manage display HW capabilities for different ASICs and implement it for Carrizo. Signed-off-by: Harry Wentland Reviewed-by: Alex Deucher --- .../gpu/drm/amd/dal/dc/asic_capability/Makefile | 35 ++++ .../amd/dal/dc/asic_capability/asic_capability.c | 190 +++++++++++++++++++++ .../dc/asic_capability/carrizo_asic_capability.c | 147 ++++++++++++++++ .../dc/asic_capability/carrizo_asic_capability.h | 36 ++++ .../dal/dc/asic_capability/tonga_asic_capability.c | 146 ++++++++++++++++ .../dal/dc/asic_capability/tonga_asic_capability.h | 36 ++++ 6 files changed, 590 insertions(+) create mode 100644 drivers/gpu/drm/amd/dal/dc/asic_capability/Makefile create mode 100644 drivers/gpu/drm/amd/dal/dc/asic_capability/asic_capability.c create mode 100644 drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.c create mode 100644 drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.h create mode 100644 drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.c create mode 100644 drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.h diff --git a/drivers/gpu/drm/amd/dal/dc/asic_capability/Makefile b/drivers/gpu/drm/amd/dal/dc/asic_capability/Makefile new file mode 100644 index 000000000000..8491b38ae726 --- /dev/null +++ b/drivers/gpu/drm/amd/dal/dc/asic_capability/Makefile @@ -0,0 +1,35 @@ +# +# Makefile for the 'asic_capability' sub-component of DAL. +# + +ASIC_CAPABILITY = asic_capability.o + +AMD_DAL_ASIC_CAPABILITY = \ + $(addprefix $(AMDDALPATH)/dc/asic_capability/,$(ASIC_CAPABILITY)) + +AMD_DAL_FILES += $(AMD_DAL_ASIC_CAPABILITY) + +############################################################################### +# DCE 10x +############################################################################### +ifdef CONFIG_DRM_AMD_DAL_DCE10_0 +ASIC_CAPABILITY_DCE10 = tonga_asic_capability.o + +AMD_DAL_ASIC_CAPABILITY_DCE10 = \ + $(addprefix $(AMDDALPATH)/dc/asic_capability/,$(ASIC_CAPABILITY_DCE10)) + +AMD_DAL_FILES += $(AMD_DAL_ASIC_CAPABILITY_DCE10) +endif + + +############################################################################### +# DCE 11x +############################################################################### +ifdef CONFIG_DRM_AMD_DAL_DCE11_0 +ASIC_CAPABILITY_DCE11 = carrizo_asic_capability.o + +AMD_DAL_ASIC_CAPABILITY_DCE11 = \ + $(addprefix $(AMDDALPATH)/dc/asic_capability/,$(ASIC_CAPABILITY_DCE11)) + +AMD_DAL_FILES += $(AMD_DAL_ASIC_CAPABILITY_DCE11) +endif diff --git a/drivers/gpu/drm/amd/dal/dc/asic_capability/asic_capability.c b/drivers/gpu/drm/amd/dal/dc/asic_capability/asic_capability.c new file mode 100644 index 000000000000..7a905f532040 --- /dev/null +++ b/drivers/gpu/drm/amd/dal/dc/asic_capability/asic_capability.c @@ -0,0 +1,190 @@ +/* + * Copyright 2012-15 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: AMD + * + */ + +#include "dm_services.h" + +#include "include/logger_interface.h" + +#include "include/asic_capability_interface.h" +#include "include/asic_capability_types.h" +#include "include/dal_types.h" +#include "include/dal_asic_id.h" + +#if defined(CONFIG_DRM_AMD_DAL_DCE10_0) +#include "tonga_asic_capability.h" +#endif + +#if defined(CONFIG_DRM_AMD_DAL_DCE11_0) +#include "carrizo_asic_capability.h" +#endif + +/* + * Initializes asic_capability instance. + */ +static bool construct( + struct asic_capability *cap, + struct hw_asic_id *init, + struct dc_context *ctx) +{ + bool asic_supported = false; + + cap->ctx = ctx; + dm_memset(cap->data, 0, sizeof(cap->data)); + + /* ASIC data */ + cap->data[ASIC_DATA_VRAM_TYPE] = init->vram_type; + cap->data[ASIC_DATA_VRAM_BITWIDTH] = init->vram_width; + cap->data[ASIC_DATA_FEATURE_FLAGS] = init->feature_flags; + cap->runtime_flags = init->runtime_flags; + cap->data[ASIC_DATA_REVISION_ID] = init->hw_internal_rev; + cap->data[ASIC_DATA_MAX_UNDERSCAN_PERCENTAGE] = 10; + cap->data[ASIC_DATA_VIEWPORT_PIXEL_GRANULARITY] = 4; + cap->data[ASIC_DATA_SUPPORTED_HDMI_CONNECTION_NUM] = 1; + cap->data[ASIC_DATA_NUM_OF_VIDEO_PLANES] = 0; + cap->data[ASIC_DATA_DEFAULT_I2C_SPEED_IN_KHZ] = 25; + + /* ASIC basic capability */ + cap->caps.UNDERSCAN_FOR_HDMI_ONLY = true; + cap->caps.SUPPORT_CEA861E_FINAL = true; + cap->caps.MIRABILIS_SUPPORTED = false; + cap->caps.MIRABILIS_ENABLED_BY_DEFAULT = false; + cap->caps.WIRELESS_LIMIT_TO_720P = false; + cap->caps.WIRELESS_FULL_TIMING_ADJUSTMENT = false; + cap->caps.WIRELESS_TIMING_ADJUSTMENT = true; + cap->caps.WIRELESS_COMPRESSED_AUDIO = false; + cap->caps.VCE_SUPPORTED = false; + cap->caps.HPD_CHECK_FOR_EDID = false; + cap->caps.NO_VCC_OFF_HPD_POLLING = false; + cap->caps.NEED_MC_TUNING = false; + cap->caps.SUPPORT_8BPP = true; + + /* ASIC stereo 3D capability */ + cap->stereo_3d_caps.SUPPORTED = true; + + switch (init->chip_family) { + case FAMILY_CI: + break; + + case FAMILY_KV: + if (ASIC_REV_IS_KALINDI(init->hw_internal_rev) || + ASIC_REV_IS_BHAVANI(init->hw_internal_rev)) { + } else { + } + break; + + case FAMILY_CZ: +#if defined(CONFIG_DRM_AMD_DAL_DCE11_0) + carrizo_asic_capability_create(cap, init); + asic_supported = true; +#endif + break; + case FAMILY_VI: +#if defined(CONFIG_DRM_AMD_DAL_DCE10_0) + if (ASIC_REV_IS_TONGA_P(init->hw_internal_rev) || + ASIC_REV_IS_FIJI_P(init->hw_internal_rev)) { + tonga_asic_capability_create(cap, init); + asic_supported = true; + break; + } +#endif + break; + default: + /* unsupported "chip_family" */ + break; + } + + if (false == asic_supported) { + dal_logger_write(ctx->logger, + LOG_MAJOR_ERROR, + LOG_MINOR_MASK_ALL, + "%s: ASIC not supported!\n", __func__); + } + + return asic_supported; +} + +static void destruct( + struct asic_capability *cap) +{ + /* nothing to do (yet?) */ +} + +/* + * dal_asic_capability_create + * + * Creates asic capability based on DCE version. + */ +struct asic_capability *dal_asic_capability_create( + struct hw_asic_id *init, + struct dc_context *ctx) +{ + struct asic_capability *cap; + + if (!init) { + BREAK_TO_DEBUGGER(); + return NULL; + } + + cap = dm_alloc(ctx, sizeof(struct asic_capability)); + + if (!cap) { + BREAK_TO_DEBUGGER(); + return NULL; + } + + if (construct(cap, init, ctx)) + return cap; + + BREAK_TO_DEBUGGER(); + + dm_free(ctx, cap); + + return NULL; +} + +/* + * dal_asic_capability_destroy + * + * Destroy allocated memory. + */ +void dal_asic_capability_destroy( + struct asic_capability **cap) +{ + if (!cap) { + BREAK_TO_DEBUGGER(); + return; + } + + if (!*cap) { + BREAK_TO_DEBUGGER(); + return; + } + + destruct(*cap); + + dm_free((*cap)->ctx, *cap); + + *cap = NULL; +} diff --git a/drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.c b/drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.c new file mode 100644 index 000000000000..4aa8c305b08c --- /dev/null +++ b/drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.c @@ -0,0 +1,147 @@ +/* + * Copyright 2012-15 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: AMD + * + */ + +#include "dm_services.h" + +#include "include/asic_capability_interface.h" +#include "include/asic_capability_types.h" + +#include "carrizo_asic_capability.h" + +#include "atom.h" +#include "dce/dce_11_0_d.h" +#include "smu/smu_8_0_d.h" +#include "dce/dce_11_0_sh_mask.h" +#include "dal_asic_id.h" + +#define ixVCE_HARVEST_FUSE_MACRO__ADDRESS 0xC0014074 + +/* + * carrizo_asic_capability_create + * + * Create and initiate Carrizo capability. + */ +void carrizo_asic_capability_create(struct asic_capability *cap, + struct hw_asic_id *init) +{ + uint32_t e_fuse_setting; + /* ASIC data */ + cap->data[ASIC_DATA_CONTROLLERS_NUM] = 3; + cap->data[ASIC_DATA_DIGFE_NUM] = 3; + cap->data[ASIC_DATA_FUNCTIONAL_CONTROLLERS_NUM] = 3; + cap->data[ASIC_DATA_LINEBUFFER_NUM] = 3; + cap->data[ASIC_DATA_PATH_NUM_PER_DPMST_CONNECTOR] = 4; + cap->data[ASIC_DATA_DCE_VERSION] = 0x110; /* DCE 11 */ + cap->data[ASIC_DATA_LINEBUFFER_SIZE] = 1712 * 144; + cap->data[ASIC_DATA_DRAM_BANDWIDTH_EFFICIENCY] = 45; + cap->data[ASIC_DATA_CLOCKSOURCES_NUM] = 2; + cap->data[ASIC_DATA_MC_LATENCY] = 5000; + cap->data[ASIC_DATA_STUTTERMODE] = 0x200A; + cap->data[ASIC_DATA_VIEWPORT_PIXEL_GRANULARITY] = 2; + cap->data[ASIC_DATA_MAX_COFUNC_NONDP_DISPLAYS] = 2; + cap->data[ASIC_DATA_MEMORYTYPE_MULTIPLIER] = 2; + cap->data[ASIC_DATA_DEFAULT_I2C_SPEED_IN_KHZ] = 100; + cap->data[ASIC_DATA_NUM_OF_VIDEO_PLANES] = 1; + cap->data[ASIC_DATA_SUPPORTED_HDMI_CONNECTION_NUM] = 3; + + /* ASIC basic capability */ + cap->caps.IS_FUSION = true; + cap->caps.DP_MST_SUPPORTED = true; + cap->caps.PANEL_SELF_REFRESH_SUPPORTED = true; + cap->caps.MIRABILIS_SUPPORTED = true; + cap->caps.NO_VCC_OFF_HPD_POLLING = true; + cap->caps.VCE_SUPPORTED = true; + cap->caps.HPD_CHECK_FOR_EDID = true; + cap->caps.DFSBYPASS_DYNAMIC_SUPPORT = true; + cap->caps.SUPPORT_8BPP = false; + + /* ASIC stereo 3d capability */ + cap->stereo_3d_caps.DISPLAY_BASED_ON_WS = true; + cap->stereo_3d_caps.HDMI_FRAME_PACK = true; + cap->stereo_3d_caps.INTERLACE_FRAME_PACK = true; + cap->stereo_3d_caps.DISPLAYPORT_FRAME_PACK = true; + cap->stereo_3d_caps.DISPLAYPORT_FRAME_ALT = true; + cap->stereo_3d_caps.INTERLEAVE = true; + + e_fuse_setting = dm_read_index_reg(cap->ctx,CGS_IND_REG__SMC, ixVCE_HARVEST_FUSE_MACRO__ADDRESS); + + /* Bits [28:27]*/ + switch ((e_fuse_setting >> 27) & 0x3) { + case 0: + /*both VCE engine are working*/ + cap->caps.VCE_SUPPORTED = true; + cap->caps.WIRELESS_TIMING_ADJUSTMENT = false; + /*TODO: + cap->caps.wirelessLowVCEPerformance = false; + m_AsicCaps.vceInstance0Enabled = true; + m_AsicCaps.vceInstance1Enabled = true;*/ + cap->caps.NEED_MC_TUNING = true; + break; + + case 1: + cap->caps.VCE_SUPPORTED = true; + cap->caps.WIRELESS_TIMING_ADJUSTMENT = true; + /*TODO: + m_AsicCaps.wirelessLowVCEPerformance = false; + m_AsicCaps.vceInstance1Enabled = true;*/ + cap->caps.NEED_MC_TUNING = true; + break; + + case 2: + cap->caps.VCE_SUPPORTED = true; + cap->caps.WIRELESS_TIMING_ADJUSTMENT = true; + /*TODO: + m_AsicCaps.wirelessLowVCEPerformance = false; + m_AsicCaps.vceInstance0Enabled = true;*/ + cap->caps.NEED_MC_TUNING = true; + break; + + case 3: + /* VCE_DISABLE = 0x3 - both VCE + * instances are in harvesting, + * no VCE supported any more. + */ + cap->caps.VCE_SUPPORTED = false; + break; + + default: + break; + } + + if (ASIC_REV_IS_STONEY(init->hw_internal_rev)) + { + /* Stoney is the same DCE11, but only two pipes, three digs. + * and HW added 64bit back for non SG */ + cap->data[ASIC_DATA_CONTROLLERS_NUM] = 2; + cap->data[ASIC_DATA_FUNCTIONAL_CONTROLLERS_NUM] = 2; + cap->data[ASIC_DATA_LINEBUFFER_NUM] = 2; + /*3 DP MST per connector, limited by number of pipe and number + * of Dig.*/ + cap->data[ASIC_DATA_PATH_NUM_PER_DPMST_CONNECTOR] = 2; + + } + + +} diff --git a/drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.h b/drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.h new file mode 100644 index 000000000000..d1e9b8337d5b --- /dev/null +++ b/drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.h @@ -0,0 +1,36 @@ +/* + * Copyright 2012-15 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: AMD + * + */ + +#ifndef __DAL_CARRIZO_ASIC_CAPABILITY_H__ +#define __DAL_CARRIZO_ASIC_CAPABILITY_H__ + +/* Forward declaration */ +struct asic_capability; + +/* Create and initialize Carrizo data */ +void carrizo_asic_capability_create(struct asic_capability *cap, + struct hw_asic_id *init); + +#endif /* __DAL_CARRIZO_ASIC_CAPABILITY_H__ */ diff --git a/drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.c b/drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.c new file mode 100644 index 000000000000..af669c81085b --- /dev/null +++ b/drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.c @@ -0,0 +1,146 @@ +/* + * Copyright 2012-15 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: AMD + * + */ + +#include "dm_services.h" + +#include "include/asic_capability_interface.h" +#include "include/asic_capability_types.h" + +#include "tonga_asic_capability.h" + +#include "atom.h" +#include "dce/dce_10_0_d.h" +#include "smu/smu_8_0_d.h" +#include "dce/dce_10_0_sh_mask.h" +#include "dal_asic_id.h" + +#define ixVCE_HARVEST_FUSE_MACRO__ADDRESS 0xC0014074 + +/* + * carrizo_asic_capability_create + * + * Create and initiate Carrizo capability. + */ +void tonga_asic_capability_create(struct asic_capability *cap, + struct hw_asic_id *init) +{ + uint32_t e_fuse_setting; + /* ASIC data */ + cap->data[ASIC_DATA_CONTROLLERS_NUM] = 6; + cap->data[ASIC_DATA_FUNCTIONAL_CONTROLLERS_NUM] = 6; + cap->data[ASIC_DATA_DIGFE_NUM] = 6; + cap->data[ASIC_DATA_LINEBUFFER_NUM] = 6; + + cap->data[ASIC_DATA_LINEBUFFER_SIZE] = 1712 * 144; + cap->data[ASIC_DATA_DRAM_BANDWIDTH_EFFICIENCY] = 70; + cap->data[ASIC_DATA_CLOCKSOURCES_NUM] = 3; + cap->data[ASIC_DATA_MC_LATENCY] = 5000; + cap->data[ASIC_DATA_STUTTERMODE] = 0x2002; + cap->data[ASIC_DATA_PATH_NUM_PER_DPMST_CONNECTOR] = 4; + cap->data[ASIC_DATA_VIEWPORT_PIXEL_GRANULARITY] = 2; + cap->data[ASIC_DATA_SUPPORTED_HDMI_CONNECTION_NUM] = 3; + cap->data[ASIC_DATA_MIN_DISPCLK_FOR_UNDERSCAN] = 300000; + + cap->data[ASIC_DATA_DCE_VERSION] = 0x100; /* DCE 11 */ + + cap->data[ASIC_DATA_MAX_COFUNC_NONDP_DISPLAYS] = 2; + cap->data[ASIC_DATA_MEMORYTYPE_MULTIPLIER] = 4; + cap->data[ASIC_DATA_DEFAULT_I2C_SPEED_IN_KHZ] = 40; + cap->data[ASIC_DATA_NUM_OF_VIDEO_PLANES] = 1; + + + /* ASIC basic capability */ + cap->caps.IS_FUSION = true; + cap->caps.DP_MST_SUPPORTED = true; + cap->caps.PANEL_SELF_REFRESH_SUPPORTED = true; + cap->caps.MIRABILIS_SUPPORTED = true; + cap->caps.NO_VCC_OFF_HPD_POLLING = true; + cap->caps.VCE_SUPPORTED = true; + cap->caps.HPD_CHECK_FOR_EDID = true; + cap->caps.DFSBYPASS_DYNAMIC_SUPPORT = true; + cap->caps.SUPPORT_8BPP = false; + + /* ASIC stereo 3d capability */ + cap->stereo_3d_caps.DISPLAY_BASED_ON_WS = true; + cap->stereo_3d_caps.HDMI_FRAME_PACK = true; + cap->stereo_3d_caps.INTERLACE_FRAME_PACK = true; + cap->stereo_3d_caps.DISPLAYPORT_FRAME_PACK = true; + cap->stereo_3d_caps.DISPLAYPORT_FRAME_ALT = true; + cap->stereo_3d_caps.INTERLEAVE = true; + + e_fuse_setting = dm_read_index_reg(cap->ctx, CGS_IND_REG__SMC, ixVCE_HARVEST_FUSE_MACRO__ADDRESS); + + /* Bits [28:27]*/ + switch ((e_fuse_setting >> 27) & 0x3) { + case 0: + /* both VCE engine are working*/ + cap->caps.VCE_SUPPORTED = true; + cap->caps.WIRELESS_TIMING_ADJUSTMENT = false; + /* + * TODO: + * cap->caps.wirelessLowVCEPerformance = false; + * m_AsicCaps.vceInstance0Enabled = true; + * m_AsicCaps.vceInstance1Enabled = true; + */ + cap->caps.NEED_MC_TUNING = true; + break; + + case 1: + cap->caps.VCE_SUPPORTED = true; + cap->caps.WIRELESS_TIMING_ADJUSTMENT = true; + /* + * TODO: + * m_AsicCaps.wirelessLowVCEPerformance = false; + * m_AsicCaps.vceInstance1Enabled = true; + */ + cap->caps.NEED_MC_TUNING = true; + break; + + case 2: + cap->caps.VCE_SUPPORTED = true; + cap->caps.WIRELESS_TIMING_ADJUSTMENT = true; + /* + * TODO: + * m_AsicCaps.wirelessLowVCEPerformance = false; + * m_AsicCaps.vceInstance0Enabled = true; + */ + cap->caps.NEED_MC_TUNING = true; + break; + + case 3: + /* + * VCE_DISABLE = 0x3 - both VCE + * instances are in harvesting, + * no VCE supported any more. + */ + cap->caps.VCE_SUPPORTED = false; + break; + + default: + break; + } + + +} diff --git a/drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.h b/drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.h new file mode 100644 index 000000000000..29d9760e6c94 --- /dev/null +++ b/drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.h @@ -0,0 +1,36 @@ +/* + * Copyright 2012-15 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: AMD + * + */ + +#ifndef TONGA_ASIC_CAPABILITY_H_ +#define TONGA_ASIC_CAPABILITY_H_ + +/* Forward declaration */ +struct asic_capability; + +/* Create and initialize Carrizo data */ +void tonga_asic_capability_create(struct asic_capability *cap, + struct hw_asic_id *init); + +#endif /* TONGA_ASIC_CAPABILITY_H_ */