From patchwork Mon Oct 21 19:37:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Li X-Patchwork-Id: 11202953 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F00813BD for ; Mon, 21 Oct 2019 19:37:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1658B2084B for ; Mon, 21 Oct 2019 19:37:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1658B2084B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 101B26E23B; Mon, 21 Oct 2019 19:37:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-SN1-obe.outbound.protection.outlook.com (mail-eopbgr700064.outbound.protection.outlook.com [40.107.70.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id B81A26E239; Mon, 21 Oct 2019 19:37:54 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IQfzaFQFWHmF9MgYipzkfjS6NlV1QNTXp6G66sM6nm6dNBGH8sSGejLIf9v24+2PyzhXX7Guyb9ewCj1hNpgqNSaF5ISEDqzOrj03CL0ZRlj0VbrcE2ZQ7vYQGPL9daFcu/gc1H3nCIqiVVH1QzmtgQst2r/0r49kT/05PvZ3eDTWMhPDZGPsYro/b2tiN3U+BPKlGlmCVTHzLApyRdsoim93b9aZ9zt1LF4YISkMVPWqYm0yPhnuXemCosZ3FNoIxvma2iyfdXF5+UikxW2YplrtpIEiH+ZCFlCEHjy7WRV5LEKbOLc640wnQGN1QKm8rGp+SOZE86g70PtkJb2IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u9lPBR6Sn47BJ1wowmuG5z9FJHUwGWIONTCTszPjvlE=; b=VMCrPev3g6NUqHoaB4YZHQivv43DK7eojNvreszbr6PsTTCO9dQxW4KjkP98ni2tLz9AEfreudaq72FjZxmlnXQWVYlmiF/osvCUqM2nnWpX8ig/qt258n9B96g5hrf1iA+H6eDlFslTuXqEoQeTu8mTuZQu9Kdn6tWiSNqTKmYCVCPSLwft5E1I0JUqpf8uTyuUeEWmndZhwHbOzqyCJJ4dKpB4tC6UEnYyo+Rr1WsDIQ945iQ0YLkAjj5eW9DzAQfa8Rj43otUW7vg5g9Fxv8TcBdLKHVe3mpev/oFv+yE1bcr9oiQUe0QCcJvfWvh7hoIudF4SjCHzn914STE5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=permerror action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from SN1PR12CA0044.namprd12.prod.outlook.com (2603:10b6:802:20::15) by MN2PR12MB4256.namprd12.prod.outlook.com (2603:10b6:208:1d2::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2367.24; Mon, 21 Oct 2019 19:37:52 +0000 Received: from CO1NAM03FT039.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::208) by SN1PR12CA0044.outlook.office365.com (2603:10b6:802:20::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2367.20 via Frontend Transport; Mon, 21 Oct 2019 19:37:52 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXMB02.amd.com (165.204.84.17) by CO1NAM03FT039.mail.protection.outlook.com (10.152.81.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2367.14 via Frontend Transport; Mon, 21 Oct 2019 19:37:51 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 21 Oct 2019 14:37:49 -0500 Received: from SATLEXMB02.amd.com (10.181.40.143) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 21 Oct 2019 14:37:49 -0500 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB02.amd.com (10.181.40.143) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 21 Oct 2019 14:37:47 -0500 From: To: , , Subject: [PATCH] drm/amdgpu: Add DC feature mask to disable fractional pwm Date: Mon, 21 Oct 2019 15:37:43 -0400 Message-ID: <20191021193743.24339-1-sunpeng.li@amd.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(346002)(376002)(136003)(396003)(428003)(199004)(189003)(316002)(36756003)(1076003)(48376002)(86362001)(14444005)(110136005)(54906003)(50466002)(2201001)(70206006)(70586007)(2876002)(2870700001)(5660300002)(2906002)(478600001)(47776003)(305945005)(50226002)(8676002)(81166006)(2616005)(81156014)(426003)(486006)(4326008)(476003)(126002)(26005)(6666004)(8936002)(356004)(51416003)(186003)(336012); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB4256; H:SATLEXMB02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1d59713f-1473-4874-5923-08d7565e295c X-MS-TrafficTypeDiagnostic: MN2PR12MB4256: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-Forefront-PRVS: 0197AFBD92 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1T18lLzvYeNT0xFPCHJOaJQcHTIpX8QQIUVzLZRrGflshzMy9N8dRjHLy/3Dr2wZlOvUUtQWcXqKZM9iBV4lnXRmqSe5YPhmOkvMRZsHcAZ1mYpBm2fUtC+OO0V4uDQa6SbFYTFafxMQkc0atPQ2CBaUQOwynesQYazdUvLmG/k93BCGRB+gUNMpgC4NIVlEkUViOhMFyjM4kSpiRgHgJELLBTT0TuRl3St+plpTxBXBRe+7ZKRmhlmDNvbFipUpyyx9X/wc3YUh5AbJAxgBlTMZouhONjZdmwrIhSnbV0CfurH5j3dlipFlo+dJ5yLE06WQq/J8EykBJr5lNlbEJdAI2gSfsDatDFcq520F+GRPm4BcKSkgWkKtL1ZtjHMCoePlI7afBE50A/h/KuQsnR7hnCqFCQqueTmKRU36OojPEShNsgqI67ouF/IePXbE X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2019 19:37:51.5399 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1d59713f-1473-4874-5923-08d7565e295c 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.17]; Helo=[SATLEXMB02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4256 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u9lPBR6Sn47BJ1wowmuG5z9FJHUwGWIONTCTszPjvlE=; b=wMGyO7ZKe5cybfj59PxYNwEwru2x0lC3CPjFcvzbsDxAVb1ab1vynyqcI7aeMXHLQTZiEJvQ80ZJKsB4J0tNNdsTC/C+I9Y1bobn/Ts9cikxBMwOpMb8+pffqvR2FsE8bb11e52lp3fRpqnbLNjeZQ+utzUL2zyIzlRaz9JRLSc= X-Mailman-Original-Authentication-Results: spf=none (sender IP is 165.204.84.17) 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; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leo Li , Anthony.Koo@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Leo Li [Why] Some LED panel drivers might not like fractional PWM. In such cases, backlight flickering may be observed. [How] Add a DC feature mask to disable fractional PWM, and associate it with the preexisting dc_config flag. The flag is only plumbed through the dmcu firmware, so plumb it through the driver path as well. To disable, add the following to the linux cmdline: amdgpu.dcfeaturemask=0x4 Signed-off-by: Leo Li --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++ drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 4 ++++ drivers/gpu/drm/amd/include/amd_shared.h | 1 + 3 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 1cf4beb76835..73f917d4d1e1 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -728,6 +728,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) if (amdgpu_dc_feature_mask & DC_MULTI_MON_PP_MCLK_SWITCH_MASK) init_data.flags.multi_mon_pp_mclk_switch = true; + if (amdgpu_dc_feature_mask & DC_DISABLE_FRACTIONAL_PWM_MASK) + init_data.flags.disable_fractional_pwm = true; + init_data.flags.power_down_display_on_boot = true; #ifdef CONFIG_DRM_AMD_DC_DCN2_0 diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c index d759fdca7fdb..b8a3fc505c9b 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c @@ -404,6 +404,10 @@ static bool dce_abm_init_backlight(struct abm *abm) /* Enable the backlight output */ REG_UPDATE(BL_PWM_CNTL, BL_PWM_EN, 1); + /* Disable fractional pwm if configured */ + REG_UPDATE(BL_PWM_CNTL, BL_PWM_FRACTIONAL_EN, + abm->ctx->dc->config.disable_fractional_pwm ? 0 : 1); + /* Unlock group 2 backlight registers */ REG_UPDATE(BL_PWM_GRP1_REG_LOCK, BL_PWM_GRP1_REG_LOCK, 0); diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h index 8889aaceec60..5450ed762b7a 100644 --- a/drivers/gpu/drm/amd/include/amd_shared.h +++ b/drivers/gpu/drm/amd/include/amd_shared.h @@ -143,6 +143,7 @@ enum PP_FEATURE_MASK { enum DC_FEATURE_MASK { DC_FBC_MASK = 0x1, DC_MULTI_MON_PP_MCLK_SWITCH_MASK = 0x2, + DC_DISABLE_FRACTIONAL_PWM_MASK = 0x4, }; enum amd_dpm_forced_level;