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

Commit 898b1bf8 authored by Ping Li's avatar Ping Li
Browse files

drm/msm/sde: Add chromaticity values for HDR support



Add WRGB chromaticity values, peak brightness and blackness
level to panel information. This change also adds method to
parse these parameters from device tree and exposes them as
connector property.

Change-Id: I30dcebed85406a933afd007e56014c668901459e
Signed-off-by: default avatarPing Li <pingli@codeaurora.org>
parent defea4e8
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -341,6 +341,28 @@ Optional properties:
					2A/2B command.
- qcom,dcs-cmd-by-left:			Boolean to indicate that dcs command are sent
					through the left DSI controller only in a dual-dsi configuration
- qcom,mdss-dsi-panel-hdr-enabled:      Boolean to indicate HDR support in panel.
- qcom,mdss-dsi-panel-hdr-color-primaries:
                                        Array of 8 unsigned integers denoting chromaticity of panel.These
                                        values are specified in nits units. The value range is 0 through 50000.
                                        To obtain real chromacity, these values should be divided by factor of
                                        50000. The structure of array is defined in below order
                                        value 1: x value of white chromaticity of display panel
                                        value 2: y value of white chromaticity of display panel
                                        value 3: x value of red chromaticity of display panel
                                        value 4: y value of red chromaticity of display panel
                                        value 5: x value of green chromaticity of display panel
                                        value 6: y value of green chromaticity of display panel
                                        value 7: x value of blue chromaticity of display panel
                                        value 8: y value of blue chromaticity of display panel
- qcom,mdss-dsi-panel-peak-brightness:  Maximum brightness supported by panel.In absence of maximum value
                                        typical value becomes peak brightness. Value is specified in nits units.
                                        To obtain real peak brightness, this value should be divided by factor of
                                        10000.
- qcom,mdss-dsi-panel-blackness-level:  Blackness level supported by panel. Blackness level is defined as
                                        ratio of peak brightness to contrast. Value is specified in nits units.
                                        To obtain real blackness level, this value should be divided by factor of
                                        10000.
- qcom,mdss-dsi-lp11-init:		Boolean used to enable the DSI clocks and data lanes (low power 11)
					before issuing hardware reset line.
- qcom,mdss-dsi-init-delay-us:		Delay in microseconds(us) before performing any DSI activity in lp11
+50 −0
Original line number Diff line number Diff line
@@ -1970,6 +1970,52 @@ int dsi_panel_parse_dsc_params(struct dsi_panel *panel,
	return rc;
}

static int dsi_panel_parse_hdr_config(struct dsi_panel *panel,
				     struct device_node *of_node)
{

	int rc = 0;
	struct drm_panel_hdr_properties *hdr_prop;

	hdr_prop = &panel->hdr_props;
	hdr_prop->hdr_enabled = of_property_read_bool(of_node,
		"qcom,mdss-dsi-panel-hdr-enabled");

	if (hdr_prop->hdr_enabled) {
		rc = of_property_read_u32_array(of_node,
				"qcom,mdss-dsi-panel-hdr-color-primaries",
				hdr_prop->display_primaries,
				DISPLAY_PRIMARIES_MAX);
		if (rc) {
			pr_err("%s:%d, Unable to read color primaries,rc:%u",
					__func__, __LINE__, rc);
			hdr_prop->hdr_enabled = false;
			return rc;
		}

		rc = of_property_read_u32(of_node,
			"qcom,mdss-dsi-panel-peak-brightness",
			&(hdr_prop->peak_brightness));
		if (rc) {
			pr_err("%s:%d, Unable to read hdr brightness, rc:%u",
				__func__, __LINE__, rc);
			hdr_prop->hdr_enabled = false;
			return rc;
		}

		rc = of_property_read_u32(of_node,
			"qcom,mdss-dsi-panel-blackness-level",
			&(hdr_prop->blackness_level));
		if (rc) {
			pr_err("%s:%d, Unable to read hdr brightness, rc:%u",
				__func__, __LINE__, rc);
			hdr_prop->hdr_enabled = false;
			return rc;
		}
	}
	return 0;
}

