From nobody Sat Nov 23 22:48:55 2024 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C735B152166 for ; Sat, 9 Nov 2024 12:35:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731155720; cv=none; b=ka/xWRPxYi5mbzKGWV7/J/KjDXcm+HkNhiP3AT4vQ0+UCYihmBdvdN8VIfbF3kCotLlqPkzrdJCo9XyZxE40DobZS2za8KtAnivdkuMRgw2KuiToyU16WrQD2OMolHNZ9B3XHpFwjJR4rBwDdaxCklOOE6Qo7J9pFm0x+mgS83E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731155720; c=relaxed/simple; bh=O0+dNPOmXaHGOBHqPcLUaOUNdAb4skVm7YApfGYSVUE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VHKC+ShTzPBpXfxewJ2HCZWyvRqi+m8IYDx1vPSL/VbhLu0PhX6ESvEiG5W5cqMJ05tHDiUG3rvHsZB8HyxoUSkbJ6nDc0q3k2KFPBYT3SGNNA3fznTV6unpdjZuVHW8SGRTsjvDMMvKuTEwrB+NRU1sK2Ht6xs4XT7S/AZnUdk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=FJjW7m9J; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FJjW7m9J" Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-539f8490856so3945484e87.2 for ; Sat, 09 Nov 2024 04:35:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731155717; x=1731760517; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=1+nD5HJByLExsTSOICbG27tCgbmZZrKa+DbcceQO2vk=; b=FJjW7m9Jr95NUZh2rupKrLwkxFuUMYjJWu+48fKo9qt5RehfBXyxqGE+qbFndQMfji XiDKtUVvDuYt1WPX09uFO775UMFZ3LfneKUGS2Q+1VBsdm0xZatA0Kn+ugmRSoXQyQda 1ZmSaDUODaw76EN74wSaBSLh4XQM12gImwEEvnacgmkUGvJkvOGkdJG+z+KrHPN6ua2d /EB3AuVLvTHaBE1bpDDjwSV6uF0P7qPMwiRICxJryGq0dEN61tr4dxvPFbOxPaFuSFiQ l+ESLWPnnvCsLFL/Lu7DuE4tuKhqzeM5v71RYAwA/7P9H0E+hcuBrXHNm2Djw9fZfBqk ULGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731155717; x=1731760517; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1+nD5HJByLExsTSOICbG27tCgbmZZrKa+DbcceQO2vk=; b=FVOaJeBiO1jO+/WAJ9oDgj9JOBPeojxPq6mmoTFkBbRg9BocX1IrBXXlP0eKjMJfvq 24W/jY4Ai7Ecd0iGFFPM6woqpmeRWFwlD1IEE5JIBxcbAmHJ52G/U607jeWa2GTw+JQJ v9SYBqCKETKNkURN0SRyJB6R4EZ7DrcZ1mzyZm2UcatThy0rWxGuB7aXwc02UNKhBWvj jCFu/7iLEMCsNnVqbWMHovBWRVXAxs1W2/vgQqi4zLJSSqdZPIajxiJ2POrzAVix+oHH lwJAJUj6kq1HSgdKrlVVAtHspOIstBlAXbuALnRCnzrdAIzHFy0f6t3V8KfN5Vhkh10D ukHg== X-Forwarded-Encrypted: i=1; AJvYcCU8i3IIJ2tgC14tT5kHejOfCwnofd3mZhlpmoBDp66Ssj4JZnCUdrDEXt5eJWNuW6zRyFQNomK5d97txM8=@vger.kernel.org X-Gm-Message-State: AOJu0Yz6AHK6dhX/KG9eZHRfelY32TPNr400EST4DGx4pqBc/tsrMvhE 8gfIV7JiV6kfFvSUuvOebqDGiakzeK8QzvT2Q9+agGaS+j8jrmOpQZq7rWE/1I0= X-Google-Smtp-Source: AGHT+IGJo4jZoEglm9go0nIAPmKBkvOJcvZk4GwfWpbMZ+lIEILOqU9QXlUgXQNesCnZ0pMqP2i/gQ== X-Received: by 2002:a05:6512:3c8e:b0:536:553f:3ef9 with SMTP id 2adb3069b0e04-53d86296487mr3367516e87.27.1731155716900; Sat, 09 Nov 2024 04:35:16 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53d826784dbsm922899e87.15.2024.11.09.04.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2024 04:35:15 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Nov 2024 14:35:05 +0200 Subject: [PATCH v3 1/7] drm/display: hdmi: add generic mode_valid helper Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241109-hdmi-mode-valid-v3-1-5348c2368076@linaro.org> References: <20241109-hdmi-mode-valid-v3-0-5348c2368076@linaro.org> In-Reply-To: <20241109-hdmi-mode-valid-v3-0-5348c2368076@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=10210; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=O0+dNPOmXaHGOBHqPcLUaOUNdAb4skVm7YApfGYSVUE=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ7p+2L9z8q471i1Ic2Gzf/eb68z07L/TghJ9VywN2NKgG nXnxZV3nYzGLAyMXAyyYoosPgUtU2M2JYd92DG1HmYQKxPIFAYuTgGYyAUV9v+pyQtrY8KOBvWl cATFFCX/u3qFUz7+u2HChUUB7+fFHGjM6c+Pq7j71DOPxXfecUWOR6kFr9gKG70W6iT6atRUc92 d1zqvSNT2h/0G6W8JcoohfOu4771VcT2S4Mj9IG9iS+jLRo+e6bwJNX5PXAzi+MUnTvUVqBJs// aNpSNud83SKdNPzMgpMgs9LnO6deG/nMcsVr+UT/F0s7YuXOxayJcpq7iLMyI1VPHIuXM85Quv6 c2YfNXcNJ3p8hY7BbbLkXLCPHtEnV+IJ0pr9x76qP1WIsVl2dmQOWdiixt5fyi5XttozqA584Bz 0/GsaDVbp90+Fy6enhbGMMOmSEl7yu+pXLdUgqbrnbkDAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Add drm_hdmi_connector_mode_valid(), generic helper for HDMI connectors. It can be either used directly or as a part of the .mode_valid callback. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 21 +++ drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 181 +++++++++++++++++= +++- include/drm/display/drm_hdmi_state_helper.h | 4 + 3 files changed, 204 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/= drm/display/drm_hdmi_state_helper.c index feb7a3a759811aed70c679be8704072093e2a79b..80bf2829ba89b5f84fed4fa9eb1= d6302e10a4f9e 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -521,6 +521,27 @@ int drm_atomic_helper_connector_hdmi_check(struct drm_= connector *connector, } EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_check); =20 +/** + * drm_hdmi_connector_mode_valid() - Check if mode is valid for HDMI conne= ctor + * @connector: DRM connector to validate the mode + * @mode: Display mode to validate + * + * Generic .mode_valid implementation for HDMI connectors. + */ +enum drm_mode_status +drm_hdmi_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) +{ + unsigned long long clock; + + clock =3D drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); + if (!clock) + return MODE_ERROR; + + return hdmi_clock_valid(connector, mode, clock); +} +EXPORT_SYMBOL(drm_hdmi_connector_mode_valid); + static int clear_device_infoframe(struct drm_connector *connector, enum hdmi_infoframe_type type) { diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index 294773342e710dc56772f839c2db9c2e487bbc1e..67c3e882592b00d803d8cba5d18= 3aa90339a16b4 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -43,10 +43,14 @@ struct drm_atomic_helper_connector_hdmi_priv { static struct drm_display_mode *find_preferred_mode(struct drm_connector *= connector) { struct drm_device *drm =3D connector->dev; - struct drm_display_mode *mode, *preferred; + struct drm_display_mode *mode, *preferred =3D NULL; =20 mutex_lock(&drm->mode_config.mutex); - preferred =3D list_first_entry(&connector->modes, struct drm_display_mode= , head); + + /* Handle the case when all modes were rejected by mode_valid() */ + if (!list_empty(&connector->modes)) + preferred =3D list_first_entry(&connector->modes, struct drm_display_mod= e, head); + list_for_each_entry(mode, &connector->modes, head) if (mode->type & DRM_MODE_TYPE_PREFERRED) preferred =3D mode; @@ -125,6 +129,18 @@ static const struct drm_connector_hdmi_funcs reject_co= nnector_hdmi_funcs =3D { .tmds_char_rate_valid =3D reject_connector_tmds_char_rate_valid, }; =20 +static enum drm_mode_status +reject_100MHz_connector_tmds_char_rate_valid(const struct drm_connector *c= onnector, + const struct drm_display_mode *mode, + unsigned long long tmds_rate) +{ + return (tmds_rate > 100ULL * 1000 * 1000) ? MODE_BAD : MODE_OK; +} + +static const struct drm_connector_hdmi_funcs reject_100_MHz_connector_hdmi= _funcs =3D { + .tmds_char_rate_valid =3D reject_100MHz_connector_tmds_char_rate_valid, +}; + static int dummy_connector_get_modes(struct drm_connector *connector) { struct drm_atomic_helper_connector_hdmi_priv *priv =3D @@ -147,6 +163,33 @@ static int dummy_connector_get_modes(struct drm_connec= tor *connector) static const struct drm_connector_helper_funcs dummy_connector_helper_func= s =3D { .atomic_check =3D drm_atomic_helper_connector_hdmi_check, .get_modes =3D dummy_connector_get_modes, + .mode_valid =3D drm_hdmi_connector_mode_valid, +}; + +static int dummy_connector_get_modes_100MHz_max_clock(struct drm_connector= *connector) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv =3D + connector_to_priv(connector); + const struct drm_edid *edid; + unsigned int num_modes; + + edid =3D drm_edid_alloc(priv->current_edid, priv->current_edid_len); + if (!edid) + return -EINVAL; + + drm_edid_connector_update(connector, edid); + connector->display_info.max_tmds_clock =3D 100 * 1000; + num_modes =3D drm_edid_connector_add_modes(connector); + + drm_edid_free(edid); + + return num_modes; +} + +static const struct drm_connector_helper_funcs dummy_connector_helper_func= s_max_tmds_clock =3D { + .atomic_check =3D drm_atomic_helper_connector_hdmi_check, + .get_modes =3D dummy_connector_get_modes_100MHz_max_clock, + .mode_valid =3D drm_hdmi_connector_mode_valid, }; =20 static void dummy_hdmi_connector_reset(struct drm_connector *connector) @@ -1734,9 +1777,143 @@ static struct kunit_suite drm_atomic_helper_connect= or_hdmi_reset_test_suite =3D { .test_cases =3D drm_atomic_helper_connector_hdmi_reset_tests, }; =20 +static void drm_test_check_mode_valid(struct kunit *test) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv; + struct drm_connector *conn; + struct drm_display_mode *preferred; + + priv =3D drm_atomic_helper_connector_hdmi_init(test, + BIT(HDMI_COLORSPACE_RGB), + 8); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn =3D &priv->connector; + preferred =3D find_preferred_mode(conn); + KUNIT_ASSERT_NOT_NULL(test, preferred); + + KUNIT_EXPECT_EQ(test, preferred->hdisplay, 1920); + KUNIT_EXPECT_EQ(test, preferred->vdisplay, 1080); + KUNIT_EXPECT_EQ(test, preferred->clock, 148500); +} + +/* + * Verify that tmds_char_rate_valid() can reject all modes. + */ +static void drm_test_check_mode_valid_reject(struct kunit *test) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv; + struct drm_connector *conn; + struct drm_display_mode *preferred; + struct drm_device *drm; + int ret; + + priv =3D drm_atomic_helper_connector_hdmi_init(test, + BIT(HDMI_COLORSPACE_RGB), + 8); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn =3D &priv->connector; + + /* You shouldn't be doing that at home. */ + conn->hdmi.funcs =3D &reject_connector_hdmi_funcs; + + priv->current_edid =3D test_edid_hdmi_1080p_rgb_max_200mhz; + priv->current_edid_len =3D ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz= ); + + drm =3D &priv->drm; + + mutex_lock(&drm->mode_config.mutex); + ret =3D conn->funcs->fill_modes(conn, 4096, 4096); + mutex_unlock(&drm->mode_config.mutex); + KUNIT_ASSERT_EQ(test, ret, 0); + + preferred =3D find_preferred_mode(conn); + KUNIT_ASSERT_NULL(test, preferred); +} + +/* + * Verify that tmds_char_rate_valid() can correctly filter out high-rate m= odes, + * but allows small modes. + */ +static void drm_test_check_mode_valid_reject_rate(struct kunit *test) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv; + struct drm_connector *conn; + struct drm_display_mode *preferred; + int ret; + + priv =3D drm_atomic_helper_connector_hdmi_init(test, + BIT(HDMI_COLORSPACE_RGB), + 8); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn =3D &priv->connector; + + /* You shouldn't be doing that at home. */ + conn->hdmi.funcs =3D &reject_100_MHz_connector_hdmi_funcs; + + ret =3D set_connector_edid(test, conn, + test_edid_hdmi_1080p_rgb_max_200mhz, + ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); + KUNIT_ASSERT_EQ(test, ret, 0); + + preferred =3D find_preferred_mode(conn); + KUNIT_ASSERT_NOT_NULL(test, preferred); + KUNIT_EXPECT_EQ(test, preferred->hdisplay, 640); + KUNIT_EXPECT_EQ(test, preferred->vdisplay, 480); + KUNIT_EXPECT_EQ(test, preferred->clock, 25200); +} + +/* + * Verify that the framework filters modes based on info.max_tmds_clock, w= hile + * allowing small resolution modes. + */ +static void drm_test_check_mode_valid_reject_max_clock(struct kunit *test) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv; + struct drm_connector *conn; + struct drm_display_mode *preferred; + int ret; + + priv =3D drm_atomic_helper_connector_hdmi_init(test, + BIT(HDMI_COLORSPACE_RGB), + 8); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn =3D &priv->connector; + + drm_connector_helper_add(conn, &dummy_connector_helper_funcs_max_tmds_clo= ck); + + ret =3D set_connector_edid(test, conn, + test_edid_hdmi_1080p_rgb_max_200mhz, + ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); + KUNIT_ASSERT_EQ(test, ret, 0); + + preferred =3D find_preferred_mode(conn); + KUNIT_ASSERT_NOT_NULL(test, preferred); + KUNIT_EXPECT_EQ(test, preferred->hdisplay, 640); + KUNIT_EXPECT_EQ(test, preferred->vdisplay, 480); + KUNIT_EXPECT_EQ(test, preferred->clock, 25200); +} + +static struct kunit_case drm_atomic_helper_connector_hdmi_mode_valid_tests= [] =3D { + KUNIT_CASE(drm_test_check_mode_valid), + KUNIT_CASE(drm_test_check_mode_valid_reject), + KUNIT_CASE(drm_test_check_mode_valid_reject_rate), + KUNIT_CASE(drm_test_check_mode_valid_reject_max_clock), + { } +}; + +static struct kunit_suite drm_atomic_helper_connector_hdmi_mode_valid_test= _suite =3D { + .name =3D "drm_atomic_helper_connector_hdmi_mode_valid", + .test_cases =3D drm_atomic_helper_connector_hdmi_mode_valid_tests, +}; + kunit_test_suites( &drm_atomic_helper_connector_hdmi_check_test_suite, &drm_atomic_helper_connector_hdmi_reset_test_suite, + &drm_atomic_helper_connector_hdmi_mode_valid_test_suite, ); =20 MODULE_AUTHOR("Maxime Ripard "); diff --git a/include/drm/display/drm_hdmi_state_helper.h b/include/drm/disp= lay/drm_hdmi_state_helper.h index 2d45fcfa461985065a5e5ad67eddc0b1c556d526..d6d65da6d8f9ee46de33114cce2= d6fbe6098a862 100644 --- a/include/drm/display/drm_hdmi_state_helper.h +++ b/include/drm/display/drm_hdmi_state_helper.h @@ -20,4 +20,8 @@ int drm_atomic_helper_connector_hdmi_clear_audio_infofram= e(struct drm_connector int drm_atomic_helper_connector_hdmi_update_infoframes(struct drm_connecto= r *connector, struct drm_atomic_state *state); =20 +enum drm_mode_status +drm_hdmi_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode); + #endif // DRM_HDMI_STATE_HELPER_H_ --=20 2.39.5 From nobody Sat Nov 23 22:48:55 2024 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CEC919415E for ; Sat, 9 Nov 2024 12:35:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731155723; cv=none; b=o0togayoHraJ4Y9EzZ7BOnivB4rJ7ke1bqSPTsw/Wd7nbtKU6Ixte76dLzFcQmQ6fw8DxTncX6yxn2m6b0h/cIP/9LOyZ0zHHeMXRwWqecQ65YlbskSRhAtrKAa9jqy3qxeDiyHv9pSw5Z3arJZi21umGqpI/01b3zGlOSrz+0Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731155723; c=relaxed/simple; bh=7WdeDK9PVMnPHS0xN6wrfKPJv4ESCzGwmvZnGPcMZ/4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lthBI5xN/a6uMIS8HwcNSxsQrLJeRndH0Xry8vmRM7SRVoXcY4pBPmYBLSb65csA0yyPml/4fmEm0xmiZ/+DuyceeAaL9W0qid/Zd3TX3HgKiKh0UiclAEfuKQ20ayOG7KP/RfZTdhWIR1u3k6rdREMyemgyk+XFiKyWMKLA8kk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=CPpIZz5v; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CPpIZz5v" Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-539f4d8ef84so3951725e87.0 for ; Sat, 09 Nov 2024 04:35:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731155719; x=1731760519; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=YdWiUnW6vTgN40+31xk3R74ZtFvE1HPhsssihDLePE8=; b=CPpIZz5vmnbubbePN7stMwGd6nHEBeN0Do+kj2XVyuAAXMJr5ZauI+ES4ANQaRzW4l 4AFlDdvj5628ftxeFSYnFwzL4sZGuCaW4YsZObZ9ouNrD+SzSaMUv7HLHAE/O371Qg0J 4CXqYYPHo0c/BaEKX10hun6i4Kcz90P7HAhdjZgn5naDHtY2KLvhAvRBZuWDHA50K6mt K7FJ7WKB7lyZ+UX7q6YeJCO7FksCZSe/gR0TBm1aUdcSzJe4FdlEUZ5ZX8q8c+HtH7S4 vun+moMO92VatlT5KcWukgmtKCLkwfcvci4GIfQln0vRSATaFsVGNRNcIQ1P20gcxlp5 pWlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731155719; x=1731760519; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YdWiUnW6vTgN40+31xk3R74ZtFvE1HPhsssihDLePE8=; b=dMEF99iccJTxiMCCobHGOl/WMCnZ52D1vJI6CV9vyBC7lWye3qEcxPY/7HzKxnqQD2 z+0DIX//kcZW1GyGyev8NEItpBjhfMSPHDKl3Dj8MW9lGX46EL5opNvzJ3f6tl8gAQzq ZBZ6+Ehop8u/QUqUu2kObFBtGP46+pAOKzco/IyGR9BrbkPbsVC0FK0xF4d0gYni9pLO 9O9xxywA52rVSQrNbxgm5kBQrGm7B39l2rENV+wamZcM2uYd2EfbgNk6aqm4fSLgUxk2 oROwGm9/SwLnoVUWVYkTcOF0mijvJSDrkFVnlsgaooxa3Zjl00+FYpKTkbqB3lP+M/eu wFig== X-Forwarded-Encrypted: i=1; AJvYcCX2BDPYdfRr+Ai9YEHSi2HhkjhSs5+GSXDG8IkWBzMXsf3DCqMX4WyWfEeKaadynPwJjN0ICd10lLEEvDc=@vger.kernel.org X-Gm-Message-State: AOJu0Yz8GDOA6Id9JPYJFErlvUW+SeVs0Sacpt7sX544u5SJhEvPSSH7 jL0vgA658krSp9W9+rWwfPVYdhlEjdmue7AZE4WLtanmdXni1Q5y13GW5hcy52s= X-Google-Smtp-Source: AGHT+IHHe97HVWISV0xTKEguhhmngXwM9bLbhKLyVT/NAPLE3XO/6gkuiT5st4Y4ibTD6FfB3h0HDw== X-Received: by 2002:a05:6512:3e1b:b0:539:f7ab:e161 with SMTP id 2adb3069b0e04-53d8626c957mr3117386e87.45.1731155719467; Sat, 09 Nov 2024 04:35:19 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53d826784dbsm922899e87.15.2024.11.09.04.35.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2024 04:35:18 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Nov 2024 14:35:06 +0200 Subject: [PATCH v3 2/7] drm/sun4i: use drm_hdmi_connector_mode_valid() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241109-hdmi-mode-valid-v3-2-5348c2368076@linaro.org> References: <20241109-hdmi-mode-valid-v3-0-5348c2368076@linaro.org> In-Reply-To: <20241109-hdmi-mode-valid-v3-0-5348c2368076@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1574; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=7WdeDK9PVMnPHS0xN6wrfKPJv4ESCzGwmvZnGPcMZ/4=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnL1b+FmOS76qswUke0aQoU7K0ppHTbndFvzZI6 MVoqTsyvKOJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZy9W/gAKCRCLPIo+Aiko 1aR2B/4roqe2QGJN9o0utoGfn7qwXfuYWUFrCpESIf0EXmVpBVMUfNKMEQ901DyyYMa07vGh9sn +syhOWO4HrB8RfdT01cQmwKSSSN/AO7aYYYR4wflgexekMnpd5MYCONI8J8OubpJFAs5BK0Qhic rzUP3emr5T3rHYkxTNjg3uIE5RV0OGNR/H4BtdIlMfVvPPEeQQtRRSjV2bl1y4C8SFCTQVUcqg7 OkAARZXrgEfv4AtOtHjIBY0tsHxg98BaVOY0T74qxX313GFfUSTD8IyJiF0vxudbOq14KYEtHng lq+8K2cePPLztOfA876jNFsQpFGyIDb/AVfVxOCSHr6+qdVY X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Use new drm_hdmi_connector_mode_valid() helper instead of a module-specific copy. Reviewed-by: Chen-Yu Tsai Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i= /sun4i_hdmi_enc.c index b3649449de3026784ae2f3466906403a0b6e3b47..54b72fe220afacc208b3fd48d51= 60031127ea14a 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -205,16 +205,6 @@ static int sun4i_hdmi_connector_atomic_check(struct dr= m_connector *connector, return 0; } =20 -static enum drm_mode_status -sun4i_hdmi_connector_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) -{ - unsigned long long rate =3D drm_hdmi_compute_mode_clock(mode, 8, - HDMI_COLORSPACE_RGB); - - return sun4i_hdmi_connector_clock_valid(connector, mode, rate); -} - static int sun4i_hdmi_get_modes(struct drm_connector *connector) { struct sun4i_hdmi *hdmi =3D drm_connector_to_sun4i_hdmi(connector); @@ -269,7 +259,7 @@ static const struct drm_connector_hdmi_funcs sun4i_hdmi= _hdmi_connector_funcs =3D { =20 static const struct drm_connector_helper_funcs sun4i_hdmi_connector_helper= _funcs =3D { .atomic_check =3D sun4i_hdmi_connector_atomic_check, - .mode_valid =3D sun4i_hdmi_connector_mode_valid, + .mode_valid =3D drm_hdmi_connector_mode_valid, .get_modes =3D sun4i_hdmi_get_modes, }; =20 --=20 2.39.5 From nobody Sat Nov 23 22:48:55 2024 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7A971953BA for ; Sat, 9 Nov 2024 12:35:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731155725; cv=none; b=dngsJdD+DyqPj0YBGLgcYxLcRO+ndvKKNte5DCMfjdH3tKsjWbUUh/Zc2ROAIo8uZvQgX7VrHs9ShxKYn/kTQS2s5L+FQrgYhY+W4GfB3bLWJm3vzaBjEMh33F7+ja5irZJDtuByxHD4RUxcR3KgN+O+n/OWSdc+JHvo29Urrfs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731155725; c=relaxed/simple; bh=HrGaJ3EnGO039JV3w0anWuEujv8ijZYE/SL4efGrI0s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Qf8pIpXEL4T7MxqnDUiCdkBk3isffC4NE6f7XbFiQ8uXUq1fTaioYUfPFC3zLKMfiinpN5IaFjLeX/2e3FKN+4T9+GwJyKfTn4TPt1cFHfG/uazC6kAyfgNefnlN3kHDlrrFdhG5ubjVkZbARhbImdHungEs3sXRsKpV0Aa4p+I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=MbRpdYj1; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MbRpdYj1" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-539f53973fdso2980789e87.1 for ; Sat, 09 Nov 2024 04:35:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731155722; x=1731760522; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=42exLch29KQ7aLIpxUbDK7QotO8PsN7YchUut2Ri5WY=; b=MbRpdYj1Jmn17hS4pMYss3jY7EXAlKMHejr/lMapsB9qiSSTS2Ucf9dUPollqNvBnh 9KfqM0pw6QYwiZv3Z24NNRf/MMnJ8QR9LI4Fni271xFlv5eNhfgTXc5sEsggFkx7qUmu P3Ly6iWoiZbCM/UzV38DDtzoy9SOVHpC2qxd85pDZssadVJhb5Meee/YE19ihuhIVMvr gUvM1VxtQKQJjS9ytUhh2ivUvUq9/YQbQHuPlTwHii/FJbBO6ok8ff4wrEoUj/Ds1Uj+ ccJ/lSlDs7eXe1SygEupvh/Q8mGDIkOv6jA/P52bOckNDRj8lJp0QNyRqqx06TOXIs57 p7aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731155722; x=1731760522; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=42exLch29KQ7aLIpxUbDK7QotO8PsN7YchUut2Ri5WY=; b=k74ARQFGmz8OBC/muQuMn1YTQamKVtHnVAdljq07y54YKpQPHpJlgNov0C+YY7MrMt 2/M7gXm0VfeqlpBzX9cuOlc07pNhrMcpc2PI1h3FyljXF+jwCrfDnplZStbSKzY53IKb 8yZd8PBms93APRD41b1d8Y0pwdADeX5D/4fnL8VWseInb09Xk04LZGhl6Wzlo9Yi7LUH eD1Ssj9w8vIPOWL0XuXWy4P1QGBvRXtG2kq/JdTRD5u+RfY5HkBm9w9XdR+WCNe6w0FY rkwPzpeSZ0P2bQWY1Xqn+i6IBhHK7kDc2uV6hSrJJW8NegJiRLKhfftorZ5jXWzmzPX1 9Flg== X-Forwarded-Encrypted: i=1; AJvYcCUEeFgxG/j1Dx8uB0J0DOZU2Dx4BvaU4yV+IU4q7nzbVCMuyge9LpA74CWBo4Vta50KIOKHtWlh3X6ni4w=@vger.kernel.org X-Gm-Message-State: AOJu0YyGqPMFi7OLBPDoT+YeWBWrjCOWxIV7ohAqi6QdrONnyLIJpW9I cq4clpQDPwNVH/sJNPjH+1GT7O16EMPujs+zR8eFCZoKQM70dyejfGVU9iNB8JQ= X-Google-Smtp-Source: AGHT+IF4/eBJh19k7QgFTqtYdnnffmTFfXf5+J78TQkqLjRVT/odItDWynAUIGAavfq6S1uNQ3S3Rg== X-Received: by 2002:a05:6512:3b0f:b0:539:e2cc:d37c with SMTP id 2adb3069b0e04-53d866b20c5mr2162656e87.3.1731155722003; Sat, 09 Nov 2024 04:35:22 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53d826784dbsm922899e87.15.2024.11.09.04.35.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2024 04:35:20 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Nov 2024 14:35:07 +0200 Subject: [PATCH v3 3/7] drm/vc4: use drm_hdmi_connector_mode_valid() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241109-hdmi-mode-valid-v3-3-5348c2368076@linaro.org> References: <20241109-hdmi-mode-valid-v3-0-5348c2368076@linaro.org> In-Reply-To: <20241109-hdmi-mode-valid-v3-0-5348c2368076@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1406; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=HrGaJ3EnGO039JV3w0anWuEujv8ijZYE/SL4efGrI0s=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ7p+2D8f9f3f02SmxcyeF2ex7K28O/vzlAxeRaO7cXPNW zsuJYd3MhqzMDByMciKKbL4FLRMjdmUHPZhx9R6mEGsTCBTGLg4BWAi8XvZ/wepedeVGdUY/a45 FTO/7Xv1pfz//KulXi+rvn++ruXV9J7NOxLtmRcxvg+wZrRovKntYX/l455LjPp/mY6/slNL/Pl IWeDX/SKHQ1IhgnO3qBnVF8wtvslfkSapYrigQPV1aors4rk70zwbriaaeRQcdeXdbrUik+9iTr 3y4uDFNV95Qi329Ra9ez75iaVqFrfO4Q+ODGlq+7zjND5K1GcfK5y1cIpR3I81f1Sq0lZ9fjpv4 h1f7px11wK7Fdc86Finv+NEnaX9fp3ZGteNPzDPa2jUMjdrizhkZfb2yw+FlWWPjxf++GQuHhh1 QN72G+PP935pvX3m6Ws0Pt6+XhQ/dbleqv5FzZ6UOZXSAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Use new drm_hdmi_connector_mode_valid() helper instead of a module-specific copy. Reviewed-by: Chen-Yu Tsai Acked-by: Dave Stevenson Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/vc4/vc4_hdmi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 62b82b1eeb3694d1685969c49b2760cbbddc840e..486e513b898d7f761e8615f2afc= 193ca44b23200 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -1752,7 +1752,6 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encod= er, const struct drm_display_mode *mode) { struct vc4_hdmi *vc4_hdmi =3D encoder_to_vc4_hdmi(encoder); - unsigned long long rate; =20 if (vc4_hdmi->variant->unsupported_odd_h_timings && !(mode->flags & DRM_MODE_FLAG_DBLCLK) && @@ -1760,8 +1759,7 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encod= er, (mode->hsync_end % 2) || (mode->htotal % 2))) return MODE_H_ILLEGAL; =20 - rate =3D drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); - return vc4_hdmi_connector_clock_valid(&vc4_hdmi->connector, mode, rate); + return drm_hdmi_connector_mode_valid(&vc4_hdmi->connector, mode); } =20 static const struct drm_encoder_helper_funcs vc4_hdmi_encoder_helper_funcs= =3D { --=20 2.39.5 From nobody Sat Nov 23 22:48:55 2024 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 648A2198853 for ; Sat, 9 Nov 2024 12:35:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731155728; cv=none; b=Czr93DqnRy+T23VIadn6w2WTd2m/5OmHMK9JuZswNuRJ5K+bPCWMPatNVm5vp3EJ9uuZnzv+QHLY0SA+AOyDmILXZ8moC6UyHqoPkpdxBT6z1h1pkADuuLVhIndcZR/x1iU1HoeSOVeDTOLt7wCfW4cogeha3t2y3jMX4+hAfjo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731155728; c=relaxed/simple; bh=V6uHu+T4+xW+xwMuVx/apScXj6PwN9KdCvTiBY/zzqA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=K+iULINgPe8leIG8HlHL5BWgVa2Rrl0kgyqnpA3LnbMXNkXLA9jYUlBlm2Z+rK0LwZXI7BXVRFjVfokx9f3axoYLwlti5+VeZcQDEiJIsvaWXqMnf/i97GkXrX0w2E5pXEAlkALhNhOVpKZJpFSMqklBRAuFu2g+rj8BCinb4i8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=CpWdQTW2; arc=none smtp.client-ip=209.85.167.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CpWdQTW2" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-53c73f01284so3728325e87.0 for ; Sat, 09 Nov 2024 04:35:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731155725; x=1731760525; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=bi+JDxO7zFRVUVNShSHXAVY8nfszGwV4/oGBGiyAqww=; b=CpWdQTW2124F9AysgtVtqZKtRJohprLxB/OoFxkZ9W8knsMM4n/tDVM1r4Pup8Qugx JKNoU7sbHZeHEV0vv6CdaUVMvPkjnJzZxYGzA715j2gUyXsXepZ1yMIybf9/Td+dawbE OqkrHdbkuEr3YqJMmmgtAtHrP/VOiGeB/u/3yRrjG3kkREWz0jk0sTNq5jTYhJTU/rBv opFuGFSi2Ffh2T1Nho4Os0V2m3K0okK4AVOuOHIFeQibKDlFi4yFqod37bguKgyTzlse GVTP3IETJKBuTSSvXvnKT1Xw/WBa+a6n+CmhOc50juaTBGTHpG08nvY6zvA425YLB0h/ fIfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731155725; x=1731760525; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bi+JDxO7zFRVUVNShSHXAVY8nfszGwV4/oGBGiyAqww=; b=rybOqgcL7nhHi+XQZMXqCyHaMdx76cKN6NErpcNk/q2PFCFq4kFpmlaDZG+Su14HtV 5EKJn+8/TigIEDgK1QbdvyydCCm9/wcDm7+tK7u3iN0gjt5sBflS3zrKB43OE3c+IC/J AfW9oF781/93fUTLfI4EIhnjIHJs6xUDu1+O9TmsOQcP7jJdh1eSSPkvgzrVUWBLovQY K3I3CdhscWfJl5j0f0LfwCslyGixJEtU5gDUsNBZMPSL8SrEprBq5dLrjhuP2f6/8qw9 xVegjxbOS9Ay25qoAG2n/iQfgFU5HczmVUlqRiK6VlhVrotD+lD7qujLz1BoRKom9TBY IAEQ== X-Forwarded-Encrypted: i=1; AJvYcCUO1Uz1MaGuTTT6Z0uVJzBQwy1shZkb4v/rSYowx7IHpjHfVn8kzjMg0ENPR7UCNchs78yyAlMg2wkLWfI=@vger.kernel.org X-Gm-Message-State: AOJu0Yz15D66tZQhtHL1Frt/vesKn1W7RiuMPO060cXtsNyO4Wwm4Brw 2mRe+dJD1zaVL1kwYmtn2676jSV53eKSTOdfpqaD6+nceLIlf3CgsuJN2ut1y8s= X-Google-Smtp-Source: AGHT+IG2mF9zXCA/y3y0kG03UAbkXGpNVLSwpOM/qt6TF2Y6MK5K8/eQXGRo4a4HPRqLDiFR1eFg0A== X-Received: by 2002:a05:6512:1592:b0:539:f51e:2465 with SMTP id 2adb3069b0e04-53d8628a83dmr3060627e87.22.1731155724584; Sat, 09 Nov 2024 04:35:24 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53d826784dbsm922899e87.15.2024.11.09.04.35.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2024 04:35:23 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Nov 2024 14:35:08 +0200 Subject: [PATCH v3 4/7] drm/display: bridge_connector: use drm_bridge_connector_mode_valid() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241109-hdmi-mode-valid-v3-4-5348c2368076@linaro.org> References: <20241109-hdmi-mode-valid-v3-0-5348c2368076@linaro.org> In-Reply-To: <20241109-hdmi-mode-valid-v3-0-5348c2368076@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1872; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=V6uHu+T4+xW+xwMuVx/apScXj6PwN9KdCvTiBY/zzqA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnL1b/KHIaludY1+1CnUBh/lq0s+PtcC5v0NONs Pv90ths6RCJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZy9W/wAKCRCLPIo+Aiko 1c5rB/95XEPGSJ2I/WYRUC9L7roQJ7z8kswhRTv6gT+rta7yHL8pZMMbulp8JmYNT6Rk6+a0XTK Z46yGeFYciY49oWjdprjny4+rAL4woYLtKm7yJFmib4najumMWlTV+Pj0JggMJqKwSTFZebEbZr xPGfugM6N8F456I3/6sjXptKWIF+VOVGk2tCwSDNlK5K3gX5l2adzR5ldrIquHhJWkh4ySTeUnU lJro1JwucnZoQ3+bJ4VWkPpcN4sZUWiMd8Or9Zknb6b9gLWnpIaANiowZHGh3Q1FHVaMUvnezMy lUGU0SiMa9kFJBSSehYWwauSlUUfkAEePIgEdIJPy/WCafW3 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Use new drm_bridge_connector_mode_valid() helper if there is a HDMI bridge in the bridge chain. This removes the need to perform TMDS char rate check manually in the bridge driver. Reviewed-by: Chen-Yu Tsai Reviewed-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/display/drm_bridge_connector.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/d= rm/display/drm_bridge_connector.c index 320c297008aaa8b6ef5b1f4c71928849b202e8ac..512ced87ea18c74e182a558a686= ddd83de891814 100644 --- a/drivers/gpu/drm/display/drm_bridge_connector.c +++ b/drivers/gpu/drm/display/drm_bridge_connector.c @@ -18,6 +18,7 @@ #include #include #include +#include #include =20 /** @@ -299,9 +300,22 @@ static int drm_bridge_connector_get_modes(struct drm_c= onnector *connector) return 0; } =20 +static enum drm_mode_status +drm_bridge_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) +{ + struct drm_bridge_connector *bridge_connector =3D + to_drm_bridge_connector(connector); + + if (bridge_connector->bridge_hdmi) + return drm_hdmi_connector_mode_valid(connector, mode); + + return MODE_OK; +} + static const struct drm_connector_helper_funcs drm_bridge_connector_helper= _funcs =3D { .get_modes =3D drm_bridge_connector_get_modes, - /* No need for .mode_valid(), the bridges are checked by the core. */ + .mode_valid =3D drm_bridge_connector_mode_valid, .enable_hpd =3D drm_bridge_connector_enable_hpd, .disable_hpd =3D drm_bridge_connector_disable_hpd, }; --=20 2.39.5 From nobody Sat Nov 23 22:48:55 2024 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56D771990BB for ; Sat, 9 Nov 2024 12:35:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731155731; cv=none; b=AJriDUtpuysE3T+ST2zJYn8lMNFCefuowBouZ2QzLUv+RHuHUbWkkois72wvEIzDAF3CvasxiOC/bz5Ne7zL46vcCe7+aiyMzKmkJ9V6uu9+a8qj1vlNQWX0LULdn1aUE2e2BPtkic5BQSFeH0w2nXnG6JNDs8kYuTPiu0y7Ahs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731155731; c=relaxed/simple; bh=bVuetdndH1+H+sM8qub00TaR8PUlbIR46HTQjmQ2vjc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M2Qnv7gA9LKIP4b0k9XRHBfMUr0O0KrKuHwoQfkAQqp+HTqgPgCMzTIP4HtpavziC1gFbbfVlCfba6CHhtfe+fzZ2ooxrgMSm/dEgpylVVR8fZAmAKn6XRD1PKCV2bN9oh3uzSYg5CvIYWvUBHFxzKx3Rd6R3ZqnH0E+J9hbYG4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=kMiAlQy/; arc=none smtp.client-ip=209.85.167.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kMiAlQy/" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-539f53973fdso2980854e87.1 for ; Sat, 09 Nov 2024 04:35:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731155727; x=1731760527; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=rhftGPVLtDhe2UTpRu1zgEjgWPv2gRVws0y4aDafrjo=; b=kMiAlQy/H4s5cwPylcaw5DExtE7fU9qpvOo+uleHBEM+N+wu+WI3XknKyzhiu5yJPg aw8uBtIM5AWja3QwjdnD3euXDT7SA7eixwjXoMsAygF6XVr6FazwN+MjRdWyubviWCVN xFZccdA68+dKzYeipneVRNE9GehbEXzsWP9nJypuPNmiDueQlIFpdjPo6a+XyFp/4uL/ h2ksfdZIEgaJMshRnHy9kDouCxcAUFHMn2WgHhGra2MF0YDfwmZWd8KTKUVI1NM8B+Jq ChV5Gxj7gaXesf/YMTyElD0fpSm6QUkz7Dd9a7B2rZxhT+Kc4pgUYko1/0Kqcxnxs6aE BDEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731155727; x=1731760527; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rhftGPVLtDhe2UTpRu1zgEjgWPv2gRVws0y4aDafrjo=; b=kDpHiZbiAmeNkB2kbzT80PRoEsqNlYVHIUr98h21q0Dlaar8/BnzrfeN2QDqx6B6gr Pn7aZ2sqBh4MrpHZg5aOxxxY0jcCt5ZRP+hUFCZcV/CT2yaIvKa0eDVJQcys7lbP2hQV Llh6p7/g0gJ9XXCiFLTgxOXyUU6tXDyi5W2/wm9rkXKjDLcfSdsrBnjrEtyRQ3KUC5lC m5u5equJhpxb7jFfwgI2qUXKUCYFIWOjkoCPTYIudj3AZ93ZKfEf7ynERFyHf0w7ly+f Pj8nSyL46DFuYqI5WXFdBhZCNXhW4Z6NN0HIR2Yc2xQGP9QCpmKZwyUji1smLVGKIZVO /rTw== X-Forwarded-Encrypted: i=1; AJvYcCWtCNuojxV2LrjqPnNo8fOPT9cGLKp25rco/1r999YaatfI4p8FX1EWihZ/njveuRfWeZDN9ydTC74lWMk=@vger.kernel.org X-Gm-Message-State: AOJu0YxgtnWvdJzIAD/MBBZ4DqowpZnyNgHHvjlitIhlGL/fOXPDW/Lx 859egGqtyBCw7btk8f4phzYvsCvhHQ8YiUzNlzJNeR3bZ4eYjqUbRJUmo3lBMho= X-Google-Smtp-Source: AGHT+IEigUfK1s5B1XhS9sfEmdo+maxC2U8AZO/uY92umN9wYkTsgVSKNmZyXdmp1QCMyrfV4W+TfA== X-Received: by 2002:a05:6512:31cc:b0:539:e1a7:345d with SMTP id 2adb3069b0e04-53d866c94cbmr2232719e87.10.1731155727195; Sat, 09 Nov 2024 04:35:27 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53d826784dbsm922899e87.15.2024.11.09.04.35.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2024 04:35:25 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Nov 2024 14:35:09 +0200 Subject: [PATCH v3 5/7] drm/bridge: lontium-lt9611: drop TMDS char rate check in mode_valid Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241109-hdmi-mode-valid-v3-5-5348c2368076@linaro.org> References: <20241109-hdmi-mode-valid-v3-0-5348c2368076@linaro.org> In-Reply-To: <20241109-hdmi-mode-valid-v3-0-5348c2368076@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1393; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=bVuetdndH1+H+sM8qub00TaR8PUlbIR46HTQjmQ2vjc=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnL1b/ZfMsGkQ52uI+m656a0A3dgPEqlPCAieD6 1QAsnoR/kuJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZy9W/wAKCRCLPIo+Aiko 1eNxB/wJULjX0l8Lz4aRPnuWR70dfZVJYrQkpc+zPAuribEC0F0j7hQNWkmczAezUyvVpgP+Fgh 04j4uyP1p4ZjZjgOqT7vq+wr3pCtkA/QWAIopDvYotWFldcsgLXdYCtpZskcTOcaG5rGGFCyTyU eNJhP0NRQ+UKJrK/n9t+WRARtDE9xjju194IYz61poLEPBdhGQVMp2rdhYyF6My5hgikZ4N6oq+ a4ut24LnuuY50GSMoRukcFdytXScvNZQgHpSrxvkTvQvMdx2jsx70hJE59nYLmCcQpNLcXQ3z4x JeLtLBiJCB09gw/tvJDQ6ZibiPFWU4BeltZf1zuT3eU5stU+ X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Drop manual check of the TMDS char rate in the mode_valid callback. This check is now being performed by the core. Reviewed-by: Chen-Yu Tsai Reviewed-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/lontium-lt9611.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/brid= ge/lontium-lt9611.c index 1b31fdebe164063e6f3972fdf8a5801ef4c35c4e..b8ccffdf515ade6e3bf863edbed= c41e6f2030f29 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -757,7 +757,6 @@ static enum drm_mode_status lt9611_bridge_mode_valid(st= ruct drm_bridge *bridge, const struct drm_display_mode *mode) { struct lt9611 *lt9611 =3D bridge_to_lt9611(bridge); - unsigned long long rate; =20 if (mode->hdisplay > 3840) return MODE_BAD_HVALUE; @@ -765,8 +764,7 @@ static enum drm_mode_status lt9611_bridge_mode_valid(st= ruct drm_bridge *bridge, if (mode->hdisplay > 2000 && !lt9611->dsi1_node) return MODE_PANEL; =20 - rate =3D drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); - return bridge->funcs->hdmi_tmds_char_rate_valid(bridge, mode, rate); + return MODE_OK; } =20 static int lt9611_bridge_atomic_check(struct drm_bridge *bridge, --=20 2.39.5 From nobody Sat Nov 23 22:48:55 2024 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BBAD61991AD for ; Sat, 9 Nov 2024 12:35:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731155733; cv=none; b=oTwrXlxuGai4gFD4NE1Z9XEsFU90fWCsOyOCX9ZbWdh/mec9Mtw0LLu1a+qkXqDceZUqiekeqSYDvvWRD2iyncO0Icc64HgzhhGVn+pfxE8/g51pBR7DufuP+spEd3xu8N006+fPCQV5E/KuNSYqG5DMn2lLI8u2YZNyjSuiee8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731155733; c=relaxed/simple; bh=UjNMLqX51SwfyB+kbUbjnJt95fAbmRoKvLYOPQ8ek9c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KesbrLRh7mbpP6nrYpqIwdMP8s0ZpFsyxldQ4ZRzIex4/+uITntKZ3YWkmlc+jloWNG6z/VC4U9K5Hfu2oy1mV80dNzUuucDlXq6LV7yE/zx3bGXF2CTUV+AJ2ucTZF5esbkd8VsbOfUOhH5SjQFKyQfxQnSGkGzbqPJ/IwcHv8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=U9optEex; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="U9optEex" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-539fe76e802so3518196e87.1 for ; Sat, 09 Nov 2024 04:35:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731155730; x=1731760530; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=n9wxCYXwjuFpbEm8J6hnlc7LqgHEUz/bPD6SI90IVR0=; b=U9optEex069dww5YwPiTMdM5MbM/X6ZGhlmOC5xheJbVVxnHAWo/08M71oxxwQ+kiJ p9+jbrNb8Onv9fyga5MNL8zobupPudUdjfGmgEP3BK/CfURvtNGYQ12EoRsfFMFv0yHb 9mGGWzlz6RPH5nnjtr4ePiQaqrO1MWDDTcJ9FJTRxfwasKXLpPDXC/CtQ26H/kwUSlUZ lD0pKSKlVr4qsM5VE6hEUO9FJ2hrE1GQPPx2FgaWq9NQjSwIiK4HD5pT3fWOoVqY//ba tfEhAEmbaCGrY41QgRyn5lkNOJHDKAZCKMPGNnot3KtIT+wKxrKXQSmkJd4TydQ7OzOg b4dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731155730; x=1731760530; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n9wxCYXwjuFpbEm8J6hnlc7LqgHEUz/bPD6SI90IVR0=; b=DZSjfwfjZjhz85UBQB5b64fMs5HMwpojjfbAH6A0FQdbgoWlha9ihfMPt/9zQG7Do9 0A2fgUc38ufogP2i+03eIs30WL9bpSUm4eXVcqbG9gIfGpnqVN0Qqn17PuuAAUXgO4Yj HAAwABIncNXp3ZN+9Z5LaKzyRvXGuZ17bunT6Hj41Wa9TJPaQ1WQigKPRUMGzb7jOf92 /lSmJWYSSE2rqylkzPyQf4cNli7Zx7D41YOLUSKSuCKiaeTt0wiyNWqBbihTOkdb14XR zEYEHfKM6K5Y9kfTvtlUFTRzi8XGY1UiBY5WQAhdJhRcQ2VUXdWmiBic1Paw8xV49zlo BQoA== X-Forwarded-Encrypted: i=1; AJvYcCWhlYJPbmBpEnUXKnniFV7yOLSyRHUyGeEVOQ2R0tSS2WMPnFmi4A4hkotu4hp5EYBCjcfyUMi/Iq4xowg=@vger.kernel.org X-Gm-Message-State: AOJu0Yz/9Lj6eVeMYQA+zAyP6qq5bTc4MJdKO5Yf+baTi3bFKD/97B9n eXZDWoePweaNOLwwonDDyCAZ+/xBjcCUHBZsGBcJ9J1qFzxX99xIUMeN8szs8pk= X-Google-Smtp-Source: AGHT+IExWCGWwweJ3/2iRfeNRk4AonxFSRBohmS9iN1pZjqL1Hm83HHjYVjbPTXo/ZRFzwelKC8tdQ== X-Received: by 2002:ac2:4c4f:0:b0:539:8a9a:4e63 with SMTP id 2adb3069b0e04-53d862fded1mr3117421e87.42.1731155729899; Sat, 09 Nov 2024 04:35:29 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53d826784dbsm922899e87.15.2024.11.09.04.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2024 04:35:28 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Nov 2024 14:35:10 +0200 Subject: [PATCH v3 6/7] drm/bridge: dw-hdmi-qp: replace mode_valid with tmds_char_rate Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241109-hdmi-mode-valid-v3-6-5348c2368076@linaro.org> References: <20241109-hdmi-mode-valid-v3-0-5348c2368076@linaro.org> In-Reply-To: <20241109-hdmi-mode-valid-v3-0-5348c2368076@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2092; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=UjNMLqX51SwfyB+kbUbjnJt95fAbmRoKvLYOPQ8ek9c=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnL1b/mNQQcFqCkzuMTFi21MgL+ClfX6zdxYmOE WDmYH96sASJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZy9W/wAKCRCLPIo+Aiko 1b1cB/4saVmbA16c6Z2bnXMNH/2b3oJllF/7OUdQvKCnntWfx23Ah8wjwzFSaoqoFc+jrad4IuM GUO4DHOvHv2lRiN/dW3NjaYzf/4Fs6FTemzc2Tetv9JJ6dc6DKLv0dHR+kawu93qS4TSwCbpduz bQJDOP0pZK/UbBjbJl2jUUGcMHS8CWn2EgZc0Y+aej2d1R87ogJebwR3Yik2NciCNDbX4INzayI AjmNHAq/LOOrLHcgLBbd15aEsGcw8q47AiX1jSh39Q7NHyX78ZfMpSIOQ68OnoI84bRbaz8Mx2S zjDUhci0ay3ohdizDU96iTYRPo+tGSq9Sxzlpty6qOenFpKs X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Replace .mode_valid() callback with .hdmi_tmds_char_rate_valid(). It is more generic and is used in other mode validation paths. The rate validation for .mode_valid() will be performed by the drm_bridge_connector code. Reviewed-by: Chen-Yu Tsai Reviewed-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm= /bridge/synopsys/dw-hdmi-qp.c index 181c5164b23192f0b557624d73c6223032b90ec6..c686671e4850a1af75b82995185= ffc3cbb22a447 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c @@ -442,16 +442,14 @@ dw_hdmi_qp_bridge_edid_read(struct drm_bridge *bridge, } =20 static enum drm_mode_status -dw_hdmi_qp_bridge_mode_valid(struct drm_bridge *bridge, - const struct drm_display_info *info, - const struct drm_display_mode *mode) +dw_hdmi_qp_bridge_tmds_char_rate_valid(const struct drm_bridge *bridge, + const struct drm_display_mode *mode, + unsigned long long rate) { struct dw_hdmi_qp *hdmi =3D bridge->driver_private; - unsigned long long rate; =20 - rate =3D drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); if (rate > HDMI14_MAX_TMDSCLK) { - dev_dbg(hdmi->dev, "Unsupported mode clock: %d\n", mode->clock); + dev_dbg(hdmi->dev, "Unsupported TMDS char rate: %lld\n", rate); return MODE_CLOCK_HIGH; } =20 @@ -510,7 +508,7 @@ static const struct drm_bridge_funcs dw_hdmi_qp_bridge_= funcs =3D { .atomic_disable =3D dw_hdmi_qp_bridge_atomic_disable, .detect =3D dw_hdmi_qp_bridge_detect, .edid_read =3D dw_hdmi_qp_bridge_edid_read, - .mode_valid =3D dw_hdmi_qp_bridge_mode_valid, + .hdmi_tmds_char_rate_valid =3D dw_hdmi_qp_bridge_tmds_char_rate_valid, .hdmi_clear_infoframe =3D dw_hdmi_qp_bridge_clear_infoframe, .hdmi_write_infoframe =3D dw_hdmi_qp_bridge_write_infoframe, }; --=20 2.39.5 From nobody Sat Nov 23 22:48:55 2024 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A6D419923D for ; Sat, 9 Nov 2024 12:35:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731155736; cv=none; b=EVunrs8IChn9Xe/uAVghrsvx6g/ZnioVGEIp01LdJmmGF0Zh3dHng7bwAMFwv75TPdo/uftDp+Lz/nXvv0hSfGGSqT3ycoi1eRCiQlHh+AXaPkLfFGNCpbo3zk5MnA0WyeA5OM0XLasVe0jAsEbPTCIjUxG4toEqmAPd4txKjzY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731155736; c=relaxed/simple; bh=NRpLumrdDZhSXCJcusWkwzHsBkwvkTsOwVSCIyGYQBU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=l24CpSl/GcKgLVdLQ0J/MTtl/eFt1UUAaWgdEUggswUDJtShQyDSEHhkF8AjBA7n8BuFaku62WG6Da6uShzD/Tr9T5XeuIu70ApSkqac6zxUps+dyibMqxRtkKXjBFZ5bZ8DUDWnoe6uX7ZuAekLtaLzweCR5isiBX+PRRDOcsY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=AwpGjrZ/; arc=none smtp.client-ip=209.85.167.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="AwpGjrZ/" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-539e13375d3so3656335e87.3 for ; Sat, 09 Nov 2024 04:35:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731155733; x=1731760533; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=L+pN3XKvVFmetq3YJbHAkykp748W6pEN5H4vcdcbZbk=; b=AwpGjrZ/Xli1KfI1NYatJxUoEVMfsxo0ri6sU46Oti+kati5y0CRv3WuInXhdIi9lo yDhxf+E/dQ3f/0mL+EdzLTY8P3OLY912zUfmO2osEEVodoKOYK9MPZBDt+h0rpKJNlRI WR/irWlV+0UJGQnMwqWhOWmM1aIjQwVcQ0vkN1u3wxXBD0O5kytxuwCpgqmpn//oD6Ue 5MooNeQl7VnSrA0w24wa31WEgACWbuZEo4Z55AlNv3o+78Jp7lpsAlfR6JwL2F6bnhxQ 9p6imSyNIaiXMtxdE8I5PHOotFHm/6Pylxg2jH79UX11DUNtsDoEHKL8wTl01VvMgZQ3 kqFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731155733; x=1731760533; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L+pN3XKvVFmetq3YJbHAkykp748W6pEN5H4vcdcbZbk=; b=Mp5ZmwTj1HFLRZ2hw+MZ+AYdtte/20aBAXZxuHzKiql3AJZCEOybm/ozEpPlXOXtZ9 UuFcqWmjlBjtS4a6bwqtM/YsEPIHLcxKwRCx9ZzKsj3xrMa5oGLKTnsSTquOmMRkVoPb b6l0r5nCHNGBoKGGhhdOvL690H/sI/4gip6fkEqSCLCoSL178aXWs7X7c3tIV693MnjT ZwzHes+oUkklfV2rPIF53a9EIYE3R4xE2V7Ca4D5n5YOnQDZNBsLn+dmcXVRq/RWN1tl TYcs2pdr3jeRhBsM57aCknvwmazbL2RCDZRgGCDbAb8Vtz1vGAPjuga6P3htMI0wUvP+ 1stA== X-Forwarded-Encrypted: i=1; AJvYcCUU3bwpr31EQGCoYv56wvLd3tx6dKv36md5d7r5wYVgUuSzyCstXjHIuN18rPA9t7OtyyyUB4yJ8S40yGU=@vger.kernel.org X-Gm-Message-State: AOJu0YyM6gpLoUAfMYQwokXRU3d/WCrGwOiSfgnTinH5a5fiGv2hQGDW g9qAf5pUJU55bbrO85DpR7aoOuFAqbWV5Q1gjm7yJ8C+RgxpIm16Zj12tfeVIQ8= X-Google-Smtp-Source: AGHT+IHYy8a0Jl0t4eXfYO7d1FqKeWB0bC8cvUQRPjyNFzEV2jihfF3Am0WWkBzVwoqL1QUMEqIP1A== X-Received: by 2002:a05:6512:3f16:b0:539:d9e2:9d15 with SMTP id 2adb3069b0e04-53d8623fffcmr3082722e87.29.1731155732594; Sat, 09 Nov 2024 04:35:32 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53d826784dbsm922899e87.15.2024.11.09.04.35.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Nov 2024 04:35:31 -0800 (PST) From: Dmitry Baryshkov Date: Sat, 09 Nov 2024 14:35:11 +0200 Subject: [PATCH v3 7/7] drm/sun4i: use drm_atomic_helper_connector_hdmi_check() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241109-hdmi-mode-valid-v3-7-5348c2368076@linaro.org> References: <20241109-hdmi-mode-valid-v3-0-5348c2368076@linaro.org> In-Reply-To: <20241109-hdmi-mode-valid-v3-0-5348c2368076@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2011; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=NRpLumrdDZhSXCJcusWkwzHsBkwvkTsOwVSCIyGYQBU=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ7p+2P/UnAP/1lS+cTe5zqq05k8zk9jJ3/kFf9hFefyer PvILuvWyWjMwsDIxSArpsjiU9AyNWZTctiHHVPrYQaxMoFMYeDiFICJ3H/JwTBByj1Gq3qN6AeP o7aBh83EfpQelbE2PxPHwSrQtOXuzpWWAdPL7V20fHnmPSgJPae4eu0jF4EvzSKi1hf6GBqMq/4 eeLB96THGoJQfpepc7ku0Iy8Ei4RpMyhoFiceTbF5wJibpHuC37Nlnvn6xLlRhfOuScz40LdLMj vuZ1muq9PZ27M9+CN3C812ttdTdP+R/3jN9uAWG57HW0rPH+E1e3pukty3ZXZbUv4ylJ2/dyD3X MeLJPnAnaIOsusKL33yPnrZioPv9o+bP3ZYrlLsjS+/aRWZ2L1002uP9vgHx24wz2hv6qjrv/ih oTtM/MHPrSUulTmRUXP+1LEGMK7ck3dy07HdEs8aPB04AQ== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Replace sun4i_hdmi_connector_atomic_check(), which performs just TMDS char rate check, with drm_atomic_helper_connector_hdmi_check(), which performs additional checks basing on the HDMI Connector's state. Suggested-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i= /sun4i_hdmi_enc.c index 54b72fe220afacc208b3fd48d5160031127ea14a..b05fd77870b00aac97d003f3fb9= c2b98cb73abc0 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -187,24 +187,6 @@ sun4i_hdmi_connector_clock_valid(const struct drm_conn= ector *connector, return MODE_NOCLOCK; } =20 -static int sun4i_hdmi_connector_atomic_check(struct drm_connector *connect= or, - struct drm_atomic_state *state) -{ - struct drm_connector_state *conn_state =3D - drm_atomic_get_new_connector_state(state, connector); - struct drm_crtc *crtc =3D conn_state->crtc; - struct drm_crtc_state *crtc_state =3D crtc->state; - struct drm_display_mode *mode =3D &crtc_state->adjusted_mode; - enum drm_mode_status status; - - status =3D sun4i_hdmi_connector_clock_valid(connector, mode, - conn_state->hdmi.tmds_char_rate); - if (status !=3D MODE_OK) - return -EINVAL; - - return 0; -} - static int sun4i_hdmi_get_modes(struct drm_connector *connector) { struct sun4i_hdmi *hdmi =3D drm_connector_to_sun4i_hdmi(connector); @@ -258,7 +240,7 @@ static const struct drm_connector_hdmi_funcs sun4i_hdmi= _hdmi_connector_funcs =3D { }; =20 static const struct drm_connector_helper_funcs sun4i_hdmi_connector_helper= _funcs =3D { - .atomic_check =3D sun4i_hdmi_connector_atomic_check, + .atomic_check =3D drm_atomic_helper_connector_hdmi_check, .mode_valid =3D drm_hdmi_connector_mode_valid, .get_modes =3D sun4i_hdmi_get_modes, }; --=20 2.39.5