xref: /openbmc/linux/include/sound/hda-mlink.h (revision 9134211f)
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. All rights reserved.
7  */
8 
9 struct hdac_bus;
10 struct hdac_ext_link;
11 
12 #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_MLINK)
13 
14 int hda_bus_ml_init(struct hdac_bus *bus);
15 void hda_bus_ml_free(struct hdac_bus *bus);
16 
17 int hdac_bus_eml_get_count(struct hdac_bus *bus, bool alt, int elid);
18 void hdac_bus_eml_enable_interrupt(struct hdac_bus *bus, bool alt, int elid, bool enable);
19 bool hdac_bus_eml_check_interrupt(struct hdac_bus *bus, bool alt, int elid);
20 
21 int hdac_bus_eml_set_syncprd_unlocked(struct hdac_bus *bus, bool alt, int elid, u32 syncprd);
22 int hdac_bus_eml_sdw_set_syncprd_unlocked(struct hdac_bus *bus, u32 syncprd);
23 
24 int hdac_bus_eml_wait_syncpu_unlocked(struct hdac_bus *bus, bool alt, int elid);
25 int hdac_bus_eml_sdw_wait_syncpu_unlocked(struct hdac_bus *bus);
26 
27 void hdac_bus_eml_sync_arm_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink);
28 void hdac_bus_eml_sdw_sync_arm_unlocked(struct hdac_bus *bus, int sublink);
29 
30 int hdac_bus_eml_sync_go_unlocked(struct hdac_bus *bus, bool alt, int elid);
31 int hdac_bus_eml_sdw_sync_go_unlocked(struct hdac_bus *bus);
32 
33 bool hdac_bus_eml_check_cmdsync_unlocked(struct hdac_bus *bus, bool alt, int elid);
34 bool hdac_bus_eml_sdw_check_cmdsync_unlocked(struct hdac_bus *bus);
35 
36 int hdac_bus_eml_power_up(struct hdac_bus *bus, bool alt, int elid, int sublink);
37 int hdac_bus_eml_power_up_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink);
38 
39 int hdac_bus_eml_power_down(struct hdac_bus *bus, bool alt, int elid, int sublink);
40 int hdac_bus_eml_power_down_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink);
41 
42 int hdac_bus_eml_sdw_power_up_unlocked(struct hdac_bus *bus, int sublink);
43 int hdac_bus_eml_sdw_power_down_unlocked(struct hdac_bus *bus, int sublink);
44 
45 int hdac_bus_eml_sdw_set_lsdiid(struct hdac_bus *bus, int sublink, int dev_num);
46 
47 int hdac_bus_eml_sdw_map_stream_ch(struct hdac_bus *bus, int sublink, int y,
48 				   int channel_mask, int stream_id, int dir);
49 
50 void hda_bus_ml_put_all(struct hdac_bus *bus);
51 void hda_bus_ml_reset_losidv(struct hdac_bus *bus);
52 int hda_bus_ml_resume(struct hdac_bus *bus);
53 int hda_bus_ml_suspend(struct hdac_bus *bus);
54 
55 struct hdac_ext_link *hdac_bus_eml_ssp_get_hlink(struct hdac_bus *bus);
56 struct hdac_ext_link *hdac_bus_eml_dmic_get_hlink(struct hdac_bus *bus);
57 struct hdac_ext_link *hdac_bus_eml_sdw_get_hlink(struct hdac_bus *bus);
58 
59 struct mutex *hdac_bus_eml_get_mutex(struct hdac_bus *bus, bool alt, int elid);
60 
61 int hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable);
62 
63 #else
64 
65 static inline int
66 hda_bus_ml_init(struct hdac_bus *bus) { return 0; }
67 
68 static inline void hda_bus_ml_free(struct hdac_bus *bus) { }
69 
70 static inline int
71 hdac_bus_eml_get_count(struct hdac_bus *bus, bool alt, int elid) { return 0; }
72 
73 static inline void
74 hdac_bus_eml_enable_interrupt(struct hdac_bus *bus, bool alt, int elid, bool enable) { }
75 
76 static inline bool
77 hdac_bus_eml_check_interrupt(struct hdac_bus *bus, bool alt, int elid) { return false; }
78 
79 static inline int
80 hdac_bus_eml_set_syncprd_unlocked(struct hdac_bus *bus, bool alt, int elid, u32 syncprd)
81 {
82 	return 0;
83 }
84 
85 static inline int
86 hdac_bus_eml_sdw_set_syncprd_unlocked(struct hdac_bus *bus, u32 syncprd)
87 {
88 	return 0;
89 }
90 
91 static inline int
92 hdac_bus_eml_wait_syncpu_unlocked(struct hdac_bus *bus, bool alt, int elid)
93 {
94 	return 0;
95 }
96 
97 static inline int
98 hdac_bus_eml_sdw_wait_syncpu_unlocked(struct hdac_bus *bus) { return 0; }
99 
100 static inline void
101 hdac_bus_eml_sync_arm_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink) { }
102 
103 static inline void
104 hdac_bus_eml_sdw_sync_arm_unlocked(struct hdac_bus *bus, int sublink) { }
105 
106 static inline int
107 hdac_bus_eml_sync_go_unlocked(struct hdac_bus *bus, bool alt, int elid) { return 0; }
108 
109 static inline int
110 hdac_bus_eml_sdw_sync_go_unlocked(struct hdac_bus *bus) { return 0; }
111 
112 static inline bool
113 hdac_bus_eml_check_cmdsync_unlocked(struct hdac_bus *bus, bool alt, int elid) { return false; }
114 
115 static inline bool
116 hdac_bus_eml_sdw_check_cmdsync_unlocked(struct hdac_bus *bus) { return false; }
117 
118 static inline int
119 hdac_bus_eml_power_up(struct hdac_bus *bus, bool alt, int elid, int sublink)
120 {
121 	return 0;
122 }
123 
124 static inline int
125 hdac_bus_eml_power_up_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink)
126 {
127 	return 0;
128 }
129 
130 static inline int
131 hdac_bus_eml_power_down(struct hdac_bus *bus, bool alt, int elid, int sublink)
132 {
133 	return 0;
134 }
135 
136 static inline int
137 hdac_bus_eml_power_down_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink)
138 {
139 	return 0;
140 }
141 
142 static inline int
143 hdac_bus_eml_sdw_power_up_unlocked(struct hdac_bus *bus, int sublink) { return 0; }
144 
145 static inline int
146 hdac_bus_eml_sdw_power_down_unlocked(struct hdac_bus *bus, int sublink) { return 0; }
147 
148 static inline int
149 hdac_bus_eml_sdw_set_lsdiid(struct hdac_bus *bus, int sublink, int dev_num) { return 0; }
150 
151 static inline int
152 hdac_bus_eml_sdw_map_stream_ch(struct hdac_bus *bus, int sublink, int y,
153 			       int channel_mask, int stream_id, int dir)
154 {
155 	return 0;
156 }
157 
158 static inline void hda_bus_ml_put_all(struct hdac_bus *bus) { }
159 static inline void hda_bus_ml_reset_losidv(struct hdac_bus *bus) { }
160 static inline int hda_bus_ml_resume(struct hdac_bus *bus) { return 0; }
161 static inline int hda_bus_ml_suspend(struct hdac_bus *bus) { return 0; }
162 
163 static inline struct hdac_ext_link *
164 hdac_bus_eml_ssp_get_hlink(struct hdac_bus *bus) { return NULL; }
165 
166 static inline struct hdac_ext_link *
167 hdac_bus_eml_dmic_get_hlink(struct hdac_bus *bus) { return NULL; }
168 
169 static inline struct hdac_ext_link *
170 hdac_bus_eml_sdw_get_hlink(struct hdac_bus *bus) { return NULL; }
171 
172 static inline struct mutex *
173 hdac_bus_eml_get_mutex(struct hdac_bus *bus, bool alt, int elid) { return NULL; }
174 
175 static inline int
176 hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable)
177 {
178 	return 0;
179 }
180 #endif /* CONFIG_SND_SOC_SOF_HDA */
181