summaryrefslogtreecommitdiff
path: root/include/linux/qdsp6v2/audio_pdr.h
blob: b8eb1be3ee64cc459de8fed94c3466b4dd1ba063 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/* Copyright (c) 2016, 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 __AUDIO_PDR_H_
#define __AUDIO_PDR_H_

enum {
	AUDIO_PDR_DOMAIN_ADSP,
	AUDIO_PDR_DOMAIN_MAX
};

enum {
	AUDIO_PDR_FRAMEWORK_DOWN,
	AUDIO_PDR_FRAMEWORK_UP
};

#ifdef CONFIG_MSM_QDSP6_PDR

/*
 * Use audio_pdr_register to register with the PDR subsystem this
 * should be done before module late init otherwise notification
 * of the AUDIO_PDR_FRAMEWORK_UP cannot be guaranteed.
 *
 * *nb - Pointer to a notifier block. Provide a callback function
 *       to be notified once the PDR framework has been initialized.
 *       Callback will receive either the AUDIO_PDR_FRAMEWORK_DOWN
 *       or AUDIO_PDR_FRAMEWORK_UP ioctl depending on the state of
 *       the PDR framework.
 *
 * Returns: Success: 0
 *          Failure: Error code
 */
int audio_pdr_register(struct notifier_block *nb);

/*
 * Use audio_pdr_service_register to register with a PDR service
 * Function should be called after nb callback registered with
 * audio_pdr_register has been called back with the
 * AUDIO_PDR_FRAMEWORK_UP ioctl.
 *
 * domain_id - Domain to use, example: AUDIO_PDR_ADSP
 * *nb - Pointer to a notifier block. Provide a callback function
 *       that will be notified of the state of the domain
 *       requested. The ioctls received by the callback are
 *       defined in service-notifier.h.
 *
 * Returns: Success: Client handle
 *          Failure: Pointer error code
 */
void *audio_pdr_service_register(int domain_id,
				 struct notifier_block *nb, int *curr_state);

				 /*
 * Use audio_pdr_service_deregister to deregister with a PDR
 * service that was registered using the audio_pdr_service_register
 * API.
 *
 * *service_handle - Service handle returned by audio_pdr_service_register
 * *nb - Pointer to the notifier block. Used in the call to
 *       audio_pdr_service_register.
 *
 * Returns: Success: Client handle
 *          Failure: Error code
 */
int audio_pdr_service_deregister(void *service_handle,
				 struct notifier_block *nb);

#else

static inline int audio_pdr_register(struct notifier_block *nb)
{
	return -ENODEV;
}


static inline void *audio_pdr_service_register(int domain_id,
					       struct notifier_block *nb,
					       int *curr_state)
{
	return NULL;
}

static inline int audio_pdr_service_deregister(void *service_handle,
					       struct notifier_block *nb)
{
	return 0;
}

#endif /* CONFIG_MSM_QDSP6_PDR */

#endif