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

Commit 1e54d781 authored by Shashank Babu Chinta Venkata's avatar Shashank Babu Chinta Venkata
Browse files

msm: mdss: dsi: 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 afore mentioned parameters from device tree and exposes
this properties on sysfs node to read.

CRs-Fixed: 1095347
Change-Id: I039732d8c2a5fa98233647928283df8d9d3f3123
Signed-off-by: default avatarShashank Babu Chinta Venkata <sbchin@codeaurora.org>
parent 3d8ce6dd
Loading
Loading
Loading
Loading
+55 −0
Original line number Diff line number Diff line
@@ -1226,6 +1226,58 @@ void mdss_dsi_panel_dsc_pps_send(struct mdss_dsi_ctrl_pdata *ctrl,
	mdss_dsi_panel_cmds_send(ctrl, &pcmds, CMD_REQ_COMMIT);
}

static int mdss_dsi_parse_hdr_settings(struct device_node *np,
		struct mdss_panel_info *pinfo)
{
	int rc = 0;
	struct mdss_panel_hdr_properties *hdr_prop;

	if (!np) {
		pr_err("%s: device node pointer is NULL\n", __func__);
		return -EINVAL;
	}

	if (!pinfo) {
		pr_err("%s: panel info is NULL\n", __func__);
		return -EINVAL;
	}

	hdr_prop = &pinfo->hdr_properties;
	hdr_prop->hdr_enabled = of_property_read_bool(np,
		"qcom,mdss-dsi-panel-hdr-enabled");

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

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

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

static int mdss_dsi_parse_dsc_version(struct device_node *np,
		struct mdss_panel_timing *timing)
{
@@ -2602,6 +2654,9 @@ static int mdss_panel_parse_dt(struct device_node *np,
		"qcom,mdss-dsi-lane-3-state");

	rc = mdss_panel_parse_display_timings(np, &ctrl_pdata->panel_data);
	if (rc)
		return rc;
	rc = mdss_dsi_parse_hdr_settings(np, pinfo);
	if (rc)
		return rc;

+18 −2
Original line number Diff line number Diff line
@@ -566,7 +566,13 @@ static ssize_t mdss_fb_get_panel_info(struct device *dev,
			"min_fps=%d\nmax_fps=%d\npanel_name=%s\n"
			"primary_panel=%d\nis_pluggable=%d\ndisplay_id=%s\n"
			"is_cec_supported=%d\nis_pingpong_split=%d\n"
			"dfps_porch_mode=%d\npu_roi_cnt=%d\ndual_dsi=%d",
			"dfps_porch_mode=%d\npu_roi_cnt=%d\ndual_dsi=%d\n"
			"is_hdr_enabled=%d\n"
			"peak_brightness=%d\nblackness_level=%d\n"
			"white_chromaticity_x=%d\nwhite_chromaticity_y=%d\n"
			"red_chromaticity_x=%d\nred_chromaticity_y=%d\n"
			"green_chromaticity_x=%d\ngreen_chromaticity_y=%d\n"
			"blue_chromaticity_x=%d\nblue_chromaticity_y=%d\n",
			pinfo->partial_update_enabled,
			pinfo->roi_alignment.xstart_pix_align,
			pinfo->roi_alignment.width_pix_align,
@@ -580,7 +586,17 @@ static ssize_t mdss_fb_get_panel_info(struct device *dev,
			pinfo->is_pluggable, pinfo->display_id,
			pinfo->is_cec_supported, is_pingpong_split(mfd),
			dfps_porch_mode, pinfo->partial_update_enabled,
			is_panel_split(mfd));
			is_panel_split(mfd), pinfo->hdr_properties.hdr_enabled,
			pinfo->hdr_properties.peak_brightness,
			pinfo->hdr_properties.blackness_level,
			pinfo->hdr_properties.display_primaries[0],
			pinfo->hdr_properties.display_primaries[1],
			pinfo->hdr_properties.display_primaries[2],
			pinfo->hdr_properties.display_primaries[3],
			pinfo->hdr_properties.display_primaries[4],
			pinfo->hdr_properties.display_primaries[5],
			pinfo->hdr_properties.display_primaries[6],
			pinfo->hdr_properties.display_primaries[7]);

	return ret;
}
+19 −0
Original line number Diff line number Diff line
@@ -56,6 +56,9 @@ struct panel_id {
#define DSC_PPS_LEN		128
#define INTF_EVENT_STR(x)	#x

/* HDR propeties count */
#define DISPLAY_PRIMARIES_COUNT	8	/* WRGB x and y values*/

static inline const char *mdss_panel2str(u32 panel)
{
	static const char const *names[] = {
@@ -730,6 +733,19 @@ struct mdss_dsi_dual_pu_roi {
	bool enabled;
};

struct mdss_panel_hdr_properties {
	bool hdr_enabled;

	/* WRGB X and y values arrayed in format */
	/* [WX, WY, RX, RY, GX, GY, BX, BY] */
	u32 display_primaries[DISPLAY_PRIMARIES_COUNT];

	/* peak brightness supported by panel */
	u32 peak_brightness;
	/* Blackness level supported by panel */
	u32 blackness_level;
};

struct mdss_panel_info {
	u32 xres;
	u32 yres;
@@ -874,6 +890,9 @@ struct mdss_panel_info {

	/* stores initial adaptive variable refresh vtotal value */
	u32 saved_avr_vtotal;

	/* HDR properties of display panel*/
	struct mdss_panel_hdr_properties hdr_properties;
};

struct mdss_panel_timing {