Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1169562lqb; Thu, 30 May 2024 02:18:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXdRINwZdQjhNf4XI6Rjz1aPkEAtlQZLvnT28e2saonuDhHrPMRs2a2RdbccYLTZhhepBRGei+sNtrHulGq2xyB2oWHn9KY9t9gM2Mn7Q== X-Google-Smtp-Source: AGHT+IE7jvvm9MnI9+dlk0mOnSgppHY6Q5BGY4EdNzO87VVNFOI54T9ME09Qg3CkirRJCL5HKDV6 X-Received: by 2002:a05:6358:6503:b0:199:34c3:2328 with SMTP id e5c5f4694b2df-199b960906bmr122776755d.30.1717060720625; Thu, 30 May 2024 02:18:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717060720; cv=pass; d=google.com; s=arc-20160816; b=gt9cxZkdCcqAn1F4FwiW3HRnjV1V3gdbpk4HmstVyoNv29Bo/EwGbnI9qTucyUOTTR Sw0QdVmbA4RdTkJJtWhQ565NOMPVsil17oVuB6m+Gh66W2HJ0DQ9htJZvNABehlvt7ty ROorXJr3BkM39Ciqz0EJs2x/0eMyCJyXGtwAw20OSkkb4Ye2il1/mZTSMnIpOC92J60G /OPFFIm8hYWU4VlbxvQJPZISYlOZD2SOMz3SoSauWpZj4hjAKkNZ7eCsW7RVv7VK8A2A oTiJnlvOxVXtDeDjNuxCqQQBEUo5qUupQailkVaO6gbv5vxpLQTejsdMqhjB2AH+YxMZ SFFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=nifFyWavGbEvmrxaSGZKNyaYc2U3Tro+G+/rqBFVG+g=; fh=RxFNbIjVHDpbUfdCH3lHsuZ0iVYPK6lpDSCAqOsAGE4=; b=rrPygb2qJCskYY7dd17xJB+kTxfsbZvnYXiLzwyyzWrQ1FsNeozW9omQUgo5MsThHZ oTTok67oEg0WX3V7p7c/zQr6wKLVIm2D3MptEccNlYu30HqGDmUJrBaN48ANMo3gA7mR 1T/FyN822DzkV+rUE4trbzFlnz6afUlXjUKlGQlDkNSjkKu4uQ3E8eRXJlHy2DRGDQUn VTfdp1DUovxJcyHxyI6Rw0yQmeIf9R/oEQjT4enx0ikzeaXRQlIt5VH4pbsJpl8Hy7Md p64A3JnEdkUwqIW/wohbm6hR5dN3OWFAmhT6PNNH57kTkfAASqRO3OPRzG/Wvs5dqpRM tXJw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="B4/28tsI"; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-195152-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195152-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c0e256b4basi613653a12.588.2024.05.30.02.18.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 02:18:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195152-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="B4/28tsI"; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-195152-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195152-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 410D5283BB3 for ; Thu, 30 May 2024 09:18:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E15796F30C; Thu, 30 May 2024 09:18:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="B4/28tsI" Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 447DA183999 for ; Thu, 30 May 2024 09:18:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.142 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717060711; cv=none; b=G2G7JJPZmleXUlykESyO4NBzkEeAywQt+zVfvDzND4bLIZTjjjZ3SIYhf3wcJbOxfZu7dHnrhvskJnHnKzEkYN1E7KHPhP9V7UseOobXhbcWcT2l3YmYVLe0hILayqNrgn9G0tQfgPiJ6apiElTpkKAOIodxZcPHfZfIpkDHE0I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717060711; c=relaxed/simple; bh=zO9ShCoFXelPtI8Jo03DMY5HzkzzcN1uFHRTYYZao1I=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=brSEWVkegnY8N5lqEoG6Yb39xK44ZKWn5Tu5S7uG+d9fwKCmRInIX3IIjYU2jgvZfm6ry/EHA/GkWVzE8ANO5Uf7n9QOazc+t9U9E30gTl1YewHk+LSLHKjf6fLzBiVicfhvheCirMYaMmEEE7CAOURXgYjaYkwoFrCfcZL59Ms= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=B4/28tsI; arc=none smtp.client-ip=198.47.19.142 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 44U9Hw9v027328; Thu, 30 May 2024 04:17:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1717060678; bh=nifFyWavGbEvmrxaSGZKNyaYc2U3Tro+G+/rqBFVG+g=; h=From:To:CC:Subject:Date; b=B4/28tsI/5vt1/dpnbWKj+V5F7NB11k3Da5dfEVdjUhyYuLiZuKDj+EBLRpbliRs+ xU45BkGkAMq6bH2wCHNuU9dr9qvMiFoScY8akAbFXD4MxRavY44xjkHH7nRjq2rGDh 8fOzgUOP41rBAcEANLW7zO4QhZLH99i93g2acRKI= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 44U9HwVH093381 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 30 May 2024 04:17:58 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 30 May 2024 04:17:58 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 30 May 2024 04:17:58 -0500 Received: from localhost (jayesh-hp-probook-440-g8-notebook-pc.dhcp.ti.com [172.24.227.102]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 44U9HvjQ058569; Thu, 30 May 2024 04:17:58 -0500 From: Jayesh Choudhary To: , , , , , , CC: , , , , , , , , , , , Subject: [PATCH v2] drm: bridge: cdns-mhdp8546: Move mode_valid hook to drm_bridge_funcs Date: Thu, 30 May 2024 14:47:57 +0530 Message-ID: <20240530091757.433106-1-j-choudhary@ti.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 With the support for the 'DRM_BRIDGE_ATTACH_NO_CONNECTOR' case, the connector_helper funcs are not initialized if the encoder has this flag in its bridge_attach call. Till now we had mode_valid hook only in the drm_connector_helper_funcs. Move this hook to drm_bridge_funcs to validate the modes. Signed-off-by: Jayesh Choudhary --- Changelog v1->v2: - Remove mode_valid hook from connector_helper_funcs as it is not required. (Function despite being identical has been moved below with other bridge_funcs instead of keeping it up with drm_connector_helper_funcs) v1 patch: .../drm/bridge/cadence/cdns-mhdp8546-core.c | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c index 8a91ef0ae065..8a6cd00a1443 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c @@ -1617,24 +1617,6 @@ bool cdns_mhdp_bandwidth_ok(struct cdns_mhdp_device *mhdp, return true; } -static -enum drm_mode_status cdns_mhdp_mode_valid(struct drm_connector *conn, - struct drm_display_mode *mode) -{ - struct cdns_mhdp_device *mhdp = connector_to_mhdp(conn); - - mutex_lock(&mhdp->link_mutex); - - if (!cdns_mhdp_bandwidth_ok(mhdp, mode, mhdp->link.num_lanes, - mhdp->link.rate)) { - mutex_unlock(&mhdp->link_mutex); - return MODE_CLOCK_HIGH; - } - - mutex_unlock(&mhdp->link_mutex); - return MODE_OK; -} - static int cdns_mhdp_connector_atomic_check(struct drm_connector *conn, struct drm_atomic_state *state) { @@ -1678,7 +1660,6 @@ static int cdns_mhdp_connector_atomic_check(struct drm_connector *conn, static const struct drm_connector_helper_funcs cdns_mhdp_conn_helper_funcs = { .detect_ctx = cdns_mhdp_connector_detect, .get_modes = cdns_mhdp_get_modes, - .mode_valid = cdns_mhdp_mode_valid, .atomic_check = cdns_mhdp_connector_atomic_check, }; @@ -2233,6 +2214,25 @@ static const struct drm_edid *cdns_mhdp_bridge_edid_read(struct drm_bridge *brid return cdns_mhdp_edid_read(mhdp, connector); } +static enum drm_mode_status +cdns_mhdp_bridge_mode_valid(struct drm_bridge *bridge, + const struct drm_display_info *info, + const struct drm_display_mode *mode) +{ + struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge); + + mutex_lock(&mhdp->link_mutex); + + if (!cdns_mhdp_bandwidth_ok(mhdp, mode, mhdp->link.num_lanes, + mhdp->link.rate)) { + mutex_unlock(&mhdp->link_mutex); + return MODE_CLOCK_HIGH; + } + + mutex_unlock(&mhdp->link_mutex); + return MODE_OK; +} + static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = { .atomic_enable = cdns_mhdp_atomic_enable, .atomic_disable = cdns_mhdp_atomic_disable, @@ -2247,6 +2247,7 @@ static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = { .edid_read = cdns_mhdp_bridge_edid_read, .hpd_enable = cdns_mhdp_bridge_hpd_enable, .hpd_disable = cdns_mhdp_bridge_hpd_disable, + .mode_valid = cdns_mhdp_bridge_mode_valid, }; static bool cdns_mhdp_detect_hpd(struct cdns_mhdp_device *mhdp, bool *hpd_pulse) -- 2.25.1