Skip to content

Commit 3b7bd0c

Browse files
plbossartbroonie
authored andcommitted
ASoC: SOF: Intel: remove circular dependency on hda_sdw_process_wakeen()
hda_sdw_process_wakeen() is used in hda-loader.c, but defined in hda.c. This code split will create a circular dependency when hda.c is moved to a different module. Rather than an invasive code change, this patch follows the model used for sdw_check_wakeen_irq() with an abstraction. For now all abstractions point to the same common routine, which is arguably not great, but this also provides us with a future-proof way of addressing platform-specific wake processing. Signed-off-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Bard Liao <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 136b373 commit 3b7bd0c

File tree

9 files changed

+33
-1
lines changed

9 files changed

+33
-1
lines changed

sound/soc/sof/intel/cnl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ const struct sof_intel_dsp_desc cnl_chip_info = {
473473
.enable_sdw_irq = hda_common_enable_sdw_irq,
474474
.check_sdw_irq = hda_common_check_sdw_irq,
475475
.check_sdw_wakeen_irq = hda_sdw_check_wakeen_irq_common,
476+
.sdw_process_wakeen = hda_sdw_process_wakeen_common,
476477
.check_ipc_irq = hda_dsp_check_ipc_irq,
477478
.cl_init = cl_dsp_init,
478479
.power_down_dsp = hda_power_down_dsp,
@@ -508,6 +509,7 @@ const struct sof_intel_dsp_desc jsl_chip_info = {
508509
.enable_sdw_irq = hda_common_enable_sdw_irq,
509510
.check_sdw_irq = hda_common_check_sdw_irq,
510511
.check_sdw_wakeen_irq = hda_sdw_check_wakeen_irq_common,
512+
.sdw_process_wakeen = hda_sdw_process_wakeen_common,
511513
.check_ipc_irq = hda_dsp_check_ipc_irq,
512514
.cl_init = cl_dsp_init,
513515
.power_down_dsp = hda_power_down_dsp,

sound/soc/sof/intel/hda-dsp.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,21 @@ int hda_sdw_check_lcount(struct snd_sof_dev *sdev)
13111311

13121312
return 0;
13131313
}
1314+
1315+
void hda_sdw_process_wakeen(struct snd_sof_dev *sdev)
1316+
{
1317+
u32 interface_mask = hda_get_interface_mask(sdev);
1318+
const struct sof_intel_dsp_desc *chip;
1319+
1320+
if (!(interface_mask & BIT(SOF_DAI_INTEL_ALH)))
1321+
return;
1322+
1323+
chip = get_chip_info(sdev->pdata);
1324+
if (chip && chip->sdw_process_wakeen)
1325+
chip->sdw_process_wakeen(sdev);
1326+
}
1327+
EXPORT_SYMBOL_NS(hda_sdw_process_wakeen, SND_SOC_SOF_INTEL_HDA_COMMON);
1328+
13141329
#endif
13151330

13161331
int hda_dsp_disable_interrupts(struct snd_sof_dev *sdev)

sound/soc/sof/intel/hda.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ static bool hda_sdw_check_wakeen_irq(struct snd_sof_dev *sdev)
331331
return false;
332332
}
333333

334-
void hda_sdw_process_wakeen(struct snd_sof_dev *sdev)
334+
void hda_sdw_process_wakeen_common(struct snd_sof_dev *sdev)
335335
{
336336
u32 interface_mask = hda_get_interface_mask(sdev);
337337
struct sof_intel_hda_dev *hdev;
@@ -345,6 +345,7 @@ void hda_sdw_process_wakeen(struct snd_sof_dev *sdev)
345345

346346
sdw_intel_process_wakeen_event(hdev->sdw);
347347
}
348+
EXPORT_SYMBOL_NS(hda_sdw_process_wakeen_common, SND_SOC_SOF_INTEL_HDA_COMMON);
348349

349350
#else /* IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE) */
350351
static inline int hda_sdw_acpi_scan(struct snd_sof_dev *sdev)

sound/soc/sof/intel/hda.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,7 @@ int hda_sdw_startup(struct snd_sof_dev *sdev);
815815
void hda_common_enable_sdw_irq(struct snd_sof_dev *sdev, bool enable);
816816
void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable);
817817
bool hda_sdw_check_wakeen_irq_common(struct snd_sof_dev *sdev);
818+
void hda_sdw_process_wakeen_common(struct snd_sof_dev *sdev);
818819
void hda_sdw_process_wakeen(struct snd_sof_dev *sdev);
819820
bool hda_common_check_sdw_irq(struct snd_sof_dev *sdev);
820821

@@ -853,6 +854,10 @@ static inline bool hda_sdw_check_wakeen_irq_common(struct snd_sof_dev *sdev)
853854
return false;
854855
}
855856

857+
static inline void hda_sdw_process_wakeen_common(struct snd_sof_dev *sdev)
858+
{
859+
}
860+
856861
static inline void hda_sdw_process_wakeen(struct snd_sof_dev *sdev)
857862
{
858863
}

