From patchwork Tue Nov 7 20:41:55 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: 162725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp504140vqo; Tue, 7 Nov 2023 12:46:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3xb78J8d4AZ/7tl9tuc01FPaD86gsc7jCoWzmmSuhkL2cHUZBuN5Ddvad0hBE6WCS1ctm X-Received: by 2002:aca:1c12:0:b0:3b6:701b:97f3 with SMTP id c18-20020aca1c12000000b003b6701b97f3mr91783oic.57.1699390019640; Tue, 07 Nov 2023 12:46:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699390019; cv=none; d=google.com; s=arc-20160816; b=kl5Iv4u+VdGbVtAnzn6Fugvqv/j8bEBQurN+LU8KWkEAZZDLaxp8kHtM6gWKhfCA6B AtUFKNk8qIwthnGK0ZGBxm5DtmUovv0xaFzOoVtGhe3SvcNMjyXmmRuoG2xW4u6KN1H9 /muY8yKni8VdH2rvagv9DRC8l6AeZj2JuFlVlNeBgO1Lw7+En2KKsKQPJT1lgSRPMA7d Xxtr2ARQt8l+stqNcTujl9lJ3Uq2T7aRP6H3EipBk91IzS9GZDa7pSx5wbZD1d22s97O BOhSUE1R1C6RLOzqLaXsdrJCf6DgYX9ZYT5bV81Gaa8LKgtaBol+p6Ksn9H3XdhSgtRv 5X7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=91MByGmQVl2taa6i/AdbRt3neF5iZF/QU7vQ/CbO+ic=; fh=QSF6wZwxRRIGJ9Ybx1nP+GUhkXoPhy52zPZ6csROsqc=; b=Pkf8gTLOMKv9iSD3KjXXSR+f7B8tyhy6AYApLIO5878e2r6HkVyzmesrUZL7U77vQ0 Z8FBw2F8GCOZiYzTa3egrxk4dSJDAdx272PZqHFifXbYF1L6u3LVQq9GXH+1X6nd4h7Z RwMNaohhWEewdcINwA6WqeX7RgoTf55iWW6HQldo1c/kw+qnPX0/x0Mvo9NB7BfCraUa L8eZk3xlqQWzWosFp5hB85Sc2Y6OvgFcSxs1sgoQ+O/RN/bWAV5BXbXJatpQeSQY6mnA C7obsi+Kz+mpep8Kl6BYK0ibC4AiyGp8jbCYn2LKXCQljg9bi3EgekOZappM5V10fCKl gQNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QMWK1Y2s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id u3-20020a655c03000000b005bd272f5bc5si2795849pgr.275.2023.11.07.12.46.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 12:46:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QMWK1Y2s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 92B2482B1C6B; Tue, 7 Nov 2023 12:46:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233554AbjKGUqm (ORCPT + 32 others); Tue, 7 Nov 2023 15:46:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234488AbjKGUq0 (ORCPT ); Tue, 7 Nov 2023 15:46:26 -0500 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D617F10DB for ; Tue, 7 Nov 2023 12:46:23 -0800 (PST) Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3b2ec9a79bdso4213259b6e.3 for ; Tue, 07 Nov 2023 12:46:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699389983; x=1699994783; darn=vger.kernel.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=91MByGmQVl2taa6i/AdbRt3neF5iZF/QU7vQ/CbO+ic=; b=QMWK1Y2sL1M8kS8g8pkP6ydMYFQ+WRaw58mPq7S/x6YIy0XyxA506a0M/nmHlD0YqV 4z2ZArku/fMtQqAv8aVQfBW5gWpSWRMQT+Km9PIBB/BNMDq7kaWstvAKbrLmbBKy60C9 WXRC3dw9Llgya3yRDkXQNlvgTI4we0+HqKpv0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699389983; x=1699994783; 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=91MByGmQVl2taa6i/AdbRt3neF5iZF/QU7vQ/CbO+ic=; b=P+7KNXn1v8DNMPGZ8tPmOmU+WlsDhe/+xUTAf1yLlOeB1gF7twjWt9bcolpyh+MFvU ecSv2vynUQ+O0mntjaqWYMH1SELqlEq4c2p7MiHcyzlkjc7OOXEHVJjFMjoJUk+NM8Wp zmsVzykd/wN+TCn5bQRXvJ3V32NHw35xxsAhcUBRqzHoUTSX9dTDYOTqSuj1LqfnyJXf 0txqQ3JEuKqqUa5VvXmUnXCk/CM9PrhMuFT4LYHQ4piFYNzvE+vN1jo9VoTpPBTGCDsf mXwfyw/Ef/ghARuo7VDBQk03yWxgJViYNRPr2/PifxmDJN9fh2wyN+SmIiCkg/NVFWDY xKQw== X-Gm-Message-State: AOJu0Yw+94xQQTuyDYbvf16Wz7j3em70ZqSFrgyqlD/3+PZfu7RwQsoX /kPLLc1WdriHZiPhO88AbncdvQ== X-Received: by 2002:a05:6870:2423:b0:1e9:b025:cf88 with SMTP id n35-20020a056870242300b001e9b025cf88mr4646934oap.36.1699389983229; Tue, 07 Nov 2023 12:46:23 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:586c:80a1:e007:beb9]) by smtp.gmail.com with ESMTPSA id e7-20020a630f07000000b005ab46970aaasm1750211pgl.17.2023.11.07.12.46.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 12:46:22 -0800 (PST) From: Hsin-Yi Wang To: Douglas Anderson Cc: Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v6 5/5] drm/panel-edp: Avoid adding multiple preferred modes Date: Tue, 7 Nov 2023 12:41:55 -0800 Message-ID: <20231107204611.3082200-6-hsinyi@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231107204611.3082200-1-hsinyi@chromium.org> References: <20231107204611.3082200-1-hsinyi@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 07 Nov 2023 12:46:45 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781939589397931199 X-GMAIL-MSGID: 1781939589397931199 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 --- 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 c0c24d94c3a0..006939cc3fee 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");