Commit 76f56fae authored by Rakesh Ughreja's avatar Rakesh Ughreja Committed by Takashi Iwai

ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus instead

This patch removes the hdac_ext_bus structure. The legacy and
enhanced HDaudio capabilities can be handled in a backward-compatible
way without separate definitions.

Follow-up patches in this series handle the driver definition.
Signed-off-by: default avatarRakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 3787a398
...@@ -250,6 +250,11 @@ struct hdac_rb { ...@@ -250,6 +250,11 @@ struct hdac_rb {
* @mlcap: MultiLink capabilities pointer * @mlcap: MultiLink capabilities pointer
* @gtscap: gts capabilities pointer * @gtscap: gts capabilities pointer
* @drsmcap: dma resume capabilities pointer * @drsmcap: dma resume capabilities pointer
* @num_streams: streams supported
* @idx: HDA link index
* @hlink_list: link list of HDA links
* @lock: lock for link mgmt
* @cmd_dma_state: state of cmd DMAs: CORB and RIRB
*/ */
struct hdac_bus { struct hdac_bus {
struct device *dev; struct device *dev;
...@@ -317,6 +322,16 @@ struct hdac_bus { ...@@ -317,6 +322,16 @@ struct hdac_bus {
/* i915 component interface */ /* i915 component interface */
struct i915_audio_component *audio_component; struct i915_audio_component *audio_component;
int i915_power_refcount; int i915_power_refcount;
/* parameters required for enhanced capabilities */
int num_streams;
int idx;
struct list_head hlink_list;
struct mutex lock;
bool cmd_dma_state;
}; };
int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
......
...@@ -4,38 +4,14 @@ ...@@ -4,38 +4,14 @@
#include <sound/hdaudio.h> #include <sound/hdaudio.h>
/** int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
* hdac_ext_bus: HDAC extended bus for extended HDA caps
*
* @bus: hdac bus
* @num_streams: streams supported
* @hlink_list: link list of HDA links
* @lock: lock for link mgmt
* @cmd_dma_state: state of cmd DMAs: CORB and RIRB
*/
struct hdac_ext_bus {
struct hdac_bus bus;
int num_streams;
int idx;
struct list_head hlink_list;
struct mutex lock;
bool cmd_dma_state;
};
int snd_hdac_ext_bus_init(struct hdac_ext_bus *sbus, struct device *dev,
const struct hdac_bus_ops *ops, const struct hdac_bus_ops *ops,
const struct hdac_io_ops *io_ops); const struct hdac_io_ops *io_ops);
void snd_hdac_ext_bus_exit(struct hdac_ext_bus *sbus); void snd_hdac_ext_bus_exit(struct hdac_bus *bus);
int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *sbus, int addr); int snd_hdac_ext_bus_device_init(struct hdac_bus *bus, int addr);
void snd_hdac_ext_bus_device_exit(struct hdac_device *hdev); void snd_hdac_ext_bus_device_exit(struct hdac_device *hdev);
void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus); void snd_hdac_ext_bus_device_remove(struct hdac_bus *bus);
#define ebus_to_hbus(ebus) (&(ebus)->bus)
#define hbus_to_ebus(_bus) \
container_of(_bus, struct hdac_ext_bus, bus)
#define HDA_CODEC_REV_EXT_ENTRY(_vid, _rev, _name, drv_data) \ #define HDA_CODEC_REV_EXT_ENTRY(_vid, _rev, _name, drv_data) \
{ .vendor_id = (_vid), .rev_id = (_rev), .name = (_name), \ { .vendor_id = (_vid), .rev_id = (_rev), .name = (_name), \
...@@ -44,14 +20,14 @@ void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus); ...@@ -44,14 +20,14 @@ void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus);
#define HDA_CODEC_EXT_ENTRY(_vid, _revid, _name, _drv_data) \ #define HDA_CODEC_EXT_ENTRY(_vid, _revid, _name, _drv_data) \
HDA_CODEC_REV_EXT_ENTRY(_vid, _revid, _name, _drv_data) HDA_CODEC_REV_EXT_ENTRY(_vid, _revid, _name, _drv_data)
void snd_hdac_ext_bus_ppcap_enable(struct hdac_ext_bus *chip, bool enable); void snd_hdac_ext_bus_ppcap_enable(struct hdac_bus *chip, bool enable);
void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_ext_bus *chip, bool enable); void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_bus *chip, bool enable);
void snd_hdac_ext_stream_spbcap_enable(struct hdac_ext_bus *chip, void snd_hdac_ext_stream_spbcap_enable(struct hdac_bus *chip,
bool enable, int index); bool enable, int index);
int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_ext_bus *bus); int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus);
struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_ext_bus *bus, struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus,
const char *codec_name); const char *codec_name);
enum hdac_ext_stream_type { enum hdac_ext_stream_type {
...@@ -100,28 +76,28 @@ struct hdac_ext_stream { ...@@ -100,28 +76,28 @@ struct hdac_ext_stream {
#define stream_to_hdac_ext_stream(s) \ #define stream_to_hdac_ext_stream(s) \
container_of(s, struct hdac_ext_stream, hstream) container_of(s, struct hdac_ext_stream, hstream)
void snd_hdac_ext_stream_init(struct hdac_ext_bus *bus, void snd_hdac_ext_stream_init(struct hdac_bus *bus,
struct hdac_ext_stream *stream, int idx, struct hdac_ext_stream *stream, int idx,
int direction, int tag); int direction, int tag);
int snd_hdac_ext_stream_init_all(struct hdac_ext_bus *ebus, int start_idx, int snd_hdac_ext_stream_init_all(struct hdac_bus *bus, int start_idx,
int num_stream, int dir); int num_stream, int dir);
void snd_hdac_stream_free_all(struct hdac_ext_bus *ebus); void snd_hdac_stream_free_all(struct hdac_bus *bus);
void snd_hdac_link_free_all(struct hdac_ext_bus *ebus); void snd_hdac_link_free_all(struct hdac_bus *bus);
struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_ext_bus *bus, struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus,
struct snd_pcm_substream *substream, struct snd_pcm_substream *substream,
int type); int type);
void snd_hdac_ext_stream_release(struct hdac_ext_stream *azx_dev, int type); void snd_hdac_ext_stream_release(struct hdac_ext_stream *azx_dev, int type);
void snd_hdac_ext_stream_decouple(struct hdac_ext_bus *bus, void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,
struct hdac_ext_stream *azx_dev, bool decouple); struct hdac_ext_stream *azx_dev, bool decouple);
void snd_hdac_ext_stop_streams(struct hdac_ext_bus *sbus); void snd_hdac_ext_stop_streams(struct hdac_bus *bus);
int snd_hdac_ext_stream_set_spib(struct hdac_ext_bus *ebus, int snd_hdac_ext_stream_set_spib(struct hdac_bus *bus,
struct hdac_ext_stream *stream, u32 value); struct hdac_ext_stream *stream, u32 value);
int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_ext_bus *ebus, int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_bus *bus,
struct hdac_ext_stream *stream); struct hdac_ext_stream *stream);
void snd_hdac_ext_stream_drsm_enable(struct hdac_ext_bus *ebus, void snd_hdac_ext_stream_drsm_enable(struct hdac_bus *bus,
bool enable, int index); bool enable, int index);
int snd_hdac_ext_stream_set_dpibr(struct hdac_ext_bus *ebus, int snd_hdac_ext_stream_set_dpibr(struct hdac_bus *bus,
struct hdac_ext_stream *stream, u32 value); struct hdac_ext_stream *stream, u32 value);
int snd_hdac_ext_stream_set_lpib(struct hdac_ext_stream *stream, u32 value); int snd_hdac_ext_stream_set_lpib(struct hdac_ext_stream *stream, u32 value);
...@@ -144,17 +120,15 @@ struct hdac_ext_link { ...@@ -144,17 +120,15 @@ struct hdac_ext_link {
int snd_hdac_ext_bus_link_power_up(struct hdac_ext_link *link); int snd_hdac_ext_bus_link_power_up(struct hdac_ext_link *link);
int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *link); int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *link);
int snd_hdac_ext_bus_link_power_up_all(struct hdac_ext_bus *ebus); int snd_hdac_ext_bus_link_power_up_all(struct hdac_bus *bus);
int snd_hdac_ext_bus_link_power_down_all(struct hdac_ext_bus *ebus); int snd_hdac_ext_bus_link_power_down_all(struct hdac_bus *bus);
void snd_hdac_ext_link_set_stream_id(struct hdac_ext_link *link, void snd_hdac_ext_link_set_stream_id(struct hdac_ext_link *link,
int stream); int stream);
void snd_hdac_ext_link_clear_stream_id(struct hdac_ext_link *link, void snd_hdac_ext_link_clear_stream_id(struct hdac_ext_link *link,
int stream); int stream);
int snd_hdac_ext_bus_link_get(struct hdac_ext_bus *ebus, int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, struct hdac_ext_link *link);
struct hdac_ext_link *link); int snd_hdac_ext_bus_link_put(struct hdac_bus *bus, struct hdac_ext_link *link);
int snd_hdac_ext_bus_link_put(struct hdac_ext_bus *ebus,
struct hdac_ext_link *link);
/* update register macro */ /* update register macro */
#define snd_hdac_updatel(addr, reg, mask, val) \ #define snd_hdac_updatel(addr, reg, mask, val) \
......
...@@ -87,7 +87,7 @@ static const struct hdac_io_ops hdac_ext_default_io = { ...@@ -87,7 +87,7 @@ static const struct hdac_io_ops hdac_ext_default_io = {
* *
* Returns 0 if successful, or a negative error code. * Returns 0 if successful, or a negative error code.
*/ */
int snd_hdac_ext_bus_init(struct hdac_ext_bus *ebus, struct device *dev, int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
const struct hdac_bus_ops *ops, const struct hdac_bus_ops *ops,
const struct hdac_io_ops *io_ops) const struct hdac_io_ops *io_ops)
{ {
...@@ -98,15 +98,15 @@ int snd_hdac_ext_bus_init(struct hdac_ext_bus *ebus, struct device *dev, ...@@ -98,15 +98,15 @@ int snd_hdac_ext_bus_init(struct hdac_ext_bus *ebus, struct device *dev,
if (io_ops == NULL) if (io_ops == NULL)
io_ops = &hdac_ext_default_io; io_ops = &hdac_ext_default_io;
ret = snd_hdac_bus_init(&ebus->bus, dev, ops, io_ops); ret = snd_hdac_bus_init(bus, dev, ops, io_ops);
if (ret < 0) if (ret < 0)
return ret; return ret;
INIT_LIST_HEAD(&ebus->hlink_list); INIT_LIST_HEAD(&bus->hlink_list);
ebus->idx = idx++; bus->idx = idx++;
mutex_init(&ebus->lock); mutex_init(&bus->lock);
ebus->cmd_dma_state = true; bus->cmd_dma_state = true;
return 0; return 0;
} }
...@@ -116,10 +116,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_init); ...@@ -116,10 +116,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_init);
* snd_hdac_ext_bus_exit - clean up a HD-audio extended bus * snd_hdac_ext_bus_exit - clean up a HD-audio extended bus
* @ebus: the pointer to extended bus object * @ebus: the pointer to extended bus object
*/ */
void snd_hdac_ext_bus_exit(struct hdac_ext_bus *ebus) void snd_hdac_ext_bus_exit(struct hdac_bus *bus)
{ {
snd_hdac_bus_exit(&ebus->bus); snd_hdac_bus_exit(bus);
WARN_ON(!list_empty(&ebus->hlink_list)); WARN_ON(!list_empty(&bus->hlink_list));
} }
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_exit); EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_exit);
...@@ -135,10 +135,9 @@ static void default_release(struct device *dev) ...@@ -135,10 +135,9 @@ static void default_release(struct device *dev)
* *
* Returns zero for success or a negative error code. * Returns zero for success or a negative error code.
*/ */
int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *ebus, int addr) int snd_hdac_ext_bus_device_init(struct hdac_bus *bus, int addr)
{ {
struct hdac_device *hdev = NULL; struct hdac_device *hdev = NULL;
struct hdac_bus *bus = ebus_to_hbus(ebus);
char name[15]; char name[15];
int ret; int ret;
...@@ -148,7 +147,7 @@ int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *ebus, int addr) ...@@ -148,7 +147,7 @@ int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *ebus, int addr)
hdev->bus = bus; hdev->bus = bus;
snprintf(name, sizeof(name), "ehdaudio%dD%d", ebus->idx, addr); snprintf(name, sizeof(name), "ehdaudio%dD%d", bus->idx, addr);
ret = snd_hdac_device_init(hdev, bus, name, addr); ret = snd_hdac_device_init(hdev, bus, name, addr);
if (ret < 0) { if (ret < 0) {
...@@ -185,14 +184,14 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_exit); ...@@ -185,14 +184,14 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_exit);
* *
* @ebus: HD-audio extended bus * @ebus: HD-audio extended bus
*/ */
void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus) void snd_hdac_ext_bus_device_remove(struct hdac_bus *bus)
{ {
struct hdac_device *codec, *__codec; struct hdac_device *codec, *__codec;
/* /*
* we need to remove all the codec devices objects created in the * we need to remove all the codec devices objects created in the
* snd_hdac_ext_bus_device_init * snd_hdac_ext_bus_device_init
*/ */
list_for_each_entry_safe(codec, __codec, &ebus->bus.codec_list, list) { list_for_each_entry_safe(codec, __codec, &bus->codec_list, list) {
snd_hdac_device_unregister(codec); snd_hdac_device_unregister(codec);
put_device(&codec->dev); put_device(&codec->dev);
} }
......
...@@ -39,9 +39,8 @@ ...@@ -39,9 +39,8 @@
* @ebus: HD-audio extended core bus * @ebus: HD-audio extended core bus
* @enable: flag to turn on/off the capability * @enable: flag to turn on/off the capability
*/ */
void snd_hdac_ext_bus_ppcap_enable(struct hdac_ext_bus *ebus, bool enable) void snd_hdac_ext_bus_ppcap_enable(struct hdac_bus *bus, bool enable)
{ {
struct hdac_bus *bus = &ebus->bus;
if (!bus->ppcap) { if (!bus->ppcap) {
dev_err(bus->dev, "Address of PP capability is NULL"); dev_err(bus->dev, "Address of PP capability is NULL");
...@@ -60,9 +59,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_ppcap_enable); ...@@ -60,9 +59,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_ppcap_enable);
* @ebus: HD-audio extended core bus * @ebus: HD-audio extended core bus
* @enable: flag to enable/disable interrupt * @enable: flag to enable/disable interrupt
*/ */
void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_ext_bus *ebus, bool enable) void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_bus *bus, bool enable)
{ {
struct hdac_bus *bus = &ebus->bus;
if (!bus->ppcap) { if (!bus->ppcap) {
dev_err(bus->dev, "Address of PP capability is NULL\n"); dev_err(bus->dev, "Address of PP capability is NULL\n");
...@@ -89,12 +87,11 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_ppcap_int_enable); ...@@ -89,12 +87,11 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_ppcap_int_enable);
* in hlink_list of extended hdac bus * in hlink_list of extended hdac bus
* Note: this will be freed on bus exit by driver * Note: this will be freed on bus exit by driver
*/ */
int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_ext_bus *ebus) int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus)
{ {
int idx; int idx;
u32 link_count; u32 link_count;
struct hdac_ext_link *hlink; struct hdac_ext_link *hlink;
struct hdac_bus *bus = &ebus->bus;
link_count = readl(bus->mlcap + AZX_REG_ML_MLCD) + 1; link_count = readl(bus->mlcap + AZX_REG_ML_MLCD) + 1;
...@@ -114,7 +111,7 @@ int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_ext_bus *ebus) ...@@ -114,7 +111,7 @@ int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_ext_bus *ebus)
/* since link in On, update the ref */ /* since link in On, update the ref */
hlink->ref_count = 1; hlink->ref_count = 1;
list_add_tail(&hlink->list, &ebus->hlink_list); list_add_tail(&hlink->list, &bus->hlink_list);
} }
return 0; return 0;
...@@ -127,12 +124,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_get_ml_capabilities); ...@@ -127,12 +124,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_get_ml_capabilities);
* @ebus: HD-audio ext core bus * @ebus: HD-audio ext core bus
*/ */
void snd_hdac_link_free_all(struct hdac_ext_bus *ebus) void snd_hdac_link_free_all(struct hdac_bus *bus)
{ {
struct hdac_ext_link *l; struct hdac_ext_link *l;
while (!list_empty(&ebus->hlink_list)) { while (!list_empty(&bus->hlink_list)) {
l = list_first_entry(&ebus->hlink_list, struct hdac_ext_link, list); l = list_first_entry(&bus->hlink_list, struct hdac_ext_link, list);
list_del(&l->list); list_del(&l->list);
kfree(l); kfree(l);
} }
...@@ -144,7 +141,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_link_free_all); ...@@ -144,7 +141,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_link_free_all);
* @ebus: HD-audio extended core bus * @ebus: HD-audio extended core bus
* @codec_name: codec name * @codec_name: codec name
*/ */
struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_ext_bus *ebus, struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_bus *bus,
const char *codec_name) const char *codec_name)
{ {
int i; int i;
...@@ -153,10 +150,10 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_ext_bus *ebus, ...@@ -153,10 +150,10 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_ext_bus *ebus,
if (sscanf(codec_name, "ehdaudio%dD%d", &bus_idx, &addr) != 2) if (sscanf(codec_name, "ehdaudio%dD%d", &bus_idx, &addr) != 2)
return NULL; return NULL;
if (ebus->idx != bus_idx) if (bus->idx != bus_idx)
return NULL; return NULL;
list_for_each_entry(hlink, &ebus->hlink_list, list) { list_for_each_entry(hlink, &bus->hlink_list, list) {
for (i = 0; i < HDA_MAX_CODECS; i++) { for (i = 0; i < HDA_MAX_CODECS; i++) {
if (hlink->lsdiid & (0x1 << addr)) if (hlink->lsdiid & (0x1 << addr))
return hlink; return hlink;
...@@ -219,12 +216,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down); ...@@ -219,12 +216,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down);
* snd_hdac_ext_bus_link_power_up_all -power up all hda link * snd_hdac_ext_bus_link_power_up_all -power up all hda link
* @ebus: HD-audio extended bus * @ebus: HD-audio extended bus
*/ */
int snd_hdac_ext_bus_link_power_up_all(struct hdac_ext_bus *ebus) int snd_hdac_ext_bus_link_power_up_all(struct hdac_bus *bus)
{ {
struct hdac_ext_link *hlink = NULL; struct hdac_ext_link *hlink = NULL;
int ret; int ret;
list_for_each_entry(hlink, &ebus->hlink_list, list) { list_for_each_entry(hlink, &bus->hlink_list, list) {
snd_hdac_updatel(hlink->ml_addr, snd_hdac_updatel(hlink->ml_addr,
AZX_REG_ML_LCTL, 0, AZX_MLCTL_SPA); AZX_REG_ML_LCTL, 0, AZX_MLCTL_SPA);
ret = check_hdac_link_power_active(hlink, true); ret = check_hdac_link_power_active(hlink, true);
...@@ -240,12 +237,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_up_all); ...@@ -240,12 +237,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_up_all);
* snd_hdac_ext_bus_link_power_down_all -power down all hda link * snd_hdac_ext_bus_link_power_down_all -power down all hda link
* @ebus: HD-audio extended bus * @ebus: HD-audio extended bus
*/ */
int snd_hdac_ext_bus_link_power_down_all(struct hdac_ext_bus *ebus) int snd_hdac_ext_bus_link_power_down_all(struct hdac_bus *bus)
{ {
struct hdac_ext_link *hlink = NULL; struct hdac_ext_link *hlink = NULL;
int ret; int ret;
list_for_each_entry(hlink, &ebus->hlink_list, list) { list_for_each_entry(hlink, &bus->hlink_list, list) {
snd_hdac_updatel(hlink->ml_addr, AZX_REG_ML_LCTL, AZX_MLCTL_SPA, 0); snd_hdac_updatel(hlink->ml_addr, AZX_REG_ML_LCTL, AZX_MLCTL_SPA, 0);
ret = check_hdac_link_power_active(hlink, false); ret = check_hdac_link_power_active(hlink, false);
if (ret < 0) if (ret < 0)
...@@ -256,39 +253,39 @@ int snd_hdac_ext_bus_link_power_down_all(struct hdac_ext_bus *ebus) ...@@ -256,39 +253,39 @@ int snd_hdac_ext_bus_link_power_down_all(struct hdac_ext_bus *ebus)
} }
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down_all); EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down_all);
int snd_hdac_ext_bus_link_get(struct hdac_ext_bus *ebus, int snd_hdac_ext_bus_link_get(struct hdac_bus *bus,
struct hdac_ext_link *link) struct hdac_ext_link *link)
{ {
int ret = 0; int ret = 0;
mutex_lock(&ebus->lock); mutex_lock(&bus->lock);
/* /*
* if we move from 0 to 1, count will be 1 so power up this link * if we move from 0 to 1, count will be 1 so power up this link
* as well, also check the dma status and trigger that * as well, also check the dma status and trigger that
*/ */
if (++link->ref_count == 1) { if (++link->ref_count == 1) {
if (!ebus->cmd_dma_state) { if (!bus->cmd_dma_state) {
snd_hdac_bus_init_cmd_io(&ebus->bus); snd_hdac_bus_init_cmd_io(bus);
ebus->cmd_dma_state = true; bus->cmd_dma_state = true;
} }
ret = snd_hdac_ext_bus_link_power_up(link); ret = snd_hdac_ext_bus_link_power_up(link);
} }
mutex_unlock(&ebus->lock); mutex_unlock(&bus->lock);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_get); EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_get);
int snd_hdac_ext_bus_link_put(struct hdac_ext_bus *ebus, int snd_hdac_ext_bus_link_put(struct hdac_bus *bus,
struct hdac_ext_link *link) struct hdac_ext_link *link)
{ {
int ret = 0; int ret = 0;
struct hdac_ext_link *hlink; struct hdac_ext_link *hlink;
bool link_up = false; bool link_up = false;
mutex_lock(&ebus->lock); mutex_lock(&bus->lock);
/* /*
* if we move from 1 to 0, count will be 0 * if we move from 1 to 0, count will be 0
...@@ -301,7 +298,7 @@ int snd_hdac_ext_bus_link_put(struct hdac_ext_bus *ebus, ...@@ -301,7 +298,7 @@ int snd_hdac_ext_bus_link_put(struct hdac_ext_bus *ebus,
* now check if all links are off, if so turn off * now check if all links are off, if so turn off
* cmd dma as well * cmd dma as well
*/ */
list_for_each_entry(hlink, &ebus->hlink_list, list) { list_for_each_entry(hlink, &bus->hlink_list, list) {
if (hlink->ref_count) { if (hlink->ref_count) {
link_up = true; link_up = true;
break; break;
...@@ -309,12 +306,12 @@ int snd_hdac_ext_bus_link_put(struct hdac_ext_bus *ebus, ...@@ -309,12 +306,12 @@ int snd_hdac_ext_bus_link_put(struct hdac_ext_bus *ebus,
} }
if (!link_up) { if (!link_up) {
snd_hdac_bus_stop_cmd_io(&ebus->bus); snd_hdac_bus_stop_cmd_io(bus);
ebus->cmd_dma_state = false; bus->cmd_dma_state = false;
} }
} }
mutex_unlock(&ebus->lock); mutex_unlock(&bus->lock);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_put); EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_put);
This diff is collapsed.
...@@ -1799,14 +1799,13 @@ static int hdmi_codec_probe(struct snd_soc_component *component) ...@@ -1799,14 +1799,13 @@ static int hdmi_codec_probe(struct snd_soc_component *component)
* hold the ref while we probe, also no need to drop the ref on * hold the ref while we probe, also no need to drop the ref on
* exit, we call pm_runtime_suspend() so that will do for us * exit, we call pm_runtime_suspend() so that will do for us
*/ */
hlink = snd_hdac_ext_bus_get_link(hbus_to_ebus(hdev->bus), hlink = snd_hdac_ext_bus_get_link(hdev->bus, dev_name(&hdev->dev));
dev_name(&hdev->dev));
if (!hlink) { if (!hlink) {
dev_err(&hdev->dev, "hdac link not found\n"); dev_err(&hdev->dev, "hdac link not found\n");
return -EIO; return -EIO;
} }
snd_hdac_ext_bus_link_get(hbus_to_ebus(hdev->bus), hlink); snd_hdac_ext_bus_link_get(hdev->bus, hlink);
ret = create_fill_widget_route_map(dapm); ret = create_fill_widget_route_map(dapm);
if (ret < 0) if (ret < 0)
...@@ -1984,14 +1983,13 @@ static int hdac_hdmi_dev_probe(struct hdac_device *hdev) ...@@ -1984,14 +1983,13 @@ static int hdac_hdmi_dev_probe(struct hdac_device *hdev)
const struct hda_device_id *hdac_id = hdac_get_device_id(hdev, hdrv); const struct hda_device_id *hdac_id = hdac_get_device_id(hdev, hdrv);
/* hold the ref while we probe */ /* hold the ref while we probe */
hlink = snd_hdac_ext_bus_get_link(hbus_to_ebus(hdev->bus), hlink = snd_hdac_ext_bus_get_link(hdev->bus, dev_name(&hdev->dev));
dev_name(&hdev->dev));
if (!hlink) { if (!hlink) {
dev_err(&hdev->dev, "hdac link not found\n"); dev_err(&hdev->dev, "hdac link not found\n");
return -EIO; return -EIO;
} }
snd_hdac_ext_bus_link_get(hbus_to_ebus(hdev->bus), hlink); snd_hdac_ext_bus_link_get(hdev->bus, hlink);
hdmi_priv = devm_kzalloc(&hdev->dev, sizeof(*hdmi_priv), GFP_KERNEL); hdmi_priv = devm_kzalloc(&hdev->dev, sizeof(*hdmi_priv), GFP_KERNEL);
if (hdmi_priv == NULL) if (hdmi_priv == NULL)
...@@ -2044,7 +2042,7 @@ static int hdac_hdmi_dev_probe(struct hdac_device *hdev) ...@@ -2044,7 +2042,7 @@ static int hdac_hdmi_dev_probe(struct hdac_device *hdev)
ret = devm_snd_soc_register_component(&hdev->dev, &hdmi_hda_codec, ret = devm_snd_soc_register_component(&hdev->dev, &hdmi_hda_codec,
hdmi_dais, num_dais); hdmi_dais, num_dais);
snd_hdac_ext_bus_link_put(hbus_to_ebus(hdev->bus), hlink); snd_hdac_ext_bus_link_put(hdev->bus, hlink);
return ret; return ret;
} }
...@@ -2093,7 +2091,6 @@ static int hdac_hdmi_runtime_suspend(struct device *dev) ...@@ -2093,7 +2091,6 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
{ {
struct hdac_device *hdev = dev_to_hdac_dev(dev); struct hdac_device *hdev = dev_to_hdac_dev(dev);
struct hdac_bus *bus = hdev->bus; struct hdac_bus *bus = hdev->bus;
struct hdac_ext_bus *ebus = hbus_to_ebus(bus);
struct hdac_ext_link *hlink = NULL; struct hdac_ext_link *hlink = NULL;
int err; int err;
...@@ -2118,13 +2115,13 @@ static int hdac_hdmi_runtime_suspend(struct device *dev) ...@@ -2118,13 +2115,13 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
return err; return err;
} }
hlink = snd_hdac_ext_bus_get_link(ebus, dev_name(dev)); hlink = snd_hdac_ext_bus_get_link(bus, dev_name(dev));
if (!hlink) { if (!hlink) {
dev_err(dev, "hdac link not found\n"); dev_err(dev, "hdac link not found\n");
return -EIO; return -EIO;
} }
snd_hdac_ext_bus_link_put(ebus, hlink); snd_hdac_ext_bus_link_put(bus, hlink);
return 0; return 0;
} }
...@@ -2133,7 +2130,6 @@ static int hdac_hdmi_runtime_resume(struct device *dev) ...@@ -2133,7 +2130,6 @@ static int hdac_hdmi_runtime_resume(struct device *dev)
{ {
struct hdac_device *hdev = dev_to_hdac_dev(dev); struct hdac_device *hdev = dev_to_hdac_dev(dev);
struct hdac_bus *bus = hdev->bus; struct hdac_bus *bus = hdev->bus;
struct hdac_ext_bus *ebus = hbus_to_ebus(bus);
struct hdac_ext_link *hlink = NULL; struct hdac_ext_link *hlink = NULL;
int err; int err;
...@@ -2143,13 +2139,13 @@ static int hdac_hdmi_runtime_resume(struct device *dev) ...@@ -2143,13 +2139,13 @@ static int hdac_hdmi_runtime_resume(struct device *dev)
if (!bus) if (!bus)
return 0; return 0;
hlink = snd_hdac_ext_bus_get_link(ebus, dev_name(dev)); hlink = snd_hdac_ext_bus_get_link(bus, dev_name(dev));
if (!hlink) { if (!hlink) {
dev_err(dev, "hdac link not found\n"); dev_err(dev, "hdac link not found\n");
return -EIO; return -EIO;
} }
snd_hdac_ext_bus_link_get(ebus, hlink); snd_hdac_ext_bus_link_get(bus, hlink);
err = snd_hdac_display_power(bus, true); err = snd_hdac_display_power(bus, true);
if (err < 0) { if (err < 0) {
......
...@@ -33,8 +33,7 @@ ...@@ -33,8 +33,7 @@
static int skl_alloc_dma_buf(struct device *dev, static int skl_alloc_dma_buf(struct device *dev,
struct snd_dma_buffer *dmab, size_t size) struct snd_dma_buffer *dmab, size_t size)
{ {
struct hdac_ext_bus *ebus = dev_get_drvdata(dev); struct hdac_bus *bus = dev_get_drvdata(dev);
struct hdac_bus *bus = ebus_to_hbus(ebus);
if (!bus) if (!bus)
return -ENODEV; return -ENODEV;
...@@ -44,8 +43,7 @@ static int skl_alloc_dma_buf(struct device *dev, ...@@ -44,8 +43,7 @@ static int skl_alloc_dma_buf(struct device *dev,
static int skl_free_dma_buf(struct device *dev, struct snd_dma_buffer *dmab) static int skl_free_dma_buf(struct device *dev, struct snd_dma_buffer *dmab)
{ {
struct hdac_ext_bus *ebus = dev_get_drvdata(dev); struct hdac_bus *bus = dev_get_drvdata(dev);
struct hdac_bus *bus = ebus_to_hbus(ebus);
if (!bus) if (!bus)
return -ENODEV; return -ENODEV;
...@@ -89,8 +87,7 @@ void skl_dsp_enable_notification(struct skl_sst *ctx, bool enable) ...@@ -89,8 +87,7 @@ void skl_dsp_enable_notification(struct skl_sst *ctx, bool enable)
static int skl_dsp_setup_spib(struct device *dev, unsigned int size, static int skl_dsp_setup_spib(struct device *dev, unsigned int size,
int stream_tag, int enable) int stream_tag, int enable)
{ {
struct hdac_ext_bus *ebus = dev_get_drvdata(dev); struct hdac_bus *bus = dev_get_drvdata(dev);
struct hdac_bus *bus = ebus_to_hbus(ebus);
struct hdac_stream *stream = snd_hdac_get_stream(bus, struct hdac_stream *stream = snd_hdac_get_stream(bus,
SNDRV_PCM_STREAM_PLAYBACK, stream_tag); SNDRV_PCM_STREAM_PLAYBACK, stream_tag);
struct hdac_ext_stream *estream; struct hdac_ext_stream *estream;
...@@ -100,10 +97,10 @@ static int skl_dsp_setup_spib(struct device *dev, unsigned int size, ...@@ -100,10 +97,10 @@ static int skl_dsp_setup_spib(struct device *dev, unsigned int size,
estream = stream_to_hdac_ext_stream(stream); estream = stream_to_hdac_ext_stream(stream);
/* enable/disable SPIB for this hdac stream */ /* enable/disable SPIB for this hdac stream */
snd_hdac_ext_stream_spbcap_enable(ebus, enable, stream->index); snd_hdac_ext_stream_spbcap_enable(bus, enable, stream->index);
/* set the spib value */ /* set the spib value */
snd_hdac_ext_stream_set_spib(ebus, estream, size); snd_hdac_ext_stream_set_spib(bus, estream, size);
return 0; return 0;
} }
...@@ -111,8 +108,7 @@ static int skl_dsp_setup_spib(struct device *dev, unsigned int size, ...@@ -111,8 +108,7 @@ static int skl_dsp_setup_spib(struct device *dev, unsigned int size,
static int skl_dsp_prepare(struct device *dev, unsigned int format, static int skl_dsp_prepare(struct device *dev, unsigned int format,
unsigned int size, struct snd_dma_buffer *dmab) unsigned int size, struct snd_dma_buffer *dmab)
{ {
struct hdac_ext_bus *ebus = dev_get_drvdata(dev); struct hdac_bus *bus = dev_get_drvdata(dev);
struct hdac_bus *bus = ebus_to_hbus(ebus);
struct hdac_ext_stream *estream; struct hdac_ext_stream *estream;
struct hdac_stream *stream; struct hdac_stream *stream;
struct snd_pcm_substream substream; struct snd_pcm_substream substream;
...@@ -124,7 +120,7 @@ static int skl_dsp_prepare(struct device *dev, unsigned int format, ...@@ -124,7 +120,7 @@ static int skl_dsp_prepare(struct device *dev, unsigned int format,
memset(&substream, 0, sizeof(substream)); memset(&substream, 0, sizeof(substream));
substream.stream = SNDRV_PCM_STREAM_PLAYBACK; substream.stream = SNDRV_PCM_STREAM_PLAYBACK;
estream = snd_hdac_ext_stream_assign(ebus, &substream, estream = snd_hdac_ext_stream_assign(bus, &substream,
HDAC_EXT_STREAM_TYPE_HOST); HDAC_EXT_STREAM_TYPE_HOST);
if (!estream) if (!estream)
return -ENODEV; return -ENODEV;
...@@ -143,9 +139,8 @@ static int skl_dsp_prepare(struct device *dev, unsigned int format, ...@@ -143,9 +139,8 @@ static int skl_dsp_prepare(struct device *dev, unsigned int format,
static int skl_dsp_trigger(struct device *dev, bool start, int stream_tag) static int skl_dsp_trigger(struct device *dev, bool start, int stream_tag)
{ {
struct hdac_ext_bus *ebus = dev_get_drvdata(dev); struct hdac_bus *bus = dev_get_drvdata(dev);
struct hdac_stream *stream; struct hdac_stream *stream;
struct hdac_bus *bus = ebus_to_hbus(ebus);
if (!bus) if (!bus)
return -ENODEV; return -ENODEV;
...@@ -163,10 +158,9 @@ static int skl_dsp_trigger(struct device *dev, bool start, int stream_tag) ...@@ -163,10 +158,9 @@ static int skl_dsp_trigger(struct device *dev, bool start, int stream_tag)
static int skl_dsp_cleanup(struct device *dev, static int skl_dsp_cleanup(struct device *dev,
struct snd_dma_buffer *dmab, int stream_tag) struct snd_dma_buffer *dmab, int stream_tag)
{ {
struct hdac_ext_bus *ebus = dev_get_drvdata(dev); struct hdac_bus *bus = dev_get_drvdata(dev);
struct hdac_stream *stream; struct hdac_stream *stream;
struct hdac_ext_stream *estream; struct hdac_ext_stream *estream;
struct hdac_bus *bus = ebus_to_hbus(ebus);
if (!bus) if (!bus)
return -ENODEV; return -ENODEV;
...@@ -270,8 +264,7 @@ const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id) ...@@ -270,8 +264,7 @@ const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id)
int skl_init_dsp(struct skl *skl) int skl_init_dsp(struct skl *skl)
{ {
void __iomem *mmio_base; void __iomem *mmio_base;
struct hdac_ext_bus *ebus = &skl->ebus; struct hdac_bus *bus = skl_to_bus(skl);
struct hdac_bus *bus = ebus_to_hbus(ebus);
struct skl_dsp_loader_ops loader_ops; struct skl_dsp_loader_ops loader_ops;
int irq = bus->irq; int irq = bus->irq;
const struct skl_dsp_ops *ops; const struct skl_dsp_ops *ops;
...@@ -279,8 +272,8 @@ int skl_init_dsp(struct skl *skl) ...@@ -279,8 +272,8 @@ int skl_init_dsp(struct skl *skl)
int ret; int ret;
/* enable ppcap interrupt */ /* enable ppcap interrupt */
snd_hdac_ext_bus_ppcap_enable(&skl->ebus, true); snd_hdac_ext_bus_ppcap_enable(bus, true);
snd_hdac_ext_bus_ppcap_int_enable(&skl->ebus, true); snd_hdac_ext_bus_ppcap_int_enable(bus, true);
/* read the BAR of the ADSP MMIO */ /* read the BAR of the ADSP MMIO */
mmio_base = pci_ioremap_bar(skl->pci, 4); mmio_base = pci_ioremap_bar(skl->pci, 4);
...@@ -335,12 +328,11 @@ int skl_init_dsp(struct skl *skl) ...@@ -335,12 +328,11 @@ int skl_init_dsp(struct skl *skl)
int skl_free_dsp(struct skl *skl) int skl_free_dsp(struct skl *skl)
{ {
struct hdac_ext_bus *ebus = &skl->ebus; struct hdac_bus *bus = skl_to_bus(skl);
struct hdac_bus *bus = ebus_to_hbus(ebus);
struct skl_sst *ctx = skl->skl_sst; struct skl_sst *ctx = skl->skl_sst;
/* disable ppcap interrupt */ /* disable ppcap interrupt */
snd_hdac_ext_bus_ppcap_int_enable(&skl->ebus, false); snd_hdac_ext_bus_ppcap_int_enable(bus, false);
ctx->dsp_ops->cleanup(bus->dev, ctx); ctx->dsp_ops->cleanup(bus->dev, ctx);
...@@ -383,10 +375,11 @@ int skl_suspend_late_dsp(struct skl *skl) ...@@ -383,10 +375,11 @@ int skl_suspend_late_dsp(struct skl *skl)
int skl_suspend_dsp(struct skl *skl) int skl_suspend_dsp(struct skl *skl)
{ {
struct skl_sst *ctx = skl->skl_sst; struct skl_sst *ctx = skl->skl_sst;
struct hdac_bus *bus = skl_to_bus(skl);
int ret; int ret;
/* if ppcap is not supported return 0 */ /* if ppcap is not supported return 0 */
if (!skl->ebus.bus.ppcap) if (!bus->ppcap)
return 0; return 0;
ret = skl_dsp_sleep(ctx->dsp); ret = skl_dsp_sleep(ctx->dsp);
...@@ -394,8 +387,8 @@ int skl_suspend_dsp(struct skl *skl) ...@@ -394,8 +387,8 @@ int skl_suspend_dsp(struct skl *skl)
return ret; return ret;
/* disable ppcap interrupt */ /* disable ppcap interrupt */
snd_hdac_ext_bus_ppcap_int_enable(&skl->ebus, false); snd_hdac_ext_bus_ppcap_int_enable(bus, false);
snd_hdac_ext_bus_ppcap_enable(&skl->ebus, false); snd_hdac_ext_bus_ppcap_enable(bus, false);
return 0; return 0;
} }
...@@ -403,15 +396,16 @@ int skl_suspend_dsp(struct skl *skl) ...@@ -403,15 +396,16 @@ int skl_suspend_dsp(struct skl *skl)
int skl_resume_dsp(struct skl *skl) int skl_resume_dsp(struct skl *skl)
{ {
struct skl_sst *ctx = skl->skl_sst; struct skl_sst *ctx = skl->skl_sst;
struct hdac_bus *bus = skl_to_bus(skl);
int ret; int ret;
/* if ppcap is not supported return 0 */ /* if ppcap is not supported return 0 */
if (!skl->ebus.bus.ppcap) if (!bus->ppcap)
return 0; return 0;
/* enable ppcap interrupt */ /* enable ppcap interrupt */
snd_hdac_ext_bus_ppcap_enable(&skl->ebus, true); snd_hdac_ext_bus_ppcap_enable(bus, true);
snd_hdac_ext_bus_ppcap_int_enable(&skl->ebus, true); snd_hdac_ext_bus_ppcap_int_enable(bus, true);
/* check if DSP 1st boot is done */ /* check if DSP 1st boot is done */
if (skl->skl_sst->is_first_boot == true) if (skl->skl_sst->is_first_boot == true)
......
...@@ -141,7 +141,7 @@ struct nhlt_specific_cfg ...@@ -141,7 +141,7 @@ struct nhlt_specific_cfg
{ {
struct nhlt_fmt *fmt; struct nhlt_fmt *fmt;
struct nhlt_endpoint *epnt; struct nhlt_endpoint *epnt;
struct hdac_bus *bus = ebus_to_hbus(&skl->ebus); struct hdac_bus *bus = skl_to_bus(skl);
struct device *dev = bus->dev; struct device *dev = bus->dev;
struct nhlt_specific_cfg *sp_config; struct nhlt_specific_cfg *sp_config;
struct nhlt_acpi_table *nhlt = skl->nhlt; struct nhlt_acpi_table *nhlt = skl->nhlt;
...@@ -228,7 +228,7 @@ static void skl_nhlt_trim_space(char *trim) ...@@ -228,7 +228,7 @@ static void skl_nhlt_trim_space(char *trim)
int skl_nhlt_update_topology_bin(struct skl *skl) int skl_nhlt_update_topology_bin(struct skl *skl)
{ {
struct nhlt_acpi_table *nhlt = (struct nhlt_acpi_table *)skl->nhlt; struct nhlt_acpi_table *nhlt = (struct nhlt_acpi_table *)skl->nhlt;
struct hdac_bus *bus = ebus_to_hbus(&skl->ebus); struct hdac_bus *bus = skl_to_bus(skl);
struct device *dev = bus->dev; struct device *dev = bus->dev;
dev_dbg(dev, "oem_id %.6s, oem_table_id %8s oem_revision %d\n", dev_dbg(dev, "oem_id %.6s, oem_table_id %8s oem_revision %d\n",
...@@ -248,8 +248,8 @@ static ssize_t skl_nhlt_platform_id_show(struct device *dev, ...@@ -248,8 +248,8 @@ static ssize_t skl_nhlt_platform_id_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct pci_dev *pci = to_pci_dev(dev); struct pci_dev *pci = to_pci_dev(dev);
struct hdac_ext_bus *ebus = pci_get_drvdata(pci); struct hdac_bus *bus = pci_get_drvdata(pci);
struct skl *skl = ebus_to_skl(ebus); struct skl *skl = bus_to_skl(bus);
struct nhlt_acpi_table *nhlt = (struct nhlt_acpi_table *)skl->nhlt; struct nhlt_acpi_table *nhlt = (struct nhlt_acpi_table *)skl->nhlt;
char platform_id[32]; char platform_id[32];
......
This diff is collapsed.
...@@ -934,7 +934,7 @@ static int skl_tplg_find_moduleid_from_uuid(struct skl *skl, ...@@ -934,7 +934,7 @@ static int skl_tplg_find_moduleid_from_uuid(struct skl *skl,
struct soc_bytes_ext *sb = (void *) k->private_value; struct soc_bytes_ext *sb = (void *) k->private_value;
struct skl_algo_data *bc = (struct skl_algo_data *)sb->dobj.private; struct skl_algo_data *bc = (struct skl_algo_data *)sb->dobj.private;
struct skl_kpb_params *uuid_params, *params; struct skl_kpb_params *uuid_params, *params;
struct hdac_bus *bus = ebus_to_hbus(skl_to_ebus(skl)); struct hdac_bus *bus = skl_to_bus(skl);
int i, size, module_id; int i, size, module_id;
if (bc->set_params == SKL_PARAM_BIND && bc->max) { if (bc->set_params == SKL_PARAM_BIND && bc->max) {
...@@ -3029,9 +3029,8 @@ static int skl_tplg_widget_load(struct snd_soc_component *cmpnt, ...@@ -3029,9 +3029,8 @@ static int skl_tplg_widget_load(struct snd_soc_component *cmpnt,
struct snd_soc_tplg_dapm_widget *tplg_w) struct snd_soc_tplg_dapm_widget *tplg_w)
{ {
int ret; int ret;
struct hdac_ext_bus *ebus = snd_soc_component_get_drvdata(cmpnt); struct hdac_bus *bus = snd_soc_component_get_drvdata(cmpnt);
struct skl *skl = ebus_to_skl(ebus); struct skl *skl = bus_to_skl(bus);
struct hdac_bus *bus = ebus_to_hbus(ebus);
struct skl_module_cfg *mconfig; struct skl_module_cfg *mconfig;
if (!tplg_w->priv.size) if (!tplg_w->priv.size)
...@@ -3137,8 +3136,7 @@ static int skl_tplg_control_load(struct snd_soc_component *cmpnt, ...@@ -3137,8 +3136,7 @@ static int skl_tplg_control_load(struct snd_soc_component *cmpnt,
struct soc_bytes_ext *sb; struct soc_bytes_ext *sb;
struct snd_soc_tplg_bytes_control *tplg_bc; struct snd_soc_tplg_bytes_control *tplg_bc;
struct snd_soc_tplg_enum_control *tplg_ec; struct snd_soc_tplg_enum_control *tplg_ec;
struct hdac_ext_bus *ebus = snd_soc_component_get_drvdata(cmpnt); struct hdac_bus *bus = snd_soc_component_get_drvdata(cmpnt);
struct hdac_bus *bus = ebus_to_hbus(ebus);
struct soc_enum *se; struct soc_enum *se;
switch (hdr->ops.info) { switch (hdr->ops.info) {
...@@ -3622,9 +3620,8 @@ static int skl_tplg_get_manifest_data(struct snd_soc_tplg_manifest *manifest, ...@@ -3622,9 +3620,8 @@ static int skl_tplg_get_manifest_data(struct snd_soc_tplg_manifest *manifest,
static int skl_manifest_load(struct snd_soc_component *cmpnt, static int skl_manifest_load(struct snd_soc_component *cmpnt,
struct snd_soc_tplg_manifest *manifest) struct snd_soc_tplg_manifest *manifest)
{ {
struct hdac_ext_bus *ebus = snd_soc_component_get_drvdata(cmpnt); struct hdac_bus *bus = snd_soc_component_get_drvdata(cmpnt);
struct hdac_bus *bus = ebus_to_hbus(ebus); struct skl *skl = bus_to_skl(bus);
struct skl *skl = ebus_to_skl(ebus);
/* proceed only if we have private data defined */ /* proceed only if we have private data defined */
if (manifest->priv.size == 0) if (manifest->priv.size == 0)
...@@ -3713,12 +3710,11 @@ static void skl_tplg_set_pipe_type(struct skl *skl, struct skl_pipe *pipe) ...@@ -3713,12 +3710,11 @@ static void skl_tplg_set_pipe_type(struct skl *skl, struct skl_pipe *pipe)
/* /*
* SKL topology init routine * SKL topology init routine
*/ */
int skl_tplg_init(struct snd_soc_component *component, struct hdac_ext_bus *ebus) int skl_tplg_init(struct snd_soc_component *component, struct hdac_bus *bus)
{ {
int ret; int ret;
const struct firmware *fw; const struct firmware *fw;
struct hdac_bus *bus = ebus_to_hbus(ebus); struct skl *skl = bus_to_skl(bus);
struct skl *skl = ebus_to_skl(ebus);
struct skl_pipeline *ppl; struct skl_pipeline *ppl;
ret = request_firmware(&fw, skl->tplg_name, bus->dev); ret = request_firmware(&fw, skl->tplg_name, bus->dev);
......
...@@ -458,9 +458,9 @@ enum skl_channel { ...@@ -458,9 +458,9 @@ enum skl_channel {
static inline struct skl *get_skl_ctx(struct device *dev) static inline struct skl *get_skl_ctx(struct device *dev)
{ {
struct hdac_ext_bus *ebus = dev_get_drvdata(dev); struct hdac_bus *bus = dev_get_drvdata(dev);
return ebus_to_skl(ebus); return bus_to_skl(bus);
} }
int skl_tplg_be_update_params(struct snd_soc_dai *dai, int skl_tplg_be_update_params(struct snd_soc_dai *dai,
...@@ -470,7 +470,7 @@ int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps, ...@@ -470,7 +470,7 @@ int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps,
void skl_tplg_set_be_dmic_config(struct snd_soc_dai *dai, void skl_tplg_set_be_dmic_config(struct snd_soc_dai *dai,
struct skl_pipe_params *params, int stream); struct skl_pipe_params *params, int stream);
int skl_tplg_init(struct snd_soc_component *component, int skl_tplg_init(struct snd_soc_component *component,
struct hdac_ext_bus *ebus); struct hdac_bus *ebus);
struct skl_module_cfg *skl_tplg_fe_get_cpr_module( struct skl_module_cfg *skl_tplg_fe_get_cpr_module(
struct snd_soc_dai *dai, int stream); struct snd_soc_dai *dai, int stream);
int skl_tplg_update_pipe_params(struct device *dev, int skl_tplg_update_pipe_params(struct device *dev,
......
This diff is collapsed.
...@@ -71,7 +71,7 @@ struct skl_fw_config { ...@@ -71,7 +71,7 @@ struct skl_fw_config {
}; };
struct skl { struct skl {
struct hdac_ext_bus ebus; struct hdac_bus hbus;
struct pci_dev *pci; struct pci_dev *pci;
unsigned int init_done:1; /* delayed init status */ unsigned int init_done:1; /* delayed init status */
...@@ -105,9 +105,8 @@ struct skl { ...@@ -105,9 +105,8 @@ struct skl {
struct snd_soc_acpi_mach *mach; struct snd_soc_acpi_mach *mach;
}; };
#define skl_to_ebus(s) (&(s)->ebus) #define skl_to_bus(s) (&(s)->hbus)
#define ebus_to_skl(sbus) \ #define bus_to_skl(bus) container_of(bus, struct skl, hbus)
container_of(sbus, struct skl, sbus)
/* to pass dai dma data */ /* to pass dai dma data */
struct skl_dma_params { struct skl_dma_params {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment