From patchwork Wed Nov 1 21:20:10 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: 160681 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp719329vqx; Wed, 1 Nov 2023 14:26:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGgwAZNe5o1DMvTscpkcViTkKlqEnOudePiB6JHfVTRkqKM9sd07urQn2X8DiHBHEYDiCyH X-Received: by 2002:a05:6358:7e98:b0:168:e5d2:32e3 with SMTP id o24-20020a0563587e9800b00168e5d232e3mr18575365rwn.26.1698874011429; Wed, 01 Nov 2023 14:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698874011; cv=none; d=google.com; s=arc-20160816; b=UwHuho8r3wo9h8qgUtEE+SmuF9XwSjgsIsyluZB1MacHyYjLRKcittPzy27msIPhJD dILqesNyQ6FHZ3jyCgimAB0UGx2EPJ2GITVCq2GRTBsOvIIXuDd2DB5pVVcIwJBiY/7W lpb1nttus43PIJxj5sF4QA6j4UVo5r3ddNrgoRU3Hw3NoyOX8xVyHCynEnHMaVkcHJzz LzZPOAONFOQYDPtyKsjDYyUi18T6F3eGcORS026w+jID3lgwQRa0shjiw75qM/Yv+DU/ UwEs+qBr1ZD4STdZJAiuD5pwZnTT2YfmUArtYQSOSdV0sN3/PHrPHJaYGpnTO9rHyVK5 wY0g== 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=4xwbTQnI0BFDkZi25AAHIqWZZ1NOZD3jNak99jsdxzc=; fh=xm4V3i9y7SNKSixHUbMvMEPgDl0W8xdNniziEWdXVkQ=; b=UxGA0QxcL2mqybNIxMNeVs9SXOi34+PXANtvrEbYZcGYSz5mXvO+JcST6IqDNr/A0U 2MqIrjtW7If3ibEqAHR14zAlk7uj/DDYLQ+5V6+m5i78y1uXr4qk+HZPH5J2/QLzA7rh n9mXxyBPZGkeZ+6i+yh0Wawe+y2gyC5XYhQh83IayfF0Vf+q3QCgwDvXHy0kEZWq7emq 1WksZ8OGua/7lJUnwVjwlix24f+Ukhd1KvXpti61xpevoaiOmfs7nIIi7Rk864u42R3c B2a9E+EDO/UBx5uavZqADfGJ13L4DDfPSYcBrQ2B8yqism4cdSX4uNafc74kmyIC5xT6 YMWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Xvlby8pB; 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 82-20020a630155000000b005bd03bdf81asi683098pgb.472.2023.11.01.14.26.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 14:26:51 -0700 (PDT) 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=Xvlby8pB; 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 C757B819475D; Wed, 1 Nov 2023 14:26:24 -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 S1345342AbjKAV0T (ORCPT + 35 others); Wed, 1 Nov 2023 17:26:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345207AbjKAV0R (ORCPT ); Wed, 1 Nov 2023 17:26:17 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43E04115 for ; Wed, 1 Nov 2023 14:26:11 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-2802c41b716so317115a91.1 for ; Wed, 01 Nov 2023 14:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1698873971; x=1699478771; 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=4xwbTQnI0BFDkZi25AAHIqWZZ1NOZD3jNak99jsdxzc=; b=Xvlby8pBjG3vZ+lep8i9zpMxYYiRKEWq+w4rcBwyUkYmBP1b/kQkIMjGJmZ7C8aCFu ihltBhppdK6U/4e8Apw+LZCcGEk06Pq9UASpq3xHhBvfd8HYp6DgsfB87+vC+pDhqIW5 f9LDd8St270hVtkUCBqT9xEnTrQ5MmChpG7hw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698873971; x=1699478771; 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=4xwbTQnI0BFDkZi25AAHIqWZZ1NOZD3jNak99jsdxzc=; b=hT63vrmYtoi/NKwYsLIZYyqqlJ3uqxUNsVvRLCTZC5MWaDKTZhMAtHGniX/zYa5Ad4 3mgAxPYya75Cif0hG4A/4MIx+uaYpZEZMFQ3g8F6fqe9yVswqFvZ4h5njRucp/1qhgTS TnSLziy7LoQesm7W/yO51gzw4u3xzCw3J5Gb8mkApvXfTaUEwo7M1VjO9PD7RBlDwxpb UUty5dfgpl5T3sTo5FezeDBGhmI28kaAe0jOr2SeueIbAjJk1SszGL2KtRC8UBHX5CwI 9pce7Gc+VHHdHtlJ3uywe9PqLNoLc09xifN7aLrx4DG9p8dVp8WVNhSNiF6vr/vOgA7M 3afg== X-Gm-Message-State: AOJu0Yx220TiWwcxWJsGbFuoaUh7d5/Hs6uM8NW27qaCjVe5PtZASlyd nBqncC3nXWbMzgLclYCQpXjJUg== X-Received: by 2002:a17:90a:6f42:b0:280:1b75:f077 with SMTP id d60-20020a17090a6f4200b002801b75f077mr11349044pjk.13.1698873970505; Wed, 01 Nov 2023 14:26:10 -0700 (PDT) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:b410:473c:2b92:2e2e]) by smtp.gmail.com with ESMTPSA id ds21-20020a17090b08d500b00274262bcf8dsm1212976pjb.41.2023.11.01.14.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 14:26:10 -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 2/3] drm/panel-edp: Add override_edid_mode quirk for generic edp Date: Wed, 1 Nov 2023 14:20:10 -0700 Message-ID: <20231101212604.1636517-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231101212604.1636517-1-hsinyi@chromium.org> References: <20231101212604.1636517-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]); Wed, 01 Nov 2023 14:26:24 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781398515422152028 X-GMAIL-MSGID: 1781398515422152028 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 --- drivers/gpu/drm/panel/panel-edp.c | 68 ++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index 06ce3a73d740..0883ff312eba 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,25 @@ 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) { + mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; + drm_mode_set_name(mode); + drm_mode_probed_add(connector, mode); + return 1; + } + + dev_err(panel->base.dev, "failed to add additional mode\n"); + + return 0; +} + static int panel_edp_get_non_edid_modes(struct panel_edp *panel, struct drm_connector *connector) { @@ -568,6 +590,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 +600,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); @@ -950,6 +984,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, @@ -1882,6 +1929,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 @@ -1899,9 +1955,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, &delay_200_500_e50, "B116XAK01.0"), + EDP_PANEL_ENTRY2('A', 'U', 'O', 0x405c, &delay_200_500_e50, "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"),