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

Commit 05ccf7d2 authored by osaisruj's avatar osaisruj
Browse files

disp: msm: sde: add twm mode sysfs mode



Add sysfs node on connector to get twm enable
state. This node is used by the HAL to notify TWM
entry and exit.

Change-Id: I56a844076014c2e12075756f6b1bc42b91b48ad1
Signed-off-by: default avatarosaisruj <osaisruj@codeaurora.org>
parent 0dd45aa2
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -2860,10 +2860,46 @@ static ssize_t panel_power_state_show(struct device *device,
	return scnprintf(buf, PAGE_SIZE, "%d\n", sde_conn->last_panel_power_mode);
}

static ssize_t twm_enable_store(struct device *device,
	struct device_attribute *attr, const char *buf, size_t count)
{
	struct drm_connector *conn;
	struct sde_connector *sde_conn;
	int rc;
	int data;

	conn = dev_get_drvdata(device);
	sde_conn = to_sde_connector(conn);

	rc = kstrtoint(buf, 10, &data);
	if (rc) {
		SDE_ERROR("kstrtoint failed, rc =%d\n", rc);
		return -EINVAL;
	}
	sde_conn->twm_en = data ? true : false;
	SDE_DEBUG("TWM: %s\n", sde_conn->twm_en ? "ENABLED" : "DISABLED");
	return count;
}

static ssize_t twm_enable_show(struct device *device,
	struct device_attribute *attr, char *buf)
{
	struct drm_connector *conn;
	struct sde_connector *sde_conn;

	conn = dev_get_drvdata(device);
	sde_conn = to_sde_connector(conn);

	SDE_DEBUG("TWM: %s\n", sde_conn->twm_en ? "ENABLED" : "DISABLED");
	return scnprintf(buf, PAGE_SIZE, "%d\n", sde_conn->twm_en);
}

static DEVICE_ATTR_RO(panel_power_state);
static DEVICE_ATTR_RW(twm_enable);

static struct attribute *sde_connector_dev_attrs[] = {
	&dev_attr_panel_power_state.attr,
	&dev_attr_twm_enable.attr,
	NULL
};

@@ -2958,6 +2994,7 @@ struct drm_connector *sde_connector_init(struct drm_device *dev,
	c_conn->dpms_mode = DRM_MODE_DPMS_ON;
	c_conn->lp_mode = 0;
	c_conn->last_panel_power_mode = SDE_MODE_DPMS_ON;
	c_conn->twm_en = false;

	sde_kms = to_sde_kms(priv->kms);
	if (sde_kms->vbif[VBIF_NRT]) {
+2 −0
Original line number Diff line number Diff line
@@ -470,6 +470,7 @@ struct sde_connector_dyn_hdr_metadata {
 * @esd_status_interval: variable to change ESD check interval in millisec
 * @panel_dead: Flag to indicate if panel has gone bad
 * @esd_status_check: Flag to indicate if ESD thread is scheduled or not
 * @twm_en: Flag to indicate if TWM mode is enabled or not
 * @bl_scale_dirty: Flag to indicate PP BL scale value(s) is changed
 * @bl_scale: BL scale value for ABA feature
 * @bl_scale_sv: BL scale value for sunlight visibility feature
@@ -533,6 +534,7 @@ struct sde_connector {
	u32 esd_status_interval;
	bool panel_dead;
	bool esd_status_check;
	bool twm_en;

	bool bl_scale_dirty;
	u32 bl_scale;