diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c index cb0fcbafb8b4..a183fd7cd247 100644 --- a/drivers/video/fbdev/msm/mdss_fb.c +++ b/drivers/video/fbdev/msm/mdss_fb.c @@ -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], diff --git a/drivers/video/fbdev/msm/mdss_hdmi_tx.c b/drivers/video/fbdev/msm/mdss_hdmi_tx.c index 04c7ec326a47..abc56f5f352d 100644 --- a/drivers/video/fbdev/msm/mdss_hdmi_tx.c +++ b/drivers/video/fbdev/msm/mdss_hdmi_tx.c @@ -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 { diff --git a/drivers/video/fbdev/msm/mdss_panel.h b/drivers/video/fbdev/msm/mdss_panel.h index 39380c63e6c6..3fc5b2226b3e 100644 --- a/drivers/video/fbdev/msm/mdss_panel.h +++ b/drivers/video/fbdev/msm/mdss_panel.h @@ -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; };