Commit cb04ba33 authored by Rakesh Ughreja's avatar Rakesh Ughreja Committed by Takashi Iwai

ALSA: hdac: add extended ops in the hdac_bus

Add extended ops in the hdac_bus to allow calling the ASoC HDAC library
ops to reuse the legacy HDA codec drivers with ASoC framework.
Extended ops are used by the legacy codec drivers to call into
hdac_hda library, in the subsequent patches..
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 6298542f
...@@ -213,6 +213,14 @@ struct hdac_bus_ops { ...@@ -213,6 +213,14 @@ struct hdac_bus_ops {
int (*link_power)(struct hdac_bus *bus, bool enable); int (*link_power)(struct hdac_bus *bus, bool enable);
}; };
/*
* ops used for ASoC HDA codec drivers
*/
struct hdac_ext_bus_ops {
int (*hdev_attach)(struct hdac_device *hdev);
int (*hdev_detach)(struct hdac_device *hdev);
};
/* /*
* Lowlevel I/O operators * Lowlevel I/O operators
*/ */
...@@ -265,6 +273,7 @@ struct hdac_bus { ...@@ -265,6 +273,7 @@ struct hdac_bus {
struct device *dev; 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;
const struct hdac_ext_bus_ops *ext_ops;
/* h/w resources */ /* h/w resources */
unsigned long addr; unsigned long addr;
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
int snd_hdac_ext_bus_init(struct hdac_bus *bus, 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,
const struct hdac_ext_bus_ops *ext_ops);
void snd_hdac_ext_bus_exit(struct hdac_bus *bus); void snd_hdac_ext_bus_exit(struct hdac_bus *bus);
int snd_hdac_ext_bus_device_init(struct hdac_bus *bus, int addr, int snd_hdac_ext_bus_device_init(struct hdac_bus *bus, int addr,
......
...@@ -89,7 +89,8 @@ static const struct hdac_io_ops hdac_ext_default_io = { ...@@ -89,7 +89,8 @@ static const struct hdac_io_ops hdac_ext_default_io = {
*/ */
int snd_hdac_ext_bus_init(struct hdac_bus *bus, 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,
const struct hdac_ext_bus_ops *ext_ops)
{ {
int ret; int ret;
static int idx; static int idx;
...@@ -102,6 +103,7 @@ int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev, ...@@ -102,6 +103,7 @@ int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
if (ret < 0) if (ret < 0)
return ret; return ret;
bus->ext_ops = ext_ops;
INIT_LIST_HEAD(&bus->hlink_list); INIT_LIST_HEAD(&bus->hlink_list);
bus->idx = idx++; bus->idx = idx++;
......
...@@ -803,7 +803,7 @@ static int skl_create(struct pci_dev *pci, ...@@ -803,7 +803,7 @@ static int skl_create(struct pci_dev *pci,
} }
bus = skl_to_bus(skl); bus = skl_to_bus(skl);
snd_hdac_ext_bus_init(bus, &pci->dev, &bus_core_ops, io_ops); snd_hdac_ext_bus_init(bus, &pci->dev, &bus_core_ops, io_ops, NULL);
bus->use_posbuf = 1; bus->use_posbuf = 1;
skl->pci = pci; skl->pci = pci;
INIT_WORK(&skl->probe_work, skl_probe_work); INIT_WORK(&skl->probe_work, skl_probe_work);
......
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