Sfoglia il codice sorgente

disp: msm: dsi: add support to update brightness through drm prop

Add support to update display brightness through drm property.

Change-Id: I1954e040060a00014aae2486700dbf270147c6b0
Signed-off-by: Anand Tarakh <[email protected]>
Anand Tarakh 1 anno fa
parent
commit
3c4efe4bd4
2 ha cambiato i file con 16 aggiunte e 0 eliminazioni
  1. 1 0
      msm/msm_drv.h
  2. 15 0
      msm/sde/sde_connector.c

+ 1 - 0
msm/msm_drv.h

@@ -237,6 +237,7 @@ enum msm_mdp_conn_property {
 	CONNECTOR_PROP_DIMMING_MIN_BL,
 	CONNECTOR_PROP_EARLY_FENCE_LINE,
 	CONNECTOR_PROP_DYN_TRANSFER_TIME,
+	CONNECTOR_PROP_BRIGHTNESS,
 
 	/* enum/bitmask properties */
 	CONNECTOR_PROP_TOPOLOGY_NAME,

+ 15 - 0
msm/sde/sde_connector.c

@@ -956,6 +956,7 @@ static int _sde_connector_update_dirty_properties(
 	struct sde_connector *c_conn;
 	struct sde_connector_state *c_state;
 	int idx;
+	u32 b_lvl;
 
 	if (!connector) {
 		SDE_ERROR("invalid argument\n");
@@ -979,6 +980,11 @@ static int _sde_connector_update_dirty_properties(
 		case CONNECTOR_PROP_HDR_METADATA:
 			_sde_connector_update_hdr_metadata(c_conn, c_state);
 			break;
+		case CONNECTOR_PROP_BRIGHTNESS:
+			b_lvl = sde_connector_get_property(connector->state,
+						CONNECTOR_PROP_BRIGHTNESS);
+			backlight_device_set_brightness(c_conn->bl_device, b_lvl);
+			break;
 		default:
 			/* nothing to do for most properties */
 			break;
@@ -3323,6 +3329,15 @@ static int _sde_connector_install_properties(struct drm_device *dev,
 			ARRAY_SIZE(e_power_mode), 0,
 			CONNECTOR_PROP_LP);
 
+	if (connector_type == DRM_MODE_CONNECTOR_DSI) {
+		dsi_display = (struct dsi_display *)(display);
+		if (dsi_display && dsi_display->panel) {
+			msm_property_install_range(&c_conn->property_info, "brightness",
+			0x0, 0, dsi_display->panel->bl_config.brightness_max_level, 0,
+			CONNECTOR_PROP_BRIGHTNESS);
+		}
+	}
+
 	return 0;
 }