diff --git a/dsp/Kbuild b/dsp/Kbuild index f22573273f..74a2a7471e 100644 --- a/dsp/Kbuild +++ b/dsp/Kbuild @@ -75,6 +75,7 @@ COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR) ############ QDSP6V2 ############ ifdef CONFIG_SND_SOC_MSM_QDSP6V2_INTF + Q6_OBJS += msm-audio-event-notify.o Q6_OBJS += audio_calibration.o Q6_OBJS += audio_cal_utils.o Q6_OBJS += q6adm.o diff --git a/dsp/msm-audio-event-notify.c b/dsp/msm-audio-event-notify.c new file mode 100644 index 0000000000..6eb537d78c --- /dev/null +++ b/dsp/msm-audio-event-notify.c @@ -0,0 +1,45 @@ +/* Copyright (c) 2018, 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#include +#include + +static ATOMIC_NOTIFIER_HEAD(msm_aud_evt_notifier_list); + +/** + * msm_aud_evt_register_client - register a client notifier + * @nb: notifier block to callback on events + */ +int msm_aud_evt_register_client(struct notifier_block *nb) +{ + return atomic_notifier_chain_register(&msm_aud_evt_notifier_list, nb); +} +EXPORT_SYMBOL(msm_aud_evt_register_client); + +/** + * msm_aud_evt_unregister_client - unregister a client notifier + * @nb: notifier block to callback on events + */ +int msm_aud_evt_unregister_client(struct notifier_block *nb) +{ + return atomic_notifier_chain_unregister(&msm_aud_evt_notifier_list, nb); +} +EXPORT_SYMBOL(msm_aud_evt_unregister_client); + +/** + * msm_aud_evt_notifier_call_chain - notify clients of fb_events + * + */ +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); diff --git a/include/dsp/msm-audio-event-notify.h b/include/dsp/msm-audio-event-notify.h new file mode 100644 index 0000000000..5b85ad7e26 --- /dev/null +++ b/include/dsp/msm-audio-event-notify.h @@ -0,0 +1,44 @@ +/* Copyright (c) 2018, 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef __MSM_AUDIO_EVENT_NOTIFY_H_ +#define __MSM_AUDIO_EVENT_NOTIFY_H_ + +#include + +#if IS_ENABLED(CONFIG_SND_SOC_MSM_QDSP6V2_INTF) +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); +#else +static inline int msm_aud_evt_register_client(struct notifier_block *nb) +{ + return -ENOSYS; +} + +static inline int msm_aud_evt_unregister_client(struct notifier_block *nb) +{ + return -ENOSYS; +} + +static inline int msm_aud_evt_notifier_call_chain(unsigned long val, void *v) +{ + return -ENOSYS; +} +#endif + +enum { + MSM_AUD_DC_EVENT = 1, +}; + +#endif