Skip to content

Commit

Permalink
ALSA: hdac: add extended ops in the hdac_bus
Browse files Browse the repository at this point in the history
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: Rakesh Ughreja <[email protected]>
Signed-off-by: Pierre-Louis Bossart <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
rakeshughreja authored and tiwai committed Jun 28, 2018
1 parent 6298542 commit cb04ba3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
9 changes: 9 additions & 0 deletions include/sound/hdaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ struct hdac_bus_ops {
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
*/
Expand Down Expand Up @@ -265,6 +273,7 @@ struct hdac_bus {
struct device *dev;
const struct hdac_bus_ops *ops;
const struct hdac_io_ops *io_ops;
const struct hdac_ext_bus_ops *ext_ops;

/* h/w resources */
unsigned long addr;
Expand Down
3 changes: 2 additions & 1 deletion include/sound/hdaudio_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
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);
int snd_hdac_ext_bus_device_init(struct hdac_bus *bus, int addr,
Expand Down
4 changes: 3 additions & 1 deletion sound/hda/ext/hdac_ext_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
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;
static int idx;
Expand All @@ -102,6 +103,7 @@ int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
if (ret < 0)
return ret;

bus->ext_ops = ext_ops;
INIT_LIST_HEAD(&bus->hlink_list);
bus->idx = idx++;

Expand Down
2 changes: 1 addition & 1 deletion sound/soc/intel/skylake/skl.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ static int skl_create(struct pci_dev *pci,
}

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;
skl->pci = pci;
INIT_WORK(&skl->probe_work, skl_probe_work);
Expand Down

0 comments on commit cb04ba3

Please sign in to comment.