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

Commit 958e36a7 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: mdss: expose HDR information to panel sys node"

parents d7b12827 19a9088e
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -589,8 +589,8 @@ static ssize_t mdss_fb_get_panel_info(struct device *dev,
			"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\n"
			"is_hdr_enabled=%d\n"
			"peak_brightness=%d\nblackness_level=%d\n"
			"is_hdr_enabled=%d\npeak_brightness=%d\n"
			"blackness_level=%d\naverage_brightness=%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"
@@ -612,6 +612,7 @@ static ssize_t mdss_fb_get_panel_info(struct device *dev,
			is_panel_split(mfd), pinfo->hdr_properties.hdr_enabled,
			pinfo->hdr_properties.peak_brightness,
			pinfo->hdr_properties.blackness_level,
			pinfo->hdr_properties.avg_brightness,
			pinfo->hdr_properties.display_primaries[0],
			pinfo->hdr_properties.display_primaries[1],
			pinfo->hdr_properties.display_primaries[2],
+26 −0
Original line number Diff line number Diff line
@@ -2332,6 +2332,31 @@ static void hdmi_tx_update_deep_color(struct hdmi_tx_ctrl *hdmi_ctrl)
	}
}

static void hdmi_tx_update_hdr_info(struct hdmi_tx_ctrl *hdmi_ctrl)
{
	struct mdss_panel_info *pinfo = &hdmi_ctrl->panel_data.panel_info;
	struct mdss_panel_hdr_properties *hdr_prop = &pinfo->hdr_properties;
	struct hdmi_edid_hdr_data *hdr_data = NULL;

	/* CEA-861.3 4.2 */
	hdr_prop->hdr_enabled = hdmi_tx_is_hdr_supported(hdmi_ctrl);
	/* no display primaries in EDID, so skip it */
	memset(hdr_prop->display_primaries, 0,
		sizeof(hdr_prop->display_primaries));

	hdmi_edid_get_hdr_data(hdmi_tx_get_fd(HDMI_TX_FEAT_EDID), &hdr_data);

	if (hdr_prop->hdr_enabled) {
		hdr_prop->peak_brightness = hdr_data->max_luminance * 10000;
		if (hdr_data->avg_luminance != 0)
			hdr_prop->avg_brightness = 50 *
				(BIT(0) << (int)(hdr_data->avg_luminance / 32));
		hdr_prop->blackness_level = (hdr_data->min_luminance *
					hdr_data->min_luminance *
					hdr_data->max_luminance * 100) / 65025;
	}
}

static void hdmi_tx_hpd_int_work(struct work_struct *work)
{
	struct hdmi_tx_ctrl *hdmi_ctrl = NULL;
@@ -2360,6 +2385,7 @@ static void hdmi_tx_hpd_int_work(struct work_struct *work)
		if (!retry && rc)
			pr_warn_ratelimited("%s: EDID read failed\n", __func__);
		hdmi_tx_update_deep_color(hdmi_ctrl);
		hdmi_tx_update_hdr_info(hdmi_ctrl);

		hdmi_tx_send_cable_notification(hdmi_ctrl, true);
	} else {
+2 −0
Original line number Diff line number Diff line
@@ -754,6 +754,8 @@ struct mdss_panel_hdr_properties {

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