Skip to content

Commit

Permalink
omapfb: implement vsync sysfs, make uevents optional
Browse files Browse the repository at this point in the history
Change-Id: I0e5ee71131dde198b5995f12e9f6a38205744237
  • Loading branch information
codeworkx committed Dec 9, 2012
1 parent 6c611f2 commit c4efacd
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/arm/configs/cyanogenmod_p3100_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,8 @@ CONFIG_OMAP2_DSS_SLEEP_AFTER_VENC_RESET=y
CONFIG_FB_OMAP2=y
CONFIG_FB_OMAP2_DEBUG_SUPPORT=y
CONFIG_FB_OMAP2_NUM_FBS=2
# CONFIG_FB_OMAP2_VSYNC_SEND_UEVENTS is not set
CONFIG_FB_OMAP2_VSYNC_SYSFS=y

#
# OMAP2/3 Display Device Drivers
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/configs/cyanogenmod_p3110_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,8 @@ CONFIG_OMAP2_DSS_SLEEP_AFTER_VENC_RESET=y
CONFIG_FB_OMAP2=y
CONFIG_FB_OMAP2_DEBUG_SUPPORT=y
CONFIG_FB_OMAP2_NUM_FBS=2
# CONFIG_FB_OMAP2_VSYNC_SEND_UEVENTS is not set
CONFIG_FB_OMAP2_VSYNC_SYSFS=y

#
# OMAP2/3 Display Device Drivers
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/configs/cyanogenmod_p3113_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,8 @@ CONFIG_OMAP2_DSS_SLEEP_AFTER_VENC_RESET=y
CONFIG_FB_OMAP2=y
CONFIG_FB_OMAP2_DEBUG_SUPPORT=y
CONFIG_FB_OMAP2_NUM_FBS=2
# CONFIG_FB_OMAP2_VSYNC_SEND_UEVENTS is not set
CONFIG_FB_OMAP2_VSYNC_SYSFS=y

#
# OMAP2/3 Display Device Drivers
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/configs/cyanogenmod_p5100_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,8 @@ CONFIG_OMAP_HDMI_AUDIO_CH_EVENT=y
CONFIG_FB_OMAP2=y
CONFIG_FB_OMAP2_DEBUG_SUPPORT=y
CONFIG_FB_OMAP2_NUM_FBS=2
# CONFIG_FB_OMAP2_VSYNC_SEND_UEVENTS is not set
CONFIG_FB_OMAP2_VSYNC_SYSFS=y

#
# OMAP2/3 Display Device Drivers
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/configs/cyanogenmod_p5110_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,8 @@ CONFIG_OMAP_HDMI_AUDIO_CH_EVENT=y
CONFIG_FB_OMAP2=y
CONFIG_FB_OMAP2_DEBUG_SUPPORT=y
CONFIG_FB_OMAP2_NUM_FBS=2
# CONFIG_FB_OMAP2_VSYNC_SEND_UEVENTS is not set
CONFIG_FB_OMAP2_VSYNC_SYSFS=y

#
# OMAP2/3 Display Device Drivers
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/configs/cyanogenmod_p5113_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,8 @@ CONFIG_OMAP_HDMI_AUDIO_CH_EVENT=y
CONFIG_FB_OMAP2=y
CONFIG_FB_OMAP2_DEBUG_SUPPORT=y
CONFIG_FB_OMAP2_NUM_FBS=2
# CONFIG_FB_OMAP2_VSYNC_SEND_UEVENTS is not set
CONFIG_FB_OMAP2_VSYNC_SYSFS=y

#
# OMAP2/3 Display Device Drivers
Expand Down
14 changes: 14 additions & 0 deletions drivers/video/omap2/omapfb/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,17 @@ config FB_OMAP2_NUM_FBS
help
Select the number of framebuffers created. OMAP2/3 has 3 overlays
so normally this would be 3.

config FB_OMAP2_VSYNC_SEND_UEVENTS
bool "OMAPFB vsync uevents"
default y
depends on FB_OMAP2
help
Pass vsync via uevent to userspace.

config FB_OMAP2_VSYNC_SYSFS
bool "OMAPFB vsync sysfs"
default n
depends on FB_OMAP2
help
Pass vsync via sysfs to userspace.
26 changes: 26 additions & 0 deletions drivers/video/omap2/omapfb/omapfb-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2291,10 +2291,23 @@ static int omapfb_init_display(struct omapfb2_device *fbdev,
return 0;
}

#ifdef CONFIG_FB_OMAP2_VSYNC_SYSFS
static ssize_t omapfb_vsync_time(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct omapfb2_device *fbdev = dev_get_drvdata(dev);

return snprintf(buf, PAGE_SIZE, "%llu", ktime_to_ns(fbdev->vsync_timestamp));
}
static DEVICE_ATTR(vsync_time, S_IRUGO, omapfb_vsync_time, NULL);
#endif

static void omapfb_send_vsync_work(struct work_struct *work)
{
struct omapfb2_device *fbdev =
container_of(work, typeof(*fbdev), vsync_work);

#ifdef CONFIG_FB_OMAP2_VSYNC_SEND_UEVENTS
char buf[64];
char *envp[2];

Expand All @@ -2303,6 +2316,11 @@ static void omapfb_send_vsync_work(struct work_struct *work)
envp[0] = buf;
envp[1] = NULL;
kobject_uevent_env(&fbdev->dev->kobj, KOBJ_CHANGE, envp);
#endif

#ifdef CONFIG_FB_OMAP2_VSYNC_SYSFS
sysfs_notify(&fbdev->dev->kobj, NULL, "vsync_time");
#endif
}
static void omapfb_vsync_isr(void *data, u32 mask)
{
Expand Down Expand Up @@ -2442,6 +2460,14 @@ static int omapfb_probe(struct platform_device *pdev)
goto cleanup;
}

#ifdef CONFIG_FB_OMAP2_VSYNC_SYSFS
r = device_create_file(fbdev->dev, &dev_attr_vsync_time);
if (r) {
dev_err(fbdev->dev, "failed to add sysfs entries\n");
goto cleanup;
}
#endif

INIT_WORK(&fbdev->vsync_work, omapfb_send_vsync_work);
return 0;

Expand Down

0 comments on commit c4efacd

Please sign in to comment.