From patchwork Fri Nov 17 21:46:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 13459742 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BDDFCC072A2 for ; Fri, 17 Nov 2023 21:51:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 135DA10E1A7; Fri, 17 Nov 2023 21:51:09 +0000 (UTC) Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by gabe.freedesktop.org (Postfix) with ESMTPS id C504D10E13D for ; Fri, 17 Nov 2023 21:51:02 +0000 (UTC) Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6b1d1099a84so2388446b3a.1 for ; Fri, 17 Nov 2023 13:51:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1700257862; x=1700862662; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e5wbvoHrw5gghSmYXqYsGypau9Ymfce8CXWliYyG7ds=; b=XJJbuHQEKPpLkdBJyg+nTZGVqh1TEE9/GJOtiQGc+dV7X3lCLYbHGlLeKcSVg1x/vw eXX+cLdpX5tiMlMeGW+dlIqqn5GshtpltVEQyQg6GNaLVPyciT1Y2qaJ8amlVupfiV9J LD+1PRylz9JFdoqfKbPyZdpATT7Dw56s9X/iA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700257862; x=1700862662; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e5wbvoHrw5gghSmYXqYsGypau9Ymfce8CXWliYyG7ds=; b=RPEh+Timhe4Meo0x5g40u9qfoQAq0TvSMab/SkHw/YvMj9BkN8FlFkJpbNi45DhVTD +mc3BY3ZmP7um6GqJ67ve+neRPqYGqxYJ4unLROEIiTnyVTjVsCSRKElwODRLB9Yr5wj Uq/98kcfm0YuuSWBldZFfvfHS/WLQYAL0muRrkO6NrVB/+M2j8sKNZNYlUqVnqj87uRb hWzpN171odtzym3BX0BuccifAjBfLtCDsZjJiKP4phTnl+28/oHK6nrKrpGniXC24rGh nhkMua6E1wWNQbNesRz193p0vFhr6zvuukmXrXb6/TmYZU9u7fWnPyzBGLsIvzJFe1K/ 2/KA== X-Gm-Message-State: AOJu0Yxyc/Db/lZyOZ6jjKUUIVp4G2fMgcuA84Tny2MQNnl6zjm4NNzs 8PE9ztPrGSi834idlalxidx8nw== X-Google-Smtp-Source: AGHT+IFXa1O0px5rjy5mHaMT7yi0PRLUE2h8oNXonzeJMHXBMP048pYW3pu5gGFgpRYyO3sJvO9lqw== X-Received: by 2002:a05:6a21:398d:b0:188:aea:2138 with SMTP id ad13-20020a056a21398d00b001880aea2138mr625516pzc.19.1700257862324; Fri, 17 Nov 2023 13:51:02 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:7ed:b095:f0ba:5801]) by smtp.gmail.com with ESMTPSA id x7-20020a17090aca0700b00256b67208b1sm3639587pjt.56.2023.11.17.13.51.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 13:51:01 -0800 (PST) From: Hsin-Yi Wang To: Douglas Anderson Subject: [PATCH v7 1/3] drm/panel-edp: Add override_edid_mode quirk for generic edp Date: Fri, 17 Nov 2023 13:46:32 -0800 Message-ID: <20231117215056.1883314-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.43.0.rc0.421.g78406f8d94-goog In-Reply-To: <20231117215056.1883314-1-hsinyi@chromium.org> References: <20231117215056.1883314-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Neil Armstrong , linux-kernel@vger.kernel.org, Maxime Ripard , dri-devel@lists.freedesktop.org, Thomas Zimmermann , Jessica Zhang , stable@vger.kernel.org, Sam Ravnborg Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Generic edp gets mode from edid. However, some panels report incorrect mode in this way, resulting in glitches on panel. Introduce a new quirk additional_mode to the generic edid to pick a correct hardcoded mode. Signed-off-by: Hsin-Yi Wang Reviewed-by: Douglas Anderson --- v6->v7: split usecase to another patch. --- drivers/gpu/drm/panel/panel-edp.c | 48 +++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index f22677373171..33535f6de343 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -203,6 +203,9 @@ struct edp_panel_entry { /** @name: Name of this panel (for printing to logs). */ const char *name; + + /** @override_edid_mode: Override the mode obtained by edid. */ + const struct drm_display_mode *override_edid_mode; }; struct panel_edp { @@ -301,6 +304,24 @@ static unsigned int panel_edp_get_display_modes(struct panel_edp *panel, return num; } +static int panel_edp_override_edid_mode(struct panel_edp *panel, + struct drm_connector *connector, + const struct drm_display_mode *override_mode) +{ + struct drm_display_mode *mode; + + mode = drm_mode_duplicate(connector->dev, override_mode); + if (!mode) { + dev_err(panel->base.dev, "failed to add additional mode\n"); + return 0; + } + + mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; + drm_mode_set_name(mode); + drm_mode_probed_add(connector, mode); + return 1; +} + static int panel_edp_get_non_edid_modes(struct panel_edp *panel, struct drm_connector *connector) { @@ -568,6 +589,9 @@ static int panel_edp_get_modes(struct drm_panel *panel, { struct panel_edp *p = to_panel_edp(panel); int num = 0; + bool has_override_edid_mode = p->detected_panel && + p->detected_panel != ERR_PTR(-EINVAL) && + p->detected_panel->override_edid_mode; /* probe EDID if a DDC bus is available */ if (p->ddc) { @@ -575,9 +599,18 @@ static int panel_edp_get_modes(struct drm_panel *panel, if (!p->edid) p->edid = drm_get_edid(connector, p->ddc); - - if (p->edid) - num += drm_add_edid_modes(connector, p->edid); + if (p->edid) { + if (has_override_edid_mode) { + /* + * override_edid_mode is specified. Use + * override_edid_mode instead of from edid. + */ + num += panel_edp_override_edid_mode(p, connector, + p->detected_panel->override_edid_mode); + } else { + num += drm_add_edid_modes(connector, p->edid); + } + } pm_runtime_mark_last_busy(panel->dev); pm_runtime_put_autosuspend(panel->dev); @@ -1849,6 +1882,15 @@ static const struct panel_delay delay_200_150_e200 = { .delay = _delay \ } +#define EDP_PANEL_ENTRY2(vend_chr_0, vend_chr_1, vend_chr_2, product_id, _delay, _name, _mode) \ +{ \ + .name = _name, \ + .panel_id = drm_edid_encode_panel_id(vend_chr_0, vend_chr_1, vend_chr_2, \ + product_id), \ + .delay = _delay, \ + .override_edid_mode = _mode \ +} + /* * This table is used to figure out power sequencing delays for panels that * are detected by EDID. Entries here may point to entries in the From patchwork Fri Nov 17 21:46:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 13459743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 7D9CFC5ACB3 for ; Fri, 17 Nov 2023 21:51:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2153610E795; Fri, 17 Nov 2023 21:51:09 +0000 (UTC) Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by gabe.freedesktop.org (Postfix) with ESMTPS id F014610E1A7 for ; Fri, 17 Nov 2023 21:51:03 +0000 (UTC) Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-28039ee1587so1961958a91.2 for ; Fri, 17 Nov 2023 13:51:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1700257863; x=1700862663; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MDebfVAoPELKTEL528lJwzdi4eZAa8eNlalDXzxQ6JQ=; b=SzAOJ0QlhXcH5D4q9ia++B50WIkexLp0Uh3CMhZjOSDMT95DHOY/bh0EjRCpmv564u xsRyfGp22WgNVmgj3X1OhpMCMkrFlqQzsBROMUuktb11Vr0PHj7/zZSvJbaF7y1BCojQ z/n28a/FDwF0BB5/Mg1E1i9/GItL6Lk/6AUGA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700257863; x=1700862663; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MDebfVAoPELKTEL528lJwzdi4eZAa8eNlalDXzxQ6JQ=; b=A0b5VBKl2y6Rdx0fK2qBUyD/zZ15nPlhSQuGVUux+oKikd44G+KmIwDu2juEFoTaJX BrhJnuNbFrbFn6r0NwJGKAryDjXVwLEKAZ++skJdEKMa7ZcRQUrdvOriI587pJOaCYaX L3+ViiF5cE/szGBBqvnCg0OUuxfSMXiekEXy+GyzzLzGfXU4kED6IoVPqM25mwmK2KRO L0lT+WNj2+yYdqGonL0/hySWNkm84MoLQ3osnevjoJVwDpyhu9niHPIyhu9RRLoeIW4W K29lD0nPVwMsL0CeuvKDUgsZCulj+8Thy37F7xkay98PDRZvrzrcZPOLBGThwPgS8EIk ZETw== X-Gm-Message-State: AOJu0YxZHQAiCVBuiERXyBMnVY8iIvb25blF1n5GuzPx1UUEpdJ1s5Mx S5Eb/tDXAlF6nBdBU86v2fenmw== X-Google-Smtp-Source: AGHT+IFCO9OAi3+Qkz1XY3PYPDHiJLGt2Jkv4PHzp1qsbAme5ecpdXxOYr8cOAbRQwIJ7CNVwWUjOw== X-Received: by 2002:a17:90b:1e0f:b0:281:691:e58c with SMTP id pg15-20020a17090b1e0f00b002810691e58cmr831673pjb.37.1700257863532; Fri, 17 Nov 2023 13:51:03 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:7ed:b095:f0ba:5801]) by smtp.gmail.com with ESMTPSA id x7-20020a17090aca0700b00256b67208b1sm3639587pjt.56.2023.11.17.13.51.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 13:51:03 -0800 (PST) From: Hsin-Yi Wang To: Douglas Anderson Subject: [PATCH v7 2/3] drm/panel-edp: Add auo_b116xa3_mode Date: Fri, 17 Nov 2023 13:46:33 -0800 Message-ID: <20231117215056.1883314-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.43.0.rc0.421.g78406f8d94-goog In-Reply-To: <20231117215056.1883314-1-hsinyi@chromium.org> References: <20231117215056.1883314-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Neil Armstrong , linux-kernel@vger.kernel.org, Maxime Ripard , dri-devel@lists.freedesktop.org, Thomas Zimmermann , Jessica Zhang , stable@vger.kernel.org, Sam Ravnborg Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add auo_b116xa3_mode to override the original modes parsed from edid of the panels 0x405c B116XAK01.0 and 0x615c B116XAN06.1 which result in glitches on panel. Signed-off-by: Hsin-Yi Wang Reviewed-by: Douglas Anderson --- v6->v7: split usecase to another patch. --- drivers/gpu/drm/panel/panel-edp.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index 33535f6de343..3e144145a6bd 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -983,6 +983,19 @@ static const struct panel_desc auo_b101ean01 = { }, }; +static const struct drm_display_mode auo_b116xa3_mode = { + .clock = 70589, + .hdisplay = 1366, + .hsync_start = 1366 + 40, + .hsync_end = 1366 + 40 + 40, + .htotal = 1366 + 40 + 40 + 32, + .vdisplay = 768, + .vsync_start = 768 + 10, + .vsync_end = 768 + 10 + 12, + .vtotal = 768 + 10 + 12 + 6, + .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC, +}; + static const struct drm_display_mode auo_b116xak01_mode = { .clock = 69300, .hdisplay = 1366, @@ -1908,9 +1921,11 @@ static const struct edp_panel_entry edp_panels[] = { EDP_PANEL_ENTRY('A', 'U', 'O', 0x239b, &delay_200_500_e50, "B116XAN06.1"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x255c, &delay_200_500_e50, "B116XTN02.5"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x403d, &delay_200_500_e50, "B140HAN04.0"), - EDP_PANEL_ENTRY('A', 'U', 'O', 0x405c, &auo_b116xak01.delay, "B116XAK01.0"), + EDP_PANEL_ENTRY2('A', 'U', 'O', 0x405c, &auo_b116xak01.delay, "B116XAK01.0", + &auo_b116xa3_mode), EDP_PANEL_ENTRY('A', 'U', 'O', 0x582d, &delay_200_500_e50, "B133UAN01.0"), - EDP_PANEL_ENTRY('A', 'U', 'O', 0x615c, &delay_200_500_e50, "B116XAN06.1"), + EDP_PANEL_ENTRY2('A', 'U', 'O', 0x615c, &delay_200_500_e50, "B116XAN06.1", + &auo_b116xa3_mode), EDP_PANEL_ENTRY('A', 'U', 'O', 0x635c, &delay_200_500_e50, "B116XAN06.3"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x639c, &delay_200_500_e50, "B140HAK02.7"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x8594, &delay_200_500_e50, "B133UAN01.0"), From patchwork Fri Nov 17 21:46:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 13459744 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 369ADC072A2 for ; Fri, 17 Nov 2023 21:51:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6BFC210E798; Fri, 17 Nov 2023 21:51:10 +0000 (UTC) Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1CCAE10E1A7 for ; Fri, 17 Nov 2023 21:51:05 +0000 (UTC) Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-27ff83feb29so2120428a91.3 for ; Fri, 17 Nov 2023 13:51:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1700257864; x=1700862664; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z+W2o/1Mm+Zk29DqmS4Z9iJYsZDg6ej8XviFhoNK3hc=; b=gaRawdUv7JIf9GCyg0VNDV2Ve4uusBscEYq3rj1xWUGviKDEBLcNF83eUOWbR+h6dT aWfqdXs7a82ojcvdElmIfP7XfRuHc88XJPTN7IYETKZPc0vacYIZTXEtDQXsZawtzd3y oBKBHUbC3E0b2+6kG55mbZb6/aHN7/VJcNjwE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700257864; x=1700862664; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z+W2o/1Mm+Zk29DqmS4Z9iJYsZDg6ej8XviFhoNK3hc=; b=cmxedP3dq2i7jUJXXQgRL801yym7Cn+uG76AlX8QPjkX0uigPjIli5MpcnzDaalfUU cZnqTjhAWrSXlJB4noaaRkqMtsO3EcHAgKohDi6q+hSY08AJjehEEedW/JRUG/NZ1mIo 1Y9CbRFVw+pT8S9FWXXKyUxxt6mk8K+AEW+t8x7u+ca61Yqaabm73VWGwKRK5/WRunRf Ud8dCZbA8Ydn6SeU/2bkPSG8xK2iE4DQHPsqwSsrBkqnFTGthY1KlLYGbbuSqPRnWLcR jNnmsWBATuWynFiLhTBf9RTFynnpndfTjwoC89kHIHwkbCxaZGLiJKm8laeoNc81Fu54 w6lQ== X-Gm-Message-State: AOJu0Yz7daNeXCOWCJ5Tv9vUscJCppcpt0ID34ZXh820yto6kSXPlK/w Zb8VOCi7bu81y/B4hJuJk3ksyX93zFIOdNZ4PHs= X-Google-Smtp-Source: AGHT+IEoYZev4e+4BlmjL2DESxBNbWnVwfPVQGbvcEHXfE9mi8zXCgvFODYt3RwfTHBziPMiCXhH6g== X-Received: by 2002:a17:90b:3014:b0:27d:8ad:c4e1 with SMTP id hg20-20020a17090b301400b0027d08adc4e1mr922828pjb.19.1700257864607; Fri, 17 Nov 2023 13:51:04 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:7ed:b095:f0ba:5801]) by smtp.gmail.com with ESMTPSA id x7-20020a17090aca0700b00256b67208b1sm3639587pjt.56.2023.11.17.13.51.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 13:51:04 -0800 (PST) From: Hsin-Yi Wang To: Douglas Anderson Subject: [PATCH v7 3/3] drm/panel-edp: Avoid adding multiple preferred modes Date: Fri, 17 Nov 2023 13:46:34 -0800 Message-ID: <20231117215056.1883314-4-hsinyi@chromium.org> X-Mailer: git-send-email 2.43.0.rc0.421.g78406f8d94-goog In-Reply-To: <20231117215056.1883314-1-hsinyi@chromium.org> References: <20231117215056.1883314-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Neil Armstrong , linux-kernel@vger.kernel.org, Maxime Ripard , dri-devel@lists.freedesktop.org, Thomas Zimmermann , Jessica Zhang , stable@vger.kernel.org, Sam Ravnborg Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If a non generic edp-panel is under aux-bus, the mode read from edid would still be selected as preferred and results in multiple preferred modes, which is ambiguous. If both hard-coded mode and edid exists, only add mode from hard-coded. Signed-off-by: Hsin-Yi Wang Reviewed-by: Douglas Anderson --- v6->v7: no change --- drivers/gpu/drm/panel/panel-edp.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index 3e144145a6bd..825fa2a0d8a5 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -589,6 +589,7 @@ static int panel_edp_get_modes(struct drm_panel *panel, { struct panel_edp *p = to_panel_edp(panel); int num = 0; + bool has_hard_coded_modes = p->desc->num_timings || p->desc->num_modes; bool has_override_edid_mode = p->detected_panel && p->detected_panel != ERR_PTR(-EINVAL) && p->detected_panel->override_edid_mode; @@ -599,7 +600,11 @@ static int panel_edp_get_modes(struct drm_panel *panel, if (!p->edid) p->edid = drm_get_edid(connector, p->ddc); - if (p->edid) { + /* + * If both edid and hard-coded modes exists, skip edid modes to + * avoid multiple preferred modes. + */ + if (p->edid && !has_hard_coded_modes) { if (has_override_edid_mode) { /* * override_edid_mode is specified. Use @@ -616,12 +621,7 @@ static int panel_edp_get_modes(struct drm_panel *panel, pm_runtime_put_autosuspend(panel->dev); } - /* - * Add hard-coded panel modes. Don't call this if there are no timings - * and no modes (the generic edp-panel case) because it will clobber - * the display_info that was already set by drm_add_edid_modes(). - */ - if (p->desc->num_timings || p->desc->num_modes) + if (has_hard_coded_modes) num += panel_edp_get_non_edid_modes(p, connector); else if (!num) dev_warn(p->base.dev, "No display modes\n");