devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Kuogee Hsieh <quic_khsieh@quicinc.com>,
	dri-devel@lists.freedesktop.org, robdclark@gmail.com,
	sean@poorly.run, swboyd@chromium.org, dianders@chromium.org,
	vkoul@kernel.org, daniel@ffwll.ch, agross@kernel.org,
	andersson@kernel.org, konrad.dybcio@somainline.org,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	devicetree@vger.kernel.org, airlied@gmail.com
Cc: quic_abhinavk@quicinc.com, quic_sbillaka@quicinc.com,
	freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v14 3/5] drm/msm/dp: parse data-lanes as property of dp_out endpoint
Date: Fri, 16 Dec 2022 21:46:35 +0200	[thread overview]
Message-ID: <bfa99e8c-d413-b52f-f026-000720b01307@linaro.org> (raw)
In-Reply-To: <1671217893-17496-4-git-send-email-quic_khsieh@quicinc.com>

On 16/12/2022 21:11, Kuogee Hsieh wrote:
> Add capability to parser data-lanes as property of dp_out endpoint.
> Also retain the original capability to parser data-lanes as property
> of mdss_dp node to handle legacy case.
> 
> Changes in v6:
> -- first patch after split parser patch into two
> 
> Changes in v7:
> -- check "data-lanes" from endpoint first
> 
> Changes in v14:
> -- replace "parser" with "parse" at commit subject
> -- add matching brackets at dp_parser_misc()
> 
> Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>   drivers/gpu/drm/msm/dp/dp_parser.c | 25 +++++++++++++++++--------
>   1 file changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c
> index dd73221..d42987a 100644
> --- a/drivers/gpu/drm/msm/dp/dp_parser.c
> +++ b/drivers/gpu/drm/msm/dp/dp_parser.c
> @@ -94,16 +94,25 @@ static int dp_parser_ctrl_res(struct dp_parser *parser)
>   static int dp_parser_misc(struct dp_parser *parser)
>   {
>   	struct device_node *of_node = parser->pdev->dev.of_node;
> -	int len;
> -
> -	len = drm_of_get_data_lanes_count(of_node, 1, DP_MAX_NUM_DP_LANES);
> -	if (len < 0) {
> -		DRM_WARN("Invalid property \"data-lanes\", default max DP lanes = %d\n",
> -			 DP_MAX_NUM_DP_LANES);
> -		len = DP_MAX_NUM_DP_LANES;
> +	int cnt;
> +
> +	/*
> +	 * data-lanes is the property of dp_out endpoint
> +	 */
> +	cnt = drm_of_get_data_lanes_count_ep(of_node, 1, 0, 1, DP_MAX_NUM_DP_LANES);
> +	if (cnt > 0) {
> +		parser->max_dp_lanes = cnt;
> +	} else {
> +		/*
> +		 * legacy code, data-lanes is the property of mdss_dp node
> +		 */
> +		cnt = drm_of_get_data_lanes_count(of_node, 1, DP_MAX_NUM_DP_LANES);
> +		if (cnt > 0)
> +			parser->max_dp_lanes = cnt;
> +		else
> +			parser->max_dp_lanes = DP_MAX_NUM_DP_LANES; /* 4 lanes */

This bugged me for some time.

I think the following piece of code is easier to understand and handle:

cnt = drm_of_get_data_lanes_count_ep(...);

/* legacy, data-lanes property of the mdss_dp node */
if (cnt < 0)
     cnt = drm_of_get_data_lanes_count(.....);

if (cnt > 0)
     parser->max_dp_lanes = cnt;
else
     parser->max_dp_lanes = DP_MAX_NUM_DP_LANES;



>   	}
>   
> -	parser->max_dp_lanes = len;
>   	return 0;
>   }
>   

-- 
With best wishes
Dmitry


  reply	other threads:[~2022-12-16 19:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-16 19:11 [PATCH v14 0/5] Add data-lanes and link-frequencies to dp_out endpoint Kuogee Hsieh
2022-12-16 19:11 ` [PATCH v14 1/5] arm64: dts: qcom: add data-lanes and link-freuencies into " Kuogee Hsieh
2022-12-22 10:47   ` Krzysztof Kozlowski
2022-12-22 16:22     ` Kuogee Hsieh
2022-12-23  7:57       ` Krzysztof Kozlowski
2022-12-23 10:50         ` Dmitry Baryshkov
2022-12-16 19:11 ` [PATCH v14 2/5] dt-bindings: msm/dp: add data-lanes and link-frequencies property Kuogee Hsieh
2022-12-16 19:49   ` Dmitry Baryshkov
2022-12-16 19:11 ` [PATCH v14 3/5] drm/msm/dp: parse data-lanes as property of dp_out endpoint Kuogee Hsieh
2022-12-16 19:46   ` Dmitry Baryshkov [this message]
2022-12-16 19:11 ` [PATCH v14 4/5] drm/msm/dp: parse link-frequencies " Kuogee Hsieh
2022-12-16 19:11 ` [PATCH v14 5/5] drm/msm/dp: add support of max dp link rate Kuogee Hsieh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bfa99e8c-d413-b52f-f026-000720b01307@linaro.org \
    --to=dmitry.baryshkov@linaro.org \
    --cc=agross@kernel.org \
    --cc=airlied@gmail.com \
    --cc=andersson@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_khsieh@quicinc.com \
    --cc=quic_sbillaka@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=sean@poorly.run \
    --cc=swboyd@chromium.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).