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

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

Merge "drm/msm/sde: add special handling for post-proc BL properties"

parents 5a4efb34 92377318
Loading
Loading
Loading
Loading
+34 −20
Original line number Diff line number Diff line
@@ -490,12 +490,10 @@ static int _sde_connector_update_power_locked(struct sde_connector *c_conn)
	return rc;
}

static int _sde_connector_update_bl_scale(struct sde_connector *c_conn, int idx)
static int _sde_connector_update_bl_scale(struct sde_connector *c_conn)
{
	struct drm_connector conn;
	struct dsi_display *dsi_display;
	struct dsi_backlight_config *bl_config;
	uint64_t value;
	int rc = 0;

	if (!c_conn) {
@@ -503,7 +501,6 @@ static int _sde_connector_update_bl_scale(struct sde_connector *c_conn, int idx)
		return -EINVAL;
	}

	conn = c_conn->base;
	dsi_display = c_conn->display;
	if (!dsi_display || !dsi_display->panel) {
		SDE_ERROR("Invalid params(s) dsi_display %pK, panel %pK\n",
@@ -513,22 +510,16 @@ static int _sde_connector_update_bl_scale(struct sde_connector *c_conn, int idx)
	}

	bl_config = &dsi_display->panel->bl_config;
	value = sde_connector_get_property(conn.state, idx);

	if (idx == CONNECTOR_PROP_BL_SCALE) {
		if (value > MAX_BL_SCALE_LEVEL)
	if (c_conn->bl_scale > MAX_BL_SCALE_LEVEL)
		bl_config->bl_scale = MAX_BL_SCALE_LEVEL;
	else
			bl_config->bl_scale = (u32)value;
	} else if (idx == CONNECTOR_PROP_AD_BL_SCALE) {
		if (value > MAX_AD_BL_SCALE_LEVEL)
		bl_config->bl_scale = c_conn->bl_scale;

	if (c_conn->bl_scale_ad > MAX_AD_BL_SCALE_LEVEL)
		bl_config->bl_scale_ad = MAX_AD_BL_SCALE_LEVEL;
	else
			bl_config->bl_scale_ad = (u32)value;
	} else {
		SDE_DEBUG("invalid idx %d\n", idx);
		return 0;
	}
		bl_config->bl_scale_ad = c_conn->bl_scale_ad;

	SDE_DEBUG("bl_scale = %u, bl_scale_ad = %u, bl_level = %u\n",
		bl_config->bl_scale, bl_config->bl_scale_ad,
@@ -570,7 +561,7 @@ int sde_connector_pre_kickoff(struct drm_connector *connector)
			break;
		case CONNECTOR_PROP_BL_SCALE:
		case CONNECTOR_PROP_AD_BL_SCALE:
			_sde_connector_update_bl_scale(c_conn, idx);
			_sde_connector_update_bl_scale(c_conn);
			break;
		default:
			/* nothing to do for most properties */
@@ -578,6 +569,12 @@ int sde_connector_pre_kickoff(struct drm_connector *connector)
		}
	}

	/* Special handling for postproc properties */
	if (c_conn->bl_scale_dirty) {
		_sde_connector_update_bl_scale(c_conn);
		c_conn->bl_scale_dirty = false;
	}

	if (!c_conn->ops.pre_kickoff)
		return 0;

@@ -1041,6 +1038,19 @@ static int sde_connector_atomic_set_property(struct drm_connector *connector,
		if (rc)
			SDE_ERROR_CONN(c_conn, "invalid roi_v1, rc: %d\n", rc);
		break;
	/* CONNECTOR_PROP_BL_SCALE and CONNECTOR_PROP_AD_BL_SCALE are
	 * color-processing properties. These two properties require
	 * special handling since they don't quite fit the current standard
	 * atomic set property framework.
	 */
	case CONNECTOR_PROP_BL_SCALE:
		c_conn->bl_scale = val;
		c_conn->bl_scale_dirty = true;
		break;
	case CONNECTOR_PROP_AD_BL_SCALE:
		c_conn->bl_scale_ad = val;
		c_conn->bl_scale_dirty = true;
		break;
	default:
		break;
	}
@@ -1913,6 +1923,10 @@ struct drm_connector *sde_connector_init(struct drm_device *dev,
		0x0, 0, MAX_AD_BL_SCALE_LEVEL, MAX_AD_BL_SCALE_LEVEL,
		CONNECTOR_PROP_AD_BL_SCALE);

	c_conn->bl_scale_dirty = false;
	c_conn->bl_scale = MAX_BL_SCALE_LEVEL;
	c_conn->bl_scale_ad = MAX_AD_BL_SCALE_LEVEL;

	/* enum/bitmask properties */
	msm_property_install_enum(&c_conn->property_info, "topology_name",
			DRM_MODE_PROP_IMMUTABLE, 0, e_topology_name,
+7 −0
Original line number Diff line number Diff line
@@ -287,6 +287,9 @@ struct sde_connector_evt {
 * @bl_device: backlight device node
 * @status_work: work object to perform status checks
 * @force_panel_dead: variable to trigger forced ESD recovery
 * @bl_scale_dirty: Flag to indicate PP BL scale value(s) is changed
 * @bl_scale: BL scale value for ABA feature
 * @bl_scale_ad: BL scale value for AD feature
 */
struct sde_connector {
	struct drm_connector base;
@@ -323,6 +326,10 @@ struct sde_connector {
	struct backlight_device *bl_device;
	struct delayed_work status_work;
	u32 force_panel_dead;

	bool bl_scale_dirty;
	u32 bl_scale;
	u32 bl_scale_ad;
};

/**