From patchwork Sat Nov 9 12:35:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13869571 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4B0F5D5E369 for ; Sat, 9 Nov 2024 12:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1+nD5HJByLExsTSOICbG27tCgbmZZrKa+DbcceQO2vk=; b=fjBrzqUidQcI1lsS28bZDdkwZ9 3gVh1U8BXWuNl8njqZV2vFmY28LFf8uwiIVZDr23YIhtdsUtnQ53FDJt0DPQRBhgdNgxy4UugffCs a0KsxL+2mjiw15Z0N5vkoWUllGTTE7PnQ8rpD8zOszY3+vSJ5ZRqp2jsP7zBUsa+ikydMrZcqLSKe 8oJozMd/uDrxnKOFZyhO7DGFmKtw4GmAy9PralThKR7+Zzstj+UIc6vErLBwu3XsQH2dxhs+/THR1 nO2JTw3brXbTxY11BmLv+0O38+u2IyK0V32lbCBfAb8fLDJ++rQLOx67p/lIdBVJSnh3SUmpegdz2 LMw/Trww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9kjy-0000000DJpd-3glO; Sat, 09 Nov 2024 12:38:58 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9kgQ-0000000DJ2V-3lcT for linux-arm-kernel@lists.infradead.org; Sat, 09 Nov 2024 12:35:20 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-53c73f01284so3728253e87.0 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=lists.infradead.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=HaIxWrJSlg3hfhlIh+BI/DsaOa+tGtgo4iUitJtP/tKKN1N2e0uKoA6fu7nGE3FHXQ OhAZ2Zrywba6705tf4k0bqo3kzEu9G8YFq3vcnbZFD4hMVqTrfFaLIoYXDIkygoYIV8A SjtPdw+sYcHPfWfNk9yFDNAx7nJphOWeCLtSmk1JlC76R3egYn8guxzgwOe1dVhJEhnf nQLt5uBJ9gQLISvhcRa2NjOZlaHO5p7FXLscarZmLJC9uO7jjeCJuobek3EetVLdjAQ5 fEIDhjbwzD0adid6JUEks2tR0Y6o6YwCkIF9L8gn2Q9Jjq7IxQhgyVqNuN/z/s2qyRRH i86w== 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=UPTZUXuhnDnliygZxbOBghNsnQnKl8ZPDDUlLsdbn4IX5ARtQHaSBYb0nSOuqMFe4t Ldgpk5wcURw5dsBxfW1HVumQtND7So36JYRSZqowGdzeiGIDItKoiUvhiSKvXp1Z5soD 3VxexrZuN//MBzVKO8vw/zADSZO6OTxN/IvaQTABHeldWZV4MGo0f1Emga1bZvsQ9wCB MzAcuJQCUJH0b4XCx1mhLhhQjZSuY07KRacqRw2fb9mYV/hdPXUIVuDNySgsDvsud9LD oTW1TfU9mqPR/OSTmN25WPgqI9XJzFCn3KIez7nYWwH/otEP4UUnODai933lC1qbImTO MqLw== X-Forwarded-Encrypted: i=1; AJvYcCXCWNgscNi7lyjMWVckBUOeEaKrMglFFrA6eCdBj007V13o6MDmC5Lly33l2fUMtAwO7OLMJm4IbiruHCo8gLcV@lists.infradead.org X-Gm-Message-State: AOJu0YxjiLUDJMOO72UuddmRqjjMsbQKs0O5kEerjdNtde4wQ3w4g6Hk sZx2+ivIroKzM9z/K4FpOkXVVd8I1xno7PhIsECrzb0L1hZp+9w/J4Q/vrD0sso= 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 MIME-Version: 1.0 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_Cana?= =?utf-8?q?l?= , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241109_043518_983706_2A1FCFEA X-CRM114-Status: GOOD ( 19.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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..80bf2829ba89b5f84fed4fa9eb1d6302e10a4f9e 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); +/** + * drm_hdmi_connector_mode_valid() - Check if mode is valid for HDMI connector + * @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 = 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/gpu/drm/tests/drm_hdmi_state_helper_test.c index 294773342e710dc56772f839c2db9c2e487bbc1e..67c3e882592b00d803d8cba5d183aa90339a16b4 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 = connector->dev; - struct drm_display_mode *mode, *preferred; + struct drm_display_mode *mode, *preferred = NULL; mutex_lock(&drm->mode_config.mutex); - preferred = 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 = list_first_entry(&connector->modes, struct drm_display_mode, head); + list_for_each_entry(mode, &connector->modes, head) if (mode->type & DRM_MODE_TYPE_PREFERRED) preferred = mode; @@ -125,6 +129,18 @@ static const struct drm_connector_hdmi_funcs reject_connector_hdmi_funcs = { .tmds_char_rate_valid = reject_connector_tmds_char_rate_valid, }; +static enum drm_mode_status +reject_100MHz_connector_tmds_char_rate_valid(const struct drm_connector *connector, + 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 = { + .tmds_char_rate_valid = 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 = @@ -147,6 +163,33 @@ static int dummy_connector_get_modes(struct drm_connector *connector) static const struct drm_connector_helper_funcs dummy_connector_helper_funcs = { .atomic_check = drm_atomic_helper_connector_hdmi_check, .get_modes = dummy_connector_get_modes, + .mode_valid = 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 = + connector_to_priv(connector); + const struct drm_edid *edid; + unsigned int num_modes; + + edid = 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 = 100 * 1000; + num_modes = drm_edid_connector_add_modes(connector); + + drm_edid_free(edid); + + return num_modes; +} + +static const struct drm_connector_helper_funcs dummy_connector_helper_funcs_max_tmds_clock = { + .atomic_check = drm_atomic_helper_connector_hdmi_check, + .get_modes = dummy_connector_get_modes_100MHz_max_clock, + .mode_valid = drm_hdmi_connector_mode_valid, }; static void dummy_hdmi_connector_reset(struct drm_connector *connector) @@ -1734,9 +1777,143 @@ static struct kunit_suite drm_atomic_helper_connector_hdmi_reset_test_suite = { .test_cases = drm_atomic_helper_connector_hdmi_reset_tests, }; +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 = drm_atomic_helper_connector_hdmi_init(test, + BIT(HDMI_COLORSPACE_RGB), + 8); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn = &priv->connector; + preferred = 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 = drm_atomic_helper_connector_hdmi_init(test, + BIT(HDMI_COLORSPACE_RGB), + 8); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn = &priv->connector; + + /* You shouldn't be doing that at home. */ + conn->hdmi.funcs = &reject_connector_hdmi_funcs; + + priv->current_edid = test_edid_hdmi_1080p_rgb_max_200mhz; + priv->current_edid_len = ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz); + + drm = &priv->drm; + + mutex_lock(&drm->mode_config.mutex); + ret = conn->funcs->fill_modes(conn, 4096, 4096); + mutex_unlock(&drm->mode_config.mutex); + KUNIT_ASSERT_EQ(test, ret, 0); + + preferred = find_preferred_mode(conn); + KUNIT_ASSERT_NULL(test, preferred); +} + +/* + * Verify that tmds_char_rate_valid() can correctly filter out high-rate modes, + * 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 = drm_atomic_helper_connector_hdmi_init(test, + BIT(HDMI_COLORSPACE_RGB), + 8); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn = &priv->connector; + + /* You shouldn't be doing that at home. */ + conn->hdmi.funcs = &reject_100_MHz_connector_hdmi_funcs; + + ret = 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 = 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, while + * 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 = drm_atomic_helper_connector_hdmi_init(test, + BIT(HDMI_COLORSPACE_RGB), + 8); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn = &priv->connector; + + drm_connector_helper_add(conn, &dummy_connector_helper_funcs_max_tmds_clock); + + ret = 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 = 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[] = { + 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 = { + .name = "drm_atomic_helper_connector_hdmi_mode_valid", + .test_cases = 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, ); MODULE_AUTHOR("Maxime Ripard "); diff --git a/include/drm/display/drm_hdmi_state_helper.h b/include/drm/display/drm_hdmi_state_helper.h index 2d45fcfa461985065a5e5ad67eddc0b1c556d526..d6d65da6d8f9ee46de33114cce2d6fbe6098a862 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_infoframe(struct drm_connector int drm_atomic_helper_connector_hdmi_update_infoframes(struct drm_connector *connector, struct drm_atomic_state *state); +enum drm_mode_status +drm_hdmi_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode); + #endif // DRM_HDMI_STATE_HELPER_H_ From patchwork Sat Nov 9 12:35:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13869572 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 65469D5E369 for ; Sat, 9 Nov 2024 12:40:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YdWiUnW6vTgN40+31xk3R74ZtFvE1HPhsssihDLePE8=; b=NJ5wcJ36BE2fQo2ExWpgn4h+hD 2nvG+XnfwgMCRB7NqAvFPhGwKVeQHcCX3FQ5lIpazmivAKyb1gFYRwKjCV95TXK4mL6MqDTScEBaa 6mItZLyGXtY7sSTajVa51zSmNFRLx61b4xiI2xJJrr3e2MccDKUAbHTMDGSQzfs0Zu7OACObZ3ALT iSxb/8cjeBuhYsCQztsUmqXbN4wXVJhMUCu6sECr+0RqBHtnscSOVw2GbZ0aRcpoITM2HicSQCeCO QYN76Ub6d25QzRCftV7LCNZk9wjotwiT5hQ0aGRP/0FicPCCyPNysbNp0jpHE5rxB6OpS45q55u7b xLCJGk5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9klh-0000000DK19-2Cah; Sat, 09 Nov 2024 12:40:45 +0000 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9kgT-0000000DJ2r-2L1y for linux-arm-kernel@lists.infradead.org; Sat, 09 Nov 2024 12:35:22 +0000 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-539e6c754bdso3119476e87.2 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=lists.infradead.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=CtJnzSXQv5xDjwk8zWAZXBgtjJkFHeh26D06cooAti0qlImNY029ENvqrsnv2KVhjl mwul3uq4mnzZTcB/B7yRbO/YewMrYkccTfd9qbXjYFbfirgNVY0XznJauyEtEpj1tSJZ RObamwVIGQrc6018X3jjZS9xJexyK3joj/dheDyGGT3nW7tHCEwrlQx3Ew+RPQezL6x2 Q7ANGt+qL3h7hUTgzsEYvmqdqblGoQWH2ld2hfHtcMJGPjkcsYM6xlPb/Dny2XW/U1Xl NmIE9bPM2TI5KBfKBkWFOvjbjSlMl6l2w3frYtea6bE5o0JfyYmkuXu97JY1LxjUp0Lm eHEQ== 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=mylGJQE3jfs5OrZiO/pBWvAprXFRZWpD09pONfMfXgPUdTrUFB8BZ/iyNUszVNFN0Y Zd2ZjwXVXxzlv6qVwA6Xj5/keYD/SiyytHgbcSI1cceUInJwQk5t5MHNLMHBeDVpp9uU cD6EW/A1ANStFFehJ2qPrRMZQD49KgZ5pZ5B7IQAkimZh83WcLWB61N5J6wK3A/5mk2C aT2A/byYYd6hzNF/ILgzLdPX6DYTXPr766v31sdANTJOvpyd6QhyeVlhI3Y47yBIX4Hc WS2hvBk4wv9KHo62ozZYrSF8zfSdPv/eZRZ+3EAQQvNddsMExuuOQlhhogH9gK/1d+r2 f5zA== X-Forwarded-Encrypted: i=1; AJvYcCVqzKhT3kbv6Ei7135K/19FZDcnMSYjmx7I0sNsFJ7ozfTCl4Da6TvK/FvxQq6iW9TjxwA+qPCI7suR3DHMHcRN@lists.infradead.org X-Gm-Message-State: AOJu0Yx7Rg5yLpjCg5A9mfAOvRRLYlNdVqGdTRRBJX/EOhrcLaHvEugp Zxk0vwtwSEdnfILLAq0/+4Lq/zgRdkSAJkZssCjaqOz3K1srNfzjngOqmvbxneo= 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() MIME-Version: 1.0 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_Cana?= =?utf-8?q?l?= , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241109_043521_633479_2C2F7DD1 X-CRM114-Status: GOOD ( 11.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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..54b72fe220afacc208b3fd48d5160031127ea14a 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 drm_connector *connector, return 0; } -static enum drm_mode_status -sun4i_hdmi_connector_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) -{ - unsigned long long rate = 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 = drm_connector_to_sun4i_hdmi(connector); @@ -269,7 +259,7 @@ static const struct drm_connector_hdmi_funcs sun4i_hdmi_hdmi_connector_funcs = { static const struct drm_connector_helper_funcs sun4i_hdmi_connector_helper_funcs = { .atomic_check = sun4i_hdmi_connector_atomic_check, - .mode_valid = sun4i_hdmi_connector_mode_valid, + .mode_valid = drm_hdmi_connector_mode_valid, .get_modes = sun4i_hdmi_get_modes, }; From patchwork Sat Nov 9 12:35:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13869573 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 79052D5E368 for ; Sat, 9 Nov 2024 12:42:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=42exLch29KQ7aLIpxUbDK7QotO8PsN7YchUut2Ri5WY=; b=z5T3wJUXHJt4pY8L7YO5JgAKYT hoL5wqSF5THedDhc/uJfQ/Km/Tx7IbCuCKlmQwUN1D7mqz6hdzlIV/sGcXmOQumXBJLT1D940kYO+ a9ZiQVWpBNZ0+7agA6lNGK9JEKoafo4e+Vlg4VW0hgwzeVDDJZcIcCfdYhPqZJRto5gijiuEZCy7r HD0/cvItAGei8mfhm5SOD9tgVDigC3+mXzBeKXVjWedZHPahcVyFZ8hrZ2HerZMyRK19xmB3rQkyr oLdP7hfQZ6wzmxjdVBJNZjq2gXZR9KPXpJEhY2ArYGjbLv6WuLbG+D7OrHGCWyr8umYCtCXKZ/yTn tsH3Q14Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9knR-0000000DKDh-0vQh; Sat, 09 Nov 2024 12:42:33 +0000 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9kgW-0000000DJ3n-08qH for linux-arm-kernel@lists.infradead.org; Sat, 09 Nov 2024 12:35:25 +0000 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-539e4b7409fso3588382e87.0 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=lists.infradead.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=x2atpNHaprGaG8Wr3eUa4sKnk+H0fkQSFDHXfuHR0nt69RiMYyIxJQaaYjwLW0a3q5 IL4a8HZMIxV1kdR3Y2kDTcw4YuGI10VMcGfqVNst91j1mB3cWUCelY+cojT2tCQb0G6a Hx8ryjocGRcPT2r4nhNVz2aBWaxCK8rU/yhzeJZRtgKGY9vZoSfx51aezcdRB+Zi2cxT VO55fcdHcrcqF5CSs3rsfRW8vxD9vmGqp8tyjbe76TzaUYyFg96Q9OkOAwczZ9mCTxhP TPJ/JqWWSK6GuXBqCxU1qIqF/tgSiJmV+Y4Ee27IVT94uND5K9lr4wqyTPxUgf/hM2eu eXrw== 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=YgFWDePsBf5PkwrcM7jx3ZKJl67EcFClllGejBL4pO5AGyIbIlJHCY/diQVbKcMgaT n3HgqqTs2kVrj6hYq1xA95nipR2iIu6PuijD0LegGx6UbIOcQ2YJ6m8SJqWBPXiuwn33 fY0nwTA0OY36mUhqVoDlpsxa+p7lEe2HRA5ErRcHofPMje13zsjR3f9eIQUw2Opv7XMh RJgUkeTZnFj0eg87nTwLZ/psL9D0mUi65wpTnjvm+/IYOs4ErPBC1ZQ6vjlI+5r/hIOr hmKH6Q62xMfWByfcze2NZxj4R1u4ElYwx4r/drue477QqfNvtwRAIbALotByiFIaU3wV ouyg== X-Forwarded-Encrypted: i=1; AJvYcCVHc3IVH3PwH8zdLpVDVLU/82mvzgF1VU/U1c/KRpHG14LurqVjtmJNaLFbb8PHAiMAKi1QTu4wuHIO/pt/qGfS@lists.infradead.org X-Gm-Message-State: AOJu0YyAEyx+tKv+4NjA+YHfX5f/pVRMPXmZMCTKt5I7FT2vtj/vVMhQ hkcwuy9qIVTnj+oHmfzJCq8EFD8UKFkqu1vX37b5oRINBn4plEIFvu8pW03PdKU= 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() MIME-Version: 1.0 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_Cana?= =?utf-8?q?l?= , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241109_043524_224602_CBF8E7B0 X-CRM114-Status: GOOD ( 10.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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..486e513b898d7f761e8615f2afc193ca44b23200 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 *encoder, const struct drm_display_mode *mode) { struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); - unsigned long long rate; 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 *encoder, (mode->hsync_end % 2) || (mode->htotal % 2))) return MODE_H_ILLEGAL; - rate = 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); } static const struct drm_encoder_helper_funcs vc4_hdmi_encoder_helper_funcs = { From patchwork Sat Nov 9 12:35:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13869590 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35D80D5E368 for ; Sat, 9 Nov 2024 12:44:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bi+JDxO7zFRVUVNShSHXAVY8nfszGwV4/oGBGiyAqww=; b=zq9e6zGXzxRLs8eZHNDTVOJuHR fOOzWm+DDk5eUE0weB+JP5eYMlsxiPafQVvjQ3bk8FJW+ZHTKyAL2OJ6s4MTYF+d9qfypEqVt6awC V94LmAJJgzPbeXMQX0C0vFTwhOD9j7rv/VpdR8xBCFUxLtq/9rEZ2lkmh5WBSQk7DitiQT3zA6ZZM QTwCjmF26gAA4PTLtDUgrTalMRpD8JRBRhVoKvD32RoX/6ta0lX3z420kCbHbahFoxZCvPLe7B443 LmmlfhjCNXYkze2UrLLOd2hK8DlOQzkoyyu3qT4Bszp0ka1G+KGAVinW/cYhE5J9AqGXYkN/hgeVs U9whHHdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9kp9-0000000DKOP-25I9; Sat, 09 Nov 2024 12:44:19 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9kgY-0000000DJ5c-0ZKp for linux-arm-kernel@lists.infradead.org; Sat, 09 Nov 2024 12:35:28 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-53c73f01284so3728323e87.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=lists.infradead.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=DoyXiZXzvokLHM7yv+xQGoy0qvlC7WEvttOEb831qNZMX/8Bfrj8dIyqKJWHe+ese2 LVIrkH/jJMaYbJ4VYk5b2IbmpoPgN9rFb6WkvjuV/Tp4/9G/fKK68pLPAETr9pN1DMpf NPJ8sqZY34ykgHjcmnAO9PXAVf7Xto0RdiPmIjm3+gTQTzzvwuejPDTdb3yQwKgWDH8W nwYB6VEJh2RJYHl+AyWVuWGU5lYJeRQYm4BlUbjmLpyEqcIWEXHEjtD521W0xUvb8s8t Pu5JII1BnVm3MB3po4XcOrDfD6XkKRTEh71bYJvsjrOK0Zil799fd5LkVsGqVqq6gPQH csnA== 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=eqlzbDgmJR5MZs8nXCysym5H5i3N1YMsJCOFvMsr8jHSBNFuWD6u2LVJKwmdUoXgMx o4Nrb3FAa4RK66OQK9+SiMQj4D4JKRdm5nG+34hKiKmIJxutar3wzFYqjAC2CW8X+bok HQXJHaKAAFIur+vepGGHdSnVhiizGXXv/Y2wkUXW+pm/1ASUgoSutt9B70vQSlwCZM9E CPnm+rtB6yV1L+epFZl8jWT1gMFSfPKPu1ONmQtubnNWIN6sfYxd2GrQ+yIx2z+w1CMD yymiD/HvvmLcjBHSMXOouhA3dj2Zc2Wdk+/+LkWnGzzguQi94tjXRIK/hV0lwgz8H7vX kbVg== X-Forwarded-Encrypted: i=1; AJvYcCX87nyCMqJcIx860WVpeYRvU4RWreOd8lbmGMwbNl7tlELKiEn94w+fvPnDwx/gVfb5/210jJRCfsSGgGzP6XaY@lists.infradead.org X-Gm-Message-State: AOJu0Yzk9Aoo8J0RjwFKyz9UB19Aip8Exxmat0qQMj+0/Lpc5Pw+fw16 z+f9DSuoKNwGQzXdAb9HsZSpi1JqevxQxbVlzM5pkFRL8BLWUCD1MEpHGeV/YHk= 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() MIME-Version: 1.0 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_Cana?= =?utf-8?q?l?= , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241109_043526_220712_E0EF1994 X-CRM114-Status: GOOD ( 14.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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/drm/display/drm_bridge_connector.c index 320c297008aaa8b6ef5b1f4c71928849b202e8ac..512ced87ea18c74e182a558a686ddd83de891814 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 /** @@ -299,9 +300,22 @@ static int drm_bridge_connector_get_modes(struct drm_connector *connector) return 0; } +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 = + 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 = { .get_modes = drm_bridge_connector_get_modes, - /* No need for .mode_valid(), the bridges are checked by the core. */ + .mode_valid = drm_bridge_connector_mode_valid, .enable_hpd = drm_bridge_connector_enable_hpd, .disable_hpd = drm_bridge_connector_disable_hpd, }; From patchwork Sat Nov 9 12:35:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13869591 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA1CFD5E369 for ; Sat, 9 Nov 2024 12:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rhftGPVLtDhe2UTpRu1zgEjgWPv2gRVws0y4aDafrjo=; b=U20Vc3hXij4A636eNmwzw0BsZn XRJOroEn08tXfhyoujYQnMlt+QwPg8KOZPmh/tnparSPH5C9+56xYQvZOKct7wpapfe1PkRDf0lmU DxD7UHDQmzWTdxCjsKFbKJvVb3SL3UZh6kCft2dIDWN6CUj4WvD78HKBl+hZNJAil1Gw5htOTuDUy 118K+Q2FRQ3oPZK8rQqTEyq9adKIxFwKl+ya0WvrVFJ4SOB+rRi88Qhx1Nl9JV6z+rtgF0WoLYda8 YuZqJBsNCWJ3fNYTNFeExsyYxWFugOqofvf/Y+Tgfv3UtPpbotfLqoNwJji93/FvDCdG7BaL/SRS/ wlBjT49w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9kqu-0000000DKlI-04hb; Sat, 09 Nov 2024 12:46:08 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9kgb-0000000DJ7K-1xUo for linux-arm-kernel@lists.infradead.org; Sat, 09 Nov 2024 12:35:31 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-539e4b7409fso3588439e87.0 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=lists.infradead.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=cyR8a4tvNE5DgkOZ/2wBGEoHqgRbA8zG+C+VK/je9Lu9NUhrnjTld3vJFoL6xecNtE K6iG0NhoCDKW7rkS5hzYotRM7GIf7858EIX7NBMe99rneKBNh/fb3kHhlde4KaFA3EaD UV9nDjePI8Aovq3ur4akesfxh9Z4CkK6QUeJ2GHH4J1czA2cV6cHLpd3lu5XEnxSh9OZ lLjsgtKcCo1AlxzH//xXW4p/NiYBzf2TlvSK4LAn8J8gu4wTe5JvSuBxhVFrtE6eARvb Es8QVEWW20qE54DZXlMz9IB8D9T19UX1JVBGoP/fNhYYUWdUAWd8W8tPp4JNa+GStoqf waqw== 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=MP0ldM6bY6wk4RYd6pPu25TK1MipqANNW+ErznIF9aDQn1XPaLQeWcSKiAVcrHudES PIBB3v7RY4mNO8GGq+KbcUUhP/M1xbPZsgoHbL+f6BsrORx7a+Yz0OIgIzhrh5cklY1e FoqzKhWp75y2tam8jabJmeGskrxrkmdtlekPEzwbx8lmewNGUHgfHG1bspYJoiY9tIWs 086YFFkMKZwn51y8Flayhq1qmzu5x0JrTnH58ObPDFAewMaL7DAR+8rdV9vV0frbboFC t+zH6EUZ7xSbDMyHyu9HLgyNMRZhJfrDfqABTRmMJGCrLOgJQfEniUC7brPhMZYBdKSy r3+Q== X-Forwarded-Encrypted: i=1; AJvYcCXsWWXSc+7XZiUAdvDS7pXZM/PnQO1R4WkEqxL4jn8JAwo8aWs48NlUvkqf5FA7s6LY2SURACXwwNSWPrxm85qw@lists.infradead.org X-Gm-Message-State: AOJu0Yxklu0cA9vOQgBAK4V1zRgNnWHs/5QCuAvWf4BpGTQ1iQD2r5pQ /02Eh/Lqp8RA8+IgC3JhYr8B8xXA02QPY9TUjjiWIn6I+Upayp3YwsgRp//c2Ak= 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 MIME-Version: 1.0 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_Cana?= =?utf-8?q?l?= , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241109_043529_571473_AD59C903 X-CRM114-Status: GOOD ( 12.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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/bridge/lontium-lt9611.c index 1b31fdebe164063e6f3972fdf8a5801ef4c35c4e..b8ccffdf515ade6e3bf863edbedc41e6f2030f29 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(struct drm_bridge *bridge, const struct drm_display_mode *mode) { struct lt9611 *lt9611 = bridge_to_lt9611(bridge); - unsigned long long rate; if (mode->hdisplay > 3840) return MODE_BAD_HVALUE; @@ -765,8 +764,7 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge, if (mode->hdisplay > 2000 && !lt9611->dsi1_node) return MODE_PANEL; - rate = drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); - return bridge->funcs->hdmi_tmds_char_rate_valid(bridge, mode, rate); + return MODE_OK; } static int lt9611_bridge_atomic_check(struct drm_bridge *bridge, From patchwork Sat Nov 9 12:35:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13869592 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A5A61D5E369 for ; Sat, 9 Nov 2024 12:48:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=n9wxCYXwjuFpbEm8J6hnlc7LqgHEUz/bPD6SI90IVR0=; b=hq8auTGaRoM4OHheeeGaUluHY1 YZkq7waACm6hoqYYZE8FjH2SnRBiEYb3FmL/PGzUUNnrEaSfdvzKMfcE3KdEGBLmIVTuoWyHmeMy7 Dc0w58aBzM0vX2RmzIsXYVEGz5o3nFUqiCf/9riNOQorX0m5M9ntoH+ksSpzjLiRfULDAHT/ZP7PX e8WEnvF47xnSKb8uyBzR3FFRkHvKdTxl9tvne462d+qdyJEWT0Gvc6Jhafy7OoCYBUH9BqGXB3w4I OXTxfHDEuDOhUfCQVjvAivV+N8wEx1zyLb0LX0Ow20luhpv8alxl2CcPe2ijQuYKxAcVC8imTHsQS d01fAW/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9ksc-0000000DKup-3lr4; Sat, 09 Nov 2024 12:47:54 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9kgd-0000000DJ9p-24ZH for linux-arm-kernel@lists.infradead.org; Sat, 09 Nov 2024 12:35:32 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-539ebb5a20aso3461407e87.2 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=lists.infradead.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=H4M7FOm7Fj3M0SvzcOE3R9SJPfc45tF6rp2fXzU5Edb5ICchfB+9z7Let85EIDdRHf EoGaSzZy66qArcsdLz/eJl3qiR6XWNh4GUBw525GXxVpSA1SEKYjp0ZuS+o4EndHV3L3 plqe+oRS2WH0afHBuSXAPIJgas9FzZ4T9JUs1ciX0RVMWzFHjW3vMU0dq2/F/Gbm/dht tzsPPWvv+RIjbHiue+EvgrpAZj+9lTpjajhBfQlt1py04QzKaCssMSsSKw9TFmcHS5A/ 8mCGdIuTiSEU2FlT4SA+43vR5FTUrEMmD4GVHXkOCzXi7BGAyvHGT+IoQ2rdzmETm2z3 OCxw== 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=sBqWjQ/yx/xz6HvtKXE7p1NYv7YL5d8aw/76Rp7ry8codnmfH0jrcyGQAk9IgeUFOV XskyabsrmNdc727WrJQIRKj14gy6kYZ8sR70m2UH+/h/C0qRolj2TwYHEsLlZYvdBpWY 6uxRudsBtpj35boY0dxZ0M2rFrq9CNE7bQI5aPGDOMNtYINR7lPCHEoogjjdrmz/f/Ta PCqhM/ShfQi5rxOcZI0LfS2iZbt3zFoumGy/3//LveMkAUq9O2Z6FYgF1PTomgZrcuZF iyPOsVwovr9rQ4j0f+7/+7ugPxCwPHge9xWPSSsaPCkOgSQZNlcvuVXpkXqGMjrP09Pa Lw3A== X-Forwarded-Encrypted: i=1; AJvYcCWPp2DKXOD8gl4GgS3+E8nYfoCL0MD4N1+qDT26HeJR1yGq2VjF1pG1CT7R13kAP2RHxvlJ5jeon7QWoxNryvXc@lists.infradead.org X-Gm-Message-State: AOJu0YwrkT/9czE+l/GHo/bbu9ZM93EaJqQ66UBetANavI+pB3PL/xzy VznSdoyT8kK/6aUxCDhfyqPinhUsTN1JN8MwM/o+/mwAyeYdbvwjd3msWG1s+Tg= 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 MIME-Version: 1.0 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_Cana?= =?utf-8?q?l?= , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241109_043531_618817_0E0F5F04 X-CRM114-Status: GOOD ( 12.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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..c686671e4850a1af75b82995185ffc3cbb22a447 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, } 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 = bridge->driver_private; - unsigned long long rate; - rate = 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; } @@ -510,7 +508,7 @@ static const struct drm_bridge_funcs dw_hdmi_qp_bridge_funcs = { .atomic_disable = dw_hdmi_qp_bridge_atomic_disable, .detect = dw_hdmi_qp_bridge_detect, .edid_read = dw_hdmi_qp_bridge_edid_read, - .mode_valid = dw_hdmi_qp_bridge_mode_valid, + .hdmi_tmds_char_rate_valid = dw_hdmi_qp_bridge_tmds_char_rate_valid, .hdmi_clear_infoframe = dw_hdmi_qp_bridge_clear_infoframe, .hdmi_write_infoframe = dw_hdmi_qp_bridge_write_infoframe, }; From patchwork Sat Nov 9 12:35:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13869619 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A476AD5E369 for ; Sat, 9 Nov 2024 12:50:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=L+pN3XKvVFmetq3YJbHAkykp748W6pEN5H4vcdcbZbk=; b=oAOsvK7ehykwf25cPLWChWVVMi fmpKMJttka1RDGcE8lEoAKuVs5lmVT+a2LvE2HeEpYci/+gD3rkuDiIFh+0L4b5Y0ulPk2hUIdZra peXtxtancMnabziIrpwM1jj6SVC81UMGrYew61bfVAD+/moScsTTULChDoGnOYTrGyjuGBEIsRwz6 t7+natjhl3kJg22HdG3aTePp0R1XW15NSNyYzu7QEazNZhtqzJwGA7XfMW+b41Or5CNbWaXfnbNa5 35ISA3xG7mZWtaSuW9ZbSSy6G1wYOzjZt4tLwf110ns2fDW3hhk9hw618TGMGQ7RJaJRL1M1r31KN ++klYV9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9kuY-0000000DLR5-08F0; Sat, 09 Nov 2024 12:49:54 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9kgg-0000000DJBJ-0pJQ for linux-arm-kernel@lists.infradead.org; Sat, 09 Nov 2024 12:35:36 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-539e13375d3so3656334e87.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=lists.infradead.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=Y0iUcy3IVBUWYbkbCoCD7qYKdA9oLOJqtMCYE+KVlkt1DNu3P0ScbOloLvLOJTLh2R zYP3+JSUNmGx4u7JQ0V2RizrJPf6QZPlvG3XufDndhLV1jBW0aegaZEY5SRcW6FEC7Mo d1pSS3P6vZal+Zgz/ZXk5x6yyqm8G0UFTBNFDFPoLq+uxjwUyu9O/YGDDPMcDL8HmHL3 P9kf7Pd5qCrL/7heLdPmNo9P/jxSuHMGl6V7GWBPX9mRPZPBFJMivZBA0PJw7jh3I8OK goFdp6ZhId0wRI91zgvR1mbnWKSeYRihkm86hIEIHyB9LY7V/qIUzgnJGELeTA+5/NtH roVQ== 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=vLgjZ1mw2Gvn7Z+wVYx1eiqlZDfUd1IBEAz+71EsE7z/Gny9M6DZ7VYPM9Z4UrOtsp P83wBq6mbtQZoXPShjJO6xgvyU69ZNOoC5TxKUxCrP7uEAKl8ijA/vDIEcrahv72IWKP txQ18uxTyX2YZhvBPK84dZvvfOJViyi5n3vSVrIdtaJVPV2q5ugy3JD1l3nIiTbBkuXY 05F91liOPPd4OFbwHXY+jRSfHZOxd8W3ekiYYnBOjCY1Mx5JBwQdANHHR91lyYJ0hLw/ NnaEbuh9QLwRt5oI074lx6hJ0DAgk/iyqPgGSJufudXZFv5lunNq7vXYfQ+ILaK8gqQC lc9g== X-Forwarded-Encrypted: i=1; AJvYcCVhmR/VaponaHGFymLLrZtt/bkHGSxN8kgEHM0SMtg0lz/8X9dXu7TNYC7M116TdghIW6/DA02QazEY+OXb8uko@lists.infradead.org X-Gm-Message-State: AOJu0Yxe3kTKx1nSLFwbSJ79msTHfRN8bq9EOnl6wiJBZePy4Gcj+TRa bKDIIOHctzkpBQC1e0FBY6MG0ZHsqpQUqJYGsDRMzo+GiDbpizSOn2n7jcrRWok= 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() MIME-Version: 1.0 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_Cana?= =?utf-8?q?l?= , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241109_043534_332409_8E783E2F X-CRM114-Status: GOOD ( 12.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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..b05fd77870b00aac97d003f3fb9c2b98cb73abc0 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_connector *connector, return MODE_NOCLOCK; } -static int sun4i_hdmi_connector_atomic_check(struct drm_connector *connector, - struct drm_atomic_state *state) -{ - struct drm_connector_state *conn_state = - drm_atomic_get_new_connector_state(state, connector); - struct drm_crtc *crtc = conn_state->crtc; - struct drm_crtc_state *crtc_state = crtc->state; - struct drm_display_mode *mode = &crtc_state->adjusted_mode; - enum drm_mode_status status; - - status = sun4i_hdmi_connector_clock_valid(connector, mode, - conn_state->hdmi.tmds_char_rate); - if (status != MODE_OK) - return -EINVAL; - - return 0; -} - static int sun4i_hdmi_get_modes(struct drm_connector *connector) { struct sun4i_hdmi *hdmi = drm_connector_to_sun4i_hdmi(connector); @@ -258,7 +240,7 @@ static const struct drm_connector_hdmi_funcs sun4i_hdmi_hdmi_connector_funcs = { }; static const struct drm_connector_helper_funcs sun4i_hdmi_connector_helper_funcs = { - .atomic_check = sun4i_hdmi_connector_atomic_check, + .atomic_check = drm_atomic_helper_connector_hdmi_check, .mode_valid = drm_hdmi_connector_mode_valid, .get_modes = sun4i_hdmi_get_modes, };