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

Commit 91f29130 authored by Gopikrishnaiah Anandan's avatar Gopikrishnaiah Anandan Committed by Matt Wagantall
Browse files

mdss: mdp: sysfs node for ad notification



Assertive display(ad) feature needs to issue screen refresh when ambient
light or backlight changes. It needs multiple screen refreshes to ensure
that AD block strength is reached. Duration between each refresh should
be vsync interval. AD calc worker is scheduled from vsync handler which
can notify the AD userspace module via sysfs node

Change-Id: If9d688de0b5befec9adab262a6ec1182b2bd5a19
Signed-off-by: default avatarGopikrishnaiah Anandan <agopik@codeaurora.org>
parent 86317818
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -562,6 +562,7 @@ struct mdss_overlay_private {
	struct kernfs_node *vsync_event_sd;
	struct kernfs_node *hist_event_sd;
	struct kernfs_node *bl_event_sd;
	struct kernfs_node *ad_event_sd;
	int borderfill_enable;
	int overlay_play_enable;
	int hw_refresh;
@@ -602,6 +603,7 @@ struct mdss_overlay_private {
	u32 cursor_ndx[2];
	u32 hist_events;
	u32 bl_events;
	u32 ad_events;
};

struct mdss_mdp_set_ot_params {
+22 −0
Original line number Diff line number Diff line
@@ -2701,6 +2701,18 @@ static ssize_t mdss_mdp_hist_show_event(struct device *dev,
	return ret;
}

static ssize_t mdss_mdp_ad_show_event(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct fb_info *fbi = dev_get_drvdata(dev);
	struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)fbi->par;
	struct mdss_overlay_private *mdp5_data = mfd_to_mdp5_data(mfd);
	int ret;

	ret = scnprintf(buf, PAGE_SIZE, "%d\n", mdp5_data->ad_events);
	return ret;
}

static inline int mdss_mdp_ad_is_supported(struct msm_fb_data_type *mfd)
{
	struct mdss_mdp_ctl *ctl = mfd_to_ctl(mfd);
@@ -2917,6 +2929,7 @@ static DEVICE_ATTR(dyn_pu, S_IRUGO | S_IWUSR | S_IWGRP, mdss_mdp_dyn_pu_show,
	mdss_mdp_dyn_pu_store);
static DEVICE_ATTR(hist_event, S_IRUGO, mdss_mdp_hist_show_event, NULL);
static DEVICE_ATTR(bl_event, S_IRUGO, mdss_mdp_bl_show_event, NULL);
static DEVICE_ATTR(ad_event, S_IRUGO, mdss_mdp_ad_show_event, NULL);

static struct attribute *mdp_overlay_sysfs_attrs[] = {
	&dev_attr_vsync_event.attr,
@@ -2925,6 +2938,7 @@ static struct attribute *mdp_overlay_sysfs_attrs[] = {
	&dev_attr_msm_cmd_autorefresh_en.attr,
	&dev_attr_hist_event.attr,
	&dev_attr_bl_event.attr,
	&dev_attr_ad_event.attr,
	NULL,
};

@@ -4906,6 +4920,14 @@ int mdss_mdp_overlay_init(struct msm_fb_data_type *mfd)
		goto init_fail;
	}

	mdp5_data->ad_event_sd = sysfs_get_dirent(dev->kobj.sd,
							 "ad_event");
	if (!mdp5_data->ad_event_sd) {
		pr_err("ad_event sysfs lookup failed\n");
		rc = -ENODEV;
		goto init_fail;
	}

	rc = sysfs_create_link_nowarn(&dev->kobj,
			&mdp5_data->mdata->pdev->dev.kobj, "mdp");
	if (rc)
+7 −1
Original line number Diff line number Diff line
@@ -5351,6 +5351,7 @@ static void pp_ad_calc_worker(struct work_struct *work)
	struct mdss_ad_info *ad;
	struct mdss_mdp_ctl *ctl;
	struct msm_fb_data_type *mfd, *bl_mfd;
	struct mdss_overlay_private *mdp5_data;
	struct mdss_data_type *mdata;
	char __iomem *base;
	u32 calc_done = 0;
@@ -5365,13 +5366,13 @@ static void pp_ad_calc_worker(struct work_struct *work)
	bl_mfd = ad->bl_mfd;
	ctl = mfd_to_ctl(ad->mfd);
	mdata = mfd_to_mdata(ad->mfd);
	mdp5_data = mfd_to_mdp5_data(mfd);

	if (!mdata || ad->calc_hw_num >= mdata->nad_cfgs) {
		mutex_unlock(&ad->lock);
		return;
	}


	base = mdata->ad_off[ad->calc_hw_num].base;

	if ((ad->cfg.mode == MDSS_AD_MODE_AUTO_STR) && (ad->last_bl == 0)) {
@@ -5410,6 +5411,11 @@ static void pp_ad_calc_worker(struct work_struct *work)
	if (!ad->calc_itr) {
		ad->state &= ~PP_AD_STATE_VSYNC;
		ctl->ops.remove_vsync_handler(ctl, &ad->handle);
	} else {
		if (mdp5_data) {
			mdp5_data->ad_events++;
			sysfs_notify_dirent(mdp5_data->ad_event_sd);
		}
	}
	mutex_unlock(&ad->lock);
	/* dspp3 doesn't have ad attached to it so following is safe */