From nobody Wed Dec 31 08:52:04 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3606C4167D for ; Mon, 6 Nov 2023 20:27:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233064AbjKFU1g (ORCPT ); Mon, 6 Nov 2023 15:27:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232929AbjKFU13 (ORCPT ); Mon, 6 Nov 2023 15:27:29 -0500 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2878BD73 for ; Mon, 6 Nov 2023 12:27:26 -0800 (PST) Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3b2e330033fso2980655b6e.3 for ; Mon, 06 Nov 2023 12:27:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699302445; x=1699907245; 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=QPhsID+q93OjsSxKAgkiiMJkhHyPCqUVxHPEAVkAeW0=; b=RHb0P/FjISW/zbAyvPPK2A8eNvMN4kdEe27s5rFSJoZ5Wk4mpLKx/U4YZzoeC1xOfo o4UE70Og2ZF2LT/Mqmc/OhS0xD4JfGq2WnMZICxK+kuPzHterUnvfQfUxNJpUjb8tpM3 PtRffVEq3lMpHCB06zUtxsmk/zmzr48Wria04= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699302445; x=1699907245; 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=QPhsID+q93OjsSxKAgkiiMJkhHyPCqUVxHPEAVkAeW0=; b=vYRrEypt27F0eQUykf3E41m/JqM1D9UxdaSwmzJK1GhJYEeyYwgCcgvsmU/qJZzavR s8LJpkdqYQH+nUnYEm1oShVciu8WHDTKGO68c/ouWj6IQ1j6jB+UKE83QfxX7ShbZ2dx NWxwrst4kJOLEsxLl7olfwRhFxjIsuO9DiUDDH04F9ungNIJdl8EGzxmMmynX1KDGi1A RXORFg34eginCmJ7QyjVAQOWVX56U8M5ul1cvNAp00UJrVPvoZhOqaPDiABztj2QXHw4 DqtLAM+kwY7s6UDHjiqYb/UpXeA7gTIWOgYorRSmD/jGVV2DkIw9S6KK7wANOp8c7EgF nukQ== X-Gm-Message-State: AOJu0YwyPc2fOF7YlcmN9DJQxCWSAwxmsYUwsDQNKBathvcM7w8ZNd2d VuFf7oi0y64W1QrZrwM/81sBMR2/kgd1zqL7H+E= X-Google-Smtp-Source: AGHT+IGMxf5NurtNfZlidY904/of5nsc9PZUhacFZmqJhOTz/3Xdr9rmOt9/k64q0L08xxziD81fCQ== X-Received: by 2002:a05:6808:23cd:b0:3a7:9e15:fbfb with SMTP id bq13-20020a05680823cd00b003a79e15fbfbmr39556635oib.9.1699302445450; Mon, 06 Nov 2023 12:27:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 12:27:25 -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 2/3] drm/panel-edp: Add override_edid_mode quirk for generic edp Date: Mon, 6 Nov 2023 12:22:49 -0800 Message-ID: <20231106202718.2770821-3-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- v2->v3: no change. --- 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/pane= l-edp.c index 599a949d74d1..0fb439b5efb1 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 { =20 /** @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; }; =20 struct panel_edp { @@ -301,6 +304,25 @@ static unsigned int panel_edp_get_display_modes(struct= panel_edp *panel, return num; } =20 +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 =3D drm_mode_duplicate(connector->dev, override_mode); + if (mode) { + mode->type |=3D 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 =3D to_panel_edp(panel); int num =3D 0; + bool has_override_edid_mode =3D p->detected_panel && + p->detected_panel !=3D ERR_PTR(-EINVAL) && + p->detected_panel->override_edid_mode; =20 /* 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, =20 if (!p->edid) p->edid =3D drm_get_edid(connector, p->ddc); - - if (p->edid) - num +=3D 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 +=3D panel_edp_override_edid_mode(p, connector, + p->detected_panel->override_edid_mode); + } else { + num +=3D drm_add_edid_modes(connector, p->edid); + } + } =20 pm_runtime_mark_last_busy(panel->dev); pm_runtime_put_autosuspend(panel->dev); @@ -950,6 +984,19 @@ static const struct panel_desc auo_b101ean01 =3D { }, }; =20 +static const struct drm_display_mode auo_b116xa3_mode =3D { + .clock =3D 70589, + .hdisplay =3D 1366, + .hsync_start =3D 1366 + 40, + .hsync_end =3D 1366 + 40 + 40, + .htotal =3D 1366 + 40 + 40 + 32, + .vdisplay =3D 768, + .vsync_start =3D 768 + 10, + .vsync_end =3D 768 + 10 + 12, + .vtotal =3D 768 + 10 + 12 + 6, + .flags =3D DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC, +}; + static const struct drm_display_mode auo_b116xak01_mode =3D { .clock =3D 69300, .hdisplay =3D 1366, @@ -1878,6 +1925,15 @@ static const struct panel_delay delay_200_150_e200 = =3D { .delay =3D _delay \ } =20 +#define EDP_PANEL_ENTRY2(vend_chr_0, vend_chr_1, vend_chr_2, product_id, _= delay, _name, _mode) \ +{ \ + .name =3D _name, \ + .panel_id =3D drm_edid_encode_panel_id(vend_chr_0, vend_chr_1, vend_chr_2= , \ + product_id), \ + .delay =3D _delay, \ + .override_edid_mode =3D _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 @@ -1895,9 +1951,11 @@ static const struct edp_panel_entry edp_panels[] =3D= { 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"), --=20 2.42.0.869.gea05f2083d-goog