From patchwork Mon Nov 6 20:22:50 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: 162178 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2909582vqu; Mon, 6 Nov 2023 12:27:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDtXCcOkNiniLkgh0Pxs1Ta/VQvG6QQcjggRA565jnCQPA6r9C9PDR+UxkCXuRVAAO6yZG X-Received: by 2002:a17:90b:696:b0:280:4829:52cc with SMTP id m22-20020a17090b069600b00280482952ccmr20171523pjz.37.1699302457877; Mon, 06 Nov 2023 12:27:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699302457; cv=none; d=google.com; s=arc-20160816; b=Sg2bFmcjQnqczoSWNPi8wPIVAIWpOL6U5P3CLJAsO3wMsO0ItpUPPtMP+5Sgo0rrpu GNaHdMyo3u/CqZLEQQ+rDjIR6amzqluupNnPp/6Ym+Aa7JDeFzOSLa2F6WaXDAEcxhyT 3Mtmk11+h/56CJsWwoSZQEixZ5s7rYn5X5Gx3dpnrysjzX9AxEiyTzz3ld++2hSPDEmd PdR1O/DlQYkDcjonAE47NQN/04vNHZh4bmq+dh1ETWuW8YzcvJfcfhNP0O8aplUjMbD6 ai5mkQzzUtsgS9zOxGplhXvBTYdwK/KB8Q6cnFjUbjtb4yv+E1TLo07enrfORo5imPLV 0Z0A== 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=lJlE6HDvd5TvSMidl1UF4V7GiD3TUKDPHWop4ycck10=; fh=xm4V3i9y7SNKSixHUbMvMEPgDl0W8xdNniziEWdXVkQ=; b=Vz6uvwriR1+OIggsSXhmm2xKVmokQ0cn6jtfnTEqo3yuEqfmxq9PnGGmSZor5rUDAI qC31pMQd/gp0gAR7bDWxnWKt8oIHV6O22iCD0HzT8/UOrOA5JCrs2T4PSjpD70DFD3an PEBwUXasYqtApZwkKwx+e5bG4dgzJJwgLQ1JokyAwg2KB46uKDbo6roVuYyraQ50+eA/ VXv/Bu7zV9DwK3N8PIZpqYywTETV4kmK0EdBwBywoyb3iCowAsD8J341lNOeSFc/Mx2d OcA9PmRSvEWqvrFqAstgsqkbRvdwT8lUcTj4v/RvtQtSVWXz8LGA4CRONcBQ35evAdiE zXsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=j49zgON+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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. [23.128.96.37]) by mx.google.com with ESMTPS id a20-20020a17090ad81400b00280203592dbsi8698673pjv.90.2023.11.06.12.27.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 12:27:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=j49zgON+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 715A9801B929; Mon, 6 Nov 2023 12:27:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232979AbjKFU1c (ORCPT + 34 others); Mon, 6 Nov 2023 15:27:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232955AbjKFU1a (ORCPT ); Mon, 6 Nov 2023 15:27:30 -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 31D4AD71 for ; Mon, 6 Nov 2023 12:27:27 -0800 (PST) Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3b2ea7cca04so3176153b6e.2 for ; Mon, 06 Nov 2023 12:27:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699302446; x=1699907246; 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=lJlE6HDvd5TvSMidl1UF4V7GiD3TUKDPHWop4ycck10=; b=j49zgON+ginlYUWH6XsufPn1jVyMvo600PjaME66lFJwZttshjNnmWiaBalYFNf7lJ oCUAtI+CT/k3fWB2HZpTGlxvXzM4OsJPgN8n1/i3rI1840uyeu4DS8ly1pOtEgwKQ1FP hgrnCnqEE67gt9q9F2D3nz7z+/PJJpAAVstOM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699302446; x=1699907246; 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=lJlE6HDvd5TvSMidl1UF4V7GiD3TUKDPHWop4ycck10=; b=jvS5mvyXstBBy2yXm0QNpx8qS4LWJKXKE96/yUb2Adj+z4aUhi6eZXC0AkHll9YgOZ BiSnj3VKfT4b2uy9aLB0hGeNvsiu2jPoZIVnPfMbxuUbq3UP2pj3XyWX5ed8edWCMfnT CS9dM78qc+hhkUfQHXSXlgbi+H3VvBHll9TldQd71prJf2hbx+htt+ZF45L0oA5gQWZy cwNn1h0QqFFDpNB5jkeHlKaYtcguYGGQm1DaoKrxoAJKcst4QIeOb7DplmFL1ENNcfn2 R0s1EiCar3zmJDLGedoLfAttO7g16D1xCgMX+vmiv9CqEyHnNCMJx8LZdDfxxSIabA+j t84Q== X-Gm-Message-State: AOJu0YxNx5Zad9QxlTsp7STk754fSo3+1nwq3YOrf0Ea2z4jlBSodMlI 2eEBUXmW+C4Mezln5Aau+B2xpA== X-Received: by 2002:a05:6808:1b14:b0:3a7:2390:3583 with SMTP id bx20-20020a0568081b1400b003a723903583mr38346779oib.38.1699302446477; Mon, 06 Nov 2023 12:27:26 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:3374:ff6c:474e:a78]) by smtp.gmail.com with ESMTPSA id fj36-20020a056a003a2400b00689f5940061sm6144150pfb.17.2023.11.06.12.27.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 12:27:26 -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 Subject: [PATCH v3 3/3] drm/panel-edp: Avoid adding multiple preferred modes Date: Mon, 6 Nov 2023 12:22:50 -0800 Message-ID: <20231106202718.2770821-4-hsinyi@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231106202718.2770821-1-hsinyi@chromium.org> References: <20231106202718.2770821-1-hsinyi@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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]); Mon, 06 Nov 2023 12:27:35 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781847774435903168 X-GMAIL-MSGID: 1781847774435903168 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 --- v2->v3: if hard-coded mode presents, don't add edid mode. --- drivers/gpu/drm/panel/panel-edp.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index 0fb439b5efb1..54dbbdf62ec0 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -594,8 +594,20 @@ static int panel_edp_get_modes(struct drm_panel *panel, p->detected_panel != ERR_PTR(-EINVAL) && p->detected_panel->override_edid_mode; - /* probe EDID if a DDC bus is available */ - if (p->ddc) { + /* + * If both edid and hard-coded modes exists, only add hard-coded modes + * to avoid multiple preferred modes. + */ + if (p->desc->num_timings || p->desc->num_modes) { + /* + * 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(). + */ + num += panel_edp_get_non_edid_modes(p, connector); + } else if (p->ddc) { + /* probe EDID if a DDC bus is available */ pm_runtime_get_sync(panel->dev); if (!p->edid) @@ -617,14 +629,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) - num += panel_edp_get_non_edid_modes(p, connector); - else if (!num) + if (!num) dev_warn(p->base.dev, "No display modes\n"); /*