sound/soc/sof/intel/icl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ const struct sof_intel_dsp_desc icl_chip_info = {
187187
.enable_sdw_irq = hda_common_enable_sdw_irq,
188188
.check_sdw_irq = hda_common_check_sdw_irq,
189189
.check_sdw_wakeen_irq = hda_sdw_check_wakeen_irq_common,
190+
.sdw_process_wakeen = hda_sdw_process_wakeen_common,
190191
.check_ipc_irq = hda_dsp_check_ipc_irq,
191192
.cl_init = cl_dsp_init,
192193
.power_down_dsp = hda_power_down_dsp,

sound/soc/sof/intel/lnl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ const struct sof_intel_dsp_desc lnl_chip_info = {
238238
.enable_sdw_irq = lnl_enable_sdw_irq,
239239
.check_sdw_irq = lnl_dsp_check_sdw_irq,
240240
.check_sdw_wakeen_irq = lnl_sdw_check_wakeen_irq,
241+
.sdw_process_wakeen = hda_sdw_process_wakeen_common,
241242
.check_ipc_irq = mtl_dsp_check_ipc_irq,
242243
.cl_init = mtl_dsp_cl_init,
243244
.power_down_dsp = mtl_power_down_dsp,

sound/soc/sof/intel/mtl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,7 @@ const struct sof_intel_dsp_desc mtl_chip_info = {
779779
.enable_sdw_irq = mtl_enable_sdw_irq,
780780
.check_sdw_irq = mtl_dsp_check_sdw_irq,
781781
.check_sdw_wakeen_irq = hda_sdw_check_wakeen_irq_common,
782+
.sdw_process_wakeen = hda_sdw_process_wakeen_common,
782783
.check_ipc_irq = mtl_dsp_check_ipc_irq,
783784
.cl_init = mtl_dsp_cl_init,
784785
.power_down_dsp = mtl_power_down_dsp,
@@ -806,6 +807,7 @@ const struct sof_intel_dsp_desc arl_s_chip_info = {
806807
.enable_sdw_irq = mtl_enable_sdw_irq,
807808
.check_sdw_irq = mtl_dsp_check_sdw_irq,
808809
.check_sdw_wakeen_irq = hda_sdw_check_wakeen_irq_common,
810+
.sdw_process_wakeen = hda_sdw_process_wakeen_common,
809811
.check_ipc_irq = mtl_dsp_check_ipc_irq,
810812
.cl_init = mtl_dsp_cl_init,
811813
.power_down_dsp = mtl_power_down_dsp,

sound/soc/sof/intel/shim.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ struct sof_intel_dsp_desc {
190190
void (*enable_sdw_irq)(struct snd_sof_dev *sdev, bool enable);
191191
bool (*check_sdw_irq)(struct snd_sof_dev *sdev);
192192
bool (*check_sdw_wakeen_irq)(struct snd_sof_dev *sdev);
193+
void (*sdw_process_wakeen)(struct snd_sof_dev *sdev);
193194
bool (*check_ipc_irq)(struct snd_sof_dev *sdev);
194195
int (*power_down_dsp)(struct snd_sof_dev *sdev);
195196
int (*disable_interrupts)(struct snd_sof_dev *sdev);

sound/soc/sof/intel/tgl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ const struct sof_intel_dsp_desc tgl_chip_info = {
156156
.enable_sdw_irq = hda_common_enable_sdw_irq,
157157
.check_sdw_irq = hda_common_check_sdw_irq,
158158
.check_sdw_wakeen_irq = hda_sdw_check_wakeen_irq_common,
159+
.sdw_process_wakeen = hda_sdw_process_wakeen_common,
159160
.check_ipc_irq = hda_dsp_check_ipc_irq,
160161
.cl_init = cl_dsp_init,
161162
.power_down_dsp = hda_power_down_dsp,
@@ -184,6 +185,7 @@ const struct sof_intel_dsp_desc tglh_chip_info = {
184185
.enable_sdw_irq = hda_common_enable_sdw_irq,
185186
.check_sdw_irq = hda_common_check_sdw_irq,
186187
.check_sdw_wakeen_irq = hda_sdw_check_wakeen_irq_common,
188+
.sdw_process_wakeen = hda_sdw_process_wakeen_common,
187189
.check_ipc_irq = hda_dsp_check_ipc_irq,
188190
.cl_init = cl_dsp_init,
189191
.power_down_dsp = hda_power_down_dsp,
@@ -212,6 +214,7 @@ const struct sof_intel_dsp_desc ehl_chip_info = {
212214
.enable_sdw_irq = hda_common_enable_sdw_irq,
213215
.check_sdw_irq = hda_common_check_sdw_irq,
214216
.check_sdw_wakeen_irq = hda_sdw_check_wakeen_irq_common,
217+
.sdw_process_wakeen = hda_sdw_process_wakeen_common,
215218
.check_ipc_irq = hda_dsp_check_ipc_irq,
216219
.cl_init = cl_dsp_init,
217220
.power_down_dsp = hda_power_down_dsp,
@@ -240,6 +243,7 @@ const struct sof_intel_dsp_desc adls_chip_info = {
240243
.enable_sdw_irq = hda_common_enable_sdw_irq,
241244
.check_sdw_irq = hda_common_check_sdw_irq,
242245
.check_sdw_wakeen_irq = hda_sdw_check_wakeen_irq_common,
246+
.sdw_process_wakeen = hda_sdw_process_wakeen_common,
243247
.check_ipc_irq = hda_dsp_check_ipc_irq,
244248
.cl_init = cl_dsp_init,
245249
.power_down_dsp = hda_power_down_dsp,

0 commit comments

Comments
 (0)