2022-12-13 22:04:55

by Kuogee Hsieh

[permalink] [raw]
Subject: [PATCH v12 3/5] drm/msm/dp: parser data-lanes as property of dp_out endpoint

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

Signed-off-by: Kuogee Hsieh <[email protected]>
Reviewed-by: Dmitry Baryshkov <[email protected]>
---
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..b5f7e70 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 */
}

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

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


2022-12-13 23:24:37

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH v12 3/5] drm/msm/dp: parser data-lanes as property of dp_out endpoint

Quoting Kuogee Hsieh (2022-12-13 13:44:06)
> 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
>
> Signed-off-by: Kuogee Hsieh <[email protected]>
> Reviewed-by: Dmitry Baryshkov <[email protected]>

Subject says "parser" when it probably should say "parse"?

> ---
> 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..b5f7e70 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 {

Please add brackets to the above if to match the 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 */
> }
>