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

Commit 82c22cba authored by raghavendra ambadas's avatar raghavendra ambadas
Browse files

msm: mdss: Add sysfs node for histogram notification



Add support for histogram notification to userspace
using sysfs node for mdp3 driver. Change adds a
histogram sysfs node for each framebuffer which will be
utilized to notify the clients.

Change-Id: I4203378f79bf7286eb40e76b269a471deed08478
Signed-off-by: default avatarRaghavendra Ambadas <rambad@codeaurora.org>
parent 30f04fcf
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -247,6 +247,13 @@ static void mdp3_vsync_retire_work_handler(struct work_struct *work)
	mdp3_vsync_retire_signal(mdp3_session->mfd, 1);
}

void mdp3_hist_intr_notify(struct mdp3_dma *dma)
{
	dma->hist_events++;
	sysfs_notify_dirent(dma->hist_event_sd);
	pr_debug("%s:: hist_events = %u\n", __func__, dma->hist_events);
}

void vsync_notify_handler(void *arg)
{
	struct mdp3_session_data *session = (struct mdp3_session_data *)arg;
@@ -392,6 +399,24 @@ static int mdp3_ctrl_blit_req(struct msm_fb_data_type *mfd, void __user *p)
	return rc;
}

static ssize_t mdp3_hist_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 mdp3_session_data *mdp3_session = NULL;
	struct mdp3_dma *dma = NULL;
	int ret;

	if (!mfd || !mfd->mdp.private1)
		return -EAGAIN;

	mdp3_session = (struct mdp3_session_data *)mfd->mdp.private1;
	dma = (struct mdp3_dma *)mdp3_session->dma;
	ret = scnprintf(buf, PAGE_SIZE, "%d\n", dma->hist_events);
	return ret;
}

static ssize_t mdp3_vsync_show_event(struct device *dev,
		struct device_attribute *attr, char *buf)
{
@@ -479,6 +504,7 @@ static ssize_t mdp3_dyn_pu_store(struct device *dev,
	return count;
}

static DEVICE_ATTR(hist_event, S_IRUGO, mdp3_hist_show_event, NULL);
static DEVICE_ATTR(vsync_event, S_IRUGO, mdp3_vsync_show_event, NULL);
static DEVICE_ATTR(packpattern, S_IRUGO, mdp3_packpattern_show, NULL);
static DEVICE_ATTR(dyn_pu, S_IRUGO | S_IWUSR | S_IWGRP, mdp3_dyn_pu_show,
@@ -487,6 +513,7 @@ static DEVICE_ATTR(dyn_pu, S_IRUGO | S_IWUSR | S_IWGRP, mdp3_dyn_pu_show,
static struct attribute *generic_attrs[] = {
	&dev_attr_packpattern.attr,
	&dev_attr_dyn_pu.attr,
	&dev_attr_hist_event.attr,
	NULL,
};

@@ -2879,6 +2906,14 @@ int mdp3_ctrl_init(struct msm_fb_data_type *mfd)
		goto init_done;
	}

	mdp3_session->dma->hist_event_sd = sysfs_get_dirent(dev->kobj.sd,
							"hist_event");
	if (!mdp3_session->dma->hist_event_sd) {
		pr_err("hist_event sysfs lookup failed\n");
		rc = -ENODEV;
		goto init_done;
	}

	rc = mdp3_create_sysfs_link(dev);
	if (rc)
		pr_warn("problem creating link to mdp sysfs\n");
+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2013-2014, 2016, The Linux Foundation. All rights reserved.
 *
 * Copyright (c) 2017, The Linux Foundation. All rights reserved.
 * 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
 * only version 2 as published by the Free Software Foundation.
@@ -90,6 +90,7 @@ static void mdp3_hist_done_intr_handler(int type, void *arg)
		dma->histo_state = MDP3_DMA_HISTO_STATE_READY;
		complete(&dma->histo_comp);
		spin_unlock(&dma->histo_lock);
		mdp3_hist_intr_notify(dma);
	}
	if (isr & MDP3_DMA_P_HIST_INTR_RESET_DONE_BIT) {
		spin_lock(&dma->histo_lock);
+4 −1
Original line number Diff line number Diff line
/* Copyright (c) 2013-2014, 2016, The Linux Foundation. All rights reserved.
 *
 * Copyright (c) 2017, The Linux Foundation. All rights reserved.
 * 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
 * only version 2 as published by the Free Software Foundation.
@@ -261,6 +261,7 @@ struct mdp3_dma {
	struct completion vsync_comp;
	struct completion dma_comp;
	struct completion histo_comp;
	struct kernfs_node *hist_event_sd;
	struct mdp3_notification vsync_client;
	struct mdp3_notification dma_notifier_client;
	struct mdp3_notification retire_client;
@@ -286,6 +287,7 @@ struct mdp3_dma {
	struct mdp3_rect roi;

	u32 lut_sts;
	u32 hist_events;
	struct fb_cmap *gc_cmap;
	struct fb_cmap *hist_cmap;

@@ -390,4 +392,5 @@ void mdp3_dma_callback_enable(struct mdp3_dma *dma, int type);

void mdp3_dma_callback_disable(struct mdp3_dma *dma, int type);

void mdp3_hist_intr_notify(struct mdp3_dma *dma);
#endif /* MDP3_DMA_H */