struct dsi_panel *dsi_panel_get(struct device *parent,
				struct device_node *of_node)
{
@@ -2071,6 +2117,10 @@ struct dsi_panel *dsi_panel_get(struct device *parent,
	if (rc)
		pr_err("failed to parse panel jitter config, rc=%d\n", rc);

	rc = dsi_panel_parse_hdr_config(panel, of_node);
	if (rc)
		pr_err("failed to parse hdr config, rc=%d\n", rc);

	panel->panel_of_node = of_node;
	drm_panel_init(&panel->drm_panel);
	mutex_init(&panel->panel_lock);
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <linux/leds.h>
#include <drm/drm_panel.h>
#include <drm/drm_mipi_dsi.h>
#include <drm/msm_drm.h>

#include "dsi_defs.h"
#include "dsi_ctrl_hw.h"
@@ -173,6 +174,7 @@ struct dsi_panel {
	struct dsi_backlight_config bl_config;
	struct dsi_panel_reset_config reset_config;
	struct dsi_pinctrl_info pinctrl;
	struct drm_panel_hdr_properties hdr_props;

	bool lp11_init;
	bool ulps_enabled;
+1 −0
Original line number Diff line number Diff line
@@ -137,6 +137,7 @@ enum msm_mdp_crtc_property {
enum msm_mdp_conn_property {
	/* blob properties, always put these first */
	CONNECTOR_PROP_SDE_INFO,
	CONNECTOR_PROP_HDR_INFO,

	/* # of blob properties */
	CONNECTOR_PROP_BLOBCOUNT,
+23 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include "sde_connector.h"
#include <linux/backlight.h>
#include "dsi_drm.h"
#include "dsi_display.h"

#define BL_NODE_NAME_SIZE 32

@@ -227,6 +228,8 @@ static void sde_connector_destroy(struct drm_connector *connector)

	if (c_conn->blob_caps)
		drm_property_unreference_blob(c_conn->blob_caps);
	if (c_conn->blob_hdr)
		drm_property_unreference_blob(c_conn->blob_hdr);
	msm_property_destroy(&c_conn->property_info);

	drm_connector_unregister(connector);
@@ -666,6 +669,7 @@ struct drm_connector *sde_connector_init(struct drm_device *dev,
	struct sde_kms *sde_kms;
	struct sde_kms_info *info;
	struct sde_connector *c_conn = NULL;
	struct dsi_display *dsi_display;
	int rc;

	if (!dev || !dev->dev_private || !encoder) {
@@ -781,6 +785,23 @@ struct drm_connector *sde_connector_init(struct drm_device *dev,
		kfree(info);
	}

	if (connector_type == DRM_MODE_CONNECTOR_DSI) {
		dsi_display = (struct dsi_display *)(display);
		if (dsi_display && dsi_display->panel &&
			dsi_display->panel->hdr_props.hdr_enabled == true) {
			msm_property_install_blob(&c_conn->property_info,
				"hdr_properties",
				DRM_MODE_PROP_IMMUTABLE,
				CONNECTOR_PROP_HDR_INFO);

			msm_property_set_blob(&c_conn->property_info,
				&c_conn->blob_hdr,
				&dsi_display->panel->hdr_props,
				sizeof(dsi_display->panel->hdr_props),
				CONNECTOR_PROP_HDR_INFO);
		}
	}

	msm_property_install_range(&c_conn->property_info, "RETIRE_FENCE",
			0x0, 0, INR_OPEN_MAX, 0, CONNECTOR_PROP_RETIRE_FENCE);

@@ -810,6 +831,8 @@ struct drm_connector *sde_connector_init(struct drm_device *dev,
error_destroy_property:
	if (c_conn->blob_caps)
		drm_property_unreference_blob(c_conn->blob_caps);
	if (c_conn->blob_hdr)
		drm_property_unreference_blob(c_conn->blob_hdr);
	msm_property_destroy(&c_conn->property_info);
error_cleanup_fence:
	sde_fence_deinit(&c_conn->retire_fence);
Loading