[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE-0n51G3sUbGftFr5RTsM2xwxCDW3y0N9KzAsZrSQX09_N0GA@mail.gmail.com>
Date: Tue, 13 Dec 2022 15:18:02 -0800
From: Stephen Boyd <swboyd@...omium.org>
To: Kuogee Hsieh <quic_khsieh@...cinc.com>, agross@...nel.org,
airlied@...il.com, andersson@...nel.org, daniel@...ll.ch,
devicetree@...r.kernel.org, dianders@...omium.org,
dmitry.baryshkov@...aro.org, dri-devel@...ts.freedesktop.org,
konrad.dybcio@...ainline.org, krzysztof.kozlowski+dt@...aro.org,
robdclark@...il.com, robh+dt@...nel.org, sean@...rly.run,
vkoul@...nel.org
Cc: quic_abhinavk@...cinc.com, quic_sbillaka@...cinc.com,
freedreno@...ts.freedesktop.org, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v12 4/5] drm/msm/dp: parser link-frequencies as property
of dp_out endpoint
Quoting Kuogee Hsieh (2022-12-13 13:44:07)
> Add capability to parser and retrieve max DP link supported rate from
to parse
> link-frequencies property of dp_out endpoint.
>
> Changes in v6:
> -- second patch after split parser patch into two patches
>
> Changes in v7:
> -- without checking cnt against DP_MAX_NUM_DP_LANES to retrieve link rate
>
> Changes in v9:
> -- separate parser link-frequencies out of data-lanes
>
> Changes in v10:
> -- add dp_parser_link_frequencies()
>
> Changes in v11:
> -- return 0 if(!endpoint)
>
> Changes in v12:
> -- replace khz with kbytes at dp_parser.h
>
> Signed-off-by: Kuogee Hsieh <quic_khsieh@...cinc.com>
> ---
Same parser in subject.
> drivers/gpu/drm/msm/dp/dp_parser.c | 27 +++++++++++++++++++++++++++
> drivers/gpu/drm/msm/dp/dp_parser.h | 2 ++
> 2 files changed, 29 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c
> index b5f7e70..5549495 100644
> --- a/drivers/gpu/drm/msm/dp/dp_parser.c
> +++ b/drivers/gpu/drm/msm/dp/dp_parser.c
> @@ -91,6 +91,29 @@ static int dp_parser_ctrl_res(struct dp_parser *parser)
> return 0;
> }
>
> +static u32 dp_parser_link_frequencies(struct device_node *of_node)
> +{
> + struct device_node *endpoint;
> + u64 frequency = 0;
> + int cnt = 0;
'cnt' doesn't need to be initialized here.
> +
> + endpoint = of_graph_get_endpoint_by_regs(of_node, 1, 0); /* port@1 */
> + if (!endpoint)
> + return 0;
> +
> + cnt = of_property_count_u64_elems(endpoint, "link-frequencies");
> +
> + if (cnt > 0)
> + of_property_read_u64_index(endpoint, "link-frequencies",
> + cnt - 1, &frequency);
> + of_node_put(endpoint);
> +
> + frequency /= 10; /* from symbol rate to link rate */
> + frequency /= 1000; /* kbytes */
Use do_div(frequency, 10 * 1000)? If you want comments it could maybe be
like this:
do_div(frequency,
10 * /* from symbol rate to link rate */
1000); /* kbytes */
> +
> + return frequency;
> +}
> +
Powered by blists - more mailing lists