1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2/*
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * Copyright(c) 2022-2023 Intel Corporation
7 */
8
9struct hdac_bus;
10struct hdac_ext_link;
11
12#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_MLINK)
13
14int hda_bus_ml_init(struct hdac_bus *bus);
15void hda_bus_ml_free(struct hdac_bus *bus);
16
17int hdac_bus_eml_get_count(struct hdac_bus *bus, bool alt, int elid);
18void hdac_bus_eml_enable_interrupt_unlocked(struct hdac_bus *bus, bool alt, int elid, bool enable);
19void hdac_bus_eml_enable_interrupt(struct hdac_bus *bus, bool alt, int elid, bool enable);
20bool hdac_bus_eml_check_interrupt(struct hdac_bus *bus, bool alt, int elid);
21
22int hdac_bus_eml_set_syncprd_unlocked(struct hdac_bus *bus, bool alt, int elid, u32 syncprd);
23int hdac_bus_eml_sdw_set_syncprd_unlocked(struct hdac_bus *bus, u32 syncprd);
24
25int hdac_bus_eml_wait_syncpu_unlocked(struct hdac_bus *bus, bool alt, int elid);
26int hdac_bus_eml_sdw_wait_syncpu_unlocked(struct hdac_bus *bus);
27
28void hdac_bus_eml_sync_arm_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink);
29void hdac_bus_eml_sdw_sync_arm_unlocked(struct hdac_bus *bus, int sublink);
30
31int hdac_bus_eml_sync_go_unlocked(struct hdac_bus *bus, bool alt, int elid);
32int hdac_bus_eml_sdw_sync_go_unlocked(struct hdac_bus *bus);
33
34bool hdac_bus_eml_check_cmdsync_unlocked(struct hdac_bus *bus, bool alt, int elid);
35bool hdac_bus_eml_sdw_check_cmdsync_unlocked(struct hdac_bus *bus);
36
37int hdac_bus_eml_power_up(struct hdac_bus *bus, bool alt, int elid, int sublink);
38int hdac_bus_eml_power_up_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink);
39
40int hdac_bus_eml_power_down(struct hdac_bus *bus, bool alt, int elid, int sublink);
41int hdac_bus_eml_power_down_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink);
42
43int hdac_bus_eml_sdw_power_up_unlocked(struct hdac_bus *bus, int sublink);
44int hdac_bus_eml_sdw_power_down_unlocked(struct hdac_bus *bus, int sublink);
45
46int hdac_bus_eml_sdw_get_lsdiid_unlocked(struct hdac_bus *bus, int sublink, u16 *lsdiid);
47int hdac_bus_eml_sdw_set_lsdiid(struct hdac_bus *bus, int sublink, int dev_num);
48
49int hdac_bus_eml_sdw_map_stream_ch(struct hdac_bus *bus, int sublink, int y,
50 int channel_mask, int stream_id, int dir);
51
52void hda_bus_ml_put_all(struct hdac_bus *bus);
53void hda_bus_ml_reset_losidv(struct hdac_bus *bus);
54int hda_bus_ml_resume(struct hdac_bus *bus);
55int hda_bus_ml_suspend(struct hdac_bus *bus);
56
57struct hdac_ext_link *hdac_bus_eml_ssp_get_hlink(struct hdac_bus *bus);
58struct hdac_ext_link *hdac_bus_eml_dmic_get_hlink(struct hdac_bus *bus);
59struct hdac_ext_link *hdac_bus_eml_sdw_get_hlink(struct hdac_bus *bus);
60
61struct mutex *hdac_bus_eml_get_mutex(struct hdac_bus *bus, bool alt, int elid);
62
63int hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable);
64
65/* microphone privacy specific function supported by ACE3+ architecture */
66void hdac_bus_eml_set_mic_privacy_mask(struct hdac_bus *bus, bool alt, int elid,
67 unsigned long mask);
68bool hdac_bus_eml_is_mic_privacy_changed(struct hdac_bus *bus, bool alt, int elid);
69bool hdac_bus_eml_get_mic_privacy_state(struct hdac_bus *bus, bool alt, int elid);
70
71#else
72
73static inline int
74hda_bus_ml_init(struct hdac_bus *bus) { return 0; }
75
76static inline void hda_bus_ml_free(struct hdac_bus *bus) { }
77
78static inline int
79hdac_bus_eml_get_count(struct hdac_bus *bus, bool alt, int elid) { return 0; }
80
81static inline void
82hdac_bus_eml_enable_interrupt_unlocked(struct hdac_bus *bus, bool alt, int elid, bool enable) { }
83
84static inline void
85hdac_bus_eml_enable_interrupt(struct hdac_bus *bus, bool alt, int elid, bool enable) { }
86
87static inline bool
88hdac_bus_eml_check_interrupt(struct hdac_bus *bus, bool alt, int elid) { return false; }
89
90static inline int
91hdac_bus_eml_set_syncprd_unlocked(struct hdac_bus *bus, bool alt, int elid, u32 syncprd)
92{
93 return 0;
94}
95
96static inline int
97hdac_bus_eml_sdw_set_syncprd_unlocked(struct hdac_bus *bus, u32 syncprd)
98{
99 return 0;
100}
101
102static inline int
103hdac_bus_eml_wait_syncpu_unlocked(struct hdac_bus *bus, bool alt, int elid)
104{
105 return 0;
106}
107
108static inline int
109hdac_bus_eml_sdw_wait_syncpu_unlocked(struct hdac_bus *bus) { return 0; }
110
111static inline void
112hdac_bus_eml_sync_arm_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink) { }
113
114static inline void
115hdac_bus_eml_sdw_sync_arm_unlocked(struct hdac_bus *bus, int sublink) { }
116
117static inline int
118hdac_bus_eml_sync_go_unlocked(struct hdac_bus *bus, bool alt, int elid) { return 0; }
119
120static inline int
121hdac_bus_eml_sdw_sync_go_unlocked(struct hdac_bus *bus) { return 0; }
122
123static inline bool
124hdac_bus_eml_check_cmdsync_unlocked(struct hdac_bus *bus, bool alt, int elid) { return false; }
125
126static inline bool
127hdac_bus_eml_sdw_check_cmdsync_unlocked(struct hdac_bus *bus) { return false; }
128
129static inline int
130hdac_bus_eml_power_up(struct hdac_bus *bus, bool alt, int elid, int sublink)
131{
132 return 0;
133}
134
135static inline int
136hdac_bus_eml_power_up_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink)
137{
138 return 0;
139}
140
141static inline int
142hdac_bus_eml_power_down(struct hdac_bus *bus, bool alt, int elid, int sublink)
143{
144 return 0;
145}
146
147static inline int
148hdac_bus_eml_power_down_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink)
149{
150 return 0;
151}
152
153static inline int
154hdac_bus_eml_sdw_power_up_unlocked(struct hdac_bus *bus, int sublink) { return 0; }
155
156static inline int
157hdac_bus_eml_sdw_power_down_unlocked(struct hdac_bus *bus, int sublink) { return 0; }
158
159static inline int
160hdac_bus_eml_sdw_get_lsdiid_unlocked(struct hdac_bus *bus, int sublink, u16 *lsdiid) { return 0; }
161
162static inline int
163hdac_bus_eml_sdw_set_lsdiid(struct hdac_bus *bus, int sublink, int dev_num) { return 0; }
164
165static inline int
166hdac_bus_eml_sdw_map_stream_ch(struct hdac_bus *bus, int sublink, int y,
167 int channel_mask, int stream_id, int dir)
168{
169 return 0;
170}
171
172static inline void hda_bus_ml_put_all(struct hdac_bus *bus) { }
173static inline void hda_bus_ml_reset_losidv(struct hdac_bus *bus) { }
174static inline int hda_bus_ml_resume(struct hdac_bus *bus) { return 0; }
175static inline int hda_bus_ml_suspend(struct hdac_bus *bus) { return 0; }
176
177static inline struct hdac_ext_link *
178hdac_bus_eml_ssp_get_hlink(struct hdac_bus *bus) { return NULL; }
179
180static inline struct hdac_ext_link *
181hdac_bus_eml_dmic_get_hlink(struct hdac_bus *bus) { return NULL; }
182
183static inline struct hdac_ext_link *
184hdac_bus_eml_sdw_get_hlink(struct hdac_bus *bus) { return NULL; }
185
186static inline struct mutex *
187hdac_bus_eml_get_mutex(struct hdac_bus *bus, bool alt, int elid) { return NULL; }
188
189static inline int
190hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable)
191{
192 return 0;
193}
194
195static inline void
196hdac_bus_eml_set_mic_privacy_mask(struct hdac_bus *bus, bool alt, int elid,
197 unsigned long mask)
198{
199}
200
201static inline bool
202hdac_bus_eml_is_mic_privacy_changed(struct hdac_bus *bus, bool alt, int elid)
203{
204 return false;
205}
206
207static inline bool
208hdac_bus_eml_get_mic_privacy_state(struct hdac_bus *bus, bool alt, int elid)
209{
210 return false;
211}
212
213#endif /* CONFIG_SND_SOC_SOF_HDA_MLINK */
214

source code of linux/include/sound/hda-mlink.h