From patchwork Thu Nov 2 21:47: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: 161132 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp673567vqu; Thu, 2 Nov 2023 15:13:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHQY25bsmyyrsawD8KwBMe5ev1Z2A5pqnKuvss5zuO2I1mJqZCaMGqWlPc4XPTAoM+1BvRW X-Received: by 2002:a17:90b:3597:b0:263:f630:228f with SMTP id mm23-20020a17090b359700b00263f630228fmr20681282pjb.23.1698963221561; Thu, 02 Nov 2023 15:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698963221; cv=none; d=google.com; s=arc-20160816; b=bw5fjvKc4B0K0dP6yOwP6ZV89bcRXeDricATw2DVvUv1CEAndu76VTJWTVXNgJnE0R PJQKS63lVxgCNVSt5TfoNjDN7aazhU9WsgBb0YHt5OQiYfUpQiU5bBQxR9HdhBDh7EF0 MkZ35rerPE9fzgxk7Y8nKQtB8FQDTFVqH6IN+LPfn+agC+qS5F+BChU3vgPahZH9IaQs +a0Gair6FL3M6+eYm/SRqKbjNTAzzEUhNWtFqMOsyhzci4a2XIf/lSto1FysVpDRXIHt ScFgN+JoXJeZ1EbzCdTwtlO8Rzi+UyDJDHtJ/PkJHke2s5hlQyW8BlhGpsuw3U/X6NOu emTw== 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=6k2Y92G/jCAECpt6DbXki9hGcN+8cUNHTMZGe3U3vro=; fh=xm4V3i9y7SNKSixHUbMvMEPgDl0W8xdNniziEWdXVkQ=; b=ZjCVmgE9R1sNI07v4meJfEC0dH2TYrymbbdUVTLTvcYkymgF+01J4OE01Q9cmADjTc ZeQ/2LsTurYBMlIVJS0eIUxDhLw7eQfC+o3uxLdO6L0FljjUydNXn69OMqvfX6V8mzjH GYoF7BBNZAy+osVmxCltPhgdMXAmHn64SXUZywTLlO8nAZ5xbrZRJ2uBMG4UFhSUagsB DVJROSKG3oD+c6k7oOVi41qvKKem7Us8n+Nydoxh28vKE4bExGT44lYbFNvpabbbKwXA SRRwAs7RTHqooWdj2HJ850J34/kBN+iCNJ7EvjxTnnuqmBWMHprx07Dyp5R+FJqF9/Mc SVaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aKqUivh5; 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 kp16-20020a170903281000b001ae40e07fb0si335799plb.216.2023.11.02.15.13.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 15:13:41 -0700 (PDT) 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=aKqUivh5; 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 11C1282F27C7; Thu, 2 Nov 2023 15:13:40 -0700 (PDT) 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 S1377476AbjKBWNe (ORCPT + 37 others); Thu, 2 Nov 2023 18:13:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377461AbjKBWNZ (ORCPT ); Thu, 2 Nov 2023 18:13:25 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EEBB192 for ; Thu, 2 Nov 2023 15:13:20 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6be1bc5aa1cso1544760b3a.3 for ; Thu, 02 Nov 2023 15:13:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1698963199; x=1699567999; 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=6k2Y92G/jCAECpt6DbXki9hGcN+8cUNHTMZGe3U3vro=; b=aKqUivh5S/VJZ0lA80BpArfupAJsYeS2Fa6R3yY+TXp363R2zVQpE6njvepBQftM51 TCmgtiskthuaiThXiMd0YoCenLOCMOgADx/t/WM5bqxLrV6xMoBPgvXO34WscwSsaan6 UO4OJoQd1dFRuWNdlcERfM8UZg73Jv0p51ID0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698963199; x=1699567999; 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=6k2Y92G/jCAECpt6DbXki9hGcN+8cUNHTMZGe3U3vro=; b=vlF3VhWtZizOY2iYphY1SPw39YTP3UGEqjDaMIs7pmK7P/WopDAP4YVhRZ0FqPn4Xs wxspjE/lw/3IqTdukKZGTAgQmD8IwjM2+SwUs+uDBVoFcz6Zh/mwuFuJuNf6xqn4bBCF pzOOsONhGBtCJiU/Ua9E1CpcHpJUALqci7voYQpcu7aHvvoza7Lq0VSgzXIFCRue14uC kSpLXRYdcQ3O5TnwLpwPiAW4boDzVNcnWqOV/gx4GUiEUaIbWIEBFNLdN7+U8msILcpw nEKjgPmipTz9XcRT7FphTBxvPRcsZbDOmyoW4iy4CMsh3biB7gm4DWQ76gQtTMXSQ1Jj v+Hg== X-Gm-Message-State: AOJu0YwfLWcCPMAqifUo4ZzR+ZwOGkk1jSKjTtxwJwJum07HYbxMj7yd Dr9u9CD6OZJJrz1eDkKVhtaN2w== X-Received: by 2002:a05:6a00:2d09:b0:6b6:5ed4:dd42 with SMTP id fa9-20020a056a002d0900b006b65ed4dd42mr23406858pfb.31.1698963199539; Thu, 02 Nov 2023 15:13:19 -0700 (PDT) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:6ec1:79de:6e50:d6fa]) by smtp.gmail.com with ESMTPSA id y6-20020a63ce06000000b00565e96d9874sm196057pgf.89.2023.11.02.15.13.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 15:13:19 -0700 (PDT) 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 v2 4/4] drm/panel-edp: Choose correct preferred mode Date: Thu, 2 Nov 2023 14:47:50 -0700 Message-ID: <20231102221309.1971910-5-hsinyi@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231102221309.1971910-1-hsinyi@chromium.org> References: <20231102221309.1971910-1-hsinyi@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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]); Thu, 02 Nov 2023 15:13:40 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781492059255263306 X-GMAIL-MSGID: 1781492059255263306 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 a hard-coded mode is present, unset the preferred bit of the modes read from edid. Signed-off-by: Hsin-Yi Wang Reviewed-by: Douglas Anderson --- v1->v2: split patches from drm_modes. --- drivers/gpu/drm/panel/panel-edp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index 0fb439b5efb1..021322ff9f65 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -622,10 +622,13 @@ static int panel_edp_get_modes(struct drm_panel *panel, * 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 (p->desc->num_timings || p->desc->num_modes) { + /* hard-coded modes present, unset preferred modes from edid. */ + drm_mode_unset_preferred_modes(connector); num += panel_edp_get_non_edid_modes(p, connector); - else if (!num) + } else if (!num) { dev_warn(p->base.dev, "No display modes\n"); + } /* * TODO: Remove once all drm drivers call