فهرست منبع

dsp: add blocking call support in event notifier

Add support for blocking call events in event notifier
to support functions which require waiting for events.

Change-Id: I255c19bc956506ea5076bb5fb1f09327141611a6
Signed-off-by: Ramprasad Katkam <[email protected]>
Ramprasad Katkam 6 سال پیش
والد
کامیت
b5528d39f2
2فایلهای تغییر یافته به همراه60 افزوده شده و 0 حذف شده
  1. 36 0
      dsp/msm-audio-event-notify.c
  2. 24 0
      include/dsp/msm-audio-event-notify.h

+ 36 - 0
dsp/msm-audio-event-notify.c

@@ -13,6 +13,7 @@
 #include <linux/export.h>
 
 static ATOMIC_NOTIFIER_HEAD(msm_aud_evt_notifier_list);
+static BLOCKING_NOTIFIER_HEAD(msm_aud_evt_blocking_notifier_list);
 
 /**
  *	msm_aud_evt_register_client - register a client notifier
@@ -43,3 +44,38 @@ int msm_aud_evt_notifier_call_chain(unsigned long val, void *v)
 	return atomic_notifier_call_chain(&msm_aud_evt_notifier_list, val, v);
 }
 EXPORT_SYMBOL_GPL(msm_aud_evt_notifier_call_chain);
+
+/**
+ *	msm_aud_evt_blocking_register_client - register a client notifier
+ *	@nb: notifier block to callback on events
+ */
+int msm_aud_evt_blocking_register_client(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_register(
+			&msm_aud_evt_blocking_notifier_list, nb);
+}
+EXPORT_SYMBOL(msm_aud_evt_blocking_register_client);
+
+/**
+ *	msm_aud_evt_unregister_client - unregister a client notifier
+ *	@nb: notifier block to callback on events
+ */
+int msm_aud_evt_blocking_unregister_client(struct notifier_block *nb)
+{
+	return blocking_notifier_chain_unregister(
+			&msm_aud_evt_blocking_notifier_list, nb);
+}
+EXPORT_SYMBOL(msm_aud_evt_blocking_unregister_client);
+
+/**
+ * msm_aud_evt_notifier_call_chain - notify clients of fb_events
+ * @val: event or enum maintained by caller
+ * @v: private data pointer
+ *
+ */
+int msm_aud_evt_blocking_notifier_call_chain(unsigned long val, void *v)
+{
+	return blocking_notifier_call_chain(
+			&msm_aud_evt_blocking_notifier_list, val, v);
+}
+EXPORT_SYMBOL_GPL(msm_aud_evt_blocking_notifier_call_chain);

+ 24 - 0
include/dsp/msm-audio-event-notify.h

@@ -20,6 +20,9 @@
 int msm_aud_evt_register_client(struct notifier_block *nb);
 int msm_aud_evt_unregister_client(struct notifier_block *nb);
 int msm_aud_evt_notifier_call_chain(unsigned long val, void *v);
+int msm_aud_evt_blocking_register_client(struct notifier_block *nb);
+int msm_aud_evt_blocking_unregister_client(struct notifier_block *nb);
+int msm_aud_evt_blocking_notifier_call_chain(unsigned long val, void *v);
 #else
 static inline int msm_aud_evt_register_client(struct notifier_block *nb)
 {
@@ -35,10 +38,31 @@ static inline int msm_aud_evt_notifier_call_chain(unsigned long val, void *v)
 {
 	return -ENOSYS;
 }
+
+static inline int msm_aud_evt_blocking_register_client(
+			struct notifier_block *nb)
+{
+	return -ENOSYS;
+}
+
+static inline int msm_aud_evt_blocking_unregister_client(
+			struct notifier_block *nb)
+{
+	return -ENOSYS;
+}
+
+static inline int msm_aud_evt_blocking_notifier_call_chain(
+			unsigned long val, void *v)
+{
+	return -ENOSYS;
+}
 #endif
 
 enum {
 	MSM_AUD_DC_EVENT = 1,
+	SWR_WAKE_IRQ_REGISTER,
+	SWR_WAKE_IRQ_DEREGISTER,
+	SWR_WAKE_IRQ_EVENT,
 };
 
 #endif