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: 166403 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp834632vqn; Fri, 17 Nov 2023 13:51:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IH1wvXTzsGmEU4YSMh8eGvakn9ncd6HPJmYTCVD/krjVshKB5xXzUAzBKfu4CRJ9eM0IM8z X-Received: by 2002:a17:902:ec02:b0:1cc:4467:a563 with SMTP id l2-20020a170902ec0200b001cc4467a563mr1031827pld.3.1700257914631; Fri, 17 Nov 2023 13:51:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700257914; cv=none; d=google.com; s=arc-20160816; b=OOd5rrxoaRQANesPsVgQ+rP5AfQgVF63DxQlMtM7/IKjP6pB5/156dKYww21tdkCer G2cHDt1upbbSLW7YmgS4lBpE0rbyAdJdQoP/b+4Ynti0m9/co+6miUvbSpbx5PG/jcAQ L3WIfeid4g036SpSI+CLNfPVFZXxJx53qrD/zM9dlu2Jh4VtNNveAdwkRxhwcsOs+CCn K9jPWW3xlss1pCArl5Qe8RpCnvB0GBpW36DEK/p02wDAKDOsjvsWMdMQQQutE83/7PY9 PlSsbYml7dnk+9Xf/aS2GBQLgV13TX7QN+K1pI30xtP9VO15H7RwWYq614wE4WsAZZUe BKhQ== 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=e5wbvoHrw5gghSmYXqYsGypau9Ymfce8CXWliYyG7ds=; fh=QSF6wZwxRRIGJ9Ybx1nP+GUhkXoPhy52zPZ6csROsqc=; b=vnX3avGXPm3QxW+ZxRry5pN/c9BCT1mUF3enTDSOe4vWNHgVh1XaGNFEOyhTMZ4lDP tbmlI1NVKjTK4+ViPBSdHREo7LfaBm5Hu/juL11nLsrE9+QhNK4A++N2Yesa8UQEVn54 VV0orwRiRAB3MYVFYLJWOrnJEW26cY7AvDStAhmwRnDq7P+xtiiLZTvGn9yDaSmbI8F8 X78E0zOM9tPIRjcculE1KxXsGaGDHU+BezynO3v/lXG67k0csy88wMqRacWu/eL+GbVH 5QALffJcrwtoCCE23/JAvhBbwO5ha6BzLN8QqMLPAma/fxoU3euywrkxWxESJnMvCRH/ SLsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZbocSEbc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id b18-20020a170902d51200b001c3b4eb2135si2740178plg.463.2023.11.17.13.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 13:51:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZbocSEbc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id E438483271F2; Fri, 17 Nov 2023 13:51:51 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232628AbjKQVvK (ORCPT + 29 others); Fri, 17 Nov 2023 16:51:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230379AbjKQVvG (ORCPT ); Fri, 17 Nov 2023 16:51:06 -0500 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7F03120 for ; Fri, 17 Nov 2023 13:51:02 -0800 (PST) Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-5c184b3bbc4so1865015a12.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=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=e5wbvoHrw5gghSmYXqYsGypau9Ymfce8CXWliYyG7ds=; b=ZbocSEbcPlefV57I+X8efa9kGoeh+19x5Vft2Hj3p98Q19Y4Mw09XVe0wqaGyVPJ1j 6HB3m81jpcwymK560uYgmAHgL6gGG80un2qIW/kMjQW4Vp+PnJGX0eUYD23Gnx/qOUJ0 /y2Tw+vQQB8bKIQfY96Rv9bllHtEjYehQt/sM= 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=BB/0S4LEKd4JTb2PKpsKQznl/d0zaRXEGHw+8MlGfsOr2o6CsK49nXgOv3fF+YeVzA mNdmNQ0fG+UWYOnyMLFy46Toc1ha/agxxQ5DG05EhAenKW0VRyhGefbdp3X4+X3tG8G/ wWMOAjDJmi6/NT52HCY2StHDDhKx67lMD2s3EyTmN/urvVj9tXbhIRZErr1FemrrT4pU eujs+4+yh1e9wUM2axgnIszMovdJqXtvVpbintKgZ+EiXrd4EXpTozI4AbVUmVppvJ16 fy5paDPhPAvCjPom0gHUmZU9u8mgk4h5dah4jT5k/eEMtPT3F5WSVsqEO5y/kbx+D3Pt tR1Q== X-Gm-Message-State: AOJu0YzjNlWv4KIvzpVrMFRvxKBpBOnOl/m5fecuThJI9HJoelNgXNjh +rH0cNJ+qm1WUtNvUJnk54JA9g== 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 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 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-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Fri, 17 Nov 2023 13:51:52 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782849643299601840 X-GMAIL-MSGID: 1782849643299601840 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: 166404 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp834655vqn; Fri, 17 Nov 2023 13:51:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHopnbFKn2qlSXvVFanVy4cBumR4CB4MOhG3kOlfdtA8vmlGfiMBMG5MoTg9Ixv0iuK0yQD X-Received: by 2002:a05:6870:c1cc:b0:1c0:f8a7:ec14 with SMTP id i12-20020a056870c1cc00b001c0f8a7ec14mr506808oad.57.1700257918324; Fri, 17 Nov 2023 13:51:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700257918; cv=none; d=google.com; s=arc-20160816; b=dDQ+QeQbWY0MG1+Gkd8Tq5r8+4kjTHOpfYgysk8bgHVyPq4b7jCML9VPm5NWtrBHAU OmPK5o4mu/mRg4S5e2o4jaSiB32qOXsNWZtPOrf4NX+5QRoKKVg+rIcxiFMt8DWr8LRD Vzd/j3oL713vr92KiQNDewrFpXV61m0GQf9nwiqzYrDSws8udGAp+OEr4KPxoFVPKmMP KRiOk97FMX8Kn9CGIpdUanOkt4LI9cy+MU2kcbaa7rS+OM2ap+AOSAuHKEf4BCwYqdaD VF4df7bcb5cYQ1A0TZgCzG6m8eD6Wtce9pFvzGDvduwzcIoDTXxVPWUwXJ1qsvP2PJ42 zkJQ== 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=MDebfVAoPELKTEL528lJwzdi4eZAa8eNlalDXzxQ6JQ=; fh=QSF6wZwxRRIGJ9Ybx1nP+GUhkXoPhy52zPZ6csROsqc=; b=e7QGjE6h8OQBJFxaCbx7ciJ8VCdqYxcU19mTlK1KG2jY1T+3b+Ryd49JcsT6L42tWI HI1Y1zvbwzmVj6mmzp6QW4oWZl5k86GoAfLVpjFNqKtNyIyYxkY/u3Xp1wuNZnGlp0Ga kL5c/aYlLsA8iJtN9o0uMemAb+IlEUdb62LChMZSq8lQ8y7eSfV7yW7LsrbjEHszWMd7 amyriMmEhkujtChBv/ja/JrLPAnx37asfi6LGjjkkqfIxiIOYlX/QVgKwYtOqvFsjY3l OT3d/CdsdVfyBuNt9xV8VH3F3B/At2SD8j85PJNLlKiqUiY7XqtW2wP4p9Ui/NRAMRSb lxAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=M+D1eLbE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id h14-20020a63c00e000000b005b95f5f8976si2822242pgg.634.2023.11.17.13.51.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 13:51:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=M+D1eLbE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id E446083271EA; Fri, 17 Nov 2023 13:51:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233351AbjKQVvN (ORCPT + 29 others); Fri, 17 Nov 2023 16:51:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231947AbjKQVvH (ORCPT ); Fri, 17 Nov 2023 16:51:07 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08E90D68 for ; Fri, 17 Nov 2023 13:51:04 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-280109daaaaso1954439a91.3 for ; Fri, 17 Nov 2023 13:51:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1700257863; x=1700862663; 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=MDebfVAoPELKTEL528lJwzdi4eZAa8eNlalDXzxQ6JQ=; b=M+D1eLbEzpNzwx/DifKMhq7xbCdmSl9iBOydYDCcei+7VtTuBKvIk0C9BbJ7FtinH/ HiuOgufWFg3YyQPZTCPCu25cR3GKg1IdhtujifAJ77Ge8In93sT84dFVMcHmUs7wEcsV FO/JF2xFoMqHz+98dUoIrb59UU7gXzeoJXG04= 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=f9+r0K53/BRzP1lx8ha//2+Pj3R3h14Cw1Ox0QheEMG1T3qBGUEUa2fapsoOfJxPDX EQL4/zgfp2x9UJCUT+gE8w7khSHjBZdHEu47Goc6gTlToVUcEt8OUFMZNKJOh+/fWWnb EJ/RnLmL0RyAj7kFMsrGuQ3SICESBNzhlzTsgy/kZgHntOINgeDtuHauz38DQ/5YojOO TctBDw3TF5g8Kih1TukhGHjEE2QtJ55jHXSDmyUvVETDANipNfo3MdnyhMeAqYpbdYkg OvWlzScAYcvFj+KBghkpdzZYnDvkVd6S+G1EBqSTRco1ATKYIHTZBSfl5sntFYr06XpT XCKw== X-Gm-Message-State: AOJu0Yzg5+q+N7pVrJEqCa9lluovGCfjwyB36fxACQj2TWK29MYd3dDt nurKa6tLymL8bgr1JXA6AEP5Og== 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 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 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-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Fri, 17 Nov 2023 13:51:56 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782849646740229242 X-GMAIL-MSGID: 1782849646740229242 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: 166405 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp834892vqn; Fri, 17 Nov 2023 13:52:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgn/JzYhXs+olBDdmczPwlMGoe2kfkwq2X3osFHMbVelNHWiAvXSa9Cmg+aN8LEy2EHRYi X-Received: by 2002:a05:6a20:1592:b0:187:fb57:9181 with SMTP id h18-20020a056a20159200b00187fb579181mr560120pzj.15.1700257950618; Fri, 17 Nov 2023 13:52:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700257950; cv=none; d=google.com; s=arc-20160816; b=m8pFVCrS8AosQci1sa5t9wUq3qMJmh/fjYKI5fFpHcBvXl5y1bCLgEQZayr8pC9OSn PsbTshRaXj3UmBDOHH3uclmaNl3x/QZVsoYDhom+ig59ufZ2lQ99JAYwDx2CmztiXsGl ZCJVWNAj0E+c8Gjyrdjrr6m6qO7t6Q03UC+HToqx92s85X7DBa7zvJRwH+8eVVKx98Vy fmMOZcITOsLWkfg9DOC9P/ed+oZEit02wk280ECcUgxiF6Xy62QQMKd2ajaTIezgQs1N QTELxjjlkQlwon34JIwD4HenlXisfLMv5hb8zzqVtoynrQuQ5491uW6saySh3V8kYveh ey1Q== 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=z+W2o/1Mm+Zk29DqmS4Z9iJYsZDg6ej8XviFhoNK3hc=; fh=QSF6wZwxRRIGJ9Ybx1nP+GUhkXoPhy52zPZ6csROsqc=; b=JClNiGfWBOHCncP68soOlxbNwgWkpk5ZFtjVkALcemLZg6Dz19oEU+m1oO5XrlWJFQ ZYjzQq2ONIGh7nX1dLjsW8LPteFMIb6Hj79p1GqX6kKU8aXwpOdWb6TL0UgMY18SVUh2 U8a3hTUwqm/VRcWrxuoi81DxCHaARqoCz8gYq3x97ADaAmE84zHr1feVD7DmWV9HCkFv dYeP4i3yrqE6duvv8pb3FFkavj2FtFriHaJzGnV1ujU1taQlm+XQSQ0BZrVaNXbIGSXz 97AvYNPIObIwB77u6sfIZTeLXbfqY5CuGXqYg+hWgO091W8Izv5HXgUFLW6+5nQlUr87 hz9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=L5IWf03I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id j7-20020a056a00174700b006bd20945b23si2843896pfc.37.2023.11.17.13.52.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 13:52:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=L5IWf03I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 976168041EBC; Fri, 17 Nov 2023 13:52:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233790AbjKQVvQ (ORCPT + 29 others); Fri, 17 Nov 2023 16:51:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232450AbjKQVvI (ORCPT ); Fri, 17 Nov 2023 16:51:08 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E1F6120 for ; Fri, 17 Nov 2023 13:51:05 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-27ff83feb29so2120427a91.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=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=z+W2o/1Mm+Zk29DqmS4Z9iJYsZDg6ej8XviFhoNK3hc=; b=L5IWf03IL9pVt3mps0ACwg8Dx8JRxZ6SIf25UGzyTdL10K3cO5MC7gSLAt0dItVnSc 68BOIZwukxfJxhd/u/8l4V37gQeW1J5Qr8yibcVhOjSL5kheHXiEcdsf7sWpR+cKqCAE /BkXp3kZOr2Zlgy/vFO08WObsuJSM0Om3Tb5g= 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=oSO16kSEoFDqhhkb9jQH9BK11SYxZ1FumraOimUaU2Hh9MmgUSIoBnzShFxcV0ZHhS PFLQrWW+BLX4WnDncqnx+oTz9kAA8iiIW0UbmfeGgzon/l8wZjCbgnDtoZ3yHqU6rilK Fsyh0IfdFzflR+KeVibuOqgLlOfULADut3eXBbAv0urXfuPeCu0y4wKiJqxOiSoMuyKV ZAlBTUuOKY3MdHwODPd3dlya0ZhabsDulIvGzDcQq0QOSsDIBTsGguMxloJ/vi1jSe5E +m8MXjDjB5ZC/Yap7QaCKY3BPXQ2N9xCIky0j+yvFR9emHzkb8h+RRBKKXdMWWcTFSFz GqZA== X-Gm-Message-State: AOJu0YwI9FhQY1vBAusMSo5CQGc2/EtrTFB50BPZ7c8V0ZErsM2QfZvt xU3nI495C3PD1YN1uCMNJjXEbA== 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 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 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-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Fri, 17 Nov 2023 13:52:01 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782849680675200574 X-GMAIL-MSGID: 1782849680675200574 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");