Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp395926rdb; Mon, 22 Jan 2024 07:32:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IElYcWnuQTFrLOaHXSY1H770gDkQR3VhXPw/dE7RYXiXFr6hV9xwgR4+BH2Zdmi6p3gIUHG X-Received: by 2002:aa7:9a5e:0:b0:6db:e1e8:6e31 with SMTP id x30-20020aa79a5e000000b006dbe1e86e31mr901604pfj.19.1705937525612; Mon, 22 Jan 2024 07:32:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705937525; cv=pass; d=google.com; s=arc-20160816; b=b41DGZ5jNPRxaV0e8w5IQg8e8CytQu32WCk7rp0JXef+ABib0jBsxPMKJaE9wJ+8KF 4PeBk07SybVqL+bVOqvepkDNbVvjFMrN0Aj/adugdvPvdsJmC8Mjb1fZ4IqDEYNLHi3z +A7mnVEgoE275Pyrqe5ElTwNqMPolucazfZKwML+jfmSNKgu1x2BkFNuN8NNP0wD66oQ lAzn2XdQPLmveHQ9oOgE4Dq4xnPg1Hh/S3Dvl2EBBcn0UGsx0OMW58kltmHLHNlRNR1V FqvlLhwBTwWYQYM/F9jakWqPl0DUBaIxnJpQfzAzB5ap9kW9wrxiWqAIACZenqa3Honq 5axQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=gK7lw+aY88PT/cOhrXf/3eGGWwknwSppMrufiqAi4To=; fh=9ia17in/2STbY6Yhn0z/OCp1HioiVh4aQZWK3WbdodE=; b=iYdjTh3VLl3O7b46vR1vDxgOoLJQGKAQga4D++0Q5nSijtcHD/wi0ch+sqGxSU330e XMfDSmheHU6Uga1XgoHg+kBVCAlxkz4PN/aABMGKZv9cRU1nDgGNUDlDSu6McJXE3MeN 1n2moWWrOMX8HH8JCeGmj8MrqXD0k4jAE7aZkBP98kh0X8Y2Yz/xV7bshDdzPgLQ4tHr MP8d24xYE/4HmcyYOhx21UIpviiqLkW9WOiszl5drmS1ra3mRuqLvks3w5p3i6y+QEdn 4Zy6Mvv1t/FOKREbWCRaKcKxLjanO0leldlxGGguMQuyzODuGFNKSFuFKo8ytjN4swr6 BPhg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TlH4lCpH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33225-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33225-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h30-20020aa79f5e000000b006d6faec9bf6si10431816pfr.13.2024.01.22.07.32.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 07:32:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33225-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TlH4lCpH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33225-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33225-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D7692B2AEA2 for ; Mon, 22 Jan 2024 15:06:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F075495CF; Mon, 22 Jan 2024 14:56:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TlH4lCpH" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 993D6495C0; Mon, 22 Jan 2024 14:56:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935395; cv=none; b=g/lz/REyeEQY0dVKuUQC5GYKc+3vh1KBNrpPRqLd/FCTzDNU96nI0zLoOcFV7j22NBUePZVDMkEhdpKG2kJu+lenm/1kdIAZYFn3tiOXTb5zxubviMmcnDh8Ox88nvCsANP87wzhMHQSrJCuLjOYbTzHHatAeBJRoMvvo5K4qok= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935395; c=relaxed/simple; bh=kEcMDVZw9umOG1L4F2Hk7oigEliQ1NG66qDiXoO2WLE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Jik/8odoqp2eEBo5DpokFSgMKBbozbiUfxon10/6i+GoXRITQ5FSNXRW+hzQLe7Z3TVw7jfe+uF2FAlMXy1tTLyjAX9M6+qYhfU+324hfALnO0p/OVQ5MIzi9c2+H+UU3gTwGnnYXvuVYT41AT/Idn9h9KO6CfseccRJAf3Jegc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TlH4lCpH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83261C43394; Mon, 22 Jan 2024 14:56:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705935395; bh=kEcMDVZw9umOG1L4F2Hk7oigEliQ1NG66qDiXoO2WLE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TlH4lCpHtJP/HR2BG3zcswxvvLaN7BgrnZV20gLKj1uK2Dhrvr38os1INuaicsiBX 0e+s+nDNNVqIRb6LfFUPHwcPGncAqQ3WBjVU6bDNLaQoljfkstQDoRVRPJrH0IlR3m zxfu416rf8b37jPpv7nVGszNUWcCsIOU47wE/KH+RWPTx0kwhoZNr+S9d3DNr/TQTb H87tNcZXElwTZAPijnoHNLHT+Ln7OiSvgzaDxkvJ4Gx804S/cvqxCXE5bP7mUXPDru mpx+I3PXgRGrLoOu3Fl6nSvQRgsWRItELDAEGYhSoumr1ry65uqIEdym2tW0cDFwPw Ufb6LZhuTHG7Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hsin-Yi Wang , Douglas Anderson , Sasha Levin , neil.armstrong@linaro.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.7 11/88] drm/panel-edp: Add override_edid_mode quirk for generic edp Date: Mon, 22 Jan 2024 09:50:44 -0500 Message-ID: <20240122145608.990137-11-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122145608.990137-1-sashal@kernel.org> References: <20240122145608.990137-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7.1 Content-Transfer-Encoding: 8bit From: Hsin-Yi Wang [ Upstream commit 9f7843b515811aea6c56527eb195b622e9c01f12 ] 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 Signed-off-by: Douglas Anderson Link: https://patchwork.freedesktop.org/patch/msgid/20231117215056.1883314-2-hsinyi@chromium.org Signed-off-by: Sasha Levin --- 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 95c8472d878a..87a69293f594 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); @@ -1828,6 +1861,15 @@ static const struct panel_delay delay_200_500_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 -- 2.43.0