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 
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_get_lsdiid_unlocked(struct hdac_bus *bus, int sublink, u16 *lsdiid);
46 int hdac_bus_eml_sdw_set_lsdiid(struct hdac_bus *bus, int sublink, int dev_num);
47 
48 int hdac_bus_eml_sdw_map_stream_ch(struct hdac_bus *bus, int sublink, int y,
49 				   int channel_mask, int stream_id, int dir);
50 
51 void hda_bus_ml_put_all(struct hdac_bus *bus);
52 void hda_bus_ml_reset_losidv(struct hdac_bus *bus);
53 int hda_bus_ml_resume(struct hdac_bus *bus);
54 int hda_bus_ml_suspend(struct hdac_bus *bus);
55 
56 struct hdac_ext_link *hdac_bus_eml_ssp_get_hlink(struct hdac_bus *bus);
57 struct hdac_ext_link *hdac_bus_eml_dmic_get_hlink(struct hdac_bus *bus);
58 struct hdac_ext_link *hdac_bus_eml_sdw_get_hlink(struct hdac_bus *bus);
59 
60 struct mutex *hdac_bus_eml_get_mutex(struct hdac_bus *bus, bool alt, int elid);
61 
62 int hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable);
63 
64 #else
65 
66 static inline int
hda_bus_ml_init(struct hdac_bus * bus)67 hda_bus_ml_init(struct hdac_bus *bus) { return 0; }
68 
hda_bus_ml_free(struct hdac_bus * bus)69 static inline void hda_bus_ml_free(struct hdac_bus *bus) { }
70 
71 static inline int
hdac_bus_eml_get_count(struct hdac_bus * bus,bool alt,int elid)72 hdac_bus_eml_get_count(struct hdac_bus *bus, bool alt, int elid) { return 0; }
73 
74 static inline void
hdac_bus_eml_enable_interrupt(struct hdac_bus * bus,bool alt,int elid,bool enable)75 hdac_bus_eml_enable_interrupt(struct hdac_bus *bus, bool alt, int elid, bool enable) { }
76 
77 static inline bool
hdac_bus_eml_check_interrupt(struct hdac_bus * bus,bool alt,int elid)78 hdac_bus_eml_check_interrupt(struct hdac_bus *bus, bool alt, int elid) { return false; }
79 
80 static inline int
hdac_bus_eml_set_syncprd_unlocked(struct hdac_bus * bus,bool alt,int elid,u32 syncprd)81 hdac_bus_eml_set_syncprd_unlocked(struct hdac_bus *bus, bool alt, int elid, u32 syncprd)
82 {
83 	return 0;
84 }
85 
86 static inline int
hdac_bus_eml_sdw_set_syncprd_unlocked(struct hdac_bus * bus,u32 syncprd)87 hdac_bus_eml_sdw_set_syncprd_unlocked(struct hdac_bus *bus, u32 syncprd)
88 {
89 	return 0;
90 }
91 
92 static inline int
hdac_bus_eml_wait_syncpu_unlocked(struct hdac_bus * bus,bool alt,int elid)93 hdac_bus_eml_wait_syncpu_unlocked(struct hdac_bus *bus, bool alt, int elid)
94 {
95 	return 0;
96 }
97 
98 static inline int
hdac_bus_eml_sdw_wait_syncpu_unlocked(struct hdac_bus * bus)99 hdac_bus_eml_sdw_wait_syncpu_unlocked(struct hdac_bus *bus) { return 0; }
100 
101 static inline void
hdac_bus_eml_sync_arm_unlocked(struct hdac_bus * bus,bool alt,int elid,int sublink)102 hdac_bus_eml_sync_arm_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink) { }
103 
104 static inline void
hdac_bus_eml_sdw_sync_arm_unlocked(struct hdac_bus * bus,int sublink)105 hdac_bus_eml_sdw_sync_arm_unlocked(struct hdac_bus *bus, int sublink) { }
106 
107 static inline int
hdac_bus_eml_sync_go_unlocked(struct hdac_bus * bus,bool alt,int elid)108 hdac_bus_eml_sync_go_unlocked(struct hdac_bus *bus, bool alt, int elid) { return 0; }
109 
110 static inline int
hdac_bus_eml_sdw_sync_go_unlocked(struct hdac_bus * bus)111 hdac_bus_eml_sdw_sync_go_unlocked(struct hdac_bus *bus) { return 0; }
112 
113 static inline bool
hdac_bus_eml_check_cmdsync_unlocked(struct hdac_bus * bus,bool alt,int elid)114 hdac_bus_eml_check_cmdsync_unlocked(struct hdac_bus *bus, bool alt, int elid) { return false; }
115 
116 static inline bool
hdac_bus_eml_sdw_check_cmdsync_unlocked(struct hdac_bus * bus)117 hdac_bus_eml_sdw_check_cmdsync_unlocked(struct hdac_bus *bus) { return false; }
118 
119 static inline int
hdac_bus_eml_power_up(struct hdac_bus * bus,bool alt,int elid,int sublink)120 hdac_bus_eml_power_up(struct hdac_bus *bus, bool alt, int elid, int sublink)
121 {
122 	return 0;
123 }
124 
125 static inline int
hdac_bus_eml_power_up_unlocked(struct hdac_bus * bus,bool alt,int elid,int sublink)126 hdac_bus_eml_power_up_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink)
127 {
128 	return 0;
129 }
130 
131 static inline int
hdac_bus_eml_power_down(struct hdac_bus * bus,bool alt,int elid,int sublink)132 hdac_bus_eml_power_down(struct hdac_bus *bus, bool alt, int elid, int sublink)
133 {
134 	return 0;
135 }
136 
137 static inline int
hdac_bus_eml_power_down_unlocked(struct hdac_bus * bus,bool alt,int elid,int sublink)138 hdac_bus_eml_power_down_unlocked(struct hdac_bus *bus, bool alt, int elid, int sublink)
139 {
140 	return 0;
141 }
142 
143 static inline int
hdac_bus_eml_sdw_power_up_unlocked(struct hdac_bus * bus,int sublink)144 hdac_bus_eml_sdw_power_up_unlocked(struct hdac_bus *bus, int sublink) { return 0; }
145 
146 static inline int
hdac_bus_eml_sdw_power_down_unlocked(struct hdac_bus * bus,int sublink)147 hdac_bus_eml_sdw_power_down_unlocked(struct hdac_bus *bus, int sublink) { return 0; }
148 
149 static inline int
hdac_bus_eml_sdw_get_lsdiid_unlocked(struct hdac_bus * bus,int sublink,u16 * lsdiid)150 hdac_bus_eml_sdw_get_lsdiid_unlocked(struct hdac_bus *bus, int sublink, u16 *lsdiid) { return 0; }
151 
152 static inline int
hdac_bus_eml_sdw_set_lsdiid(struct hdac_bus * bus,int sublink,int dev_num)153 hdac_bus_eml_sdw_set_lsdiid(struct hdac_bus *bus, int sublink, int dev_num) { return 0; }
154 
155 static inline int
hdac_bus_eml_sdw_map_stream_ch(struct hdac_bus * bus,int sublink,int y,int channel_mask,int stream_id,int dir)156 hdac_bus_eml_sdw_map_stream_ch(struct hdac_bus *bus, int sublink, int y,
157 			       int channel_mask, int stream_id, int dir)
158 {
159 	return 0;
160 }
161 
hda_bus_ml_put_all(struct hdac_bus * bus)162 static inline void hda_bus_ml_put_all(struct hdac_bus *bus) { }
hda_bus_ml_reset_losidv(struct hdac_bus * bus)163 static inline void hda_bus_ml_reset_losidv(struct hdac_bus *bus) { }
hda_bus_ml_resume(struct hdac_bus * bus)164 static inline int hda_bus_ml_resume(struct hdac_bus *bus) { return 0; }
hda_bus_ml_suspend(struct hdac_bus * bus)165 static inline int hda_bus_ml_suspend(struct hdac_bus *bus) { return 0; }
166 
167 static inline struct hdac_ext_link *
hdac_bus_eml_ssp_get_hlink(struct hdac_bus * bus)168 hdac_bus_eml_ssp_get_hlink(struct hdac_bus *bus) { return NULL; }
169 
170 static inline struct hdac_ext_link *
hdac_bus_eml_dmic_get_hlink(struct hdac_bus * bus)171 hdac_bus_eml_dmic_get_hlink(struct hdac_bus *bus) { return NULL; }
172 
173 static inline struct hdac_ext_link *
hdac_bus_eml_sdw_get_hlink(struct hdac_bus * bus)174 hdac_bus_eml_sdw_get_hlink(struct hdac_bus *bus) { return NULL; }
175 
176 static inline struct mutex *
hdac_bus_eml_get_mutex(struct hdac_bus * bus,bool alt,int elid)177 hdac_bus_eml_get_mutex(struct hdac_bus *bus, bool alt, int elid) { return NULL; }
178 
179 static inline int
hdac_bus_eml_enable_offload(struct hdac_bus * bus,bool alt,int elid,bool enable)180 hdac_bus_eml_enable_offload(struct hdac_bus *bus, bool alt, int elid, bool enable)
181 {
182 	return 0;
183 }
184 #endif /* CONFIG_SND_SOC_SOF_HDA_MLINK */
185