From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2975C1DE4F1; Tue, 7 Jan 2025 09:30:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736242233; cv=none; b=nPl9PMZ6eava/gsaynaFLEsKBcUkd/2scgOzLx6lDnJPLlAACy6un6Z0PvAepO7Pvv4YUyQ2n8hxlZBcE4Hbshh/FzTgRxm2KFtOmYK+NxCM9crm1r+uC6haivrwRvBRvPnwXFUwCRxSIdVejekK7DFPeQp9IdNtrUAimRgqTtY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736242233; c=relaxed/simple; bh=faHcSgdF3E9ljSXlRVOQi+PPa9Gd2RrArQ5HFzl15S4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tBgaFOC/gjbnlQBOCPBpZ7U+fa6f+SJQtY/MRlNLGsBekfDYxK2fYdOe9VWXjA3YSJ2MhYXE3/DDpG6ppx6u0ZavTCuvCnm8OPHE1shUT/p4TB6CxsxiNY0uGPNmZIlgWC1062eLQE8cfNxz6+apeguPdsCGCOcjPmzH9c69VlY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sQIB3sMw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sQIB3sMw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B85FC4CED6; Tue, 7 Jan 2025 09:30:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736242232; bh=faHcSgdF3E9ljSXlRVOQi+PPa9Gd2RrArQ5HFzl15S4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sQIB3sMw4gmVXtgD+5YdawMKFcDfJQVad1wMKc39QsPkKJ0w8LVl6+ToWwqpZ3D8i wSNFNWwzNBrkx4vfNK/xL/y8JgZBvym4lF1OVs3GwkOU7eDnipCzJR4/M9RdIHKYH5 8s2OfJOE01m/31DOaaWHdvgKkN1PkrZWsMd/i6I8jdD6H5XdzqWu40lJV20vVrCuxA PIeOwWft41rEhREQEvmOKfp50+xrvnjvYcqHJpYhiYn/XVNVCvtNSpHtS6SKgH0mzD VJkbuxzF1cQuZu5mG3+tSVPYkM0XupewkMn/wybdO8AhxjR9HqFoakeN0kcHysOBFQ QPiF1ADxK2kJA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1tV5uv-000000006q9-3HKE; Tue, 07 Jan 2025 10:30:29 +0100 Date: Tue, 7 Jan 2025 10:30:29 +0100 From: Johan Hovold To: Abel Vesa Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Karol Herbst , Lyude Paul , Danilo Krummrich , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , Bjorn Andersson , Konrad Dybcio , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Johan Hovold Subject: Re: [PATCH v3 1/4] drm/dp: Add helper to set LTTPRs in transparent mode Message-ID: References: <20250103-drm-dp-msm-add-lttpr-transparent-mode-set-v3-0-5c367f4b0763@linaro.org> <20250103-drm-dp-msm-add-lttpr-transparent-mode-set-v3-1-5c367f4b0763@linaro.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <20250103-drm-dp-msm-add-lttpr-transparent-mode-set-v3-1-5c367f4b0763@linaro.org> On Fri, Jan 03, 2025 at 02:58:15PM +0200, Abel Vesa wrote: > According to the DisplayPort standard, LTTPRs have two operating > modes: > - non-transparent - it replies to DPCD LTTPR field specific AUX > requests, while passes through all other AUX requests > - transparent - it passes through all AUX requests. > > Switching between this two modes is done by the DPTX by issuing > an AUX write to the DPCD PHY_REPEATER_MODE register. > > Add a generic helper that allows switching between these modes. > > Also add a generic wrapper for the helper that handles the explicit > disabling of non-transparent mode and its disable->enable sequence > mentioned in the DP Standard v2.0 section 3.6.6.1. Do this in order > to move this handling out of the vendor specific driver implementation > into the generic framework. > > Tested-by: Johan Hovold > Signed-off-by: Abel Vesa > +/** > + * drm_dp_lttpr_init - init LTTPR transparency mode according to DP standard > + * > + * @aux: DisplayPort AUX channel > + * @lttpr_count: Number of LTTPRs. Between 0 and 8, according to DP standard. > + * Negative error code for any non-valid number. > + * See drm_dp_lttpr_count(). > + * > + * Returns 0 on success or a negative error code on failure. > + */ > +int drm_dp_lttpr_init(struct drm_dp_aux *aux, int lttpr_count) > +{ > + int ret; > + > + if (!lttpr_count) > + return 0; > + > + /* > + * See DP Standard v2.0 3.6.6.1 about the explicit disabling of > + * non-transparent mode and the disable->enable non-transparent mode > + * sequence. > + */ > + ret = drm_dp_lttpr_set_transparent_mode(aux, true); > + if (ret) > + return ret; > + > + if (lttpr_count < 0) > + return -ENODEV; > + > + /* > + * Roll-back to tranparent mode if setting non-tranparent mode failed typo: transparent (2x) > + */ I think this comment now needs to go inside the conditional, if you want to keep it at all. > + if (drm_dp_lttpr_set_transparent_mode(aux, false)) { > + drm_dp_lttpr_set_transparent_mode(aux, true); > + return -EINVAL; > + } > + > + return 0; > +} > +EXPORT_SYMBOL(drm_dp_lttpr_init); This looks much better to me now, so with the above addressed: Reviewed-by: Johan Hovold