Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5b6aedd2 authored by Narender Ankam's avatar Narender Ankam
Browse files

disp: msm: dp: parse displayport label dt property



Add logic in DP driver to parse "label" dt property.
This info will be useful to configure DP as primary
or secondary.

Change-Id: I708179c5940c82256034bc6c8338b01ee52f2f79
Signed-off-by: default avatarNarender Ankam <nankam@codeaurora.org>
parent 1ff0a561
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/module.h>
@@ -2570,6 +2570,27 @@ static int dp_display_config_hdr(struct dp_display *dp_display, void *panel,
		core_clk_rate, flush_hdr);
}

static int dp_display_get_display_type(struct dp_display *dp_display,
		const char **display_type)
{
	struct dp_display_private *dp;

	if (!dp_display || !display_type) {
		pr_err("invalid input\n");
		return -EINVAL;
	}

	dp = container_of(dp_display, struct dp_display_private, dp_display);

	*display_type = dp->parser->display_type;

	if (!strcmp(*display_type, "primary"))
		dp_display->is_primary = true;

	return 0;
}


static int dp_display_setup_colospace(struct dp_display *dp_display,
		void *panel,
		u32 colorspace)
@@ -3100,6 +3121,7 @@ static int dp_display_probe(struct platform_device *pdev)
	g_dp_display->post_open     = NULL;
	g_dp_display->post_init     = dp_display_post_init;
	g_dp_display->config_hdr    = dp_display_config_hdr;
	g_dp_display->get_display_type = dp_display_get_display_type;
	g_dp_display->mst_install   = dp_display_mst_install;
	g_dp_display->mst_uninstall = dp_display_mst_uninstall;
	g_dp_display->mst_connector_install = dp_display_mst_connector_install;
+4 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 */

#ifndef _DP_DISPLAY_H_
@@ -72,6 +72,7 @@ struct dp_display {
	u32 max_pclk_khz;
	u32 no_mst_encoder;
	void *dp_mst_prv_info;
	bool is_primary;

	int (*enable)(struct dp_display *dp_display, void *panel);
	int (*post_enable)(struct dp_display *dp_display, void *panel);
@@ -126,6 +127,8 @@ struct dp_display {
			struct drm_connector *connector, char *pps_cmd);
	void (*wakeup_phy_layer)(struct dp_display *dp_display,
			bool wakeup);
	int (*get_display_type)(struct dp_display *dp_display,
			const char **display_type);
};

#ifdef CONFIG_DRM_MSM_DP
+14 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019, 2021, The Linux Foundation. All rights reserved.
 */

#include <drm/drm_atomic_helper.h>
@@ -580,6 +580,19 @@ int dp_connector_get_modes(struct drm_connector *connector,
	return rc;
}

int dp_connnector_set_info_blob(struct drm_connector *connector,
		void *info, void *display, struct msm_mode_info *mode_info)
{
	struct dp_display *dp_display = display;
	const char *display_type = NULL;

	dp_display->get_display_type(dp_display, &display_type);
	sde_kms_info_add_keystr(info,
			"display type", display_type);

	return 0;
}

int dp_drm_bridge_init(void *data, struct drm_encoder *encoder)
{
	int rc = 0;
+20 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019, 2021, The Linux Foundation. All rights reserved.
 */

#ifndef _DP_DRM_H_
@@ -177,6 +177,18 @@ int dp_mst_init(struct dp_display *dp_display);
 * @display: Pointer to private display structure
 */
void dp_mst_deinit(struct dp_display *dp_display);

/**
 * dp_conn_set_info_blob - callback to perform info blob initialization
 * @connector: Pointer to drm connector structure
 * @info: Pointer to sde connector info structure
 * @display: Pointer to private display handle
 * @mode_info: Pointer to mode info structure
 * Returns: Zero on success
 */
int dp_connnector_set_info_blob(struct drm_connector *connector,
		void *info, void *display, struct msm_mode_info *mode_info);

#else
static inline int dp_connector_config_hdr(struct drm_connector *connector,
		void *display, struct sde_connector_state *c_state)
@@ -278,6 +290,13 @@ static inline int dp_mst_deinit(struct dp_display *dp_display)
{
	return 0;
}

int dp_connnector_set_info_blob(struct drm_connector *connector,
		void *info, void *display, struct msm_mode_info *mode_info)
{
	return 0;
}

#endif

#endif /* _DP_DRM_H_ */
+5 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/of_gpio.h>
@@ -166,6 +166,10 @@ static int dp_parser_misc(struct dp_parser *parser)
	if (rc)
		parser->max_lclk_khz = DP_MAX_LINK_CLK_KHZ;

	parser->display_type = of_get_property(of_node, "label", NULL);
	if (!parser->display_type)
		parser->display_type = "unknown";

	return 0;
}

Loading