blob: e563275ee5e33b0585c5590953833c696c1b7cd8 [file] [log] [blame]
Meng Wang688a8672019-01-29 13:43:33 +08001/* SPDX-License-Identifier: GPL-2.0-only */
Meng Wang61af6842018-09-10 17:47:55 +08002/*
3 * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05304 */
5
6#ifndef __AUDIO_PDR_H_
7#define __AUDIO_PDR_H_
8
9enum {
10 AUDIO_PDR_DOMAIN_ADSP,
11 AUDIO_PDR_DOMAIN_MAX
12};
13
14enum {
15 AUDIO_PDR_FRAMEWORK_DOWN,
16 AUDIO_PDR_FRAMEWORK_UP
17};
18
19#ifdef CONFIG_MSM_QDSP6_PDR
20
21/*
22 * Use audio_pdr_register to register with the PDR subsystem this
23 * should be done before module late init otherwise notification
24 * of the AUDIO_PDR_FRAMEWORK_UP cannot be guaranteed.
25 *
26 * *nb - Pointer to a notifier block. Provide a callback function
27 * to be notified once the PDR framework has been initialized.
28 * Callback will receive either the AUDIO_PDR_FRAMEWORK_DOWN
29 * or AUDIO_PDR_FRAMEWORK_UP ioctl depending on the state of
30 * the PDR framework.
31 *
32 * Returns: Success: 0
33 * Failure: Error code
34 */
35int audio_pdr_register(struct notifier_block *nb);
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053036int audio_pdr_deregister(struct notifier_block *nb);
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053037
38/*
39 * Use audio_pdr_service_register to register with a PDR service
40 * Function should be called after nb callback registered with
41 * audio_pdr_register has been called back with the
42 * AUDIO_PDR_FRAMEWORK_UP ioctl.
43 *
44 * domain_id - Domain to use, example: AUDIO_PDR_ADSP
45 * *nb - Pointer to a notifier block. Provide a callback function
46 * that will be notified of the state of the domain
47 * requested. The ioctls received by the callback are
48 * defined in service-notifier.h.
49 *
50 * Returns: Success: Client handle
51 * Failure: Pointer error code
52 */
53void *audio_pdr_service_register(int domain_id,
54 struct notifier_block *nb, int *curr_state);
55
56/*
57 * Use audio_pdr_service_deregister to deregister with a PDR
58 * service that was registered using the audio_pdr_service_register
59 * API.
60 *
61 * *service_handle - Service handle returned by audio_pdr_service_register
62 * *nb - Pointer to the notifier block. Used in the call to
63 * audio_pdr_service_register.
64 *
65 * Returns: Success: Client handle
66 * Failure: Error code
67 */
68int audio_pdr_service_deregister(void *service_handle,
69 struct notifier_block *nb);
70
71#else
72
73static inline int audio_pdr_register(struct notifier_block *nb)
74{
75 return -ENODEV;
76}
77
Soumya Managolidd3fa1d2018-02-23 13:08:14 +053078static inline int audio_pdr_deregister(struct notifier_block *nb)
79{
80 return -ENODEV;
81}
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053082
83static inline void *audio_pdr_service_register(int domain_id,
84 struct notifier_block *nb,
85 int *curr_state)
86{
87 return NULL;
88}
89
90static inline int audio_pdr_service_deregister(void *service_handle,
91 struct notifier_block *nb)
92{
93 return 0;
94}
95
96#endif /* CONFIG_MSM_QDSP6_PDR */
97
98#endif