aboutsummaryrefslogtreecommitdiffstats
path: root/sound/hda/hdac_bus.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-04-14 06:15:47 -0400
committerTakashi Iwai <tiwai@suse.de>2015-04-16 01:27:58 -0400
commit14752412721c61d9ac1e8d8fb51d7148cb15f85b (patch)
treea66845e59854c2a01b107695b69ebf05e692776c /sound/hda/hdac_bus.c
parentcad372f1be5ef7cf14b980e679fbf30430dc241f (diff)
ALSA: hda - Add the controller helper codes to hda-core module
This patch adds the controller helper codes to hda-core library. The I/O access ops are added to the bus ops. The CORB/RIRB, the basic attributes like irq# and iomap address, some locks and the list of streams are added to the bus object, together with the stream object and its helpers. Currently the codes are just copied from the legacy driver, so you can find duplicated codes in both directories. Only constants are removed from the original hda_controller.h. More integration work will follow in the later patches. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/hda/hdac_bus.c')
-rw-r--r--sound/hda/hdac_bus.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/sound/hda/hdac_bus.c b/sound/hda/hdac_bus.c
index 8e262da74f6a..27c447e4fe5c 100644
--- a/sound/hda/hdac_bus.c
+++ b/sound/hda/hdac_bus.c
@@ -11,21 +11,36 @@
11 11
12static void process_unsol_events(struct work_struct *work); 12static void process_unsol_events(struct work_struct *work);
13 13
14static const struct hdac_bus_ops default_ops = {
15 .command = snd_hdac_bus_send_cmd,
16 .get_response = snd_hdac_bus_get_response,
17};
18
14/** 19/**
15 * snd_hdac_bus_init - initialize a HD-audio bas bus 20 * snd_hdac_bus_init - initialize a HD-audio bas bus
16 * @bus: the pointer to bus object 21 * @bus: the pointer to bus object
22 * @ops: bus verb operators
23 * @io_ops: lowlevel I/O operators
17 * 24 *
18 * Returns 0 if successful, or a negative error code. 25 * Returns 0 if successful, or a negative error code.
19 */ 26 */
20int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, 27int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
21 const struct hdac_bus_ops *ops) 28 const struct hdac_bus_ops *ops,
29 const struct hdac_io_ops *io_ops)
22{ 30{
23 memset(bus, 0, sizeof(*bus)); 31 memset(bus, 0, sizeof(*bus));
24 bus->dev = dev; 32 bus->dev = dev;
25 bus->ops = ops; 33 if (ops)
34 bus->ops = ops;
35 else
36 bus->ops = &default_ops;
37 bus->io_ops = io_ops;
38 INIT_LIST_HEAD(&bus->stream_list);
26 INIT_LIST_HEAD(&bus->codec_list); 39 INIT_LIST_HEAD(&bus->codec_list);
27 INIT_WORK(&bus->unsol_work, process_unsol_events); 40 INIT_WORK(&bus->unsol_work, process_unsol_events);
41 spin_lock_init(&bus->reg_lock);
28 mutex_init(&bus->cmd_mutex); 42 mutex_init(&bus->cmd_mutex);
43 bus->irq = -1;
29 return 0; 44 return 0;
30} 45}
31EXPORT_SYMBOL_GPL(snd_hdac_bus_init); 46EXPORT_SYMBOL_GPL(snd_hdac_bus_init);
@@ -36,6 +51,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_bus_init);
36 */ 51 */
37void snd_hdac_bus_exit(struct hdac_bus *bus) 52void snd_hdac_bus_exit(struct hdac_bus *bus)
38{ 53{
54 WARN_ON(!list_empty(&bus->stream_list));
39 WARN_ON(!list_empty(&bus->codec_list)); 55 WARN_ON(!list_empty(&bus->codec_list));
40 cancel_work_sync(&bus->unsol_work); 56 cancel_work_sync(&bus->unsol_work);
41} 57}