Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp369773lqb; Fri, 24 May 2024 00:14:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXZIq2XE6yirMiYSVZbLzl5FX378tq2crgLnzs+r1+IN/0NPs9YXOKijb2nS/iA6Z8YjWx/9VTlXJL5Er8Mf33iSHZGvjG7poMezM5DDQ== X-Google-Smtp-Source: AGHT+IEcF+Ugilopn96vQj3WlRR/duM7+bRgAxE6+j6l1IbIIa78RTj+1dO2UTYhIw0GqHNFRy0T X-Received: by 2002:a05:620a:270a:b0:793:750:3d5e with SMTP id af79cd13be357-794ab087b3dmr200599585a.29.1716534865559; Fri, 24 May 2024 00:14:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716534865; cv=pass; d=google.com; s=arc-20160816; b=L8AHh6hIYR0qraXMiNaXkB97VKZEDL1CUKcYJiDfvIFM8KaLx5ByE5ybZulT0OfboW DTl+R4Pv/jOItk/W2RfJMMzgrPpmqz37lqj9V7J+eFHOnVREZn4CnHQSk9xO6Anq3JRk V1qXRrFieQV667XLTlDceYhNeFWz1tqUJ1CVjIt4o15WZ6ylYqNmNV24zNjePsikmw3n wz76wioeWcev5rqm8MKz9UpojgPvdDfvFWMKhp1t0l6u+Vr9viM0oOo5NNsIF8u9suTm tJxdJhD9K/nR87IoXn5vDFMZ2XgDDMmS47ZCqG5UKwd852HdRXP9uQspyFVqPjuypjUF 4mzg== 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=8oHVJyl8ghpLM7G3pdOUpqrr8DkSSfn80M8q5wk4pqk=; fh=mwonZAw0VYJg2V7uCCaXn3WjEI6MdhmMdkA8FkKyrz4=; b=JLUkU8jMDq8n6lFlU7+j5EULLwWTeHD8bKrLle5qY+471BAeCghmcV0V6dc/8/2qtJ XjNwJTcDy1VX2CjSxDH5PAc3Aw6vCJNyorsC/L9nhiWPlHsFOZWX4yMUTcVKdjLKIYnU Nq4DqSrlvxx5jhMAvTziA0sEF/yB5x3Ff1Dk9pNhlY/GEAiwUkaaus4sEXOv4a20ePpz qh5xhY7JHgOB+ux6xB06I/PNqmCfIkiOnjJCQp7VCt6xxAoqsuhj+dhuQvu/P96AXoRP 42a4d+hnRCD9HlueelSumZ7F4WBOysG5WMyLVsoM4a05cZ3VZFVjpB0vd3rVI3cA92ss HvfQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=YRLipYsQ; 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-188388-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188388-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794abcc70c0si93553085a.171.2024.05.24.00.14.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 00:14:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188388-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=YRLipYsQ; 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-188388-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188388-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 318711C2128F for ; Fri, 24 May 2024 07:14:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4F64E128830; Fri, 24 May 2024 07:14:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="YRLipYsQ" 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 5412E128375 for ; Fri, 24 May 2024 07:14:16 +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=1716534858; cv=none; b=VgmkbEI1Djjg2aOZHm34E/wY6NGD26yk3ggVNaEq9Y0nBUn8deZcvr4kpEL9/ecQr35IY1/aT2uqK46CilWLFCIfnD05lwfe7bleZEzP7CV66OoU/LiuB5VHBunVdNvBB8kecnv0r9nK84fdEGNZHDSKbpNzASjTmWG6JkmNb54= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716534858; c=relaxed/simple; bh=0JI5BU/swsWQORzJL1lmBAL79oZiu624rx4K6hFjWpQ=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=fptHp1dmxGgQeU3azUB2GakTgSoeNEn2mf2D7W+LkjcyP2KxYvcAKTFRiQa1ul8KUmz3xTnZBBPCE4q7kB1Q4YnlBdkuGGU7JrDkusvqGqVNFCkBTcpDGTgTk8oVi/cHHlXRaWoWWw0xY43JyDQF+nFQKMEJw+4yM42huKtztgs= 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=YRLipYsQ; 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 fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 44O7Dox9038123; Fri, 24 May 2024 02:13:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1716534830; bh=8oHVJyl8ghpLM7G3pdOUpqrr8DkSSfn80M8q5wk4pqk=; h=From:To:CC:Subject:Date; b=YRLipYsQ5DlNWe23I3s8/QqQSexeNUnX4Esle/lvtNZukNtySi1aCLRZpe44NzcVS pTA3Nle0vPLxO4jEk1740JP9wZD/Pra8IWFINU6MYCRsWGbtQgGGuym49sYVZAxf+q KV20Ah8/oRdOHf358bdzk45wZaXtIsYO8vFMkKvg= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 44O7DoNj086309 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 24 May 2024 02:13:50 -0500 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 24 May 2024 02:13:50 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE100.ent.ti.com (10.64.6.21) 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; Fri, 24 May 2024 02:13:49 -0500 Received: from localhost (jayesh-hp-probook-440-g8-notebook-pc.dhcp.ti.com [172.24.227.102] (may be forged)) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 44O7DnPu076318; Fri, 24 May 2024 02:13:49 -0500 From: Jayesh Choudhary To: , , , , , , , CC: , , , , , , , , , , , Subject: [PATCH] drm: bridge: cdns-mhdp8546: Add mode_valid hook for the drm_bridge_funcs Date: Fri, 24 May 2024 12:43:48 +0530 Message-ID: <20240524071348.106210-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. Add this hook in drm_bridge_funcs to validate the modes in this case as well. Signed-off-by: Jayesh Choudhary --- .../drm/bridge/cadence/cdns-mhdp8546-core.c | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 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..0aee038f5db7 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c @@ -1617,12 +1617,10 @@ 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) +static enum +drm_mode_status cdns_mhdp_mode_valid(struct cdns_mhdp_device *mhdp, + const 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, @@ -1635,6 +1633,16 @@ enum drm_mode_status cdns_mhdp_mode_valid(struct drm_connector *conn, return MODE_OK; } +static enum drm_mode_status +cdns_mhdp_connector_mode_valid(struct drm_connector *conn, + struct drm_display_mode *mode) +{ + struct cdns_mhdp_device *mhdp = connector_to_mhdp(conn); + const struct drm_display_mode *mod = mode; + + return cdns_mhdp_mode_valid(mhdp, mod); +} + static int cdns_mhdp_connector_atomic_check(struct drm_connector *conn, struct drm_atomic_state *state) { @@ -1678,7 +1686,7 @@ 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, + .mode_valid = cdns_mhdp_connector_mode_valid, .atomic_check = cdns_mhdp_connector_atomic_check, }; @@ -2233,6 +2241,16 @@ 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); + + return cdns_mhdp_mode_valid(mhdp, mode); +} + static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = { .atomic_enable = cdns_mhdp_atomic_enable, .atomic_disable = cdns_mhdp_atomic_disable, @@ -2247,6 +2265,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