Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 */
2
3/* Copyright (C) 2019 Linaro Ltd. */
4
5#ifndef __QCOM_Q6V5_IPA_NOTIFY_H__
6#define __QCOM_Q6V5_IPA_NOTIFY_H__
7
8#if IS_ENABLED(CONFIG_QCOM_Q6V5_IPA_NOTIFY)
9
10#include <linux/remoteproc.h>
11
12enum qcom_rproc_event {
13 MODEM_STARTING = 0, /* Modem is about to be started */
14 MODEM_RUNNING = 1, /* Startup complete; modem is operational */
15 MODEM_STOPPING = 2, /* Modem is about to shut down */
16 MODEM_CRASHED = 3, /* Modem has crashed (implies stopping) */
17 MODEM_OFFLINE = 4, /* Modem is now offline */
18 MODEM_REMOVING = 5, /* Modem is about to be removed */
19};
20
21typedef void (*qcom_ipa_notify_t)(void *data, enum qcom_rproc_event event);
22
23struct qcom_rproc_ipa_notify {
24 struct rproc_subdev subdev;
25
26 qcom_ipa_notify_t notify;
27 void *data;
28};
29
30/**
31 * qcom_add_ipa_notify_subdev() - Register IPA notification subdevice
32 * @rproc: rproc handle
33 * @ipa_notify: IPA notification subdevice handle
34 *
35 * Register the @ipa_notify subdevice with the @rproc so modem events
36 * can be sent to IPA when they occur.
37 *
38 * This is defined in "qcom_q6v5_ipa_notify.c".
39 */
40void qcom_add_ipa_notify_subdev(struct rproc *rproc,
41 struct qcom_rproc_ipa_notify *ipa_notify);
42
43/**
44 * qcom_remove_ipa_notify_subdev() - Remove IPA SSR subdevice
45 * @rproc: rproc handle
46 * @ipa_notify: IPA notification subdevice handle
47 *
48 * This is defined in "qcom_q6v5_ipa_notify.c".
49 */
50void qcom_remove_ipa_notify_subdev(struct rproc *rproc,
51 struct qcom_rproc_ipa_notify *ipa_notify);
52
53/**
54 * qcom_register_ipa_notify() - Register IPA notification function
55 * @rproc: Remote processor handle
56 * @notify: Non-null IPA notification callback function pointer
57 * @data: Data supplied to IPA notification callback function
58 *
59 * @Return: 0 if successful, or a negative error code otherwise
60 *
61 * This is defined in "qcom_q6v5_mss.c".
62 */
63int qcom_register_ipa_notify(struct rproc *rproc, qcom_ipa_notify_t notify,
64 void *data);
65/**
66 * qcom_deregister_ipa_notify() - Deregister IPA notification function
67 * @rproc: Remote processor handle
68 *
69 * This is defined in "qcom_q6v5_mss.c".
70 */
71void qcom_deregister_ipa_notify(struct rproc *rproc);
72
73#else /* !IS_ENABLED(CONFIG_QCOM_Q6V5_IPA_NOTIFY) */
74
75struct qcom_rproc_ipa_notify { /* empty */ };
76
77#define qcom_add_ipa_notify_subdev(rproc, ipa_notify) /* no-op */
78#define qcom_remove_ipa_notify_subdev(rproc, ipa_notify) /* no-op */
79
80#endif /* !IS_ENABLED(CONFIG_QCOM_Q6V5_IPA_NOTIFY) */
81
82#endif /* !__QCOM_Q6V5_IPA_NOTIFY_H__ */