msm: mdss: sysfs node for backlight notification

Adding sysfs node for backlight notification will remove the need for
userspace clients to block on a ioctl. Exposing as a sysfs node will
allow the userspace thread architecture to be optimized.
Change updates the driver to signal via sysfs node for backlight
notification

Change-Id: I00752799ac81580f7ff7ee380b39d5bf43c3f8d3
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
This commit is contained in:
Gopikrishnaiah Anandan 2015-04-27 22:23:45 -07:00 committed by David Keitel
parent 5a6204fd8c
commit 9f2bed0126
3 changed files with 30 additions and 0 deletions

View file

@ -124,6 +124,7 @@ void mdss_fb_no_update_notify_timer_cb(unsigned long data)
void mdss_fb_bl_update_notify(struct msm_fb_data_type *mfd)
{
struct mdss_overlay_private *mdp5_data = NULL;
if (!mfd) {
pr_err("%s mfd NULL\n", __func__);
return;
@ -145,6 +146,11 @@ void mdss_fb_bl_update_notify(struct msm_fb_data_type *mfd)
mutex_lock(&mfd->no_update.lock);
}
mutex_unlock(&mfd->no_update.lock);
mdp5_data = mfd_to_mdp5_data(mfd);
if (mdp5_data) {
mdp5_data->bl_events++;
sysfs_notify_dirent(mdp5_data->bl_event_sd);
}
}
static int mdss_fb_notify_update(struct msm_fb_data_type *mfd,

View file

@ -562,6 +562,7 @@ struct mdss_overlay_private {
ktime_t vsync_time;
struct kernfs_node *vsync_event_sd;
struct kernfs_node *hist_event_sd;
struct kernfs_node *bl_event_sd;
int borderfill_enable;
int overlay_play_enable;
int hw_refresh;
@ -601,6 +602,7 @@ struct mdss_overlay_private {
bool kickoff_released;
u32 cursor_ndx[2];
u32 hist_events;
u32 bl_events;
};
struct mdss_mdp_set_ot_params {

View file

@ -2677,6 +2677,18 @@ static ssize_t mdss_mdp_vsync_show_event(struct device *dev,
return ret;
}
static ssize_t mdss_mdp_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 mdss_overlay_private *mdp5_data = mfd_to_mdp5_data(mfd);
int ret;
ret = scnprintf(buf, PAGE_SIZE, "%d\n", mdp5_data->bl_events);
return ret;
}
static ssize_t mdss_mdp_hist_show_event(struct device *dev,
struct device_attribute *attr, char *buf)
{
@ -2904,6 +2916,7 @@ static DEVICE_ATTR(ad, S_IRUGO | S_IWUSR | S_IWGRP, mdss_mdp_ad_show,
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 struct attribute *mdp_overlay_sysfs_attrs[] = {
&dev_attr_vsync_event.attr,
@ -2911,6 +2924,7 @@ static struct attribute *mdp_overlay_sysfs_attrs[] = {
&dev_attr_dyn_pu.attr,
&dev_attr_msm_cmd_autorefresh_en.attr,
&dev_attr_hist_event.attr,
&dev_attr_bl_event.attr,
NULL,
};
@ -4901,6 +4915,14 @@ int mdss_mdp_overlay_init(struct msm_fb_data_type *mfd)
goto init_fail;
}
mdp5_data->bl_event_sd = sysfs_get_dirent(dev->kobj.sd,
"bl_event");
if (!mdp5_data->bl_event_sd) {
pr_err("bl_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)