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

Commit eac58634 authored by Venkata Prahlad Valluru's avatar Venkata Prahlad Valluru Committed by Gerrit - the friendly Code Review server
Browse files

video: fbdev: msm: add TWM mode sysfs node



Userspace SW will use this sysfs node to
notify TWM entry and exit.

Change-Id: I72730620ce7bca32439054e7ef3f17ae7fe29e19
Signed-off-by: default avatarVenkata Prahlad Valluru <vvalluru@codeaurora.org>
parent 6ae0f106
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, 2020, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -489,6 +489,7 @@ struct mdss_data_type {
	u32 min_prefill_lines; /* this changes within different chipsets */
	u32 min_prefill_lines; /* this changes within different chipsets */
	u32 props;
	u32 props;


	bool twm_en;
	int handoff_pending;
	int handoff_pending;
	bool idle_pc;
	bool idle_pc;
	struct mdss_perf_tune perf_tune;
	struct mdss_perf_tune perf_tune;
+43 −1
Original line number Original line Diff line number Diff line
/*
/*
 * MDSS MDP Interface (used by framebuffer core)
 * MDSS MDP Interface (used by framebuffer core)
 *
 *
 * Copyright (c) 2007-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2007-2018, 2020, The Linux Foundation. All rights reserved.
 * Copyright (C) 2007 Google Incorporated
 * Copyright (C) 2007 Google Incorporated
 *
 *
 * This software is licensed under the terms of the GNU General Public
 * This software is licensed under the terms of the GNU General Public
@@ -2632,13 +2632,55 @@ static ssize_t mdss_mdp_store_max_limit_bw(struct device *dev,
	return len;
	return len;
}
}


static ssize_t mdss_mdp_store_twm(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t len)
{
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();
	u32 data = -1;
	ssize_t rc = 0;

	if (!mdata) {
		pr_err("Invalid mdata structure\n");
		return -EINVAL;
	}

	rc = kstrtoint(buf, 10, &data);
	if (rc) {
		pr_err("kstrtoint failed. rc=%zd\n", rc);
		return rc;
	}
	mdata->twm_en = data ? true : false;
	pr_err("TWM :  %s\n", (mdata->twm_en) ?
		"ENABLED" : "DISABLED");
	return len;
}

static ssize_t mdss_mdp_show_twm(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();
	ssize_t ret = 0;

	if (!mdata) {
		pr_err("Invalid mdata structure\n");
		return -EINVAL;
	}

	pr_err("TWM :  %s\n", (mdata->twm_en) ?
		"ENABLED" : "DISABLED");
	ret = snprintf(buf, PAGE_SIZE, "%d\n", mdata->twm_en);
	return ret;
}

static DEVICE_ATTR(caps, 0444, mdss_mdp_show_capabilities, NULL);
static DEVICE_ATTR(caps, 0444, mdss_mdp_show_capabilities, NULL);
static DEVICE_ATTR(bw_mode_bitmap, 0664,
static DEVICE_ATTR(bw_mode_bitmap, 0664,
		mdss_mdp_read_max_limit_bw, mdss_mdp_store_max_limit_bw);
		mdss_mdp_read_max_limit_bw, mdss_mdp_store_max_limit_bw);
static DEVICE_ATTR(twm_enable, 0664, mdss_mdp_show_twm, mdss_mdp_store_twm);


static struct attribute *mdp_fs_attrs[] = {
static struct attribute *mdp_fs_attrs[] = {
	&dev_attr_caps.attr,
	&dev_attr_caps.attr,
	&dev_attr_bw_mode_bitmap.attr,
	&dev_attr_bw_mode_bitmap.attr,
	&dev_attr_twm_enable.attr,
	NULL
	NULL
};
};


+9 −2
Original line number Original line Diff line number Diff line
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, 2020, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -6566,6 +6566,13 @@ static void mdss_mdp_signal_retire_fence(struct msm_fb_data_type *mfd,
	pr_debug("Signaled (%d) pending retire fence\n", retire_cnt);
	pr_debug("Signaled (%d) pending retire fence\n", retire_cnt);
}
}


static bool mdss_mdp_is_twm_en(void)
{
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();

	return (mdata && mdata->twm_en);
}

int mdss_mdp_overlay_init(struct msm_fb_data_type *mfd)
int mdss_mdp_overlay_init(struct msm_fb_data_type *mfd)
{
{
	struct device *dev = mfd->fbi->dev;
	struct device *dev = mfd->fbi->dev;
@@ -6613,7 +6620,7 @@ int mdss_mdp_overlay_init(struct msm_fb_data_type *mfd)
	mdp5_interface->configure_panel = mdss_mdp_update_panel_info;
	mdp5_interface->configure_panel = mdss_mdp_update_panel_info;
	mdp5_interface->input_event_handler = mdss_mdp_input_event_handler;
	mdp5_interface->input_event_handler = mdss_mdp_input_event_handler;
	mdp5_interface->signal_retire_fence = mdss_mdp_signal_retire_fence;
	mdp5_interface->signal_retire_fence = mdss_mdp_signal_retire_fence;
	mdp5_interface->is_twm_en = NULL;
	mdp5_interface->is_twm_en = mdss_mdp_is_twm_en;


	if (mfd->panel_info->type == WRITEBACK_PANEL) {
	if (mfd->panel_info->type == WRITEBACK_PANEL) {
		mdp5_interface->atomic_validate =
		mdp5_interface->atomic_validate =