From nobody Sun Nov 24 23:32:01 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 F3F6E18EA8 for ; Fri, 1 Nov 2024 00:25:12 +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=1730420719; cv=none; b=B0J93exn1OBfgMP/tFSoioOjFR9yBQjhT8mdQKbwevB0C9xjzRUW0cLTGdFkq5c+6Tr2cNl7VQpz64pellx53Cs0fernwpzfEl+PFbXfB3eLWCwSi2S2DfVp+0XbhqgPPp5pHFEzlvNiign/lt4+tJ1rwAibK+XBlD6R4uf29P8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730420719; c=relaxed/simple; bh=kVBUKzWAeHVvHBydx3EkRE4Q3REprXqMLr3/QDo5buM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ArpttZWdWM4SkIKrBkXlDIBeM+DopCdcEyeMN6EEardvY1LMShnv3zpl+C1ErF9lCV6I95KJTs7H37xiyPGHuNzHj97YAWkdoGNQkfKn7SqFRVDz77Gku6bfAD6YAZcp1JmxqDOv3uPjhMZd8bbFyyAkCWRORNts2WouIrpuy10= 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=i1K+lnaR; 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="i1K+lnaR" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-539fe76e802so1907672e87.1 for ; Thu, 31 Oct 2024 17:25:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730420711; x=1731025511; 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=f6wvkpdEJy3UY0KoyL1u6wW6pZJHCkWq8daEN8XaygQ=; b=i1K+lnaR6GNyLmeFeP3chkOIpLSIORzlSS21HsNsSolQK99anSEGQ16G/UwuHxdnyQ t1g3V5e1Pg0lxOdV/y764isBgS1pgv4jMPp0mgPr4nAlAmih8Nfz6iXFHHGzN1A/XIlw m63mQNLGoLTFafhNfU4CXtqcf2RqxRm/9D1CD8KNyAvZm/F5dHxhIVn8qkgnPOrZgqo9 ncolZp5Pw9Dgs+G6BLQhJOnKM6SlJBGOu/MaRMZbXnvtH9ABHMpA0cVJcsZjTDKmJKAU 1+E+oaQSqUmZxusUmpHW4zllPg982e4YcthbSEVg9zzisSz8VMd7IMTGaJ2sALVO0laF ZIiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730420711; x=1731025511; 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=f6wvkpdEJy3UY0KoyL1u6wW6pZJHCkWq8daEN8XaygQ=; b=HUC6konkmO3ckCEj9lTsPeVbciowWu9AqQnWgDOJyFaIi7ZnFUEL/9JWqcDO0kjA8K qR4NkZ3Z5//moCrMO3s/EEQU3Kem8+cmAjWl/0EXgnqYqAP05xF4hCpQthlFpAd0Cg6W TJ5FjCDOaXfkWXxS4oUzZSvV79iNnUUOztUXkOEah+IFXLgtlzMKWy44FefIFM4Yt5Bq RxD/aC2shneNv8oocmZmmALi94cMdyki1RZWBsnX/Ygf0JfiV2WyVvp5nGErY5KmqnE6 tezD4OwG1MQGYCBzuFUS/y2dczXAm0fS5bowRpbkEFWWnMcX49HrBeAXuPekgBQfCA/m 8+Cg== X-Forwarded-Encrypted: i=1; AJvYcCUUy9y5LTLr9f26d0B7AH2dbYImQq/fnobRgql1EzDYl4V1L+w7BxN9WQflUdZkS/yyLsIomd/qT6Oh8ro=@vger.kernel.org X-Gm-Message-State: AOJu0YyKHJvXe48WhUOUJu5oUDaKotIMYjHcsOIP0cWYCR0dn1++TH37 1d6S0cv2HUfEWYya67vLKtBpIbNR/fff1rCFZ9rcHB0Ae01wYsePedLUrE8/UB4= X-Google-Smtp-Source: AGHT+IFl02U+Enu+dOc8nLBGUqiQvjvTgpJmOb8nUqlghPqDc1+5KcRdRr4F22uyWdsyfKCDEEXcqg== X-Received: by 2002:a05:6512:114f:b0:539:958a:8fb1 with SMTP id 2adb3069b0e04-53d65e1aeecmr830681e87.60.1730420710791; Thu, 31 Oct 2024 17:25:10 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bcce489sm371153e87.127.2024.10.31.17.25.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 17:25:09 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 01 Nov 2024 02:25:04 +0200 Subject: [PATCH v2 1/6] 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: <20241101-hdmi-mode-valid-v2-1-a6478fd20fa6@linaro.org> References: <20241101-hdmi-mode-valid-v2-0-a6478fd20fa6@linaro.org> In-Reply-To: <20241101-hdmi-mode-valid-v2-0-a6478fd20fa6@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=12996; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=kVBUKzWAeHVvHBydx3EkRE4Q3REprXqMLr3/QDo5buM=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnJB/h+qQ1svDVzgd0LXjIU1mOZYulRshe8N4cO hhkv1trDDmJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZyQf4QAKCRCLPIo+Aiko 1YsEB/oCWybrGbF8Zp55m5T5SgJSWWMvmHdwta73P4TbzdbYxcw2s2JeW3ZdBed51YYxvd29orC p6PB0KX/CZKEEyn4Xp9ZqQYRtEo4BZufIesiJxN6SWc+jisZtmmNry8JkoNh0C6UaLeip2k6dF3 HHISp68oCmsgCVPYX7oPUN3Yv27H8YXfd1/UllhI2fuAMNtl4txBzdiPwRlvJpZEKv3CkGnOgeP QTdDn7BX88d9AjlBozZcgJa5Hib1obJ31EY57vKWvMxLt1vgPH5PIE1g94Nmq01lQdsUoZvV3GJ HjeNxTzyfa42+vFSYu0Zppy75ikECUbDVNoTowRpSr3FDqub 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_helper.c | 45 ++++++ drivers/gpu/drm/display/drm_hdmi_helper_internal.h | 11 ++ drivers/gpu/drm/display/drm_hdmi_state_helper.c | 26 +--- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 168 +++++++++++++++++= +++- include/drm/display/drm_hdmi_helper.h | 4 + 5 files changed, 229 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/display/drm_hdmi_helper.c b/drivers/gpu/drm/di= splay/drm_hdmi_helper.c index 74dd4d01dd9bb2c9e69ec1c60b0056bd69417e8a..560c5d4365ca54d3f669395349c= edfd6f75fa033 100644 --- a/drivers/gpu/drm/display/drm_hdmi_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_helper.c @@ -9,6 +9,8 @@ #include #include =20 +#include "drm_hdmi_helper_internal.h" + static inline bool is_eotf_supported(u8 output_eotf, u8 sink_eotf) { return sink_eotf & BIT(output_eotf); @@ -256,3 +258,46 @@ drm_hdmi_compute_mode_clock(const struct drm_display_m= ode *mode, return DIV_ROUND_CLOSEST_ULL(clock * bpc, 8); } EXPORT_SYMBOL(drm_hdmi_compute_mode_clock); + +enum drm_mode_status +__drm_hdmi_connector_clock_valid(const struct drm_connector *connector, + const struct drm_display_mode *mode, + unsigned long long clock) +{ + const struct drm_connector_hdmi_funcs *funcs =3D connector->hdmi.funcs; + const struct drm_display_info *info =3D &connector->display_info; + + if (info->max_tmds_clock && clock > info->max_tmds_clock * 1000) + return MODE_CLOCK_HIGH; + + if (funcs && funcs->tmds_char_rate_valid) { + enum drm_mode_status status; + + status =3D funcs->tmds_char_rate_valid(connector, mode, clock); + if (status !=3D MODE_OK) + return status; + } + + return MODE_OK; +} + +/** + * 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 __drm_hdmi_connector_clock_valid(connector, mode, clock); +} +EXPORT_SYMBOL(drm_hdmi_connector_mode_valid); diff --git a/drivers/gpu/drm/display/drm_hdmi_helper_internal.h b/drivers/g= pu/drm/display/drm_hdmi_helper_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..ee74435c04f62cf71b9857bdc42= 7c46442b85697 --- /dev/null +++ b/drivers/gpu/drm/display/drm_hdmi_helper_internal.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: MIT */ + +#ifndef DRM_DP_HELPER_INTERNAL_H +#define DRM_DP_HELPER_INTERNAL_H + +enum drm_mode_status +__drm_hdmi_connector_clock_valid(const struct drm_connector *connector, + const struct drm_display_mode *mode, + unsigned long long clock); + +#endif diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/= drm/display/drm_hdmi_state_helper.c index feb7a3a759811aed70c679be8704072093e2a79b..29c2cb2c3171366a2a68fc6ad48= f8ad8a4dc7e30 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -8,6 +8,8 @@ #include #include =20 +#include "drm_hdmi_helper_internal.h" + /** * __drm_atomic_helper_connector_hdmi_reset() - Initializes all HDMI @drm_= connector_state resources * @connector: DRM connector @@ -198,28 +200,6 @@ sink_supports_format_bpc(const struct drm_connector *c= onnector, return false; } =20 -static enum drm_mode_status -hdmi_clock_valid(const struct drm_connector *connector, - const struct drm_display_mode *mode, - unsigned long long clock) -{ - const struct drm_connector_hdmi_funcs *funcs =3D connector->hdmi.funcs; - const struct drm_display_info *info =3D &connector->display_info; - - if (info->max_tmds_clock && clock > info->max_tmds_clock * 1000) - return MODE_CLOCK_HIGH; - - if (funcs && funcs->tmds_char_rate_valid) { - enum drm_mode_status status; - - status =3D funcs->tmds_char_rate_valid(connector, mode, clock); - if (status !=3D MODE_OK) - return status; - } - - return MODE_OK; -} - static int hdmi_compute_clock(const struct drm_connector *connector, struct drm_connector_state *conn_state, @@ -233,7 +213,7 @@ hdmi_compute_clock(const struct drm_connector *connecto= r, if (!clock) return -EINVAL; =20 - status =3D hdmi_clock_valid(connector, mode, clock); + status =3D __drm_hdmi_connector_clock_valid(connector, mode, clock); if (status !=3D MODE_OK) return -EINVAL; =20 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 34ee95d41f2966ab23a60deb37d689430f6b0985..8640e7280053bd95852f53b9215= 9f493b141f2bf 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,12 @@ 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); + 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 +127,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 +161,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 +1775,132 @@ 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); +} + +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); +} + +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); +} + +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_helper.h b/include/drm/display/dr= m_hdmi_helper.h index 57e3b18c15ec79636d89267aba0e88f434c5d4db..93f0e566257338fb6e9a1f0b2cc= 14ce9c97ec0a5 100644 --- a/include/drm/display/drm_hdmi_helper.h +++ b/include/drm/display/drm_hdmi_helper.h @@ -28,4 +28,8 @@ unsigned long long drm_hdmi_compute_mode_clock(const struct drm_display_mode *mode, unsigned int bpc, enum hdmi_colorspace fmt); =20 +enum drm_mode_status +drm_hdmi_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode); + #endif --=20 2.39.5 From nobody Sun Nov 24 23:32:01 2024 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (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 76DDF1B813 for ; Fri, 1 Nov 2024 00:25:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730420721; cv=none; b=C5K0/AkVdDxVRQeuwYpP98NW+tLJf0PHd0JwkD8UCVod96Fpl7icIs7WjniHRcIGqA5/ggWlhVZE+vYjXwQ3jcjCX980EjFqi98ytaH8LJXT1OPeJzFH01TYBa1sG0uYLDW+lrl6iLxW7dqNUSdDzaq0xkie0MkksX008mhDWbI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730420721; c=relaxed/simple; bh=7WdeDK9PVMnPHS0xN6wrfKPJv4ESCzGwmvZnGPcMZ/4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CjhKtGg5OH6KcKrdnuVnYIioiqdIVe6sdXS69RMoA9px+GfhqLBZ9inbA4pzcwthv5Xm1EAwnQfzZU0qBj5x4Xp4XZPP9ETlQqf8JmO4z8SFvrogpmcefK2h1L7kThitHF1zM/GWqzYio2ZIEowbs/fqMVxTcjtFDrVZbCPfGts= 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=F+JG7opL; arc=none smtp.client-ip=209.85.167.49 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="F+JG7opL" Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-53b13ea6b78so2561222e87.2 for ; Thu, 31 Oct 2024 17:25:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730420713; x=1731025513; 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=F+JG7opLhLJm8v04je9kPbCcoctW2FI+JDG/kQu0lNFZxj+7kfdT1k6m56G74ESr++ 3XsM4CbwpbetI+CID0yc5kPDJO39cDiZX0VHespd/l9gxdgCkfRlbG5lhcylpuylnme4 AFyc3rFKVk3A5nwuEvl4o0q6+wzPgU49879IEYvPm8sy8dIBZxJGxGomea6GoxZTVj25 rkb9ff7rteMvv2By0MUVNuXh3y5Y2Jc/Q0BGJ0X/MmnMkWn9WxqC/ctTKi5kVudr0LsX ws9T5xzYLwR6uG9pIQecxz7hMLNDzM+jHv+XuJnMlZu1bjrGo5W7OFsIi5uQtbV4/8MR bL1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730420713; x=1731025513; 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=jQVds5iZrw40vsFnxpLmm4mtlPr4HOhtMRH//Qx3mNWAmdrkV3OYhYEuV8nCxl1ED0 OQyihXRDGFyyUfsXTxrJwv6oNVnoWHDbBd4WgODQsKEDOWmvVF9h0itNKolnURDMQqX8 Qt3PMVQsQDn9+6kzmlU4t5wK3Npn5H3lGBwjUkN2hwXmspRytIjCsp5mKRuQFep0MRxL 29kqym3K7E8+eARSy5cc4ZTQ+9X89e+207asz/YrGF5C6SILftn9OpJIW/omVeOgcIT/ RVy2ZiMSXYI8lqx1fpt6DBR/l8Q7Ume8+a9low0SJUk/Gey6a9wC29PEUb3yS7ONrHBl SC0Q== X-Forwarded-Encrypted: i=1; AJvYcCXzNUBj0dCxyANk/eeQ94JgfqkdPUVc3pO1ZS1d8rFGodB+w/WDHh3ZHitQZmoVgKi9Yo2f2KMrzqFXLAs=@vger.kernel.org X-Gm-Message-State: AOJu0YyAuqyfCoctD3DvRUSvG65bqJPjtJr4xVj8/laFf5dBRbh+hIym lhT3WWdYBWVCPM678BeLzvoTYuunxru4DAEDx8OR/Xx5ez5gKUjwRB6N2CeFJo4= X-Google-Smtp-Source: AGHT+IGbq8fCpRY1c1bmmg92095C0kqytUrIWwSrZUXkLxY5mzg2koxLARty7zdJQk9WrWqL2+9CxQ== X-Received: by 2002:a05:6512:ba0:b0:53c:74a7:43de with SMTP id 2adb3069b0e04-53d65df2488mr1464938e87.29.1730420713436; Thu, 31 Oct 2024 17:25:13 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bcce489sm371153e87.127.2024.10.31.17.25.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 17:25:12 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 01 Nov 2024 02:25:05 +0200 Subject: [PATCH v2 2/6] 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: <20241101-hdmi-mode-valid-v2-2-a6478fd20fa6@linaro.org> References: <20241101-hdmi-mode-valid-v2-0-a6478fd20fa6@linaro.org> In-Reply-To: <20241101-hdmi-mode-valid-v2-0-a6478fd20fa6@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/pANAwAKAYs8ij4CKSjVAcsmYgBnJB/hVs8ck2mIuOojDf5BsZyDpCAOCNbvDgTjB eEdeVyvSe6JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZyQf4QAKCRCLPIo+Aiko 1bLuB/9NYYP+2gWguXV7p7pxvci6OEsal/Vmy8LRfAO4mZDqwSPpZaLvK3tQVnCC2tplz45RV62 KH7xpFWZe4L9XV8JIyduCPu3BEZe8cdEHSNio4pUw2nXKz8fuaj/73N0DEwpQF87bixbIKyB11p EjmlZKOFvHTJ7yeuUgUUiKM6X+RDLGiXX/Qof/VMIgQjhJT0Q4qmUg2B351WDikp1lpmyRxfTpd eX0xqtaokT6BLTm64axs7FFb8od8hvVrsfpfiH3FuPtsW6Ca6XVMAIb4t7YNGUs/h7Ob4NcwJJ8 xbghQayNSZROF+m19E/pCBd8Dbmht0Ig9PpLzYlQ1LJDdDRt 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 Sun Nov 24 23:32:01 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 0D99F1BF24 for ; Fri, 1 Nov 2024 00:25:17 +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=1730420724; cv=none; b=ev+/zFGnz/aYJwuFZRrZicIeFrQR6dtw3UW7urQmRXhHVcm3gXu/XHGB3ppb2CbrE2cWtM/0VvbvCPA46HQmnDmNkhat3b33mdxFX0nntbpWsTrjlSBysNS72Im3+TqrQea8gnWFvmKVuhai/tPYb7i1/p3/1SBsKhtlRSTdwrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730420724; c=relaxed/simple; bh=j8Ztg9arYN1ELRagVfF2elNxB8pJWUt6BffPwIK5vkY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=t4MMG9aZv2+3SnCRR493iEjwp8kFxa9Gvi//QEtrTjpgHbFZLXmFedKH367t4kJabszsb8tWM/cE6pp9RhqQap2KFnqdrBMJQ1zJbEZEEWuXopcV4RHeXpRi2ehx/HgKnVcyHOg+RLT0SxpyFDXKqyv2KpF7+clkVMbS+oMDyek= 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=qIASYnQn; 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="qIASYnQn" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-539f76a6f0dso1431451e87.1 for ; Thu, 31 Oct 2024 17:25:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730420716; x=1731025516; 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=Oz8IVPHbbVKsM7ENVrxAMUhoPK6SMfJXrPI8pxkC7X8=; b=qIASYnQncsiWOman7UYOxHdIcXoq8AW5H12E0fV7Vvoi+9YOke9gT64M0HUwAbWmM1 6h1JBu3izKOVk5EXFzx46d9Q3Vr+j+tZYHvhmk0t4g/nqMNWWebO3L35y5mau/cLVPmo Kf1mDJt06DsPEj1d+N+QwWSbcqqiWsBDyIFd846Go6HHTSkTBEHvmq1FsqiMPCLWbfiH 8nOpTrxeWRSO1wDyI/eCuNmijfNV3loljVJHkAFLDi6fRJsV9hBp1a21G7yfaDu5IvO3 mZ6hcK4G0k7dfPhb+1cgc5hhwhWIoxJY6IK4T6R6s/+tB3mHMi8p7KHt1U9fqr5Rmi4U WkGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730420716; x=1731025516; 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=Oz8IVPHbbVKsM7ENVrxAMUhoPK6SMfJXrPI8pxkC7X8=; b=j/NJwPfDJ4dM+2Hvb8ITr+2guWpt6uZbHQJH45jsMrxt9RNBS9I+eNQdmTRIwUsclj zkHnmSa2gwnP6XNLTvCcjHxJ+vZqxFaQkyz4ix8tEJ1friioziZJnpWN+FS1whHp014Z EymKkvkHe5Uc9PB47T4omnILd4iky9TF3ViUaaklUQFRqyPd4TYLESYbWrWVxXtNTWWB SBpIMXY7MwwK/krpT9uRqSIMuR/FUxxMtB6JL33t7zOOZAVW6gZNR4H0I4iwRVdyJ3OV ZyKIADE2zYc/9pUQgq+w0EvKvlH0AEvarMqmI5zj0kxGuezcGcmwDCCtxJKkbdiRXbXe PdqA== X-Forwarded-Encrypted: i=1; AJvYcCXIVp/izYOEtMHOgTEv/iMRTWvv6QSmpiIOODGCe7XfI+zTC8w/AJLu+a8yxLAsVy1XBWaW/ZakXZesIrI=@vger.kernel.org X-Gm-Message-State: AOJu0YzX64RBINdaasTsfeBhtH90iOyolcjB8fgEvshf4Gm4KZNTbChB bEeU+DfBvsxJWJ7fQiW+IEg1QIqYK91pQbxHGLzdq3GrMIraZpA9TqMOp4nZ3HU= X-Google-Smtp-Source: AGHT+IHcnRqxSLmcfcXWYuLKSdTWcQFnoMfz9gg3tI8jWHEyOYxomQLugov09w4G+e8FKbd9IggEGQ== X-Received: by 2002:a05:6512:2214:b0:539:fb49:c489 with SMTP id 2adb3069b0e04-53c79e16c2emr2460125e87.9.1730420716030; Thu, 31 Oct 2024 17:25:16 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bcce489sm371153e87.127.2024.10.31.17.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 17:25:14 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 01 Nov 2024 02:25:06 +0200 Subject: [PATCH v2 3/6] 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: <20241101-hdmi-mode-valid-v2-3-a6478fd20fa6@linaro.org> References: <20241101-hdmi-mode-valid-v2-0-a6478fd20fa6@linaro.org> In-Reply-To: <20241101-hdmi-mode-valid-v2-0-a6478fd20fa6@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=1347; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=j8Ztg9arYN1ELRagVfF2elNxB8pJWUt6BffPwIK5vkY=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnJB/hBB9KzuzMuq6rZPVIIyhq0/H5DKznjnvjc mWPqbE1GVqJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZyQf4QAKCRCLPIo+Aiko 1SHmB/wLX9KwONfQBArsPgo8Qz/Mgw1Z4L54OL1ZshkDnVR+j6A1CHLrTiAn9haUM9+bgg1kAdT mJ5lQ2iexzQSb+vqQ6TPriswRPmiJPhsRJ8Hrt/j7l7zjpf00cpdDUCc0xX4hq2FGgi2OnwrGH9 8t/FOZqEZsmzrkkDf5Brms3bEZHmxOsYdt9C3Cr+6DGf/B41PgSXAgbp4X64iQN1BlkEly/Otaj vLINazwB3mxY9sN4JmhaZfrTWHNbe/39wV4Y7rA7ZCZ696ZvbGQULrGumY5jceHeqNseiYK8cB1 UvP4ZZBU5mNKzwSAMaXF0LHzTr5DeBG8s4VVaM5S3ylORuQO 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 Acked-by: Dave Stevenson --- 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 Sun Nov 24 23:32:01 2024 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (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 A4FB42B9A9 for ; Fri, 1 Nov 2024 00:25:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730420726; cv=none; b=CQ/1vsZQWqmFz3mTGkam57zZ79GI/9YAONUiL9eNp5wbuVv4qDD84oSxb/v54u8pmFvAk+KBd7IaX4wlqaVWoTPCc2UpLN3GR6s8OV/s92H0YmIHdp63Yir+FQRLQeLsqbCS2392ZRmDuJslkPKXejIzUtV9FLAwoWSkbjjBSIc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730420726; c=relaxed/simple; bh=Q9ji/NbRYwF1TNZj9n1TpgdHLjl20UItRRGWWpdDvcQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HAtPYNcS+XV1qijQNiSNPLIUy3aUxQXCROegRJdNH5BKNjD1jxgnqf8hXouYOAecV7h/nSAXjG+jtL2QeuL7wFT2DqlmuRwb9nituKzsZrOfCrJmKrGWMOb7nG/M9npqNxWV30dxk7zMuntAJTeePcMq+wXYOJv+HDeGkNit6tM= 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=QVLSpjtb; arc=none smtp.client-ip=209.85.167.51 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="QVLSpjtb" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-539e5c15fd3so1369900e87.3 for ; Thu, 31 Oct 2024 17:25:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730420719; x=1731025519; 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=Fn3LhrswAJ6uldcqCvizMSK2GK9rmkw5c0L7tOFDyzA=; b=QVLSpjtb4P2exgAPsj6bbKab/S4C3FjmgtY1yi+aOipfPe4RPQ0FBKmWgrnDeuOAnP PBbA4D0JmdT9BNjv5PIMn0E1jDzDsi79tAYRCh9d8GZH4MXoaRwvCYwXldghiUAst9hm 7WQj/O15oNYgneAEH8lQHO8leF7uHjHVcC7A74QvrYwlhNzITYsf+7mnccCBs9teDwXI 0wg+tPpVPEtSI2CETwsv9lR+raYw3+qTX/PynvnqwfQj2+3KBPmfpazcU2/aEcUFgzZ/ HNcjm4q6apFjn/PUbfKpJUps/MgxiC8ffT/i2EBeeEnhSbHCN0VDRloS8vejiUHM6Z/1 9xTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730420719; x=1731025519; 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=Fn3LhrswAJ6uldcqCvizMSK2GK9rmkw5c0L7tOFDyzA=; b=hUEjWk+DZqRYdJkWgzCKVOtFE2fkVJAx0Vf5Ok3qFPv6QQsbf96BIkrdGd8Bb/nz7Z sv923pPkYiY8Nyt1yPVRw0yCwtVDBJ2ixMxifOM8zCwroC7f177BOFo6T+WMc/Fvb01p upEy32BS51GQ/b/BSAo9crdJrg/WpOjK+2qX6i2u0ZocBgut5mus6ntiP81ERl3g+vAT Qv/ljgrIn4EYeST2nXrq7XpA6BATk7PMeLFPBOY0lSmEPZxzK9hk8iCjXycA3FeuQLRd 1WkrqPoqgwbe9xwKb1r0I56JsxlUUuIjkBD5tODt42hcqYqNTQrtiJ7BtCz1hw7qeewp yO3A== X-Forwarded-Encrypted: i=1; AJvYcCUwdDqsWnDeS4lDxbqo65OdUCsI3Efn/YY6Xk2bJp0PE5k4UepGAGtNNDNVep2IEMcU6+iKhAUnp4zXLm8=@vger.kernel.org X-Gm-Message-State: AOJu0Yzq8q0C7oitnFMMp1qvVxVAyolIYvo4txaGPQf0AwhH5p1B5UIx HalqBErSitMOwPpuRnJ/5BQWebyv/FlazBAtNvFhjWlIJUdoF4fK1uc59W2J1zE= X-Google-Smtp-Source: AGHT+IFLGk370oJX7M/fOs9yssB9UroX/yB5UrOBpoOmI1k9rBV3Tjw44Gv6j6p0t2YpMLg9rxw7rw== X-Received: by 2002:a05:6512:33d1:b0:539:e873:6e6 with SMTP id 2adb3069b0e04-53b34a1953amr11874626e87.43.1730420718759; Thu, 31 Oct 2024 17:25:18 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bcce489sm371153e87.127.2024.10.31.17.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 17:25:17 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 01 Nov 2024 02:25:07 +0200 Subject: [PATCH v2 4/6] 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: <20241101-hdmi-mode-valid-v2-4-a6478fd20fa6@linaro.org> References: <20241101-hdmi-mode-valid-v2-0-a6478fd20fa6@linaro.org> In-Reply-To: <20241101-hdmi-mode-valid-v2-0-a6478fd20fa6@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=1823; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Q9ji/NbRYwF1TNZj9n1TpgdHLjl20UItRRGWWpdDvcQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnJB/hTl+xfDm56PcvCfyLR4ruPHvUICtQpdeUo JnDXQfGiVGJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZyQf4QAKCRCLPIo+Aiko 1UGsB/0ZWiyvOHwonVjOKqiPjNjrJWmuBjMDfQVw3/uHD8NPKzxvZ9Hr3iL0YRRXMuK3C+IGqcZ 1xDNk2AzPqJOGZgbbGmpLSH/Vfq6va9o3zKRASXyCKqCYVPLYrHwhfxwJJ+TqXvMYWQrGm35SKi jUViyUXSxon0WYJwpk/vcmqyB+DineqeodUGO0o6BRHs0eKeAqqkT/GiDQapFvbC7uizl6AHCjB i6jc11/scL3bkp27MSP3HSuKmIMjtfX9dg/uyl7UEyOEM5tMkpbonBX96LPrwSzUbsRnAefU8O2 LLRA4GeogLOARJb31LmT0HUrWNwo2OHAqrb3GA19J0T6xiHS 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 Signed-off-by: Dmitry Baryshkov Reviewed-by: Maxime Ripard --- 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 Sun Nov 24 23:32:01 2024 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 2FFC43A8D0 for ; Fri, 1 Nov 2024 00:25:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730420729; cv=none; b=GeXRPD/9pUdTycMZf2Mf56EdLeoFQ97bNKvFfRQUgfCwwWAtgec6ufFf4JAoM9mfVe4tEesjzHCSPWuhrTGk3f1WvBAK6x4OZ+PaXIC3IEIzu5p3uM8XlJBsE29ueSffUhwjxbfWPQu7R7Pe/+u5W3U6FsLzTNLpxGAQC7YQKT4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730420729; c=relaxed/simple; bh=2cAY9yTx7ywPgJgHfm9Yb5s7i+clqrcNRhwPtafGQxY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RcuORYfR3uWhhGOMejzSjDgwVOor1uM9nZGARyfNWKTIWN4Qf/atuBPdbXcH48FvaYrLxBIEJJEjRry4afv7J/LeVEBnGC5YjRGP04tn73JV072YGeGIOR3qBKEncN6HXosmLpDffiZeq0O8nvnur4FKIT8zsH6dTop8j/NfiGE= 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=Leii2UNw; arc=none smtp.client-ip=209.85.167.52 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="Leii2UNw" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-539e690479cso1640665e87.3 for ; Thu, 31 Oct 2024 17:25:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730420721; x=1731025521; 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=L5YSV0GHN6tODKa+I9kvPXfXQWz+eBBIeCxWrWSu71k=; b=Leii2UNwXq8KHiC1E4S/+FVZMPwsS3Tayt6rkufD8J/wMkDzAPISva3Ezut7CouWYx Nb8dPOSMTaEo8zAJF8qXHyyTi8/4vFhoxtfv1NM6bWKo6ExGbUO7x/RhFRlU9eIBO0Aj 0pSRbZi0y5gU6NNVIHhsUVq4vo6YuKO+ZVKXmtemvpxEewqlz+LYNsC5tKewTCKjl896 4TqZ7HTFHCtY/jN8DoKm6MLiASB8upAxeBvwumZbBJhDczu+lnYy1bLiFzTNfL8R76vc mzaegvegDFaOpE+Ibr/G9k9HNbDWzxaSpbzbW5VCELWvjLj0ZVlYqZRIFmGcWA4IelaS w4rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730420721; x=1731025521; 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=L5YSV0GHN6tODKa+I9kvPXfXQWz+eBBIeCxWrWSu71k=; b=CtT9jo1XXIXWtxwxCuZ5U63fHLZ3QdqnFle/ATbRXrNfxGly6fiqnusrCvDoFOUrQ2 Yh0AfWRwzAFbmIo1ok5thsz6VI2cvWfQPd8YnvrklBb7lnSMLXolQn0woIQO8Py1MSWB nKuuuZOkIegSqZQvCtCk5cxJjc/IyoV2013b+HFnHTr97xtwEyOPia9jWecVI5L42QuO K+3Cr+5/E+1ZkoX4fEMqgW+2qH5pXrxY2L5SSP/5t3QqQY3SZIeyFLuQ1Lx4FV0YBitE w2a/xfZN3XE3BBRwcrrByLlNKuaJh9VHvZBBbP+eysgaXk8A7kAXQWO9wX+hRyLG6a+c l2nw== X-Forwarded-Encrypted: i=1; AJvYcCX6gILVg6mA7DLpFZ00lAAbck4LqgN1MUhwrljyLxV9+li/hXFk9f6d1vgvft6Y4pV0lnVfFMbeLiQMRZQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yylt+YeNfErPuqMj4b0FqVeueq8Nu9aPlBKlb9QD+yFF4/jt0QF Gp+jDqX6Gvs36SzOptHa0dVCeO2nTG2+C7u+eWQD/tBBUdz/Y1Fdf0peByK830M= X-Google-Smtp-Source: AGHT+IH+Z352s483KbHjtU5VVJ6ZByUM9w51iqApUCzupb2q+5C0iuOE0kUGC7cK9WZXbJJqsjEwvg== X-Received: by 2002:a05:6512:31cb:b0:539:e436:f1cd with SMTP id 2adb3069b0e04-53d65de60eamr1039132e87.16.1730420721328; Thu, 31 Oct 2024 17:25:21 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bcce489sm371153e87.127.2024.10.31.17.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 17:25:20 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 01 Nov 2024 02:25:08 +0200 Subject: [PATCH v2 5/6] 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: <20241101-hdmi-mode-valid-v2-5-a6478fd20fa6@linaro.org> References: <20241101-hdmi-mode-valid-v2-0-a6478fd20fa6@linaro.org> In-Reply-To: <20241101-hdmi-mode-valid-v2-0-a6478fd20fa6@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=1344; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=2cAY9yTx7ywPgJgHfm9Yb5s7i+clqrcNRhwPtafGQxY=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnJB/igzsmQyIppH1aHxewnBY4Uhlduz4k+yAau 9lDSDvbvv6JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZyQf4gAKCRCLPIo+Aiko 1RyvB/9WSZ4mNeqd6GCGzKzlegONFJkuLiNKth6QBGTxQ//vKPOg3+AtwZwoekG8i/XcF3v32K4 65STYUOFY1I/FgP221HjXjV3D9ECFQLDGGeKhm7aLPml3ejppcxSFCoSMIczoSfyYm5k1G2xoKr fCCE4IU+aSG01lp6cHyXCQG6y9YHZs864O0vGh0SgHH1N6SeLGRb4NG2Fe3MKhnXwjYwEcYpOyU J2lEr7q8KPfcvWjBZZzLDqwPmQ9c8C5h1xKOssI4DO3MY56kui4eN8trJfFkVfWm0Fg46xuPxrQ 6aBgbPv0pAwW/CBUvWVI6roTVlburpPQoWsR3WuP+sPFeVDU 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 Signed-off-by: Dmitry Baryshkov Reviewed-by: Maxime Ripard --- 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 Sun Nov 24 23:32:01 2024 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (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 E7884535D8 for ; Fri, 1 Nov 2024 00:25:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730420732; cv=none; b=mI4sf9mT+EteDr9euveygBU+n1IW7kaGKpbcQIqVm4jMlbsb8fc2Gs32zUBKK5mQ9BDy3sH+bNksgQI6vwh172ZJaqoRpqJ3EV0Me4Vsq4kiNziPiDhv+SeVRKFQf2hty0H+YcKWJaY5M+HGVu8cAsnerKQIkWnj405LL/JyCb8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730420732; c=relaxed/simple; bh=rnWWDnvK/2UdwmliNMd8qjy7ZbPEcXVWLie22T2NTNE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bkWQWt1DjENJMQUmhUCOWjxkJoXSERhqv+Z8DEJZ8++MNkHctg56DpBbFLQjnIOLoty/C+Kitx/HSlv4EcpXJVe7DPV+jJm4R8Hz8Mln6xcvQSUvmIFXcwsICvbx8AGfhO2VMNzz9+2iwsdCavKPETzfqwPA1RDdnLJbjoEr39Q= 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=gfnYhY9S; arc=none smtp.client-ip=209.85.167.54 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="gfnYhY9S" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-53c73f01284so1826009e87.0 for ; Thu, 31 Oct 2024 17:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730420724; x=1731025524; 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=Hv2lxmvcj3iHqVSo1vO+GpyATUEKN5RREgLh1lW/pKI=; b=gfnYhY9Sou7eoEPR+D65Ky/ixI68OSeYc5+QOKMHpCwze6Vd7P3w4Tn5e6SLgaZ6F9 4/MoZSU5LrUuwezt0+8LhkKxCP+eKYkGq2Iw8e3bIgAgWJyEqHnzDRnhod2HTtPnSfKB FhSFoBgT6cwTZqT6RgVgJIrARDiai0wrBUYi+wwkj2CuKpsus3MPYLdOCyKZ/VUvNR4S PlJ3wfuY9ab9O6q6cX7TqJO97Y4i9UFHgjarVV/kHBJ8inLRa/Q4Lv13Mh9yxziTmaX7 0YHryJ5thyTGAGSsr+PLnoxIdMVlMOKb7F+cSaWjk5cvNkkS15oIQZ4FaaELXz+5CfdK JPiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730420724; x=1731025524; 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=Hv2lxmvcj3iHqVSo1vO+GpyATUEKN5RREgLh1lW/pKI=; b=NYJfi1whXAd56vbyTjD354o91QS8DQehiONjWb9II0Sp4XSsuFgO3n0DG10MsGx47i Nz30T1ZQDBYQifJI9lXAPaniU+dLYvadTO03yZoPB4tDNlkwhAe2I+XoCxEwjTcbUYDB jZWw6OKxWLlBkH7ai61Tkq/H3O/kZu8I1UbLz8oTuGHSLyP4gpyMorP8Y+mVuRoJDMd1 mSIo+NGOioMUwoaOBOP8ojR+olw7OPprqPBkD8Cc/uw/dyOBojW2iICBq9fLe65XK3ku UdAO6FaOE0igKsvzjOwQYjilhrt+rP7KHFppwnh1qc71KMjwODCfZBejL6sBECw/hXqa WIgQ== X-Forwarded-Encrypted: i=1; AJvYcCWoazA3pppwalT9lYen5gGvt9pG7DEKGn/CGVbsMlm+FZP97MF7ZMvg3RYGlHqPuSpykqFpk0gzGjHn0IY=@vger.kernel.org X-Gm-Message-State: AOJu0Yy5lfm0usBhjAlxFRvQcNxsfFBO8XQqpOb4ftu1srUO2/QgElNG Ndd0R/tkaCLmE4oZpJesPKgzg/SGdIxRuIHJ4Eu/skveF4oikGgPHASll2o3/hA= X-Google-Smtp-Source: AGHT+IEAG9yn1GIhE2YrHT9rrcbTzRT2YsspXsGtFKg4MG2x8/7FF58dsirEGqVuW26T1ugiJs7GKw== X-Received: by 2002:a05:6512:1106:b0:539:8b49:8939 with SMTP id 2adb3069b0e04-53c79e913efmr2851992e87.41.1730420723969; Thu, 31 Oct 2024 17:25:23 -0700 (PDT) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53c7bcce489sm371153e87.127.2024.10.31.17.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Oct 2024 17:25:22 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 01 Nov 2024 02:25:09 +0200 Subject: [PATCH v2 6/6] 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: <20241101-hdmi-mode-valid-v2-6-a6478fd20fa6@linaro.org> References: <20241101-hdmi-mode-valid-v2-0-a6478fd20fa6@linaro.org> In-Reply-To: <20241101-hdmi-mode-valid-v2-0-a6478fd20fa6@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=2043; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=rnWWDnvK/2UdwmliNMd8qjy7ZbPEcXVWLie22T2NTNE=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnJB/iyyoKxhJ9ymVIF5jZKxhY4Q/llakDKMFQT BEjedUrIaeJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZyQf4gAKCRCLPIo+Aiko 1URAB/0Q+lN9KyT42dXskzxxSyFiafqSlV1SV+VcON3MjaaEaECIjnFoHbPKEDxvle6Xicl7vHs h46RF3lrs7ptPTroESb/pvPY/Jj5EK9/dqatVhqiLYq2adABTz85k64UaLF9WIvj1pF54o1lMJJ 0R4OFGKZEAjC02s31dNE4fIMUbhsnc8JNoP15YRKxjq6AvslRKkkh+qCN5QhotWa9AUe6/FuS3d S7bNUR5mrFzDH3QH2n196BQPAJqsuELq2I2VbXoJuXeBSoQHuH5Dlli1/25UfCBLmbABtstMdis ux9EbzgijZfuFg2ndroerRXzSm8rHmu9np1KtZBbhZYdo8ju 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 Signed-off-by: Dmitry Baryshkov Reviewed-by: Maxime Ripard --- 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