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

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

Merge "msm: mdss: Add sysfs node for bl notification"

parents 1b82687f a16cf08c
Loading
Loading
Loading
Loading
+61 −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,40 @@ static int mdp3_ctrl_blit_req(struct msm_fb_data_type *mfd, void __user *p)
	return rc;
}

static ssize_t mdp3_bl_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;
	int ret;

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

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

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 +520,8 @@ 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(bl_event, S_IRUGO, mdp3_bl_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 +530,8 @@ 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,
	&dev_attr_bl_event.attr,
	NULL,
};

@@ -2879,6 +2924,22 @@ 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;
	}

	mdp3_session->bl_event_sd = sysfs_get_dirent(dev->kobj.sd,
							"bl_event");
	if (!mdp3_session->bl_event_sd) {
		pr_err("bl_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 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ struct mdp3_session_data {
	struct timer_list vsync_timer;
	int vsync_period;
	struct kernfs_node *vsync_event_sd;
	struct kernfs_node *bl_event_sd;
	struct mdp_overlay overlay;
	struct mdp_overlay req_overlay;
	struct mdp3_buffer_queue bufq_in;
@@ -71,6 +72,7 @@ struct mdp3_session_data {
	bool in_splash_screen;
	bool esd_recovery;
	int dyn_pu_state; /* dynamic partial update status */
	u32 bl_events;

	bool dma_active;
	struct completion dma_completion;
+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 */
+12 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@
#include "mdss_debug.h"
#include "mdss_smmu.h"
#include "mdss_mdp.h"
#include "mdp3_ctrl.h"

#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
#define MDSS_FB_NUM 3
@@ -137,6 +138,9 @@ void mdss_fb_bl_update_notify(struct msm_fb_data_type *mfd,
{
#ifndef TARGET_HW_MDSS_MDP3
	struct mdss_overlay_private *mdp5_data = NULL;
#endif
#ifdef TARGET_HW_MDSS_MDP3
	struct mdp3_session_data *mdp3_session = NULL;
#endif
	if (!mfd) {
		pr_err("%s mfd NULL\n", __func__);
@@ -175,6 +179,14 @@ void mdss_fb_bl_update_notify(struct msm_fb_data_type *mfd,
		}
	}
#endif
#ifdef TARGET_HW_MDSS_MDP3
	mdp3_session = (struct mdp3_session_data *)mfd->mdp.private1;
	if (mdp3_session) {
		mdp3_session->bl_events++;
		sysfs_notify_dirent(mdp3_session->bl_event_sd);
		pr_debug("bl_event = %u\n", mdp3_session->bl_events);
	}
#endif
}

static int mdss_fb_notify_update(struct msm_fb_data_type *mfd,