18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) 28c2ecf20Sopenharmony_ci// 38c2ecf20Sopenharmony_ci// This file is provided under a dual BSD/GPLv2 license. When using or 48c2ecf20Sopenharmony_ci// redistributing this file, you may do so under either license. 58c2ecf20Sopenharmony_ci// 68c2ecf20Sopenharmony_ci// Copyright(c) 2018 Intel Corporation. All rights reserved. 78c2ecf20Sopenharmony_ci// 88c2ecf20Sopenharmony_ci// Authors: Keyon Jie <yang.jie@linux.intel.com> 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/io.h> 118c2ecf20Sopenharmony_ci#include <sound/hdaudio.h> 128c2ecf20Sopenharmony_ci#include "../sof-priv.h" 138c2ecf20Sopenharmony_ci#include "hda.h" 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) 168c2ecf20Sopenharmony_ci#include "../../codecs/hdac_hda.h" 178c2ecf20Sopenharmony_ci#define sof_hda_ext_ops snd_soc_hdac_hda_get_ops() 188c2ecf20Sopenharmony_ci#else 198c2ecf20Sopenharmony_ci#define sof_hda_ext_ops NULL 208c2ecf20Sopenharmony_ci#endif 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* 238c2ecf20Sopenharmony_ci * This can be used for both with/without hda link support. 248c2ecf20Sopenharmony_ci */ 258c2ecf20Sopenharmony_civoid sof_hda_bus_init(struct hdac_bus *bus, struct device *dev) 268c2ecf20Sopenharmony_ci{ 278c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) 288c2ecf20Sopenharmony_ci snd_hdac_ext_bus_init(bus, dev, NULL, sof_hda_ext_ops); 298c2ecf20Sopenharmony_ci#else /* CONFIG_SND_SOC_SOF_HDA */ 308c2ecf20Sopenharmony_ci memset(bus, 0, sizeof(*bus)); 318c2ecf20Sopenharmony_ci bus->dev = dev; 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci INIT_LIST_HEAD(&bus->stream_list); 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci bus->irq = -1; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci /* 388c2ecf20Sopenharmony_ci * There is only one HDA bus atm. keep the index as 0. 398c2ecf20Sopenharmony_ci * Need to fix when there are more than one HDA bus. 408c2ecf20Sopenharmony_ci */ 418c2ecf20Sopenharmony_ci bus->idx = 0; 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci spin_lock_init(&bus->reg_lock); 448c2ecf20Sopenharmony_ci#endif /* CONFIG_SND_SOC_SOF_HDA */ 458c2ecf20Sopenharmony_ci} 46