From patchwork Thu Feb 11 17:19: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: 8283101 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 51B85BEEED for ; Thu, 11 Feb 2016 17:20:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B34320397 for ; Thu, 11 Feb 2016 17:20:34 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 22F182017E for ; Thu, 11 Feb 2016 17:20:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 57F406E8C1; Thu, 11 Feb 2016 09:20:30 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0059.outbound.protection.outlook.com [207.46.100.59]) by gabe.freedesktop.org (Postfix) with ESMTPS id 89A316E8C1 for ; Thu, 11 Feb 2016 09:20:28 -0800 (PST) Received: from SN1PR12CA0018.namprd12.prod.outlook.com (10.162.96.156) by BLUPR12MB0706.namprd12.prod.outlook.com (10.163.218.144) with Microsoft SMTP Server (TLS) id 15.1.403.16; Thu, 11 Feb 2016 17:20:25 +0000 Received: from CO1NAM03FT006.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::201) by SN1PR12CA0018.outlook.office365.com (2a01:111:e400:5174::28) with Microsoft SMTP Server (TLS) id 15.1.403.16 via Frontend Transport; Thu, 11 Feb 2016 17:20:26 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.222) 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 atltwp02.amd.com (165.204.84.222) by CO1NAM03FT006.mail.protection.outlook.com (10.152.80.75) with Microsoft SMTP Server id 15.1.415.6 via Frontend Transport; Thu, 11 Feb 2016 17:20:25 +0000 X-WSS-ID: 0O2E85V-08-09I-02 X-M-MSG: Received: from satlvexedge02.amd.com (satlvexedge02.amd.com [10.177.96.29]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by atltwp02.amd.com (Axway MailGate 5.3.1) with ESMTPS id 2D142D22F90 for ; Thu, 11 Feb 2016 12:20:19 -0500 (EST) Received: from SATLEXCHOV02.amd.com (10.181.40.72) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 11 Feb 2016 11:20:55 -0600 Received: from STOREXDAG03.amd.com (10.1.13.12) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server (TLS) id 14.3.266.1; Thu, 11 Feb 2016 11:20:23 -0600 Received: from cnhwentlanub.amd.com (172.29.225.36) by storexdag03.amd.com (10.1.13.12) with Microsoft SMTP Server id 14.3.266.1; Thu, 11 Feb 2016 12:20:21 -0500 From: Harry Wentland To: Subject: [PATCH 04/29] drm/amd/dal: Asic Capabilities Date: Thu, 11 Feb 2016 12:19:44 -0500 Message-ID: <1455211209-26733-5-git-send-email-harry.wentland@amd.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1455211209-26733-1-git-send-email-harry.wentland@amd.com> 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.222; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(199003)(189002)(2950100001)(5003600100002)(50226001)(189998001)(1096002)(5008740100001)(1220700001)(50466002)(86362001)(33646002)(47776003)(4326007)(53416004)(105586002)(106466001)(76176999)(2906002)(50986999)(87936001)(19580405001)(101416001)(36756003)(92566002)(450100001)(229853001)(5003940100001)(48376002)(2351001)(77096005)(586003)(575784001)(19580395003)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0706; H:atltwp02.amd.com; FPR:; SPF:None; MLV:sfv; A:1; MX:1; LANG:en; X-MS-Office365-Filtering-Correlation-Id: 7a979c56-a354-41be-fc50-08d33307a184 X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0706; 2:2hZKXLImxFPuTJwT6Go7GBbDNafrfJWIS83Ju+rpS1iwIqTuRP8RJjI+nWIPrfVuOY2by4yYi7cVQ6kIQ6oLAViWy5qWrvy7NJNaYpqttfr7wywS3LZL6+RYra61eANnfQtCwmxXH8kKTUQgsGfcIwdrxEfPLcFY6la5pr13MWK9h/Mt3sXgVbZBzDsAbSX2; 3:ALlmOlleZ8dXNsGU2bpn7ZZdPmry1nAfJQIiG9R8PAYE+KEfIDRwUOLPBZoxfDI+K2M57/aziObfLmNiqKmYBJY4KPC8AJOH7OJfu8eWDnma0hzCUInJsjGQkJB5kifRamdx6lDvsv5MLhW04DHeaGjgBPuO4OPnkGztvuQd+dz1qpdDNcJk7nGgKZkwZq7dN3MXLuR8OG/qcw1lJZftVcivkpflGzqPgtAzOLI7eaI=; 25:ds3vB1EGzKjALJBJ+zFgE2VfhxWiJcevOvwJoWyRDq6fdAekyLSL+qpusKrcJNN4+RiMKt5p+IAmkUmuC3ZRLSoKZG1sVXckps0XIH4ctxFWF1BDllwsy7otpZJYNeKuqBkVK8nCAunqHlj653Rid5eIb02OL+CF9cq/TLHyDInDXPH1Mg6Dqr0u61TX4sZHjBGvePU+5cMzJu2/kvl6fSST1tuz6ww5WmrUvf1Uzabzi6+IXDuIlVCX/g+T5R/BTsrbcsXDWelMKWJZ/9mit3K6Ao3fDbJWCSy6EVWK5attX3YPzh7ohmnlulK2/0Jk X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR12MB0706; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0706; 20:0v3eBuALW8vsDDrawnuCUXo2j3icUMxCeey1pg+Pg2m57K88GukNU+l1C2IVh4kv6djbwenn1FFhMG/qosT0Hk24uIq7kBz+EhNpQydR3YG/OoTOO27bcu084Rwhg49Npi6duz3I7IUdRD16XbsozTYUkXXrUffx2ZH2V1c8yff06dVA+kERg16S952kKXL+wY8aptK12JXbq+Zi0cUAcsG+atH0XuNSwQRdvahjYLpa+FvPLGJ+ZmxsDiRCbwUXeuJba+ypovUt3zUL0l9fPdu/waVo7r59Blk5M3sZXmAD08bHYv2Wn0zYmDFixjLXtprQhlvpyseZhUNrh+9vuy38FhMACPh7cbwtPAGXj3eEbjiaVbyb8T/XcHieYRmJlHifAqTpWVpB8Lyac8pGjzF7KwZE2atEItkFi28NWLYQjxA0ZE+Q2+NanpRr5USiet22AM+BZMNL5JLztoFfSUiTTdCI+/o6M8gqowYctsriRhS0sn+5OCjUmewErMbF 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)(5005006)(13024025)(13015025)(8121501046)(13023025)(13018025)(3002001)(10201501046); SRVR:BLUPR12MB0706; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0706; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0706; 4:2+M8XWtPlNQnt+VGd4f4vxIeSqnm5llcaRV80A3UqBFH/5L4wrvfXB4zUiaEihIFJme9U6xZPjzmq6uHLRbyghbCj4AXh5BbBvUvIZbYLTkmtg5OB6EQjjBDt/t+CXRFMxWzhkc2JfnFAOkGcPQOhAo/Jxzif2Y5xtCDFapw/LyoMqDtNNNDGsnvN+sB86kQOGCwQg0/RPsEMp91Jc/OA4/0u5DX0U8Z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d1tnzn4PsJdxNqvSQVrS0aAnp3GdfJC/4dNI4W SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2016 17:20:25.4350 (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.222]; Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0706 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.4 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_ */