From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-m49238.qiye.163.com (mail-m49238.qiye.163.com [45.254.49.238]) (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 59A8933F377; Tue, 7 Jul 2026 06:29:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.254.49.238 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783405795; cv=none; b=MpVhyI9jTzvwnpgTTSrBNUWYmgmgpE3fQ7zWwKFnMReRCB3xq7qbfQT0Ll8Bk9U0izv+gQcdRIzfQ1kouW8lOWrWMQUhjQZBPCBtmBzRhGaP5+4XQ2slJunXr/XdUt07yQTar4szs2IrjTOJsRoWSh4sLgr6I8xeMZ8KjZe7F20= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783405795; c=relaxed/simple; bh=oOk/FBDpeTeb+T07zVCJJSLL4f+3EswxKkjSuLDBkRQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oCt9kukiJPpDL/TI4EcjcW1YIKnFTq8kYalRsMo5ofscIHLa01A+m0c8bGLhJZ0kZ8RHPxxZj5HIqbpkk1DzP2OSO+7EUAZ0fmeeaugytOKKJ2yyxj1m+dtHCi+QSoXDE6795uOmHkyTTzw0HCkROgNDiJJ2ceCoPCdrVm/EAYc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com; spf=pass smtp.mailfrom=rock-chips.com; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b=koHL70Yy; arc=none smtp.client-ip=45.254.49.238 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.b="koHL70Yy" Received: from zyb-HP-ProDesk-680-G2-MT.. (unknown [61.154.14.86]) by smtp.qiye.163.com (Hmail) with ESMTP id 452ef5832; Tue, 7 Jul 2026 12:07:19 +0800 (GMT+08:00) From: Damon Ding To: Andrzej Hajda , Neil Armstrong , Robert Foss , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sandy Huang , =?UTF-8?q?Heiko=20St=C3=BCbner?= , Andy Yan Cc: Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Dmitry Baryshkov , Marek Szyprowski , Sebastian Reichel , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Damon Ding Subject: [PATCH v6 2/5] drm/dp: Add helper to validate DP lane counts Date: Tue, 7 Jul 2026 12:06:10 +0800 Message-Id: <20260707040613.1992841-3-damon.ding@rock-chips.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260707040613.1992841-1-damon.ding@rock-chips.com> References: <20260707040613.1992841-1-damon.ding@rock-chips.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Tid: 0a9f3ac2496a03a8kunme8126cdf5bc75 X-HM-MType: 1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVkZSx5IVkpLShhJTx8aSUlLQ1YVFA kWGhdVEwETFhoSFyQUDg9ZV1kYEgtZQVlNSlVKTk9VSk9VQ01ZV1kWGg8SFR0UWUFZT0tIVUpLSU 9PT0hVSktLVUpCS0tZBg++ DKIM-Signature: a=rsa-sha256; b=koHL70Yy2rbsbm3CZpRjj1j7EvlqXB+rZQYjLgINLySwtAydfj4S9JTkFzxf/5EJlc+Swz77+y9xAcP5ImC6cAShrhGRV7xfwA2AvixN3v8RmxyYLNbwyDOTkY7X2bAH97IVc0fLNb7RX8bLHRqmQE7TWqPkujYnCmTvL9sGewU=; c=relaxed/relaxed; s=default; d=rock-chips.com; v=1; bh=lWH0Sk73+0p13PY6uyYH4gl84FiS6O5rP+nrrrsCjNY=; h=date:mime-version:subject:message-id:from; Add a generic helper function drm_dp_lane_count_is_valid() to check if a DisplayPort lane count is valid. According to the DP specification, only 1, 2, or 4 lanes are supported. This helper avoids duplicating DP lane count validation logic across individual DisplayPort drivers. Suggested-by: Luca Ceresoli Reviewed-by: Luca Ceresoli Signed-off-by: Damon Ding --- Changes in v6: - Add Reviewed-by tag. --- include/drm/display/drm_dp_helper.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h index 8c2d77a032f0..c904cb480d84 100644 --- a/include/drm/display/drm_dp_helper.h +++ b/include/drm/display/drm_dp_helper.h @@ -138,6 +138,12 @@ bool drm_dp_as_sdp_supported(struct drm_dp_aux *aux, const u8 dpcd[DP_RECEIVER_C int drm_dp_psr_setup_time(const u8 psr_cap[EDP_PSR_RECEIVER_CAP_SIZE]); +static inline bool +drm_dp_lane_count_is_valid(int lane_count) +{ + return lane_count == 1 || lane_count == 2 || lane_count == 4; +} + static inline int drm_dp_max_link_rate(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) { -- 2.34.1