mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 22:02:02 +00:00
drm/msm/dp: Add capability to parser and retrieve max DP link supported rate from 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 Changes in v14: -- replace "parser" with "parse" at commit subject -- use do_div() for 64 bits division Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Patchwork: https://patchwork.freedesktop.org/patch/516100/ Link: https://lore.kernel.org/r/1672163103-31254-5-git-send-email-quic_khsieh@quicinc.com Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
This commit is contained in:
parent
d25cfeeec0
commit
381518a167
2 changed files with 30 additions and 0 deletions
|
@ -91,6 +91,30 @@ static int dp_parser_ctrl_res(struct dp_parser *parser)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static u32 dp_parser_link_frequencies(struct device_node *of_node)
|
||||||
|
{
|
||||||
|
struct device_node *endpoint;
|
||||||
|
u64 frequency = 0;
|
||||||
|
int cnt;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
do_div(frequency,
|
||||||
|
10 * /* from symbol rate to link rate */
|
||||||
|
1000); /* kbytes */
|
||||||
|
|
||||||
|
return frequency;
|
||||||
|
}
|
||||||
|
|
||||||
static int dp_parser_misc(struct dp_parser *parser)
|
static int dp_parser_misc(struct dp_parser *parser)
|
||||||
{
|
{
|
||||||
struct device_node *of_node = parser->pdev->dev.of_node;
|
struct device_node *of_node = parser->pdev->dev.of_node;
|
||||||
|
@ -110,6 +134,10 @@ static int dp_parser_misc(struct dp_parser *parser)
|
||||||
else
|
else
|
||||||
parser->max_dp_lanes = DP_MAX_NUM_DP_LANES; /* 4 lanes */
|
parser->max_dp_lanes = DP_MAX_NUM_DP_LANES; /* 4 lanes */
|
||||||
|
|
||||||
|
parser->max_dp_link_rate = dp_parser_link_frequencies(of_node);
|
||||||
|
if (!parser->max_dp_link_rate)
|
||||||
|
parser->max_dp_link_rate = DP_LINK_RATE_HBR2;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#define DP_LABEL "MDSS DP DISPLAY"
|
#define DP_LABEL "MDSS DP DISPLAY"
|
||||||
#define DP_MAX_PIXEL_CLK_KHZ 675000
|
#define DP_MAX_PIXEL_CLK_KHZ 675000
|
||||||
#define DP_MAX_NUM_DP_LANES 4
|
#define DP_MAX_NUM_DP_LANES 4
|
||||||
|
#define DP_LINK_RATE_HBR2 540000 /* kbytes */
|
||||||
|
|
||||||
enum dp_pm_type {
|
enum dp_pm_type {
|
||||||
DP_CORE_PM,
|
DP_CORE_PM,
|
||||||
|
@ -119,6 +120,7 @@ struct dp_parser {
|
||||||
struct dp_io io;
|
struct dp_io io;
|
||||||
struct dp_display_data disp_data;
|
struct dp_display_data disp_data;
|
||||||
u32 max_dp_lanes;
|
u32 max_dp_lanes;
|
||||||
|
u32 max_dp_link_rate;
|
||||||
struct drm_bridge *next_bridge;
|
struct drm_bridge *next_bridge;
|
||||||
|
|
||||||
int (*parse)(struct dp_parser *parser);
|
int (*parse)(struct dp_parser *parser);
|
||||||
|
|
Loading…
Reference in a new issue