aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngela Stegmaier <angelabaker@ti.com>2010-09-02 19:25:41 -0400
committerPaolo Pisati <paolo.pisati@canonical.com>2012-08-17 04:19:03 -0400
commit16fc7f86afda51a7de512b9eb03369e10e2faf71 (patch)
tree0024ece00af0d345cb39c81653a973cc2827980e
parent6eb07116ade2eb07680d7ff0c0b8edb2ddc29253 (diff)
TILER: Notifier callback mechanism for events
This patch adds a tiler notifier callback mechanism for events. This covers file close events. Signed-off-by: Angela Stegmaier <angelabaker@ti.com> Signed-off-by: David Sin <davidsin@ti.com>
-rw-r--r--arch/arm/mach-omap2/include/mach/tiler.h21
-rw-r--r--drivers/media/video/tiler/tiler-iface.c31
2 files changed, 52 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/include/mach/tiler.h b/arch/arm/mach-omap2/include/mach/tiler.h
index 84452bc8944..d72f322696c 100644
--- a/arch/arm/mach-omap2/include/mach/tiler.h
+++ b/arch/arm/mach-omap2/include/mach/tiler.h
@@ -81,6 +81,27 @@ static inline u32 tiler_size(const struct tiler_block_t *b)
81 return b->height * tiler_vstride(b); 81 return b->height * tiler_vstride(b);
82} 82}
83 83
84/* Event types */
85#define TILER_DEVICE_CLOSE 0
86
87/**
88 * Registers a notifier block with TILER driver.
89 *
90 * @param nb notifier_block
91 *
92 * @return error status
93 */
94s32 tiler_reg_notifier(struct notifier_block *nb);
95
96/**
97 * Un-registers a notifier block with TILER driver.
98 *
99 * @param nb notifier_block
100 *
101 * @return error status
102 */
103s32 tiler_unreg_notifier(struct notifier_block *nb);
104
84/** 105/**
85 * Reserves a 1D or 2D TILER block area and memory for the 106 * Reserves a 1D or 2D TILER block area and memory for the
86 * current process with group ID 0. 107 * current process with group ID 0.
diff --git a/drivers/media/video/tiler/tiler-iface.c b/drivers/media/video/tiler/tiler-iface.c
index f9c53dd4f32..f7a1be7131e 100644
--- a/drivers/media/video/tiler/tiler-iface.c
+++ b/drivers/media/video/tiler/tiler-iface.c
@@ -46,6 +46,17 @@ MODULE_PARM_DESC(offset_lookup,
46static struct mutex mtx; 46static struct mutex mtx;
47static struct list_head procs; /* list of process info structs */ 47static struct list_head procs; /* list of process info structs */
48static struct tiler_ops *ops; /* shared methods and variables */ 48static struct tiler_ops *ops; /* shared methods and variables */
49static struct blocking_notifier_head notifier; /* notifier for events */
50
51/*
52 * Event notification methods
53 * ==========================================================================
54 */
55
56static s32 tiler_notify_event(int event, void *data)
57{
58 return blocking_notifier_call_chain(&notifier, event, data);
59}
49 60
50/* 61/*
51 * Buffer handling methods 62 * Buffer handling methods
@@ -222,6 +233,9 @@ static void _m_free_process_info(struct process_info *pi)
222 233
223 /* have mutex */ 234 /* have mutex */
224 235
236 if (!list_empty(&pi->bufs))
237 tiler_notify_event(TILER_DEVICE_CLOSE, NULL);
238
225 /* unregister all buffers */ 239 /* unregister all buffers */
226 list_for_each_entry_safe(_b, _b_, &pi->bufs, by_pid) 240 list_for_each_entry_safe(_b, _b_, &pi->bufs, by_pid)
227 _m_unregister_buf(_b); 241 _m_unregister_buf(_b);
@@ -614,6 +628,7 @@ void tiler_iface_init(struct tiler_ops *tiler)
614 628
615 mutex_init(&mtx); 629 mutex_init(&mtx);
616 INIT_LIST_HEAD(&procs); 630 INIT_LIST_HEAD(&procs);
631 BLOCKING_INIT_NOTIFIER_HEAD(&notifier);
617} 632}
618 633
619/* 634/*
@@ -621,6 +636,22 @@ void tiler_iface_init(struct tiler_ops *tiler)
621 * ========================================================================== 636 * ==========================================================================
622 */ 637 */
623 638
639s32 tiler_reg_notifier(struct notifier_block *nb)
640{
641 if (!nb)
642 return -EINVAL;
643 return blocking_notifier_chain_register(&notifier, nb);
644}
645EXPORT_SYMBOL(tiler_reg_notifier);
646
647s32 tiler_unreg_notifier(struct notifier_block *nb)
648{
649 if (!nb)
650 return -EINVAL;
651 return blocking_notifier_chain_unregister(&notifier, nb);
652}
653EXPORT_SYMBOL(tiler_unreg_notifier);
654
624void tiler_reservex(u32 n, enum tiler_fmt fmt, u32 width, u32 height, 655void tiler_reservex(u32 n, enum tiler_fmt fmt, u32 width, u32 height,
625 u32 align, u32 offs, u32 gid, pid_t pid) 656 u32 align, u32 offs, u32 gid, pid_t pid)
626{ 657{