summaryrefstree
path: root/kernel/techpack/audio/include/soc/snd_event.h
blob: 6561afad45bfd7367027af980fd0e5dbdb80d9c7 (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
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 */

#ifndef _SND_EVENT_H_
#define _SND_EVENT_H_

enum {
	SND_EVENT_DOWN = 0,
	SND_EVENT_UP,
};

struct snd_event_clients;

struct snd_event_ops {
	int (*enable)(struct device *dev, void *data);
	void (*disable)(struct device *dev, void *data);
};

#ifdef CONFIG_SND_EVENT
int snd_event_client_register(struct device *dev,
			      const struct snd_event_ops *snd_ev_ops,
			      void *data);
int snd_event_client_deregister(struct device *dev);
int snd_event_master_register(struct device *dev,
			      const struct snd_event_ops *ops,
			      struct snd_event_clients *clients,
			      void *data);
int snd_event_master_deregister(struct device *dev);
int snd_event_notify(struct device *dev, unsigned int state);

void snd_event_mstr_add_client(struct snd_event_clients **snd_clients,
			    int (*compare)(struct device *, void *),
			    void *data);
static inline bool is_snd_event_fwk_enabled(void)
{
	return 1;
}
#else
static inline int snd_event_client_register(struct device *dev,
			      const struct snd_event_ops *snd_ev_ops,
			      void *data)
{
	return 0;
}
static inline int snd_event_client_deregister(struct device *dev)
{
	return 0;
}
static inline int snd_event_master_register(struct device *dev,
			      const struct snd_event_ops *ops,
			      struct snd_event_clients *clients,
			      void *data)
{
	return 0;
}
static inline int snd_event_master_deregister(struct device *dev)
{
	return 0;
}
static inline int snd_event_notify(struct device *dev, unsigned int state)
{
	return 0;
}

static inline void snd_event_mstr_add_client(struct snd_event_clients **snd_clients,
			    int (*compare)(struct device *, void *),
			    void *data)
{
	return;
}
static inline bool is_snd_event_fwk_enabled(void)
{
	return 0;
}

#endif /* CONFIG_SND_EVENT */
#endif /* _SND_EVENT_H_ */