Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42704c8c authored by Rishi Gupta's avatar Rishi Gupta Committed by Gerrit - the friendly Code Review server
Browse files

soc: qcom: sideband: add helper APIs for sideband notifications



This commit introduces helper APIs and header files to be used
by sideband events publishers and subscribers.

Change-Id: I713b5b2a8dda2309453b433d922546f16a6f7e7e
Signed-off-by: default avatarRishi Gupta <rishgupt@codeaurora.org>
parent 0e7f05f6
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -284,6 +284,15 @@ config SDX_EXT_IPC

	  If unsure, say N.

config QTI_NOTIFY_SIDEBAND
	tristate "QCOM sideband signalling helper"
	help
	  This provides helper APIs and a header file through which
	  transport layer driver can talk to the sideband driver to
	  assert appropriate sideband signal.

	  If unsure, say N.

config PANIC_ON_GLADIATOR_ERROR
       depends on MSM_GLADIATOR_ERP
       bool "Panic on GLADIATOR error report"
+1 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ obj-$(CONFIG_MSM_BGCOM) += bgcom_spi.o

obj-$(CONFIG_MSM_PERFORMANCE) += msm_performance.o
obj-$(CONFIG_SDX_EXT_IPC) += sdx_ext_ipc.o
obj-$(CONFIG_QTI_NOTIFY_SIDEBAND) += sideband_notify.o

ifdef CONFIG_MSM_SUBSYSTEM_RESTART
       obj-y += subsystem_notif.o
+50 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2020, 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 <linux/notifier.h>
#include <soc/qcom/sb_notification.h>

static BLOCKING_NOTIFIER_HEAD(sb_notifier_list);

/**
 * sb_register_evt_listener - registers a notifier callback
 * @nb: pointer to the notifier block for the callback events
 */
int sb_register_evt_listener(struct notifier_block *nb)
{
	return blocking_notifier_chain_register(&sb_notifier_list, nb);
}
EXPORT_SYMBOL(sb_register_evt_listener);

/**
 * sb_unregister_evt_listener - un-registers a notifier callback
 * registered previously.
 * @nb: pointer to the notifier block for the callback events
 */
int sb_unregister_evt_listener(struct notifier_block *nb)
{
	return blocking_notifier_chain_unregister(&sb_notifier_list, nb);
}
EXPORT_SYMBOL(sb_unregister_evt_listener);

/**
 * sb_notifier_call_chain - send events to all registered listeners
 * as received from publishers.
 * @nb: pointer to the notifier block for the callback events
 */
int sb_notifier_call_chain(unsigned long val, void *v)
{
	return blocking_notifier_call_chain(&sb_notifier_list, val, v);
}
EXPORT_SYMBOL(sb_notifier_call_chain);
+56 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2020, 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 _SB_NOTIFICATION_H
#define _SB_NOTIFICATION_H

/* Indicates a system wake up event */
#define EVT_WAKE_UP 0x01

#ifdef CONFIG_QTI_NOTIFY_SIDEBAND
/**
 * sb_register_evt_listener - registers a notifier callback
 * @nb: pointer to the notifier block for the callback events
 */
int sb_register_evt_listener(struct notifier_block *nb);

/**
 * sb_unregister_evt_listener - un-registers a notifier callback
 * registered previously.
 * @nb: pointer to the notifier block for the callback events
 */
int sb_unregister_evt_listener(struct notifier_block *nb);

/**
 * sb_notifier_call_chain - send events to all registered listeners
 * as received from publishers.
 * @nb: pointer to the notifier block for the callback events
 */
int sb_notifier_call_chain(unsigned long val, void *v);
#else
static inline int sb_register_evt_listener(struct notifier_block *nb)
{
	return -EINVAL;
}
static inline int sb_unregister_evt_listener(struct notifier_block *nb)
{
	return -EINVAL;
}
static inline int sb_notifier_call_chain(unsigned long val, void *v)
{
	return -EINVAL;
}
#endif /* !CONFIG_QTI_NOTIFY_SIDEBAND */

#endif /* _SB_NOTIFICATION_H */