Commit | Line | Data |
---|---|---|
78ad1f07 KJ |
1 | // SPDX-License-Identifier: (GPL-2.0 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) 2018 Intel Corporation. All rights reserved. | |
7 | // | |
8 | // Authors: Keyon Jie <yang.jie@linux.intel.com> | |
9 | ||
10 | #include <linux/io.h> | |
11 | #include <sound/hdaudio.h> | |
12 | #include "../sof-priv.h" | |
13 | #include "hda.h" | |
14 | ||
d4ff1b39 TI |
15 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) |
16 | #define sof_hda_ext_ops snd_soc_hdac_hda_get_ops() | |
17 | #else | |
18 | #define sof_hda_ext_ops NULL | |
78ad1f07 KJ |
19 | #endif |
20 | ||
78ad1f07 KJ |
21 | /* |
22 | * This can be used for both with/without hda link support. | |
23 | */ | |
d4ff1b39 | 24 | void sof_hda_bus_init(struct hdac_bus *bus, struct device *dev) |
78ad1f07 | 25 | { |
d4ff1b39 TI |
26 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) |
27 | snd_hdac_ext_bus_init(bus, dev, NULL, sof_hda_ext_ops); | |
28 | #else /* CONFIG_SND_SOC_SOF_HDA */ | |
78ad1f07 KJ |
29 | memset(bus, 0, sizeof(*bus)); |
30 | bus->dev = dev; | |
31 | ||
78ad1f07 KJ |
32 | INIT_LIST_HEAD(&bus->stream_list); |
33 | ||
34 | bus->irq = -1; | |
d1a6459f ZY |
35 | |
36 | /* | |
37 | * There is only one HDA bus atm. keep the index as 0. | |
38 | * Need to fix when there are more than one HDA bus. | |
39 | */ | |
40 | bus->idx = 0; | |
78ad1f07 KJ |
41 | |
42 | spin_lock_init(&bus->reg_lock); | |
d4ff1b39 | 43 | #endif /* CONFIG_SND_SOC_SOF_HDA */ |
78ad1f07 | 44 | } |