~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/hda/ext/hdac_ext_bus.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  *  hdac-ext-bus.c - HD-audio extended core bus functions.
  4  *
  5  *  Copyright (C) 2014-2015 Intel Corp
  6  *  Author: Jeeja KP <jeeja.kp@intel.com>
  7  *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  8  *
  9  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 10  */
 11 
 12 #include <linux/module.h>
 13 #include <linux/slab.h>
 14 #include <linux/io.h>
 15 #include <sound/hdaudio_ext.h>
 16 
 17 MODULE_DESCRIPTION("HDA extended core");
 18 MODULE_LICENSE("GPL v2");
 19 
 20 /**
 21  * snd_hdac_ext_bus_init - initialize a HD-audio extended bus
 22  * @bus: the pointer to HDAC bus object
 23  * @dev: device pointer
 24  * @ops: bus verb operators
 25  * @ext_ops: operators used for ASoC HDA codec drivers
 26  *
 27  * Returns 0 if successful, or a negative error code.
 28  */
 29 int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
 30                         const struct hdac_bus_ops *ops,
 31                         const struct hdac_ext_bus_ops *ext_ops)
 32 {
 33         int ret;
 34 
 35         ret = snd_hdac_bus_init(bus, dev, ops);
 36         if (ret < 0)
 37                 return ret;
 38 
 39         bus->ext_ops = ext_ops;
 40         /* FIXME:
 41          * Currently only one bus is supported, if there is device with more
 42          * buses, bus->idx should be greater than 0, but there needs to be a
 43          * reliable way to always assign same number.
 44          */
 45         bus->idx = 0;
 46         bus->cmd_dma_state = true;
 47 
 48         return 0;
 49 }
 50 EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_init);
 51 
 52 /**
 53  * snd_hdac_ext_bus_exit - clean up a HD-audio extended bus
 54  * @bus: the pointer to HDAC bus object
 55  */
 56 void snd_hdac_ext_bus_exit(struct hdac_bus *bus)
 57 {
 58         snd_hdac_bus_exit(bus);
 59         WARN_ON(!list_empty(&bus->hlink_list));
 60 }
 61 EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_exit);
 62 
 63 /**
 64  * snd_hdac_ext_bus_device_remove - remove HD-audio extended codec base devices
 65  *
 66  * @bus: the pointer to HDAC bus object
 67  */
 68 void snd_hdac_ext_bus_device_remove(struct hdac_bus *bus)
 69 {
 70         struct hdac_device *codec, *__codec;
 71         /*
 72          * we need to remove all the codec devices objects created in the
 73          * snd_hdac_ext_bus_device_init
 74          */
 75         list_for_each_entry_safe(codec, __codec, &bus->codec_list, list) {
 76                 snd_hdac_device_unregister(codec);
 77                 put_device(&codec->dev);
 78         }
 79 }
 80 EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_remove);
 81 #define dev_to_hdac(dev) (container_of((dev), \
 82                         struct hdac_device, dev))
 83 
 84 static inline struct hdac_driver *get_hdrv(struct device *dev)
 85 {
 86         struct hdac_driver *hdrv = drv_to_hdac_driver(dev->driver);
 87         return hdrv;
 88 }
 89 
 90 static inline struct hdac_device *get_hdev(struct device *dev)
 91 {
 92         struct hdac_device *hdev = dev_to_hdac_dev(dev);
 93         return hdev;
 94 }
 95 
 96 static int hda_ext_drv_probe(struct device *dev)
 97 {
 98         return (get_hdrv(dev))->probe(get_hdev(dev));
 99 }
100 
101 static int hdac_ext_drv_remove(struct device *dev)
102 {
103         return (get_hdrv(dev))->remove(get_hdev(dev));
104 }
105 
106 static void hdac_ext_drv_shutdown(struct device *dev)
107 {
108         return (get_hdrv(dev))->shutdown(get_hdev(dev));
109 }
110 
111 /**
112  * snd_hda_ext_driver_register - register a driver for ext hda devices
113  *
114  * @drv: ext hda driver structure
115  */
116 int snd_hda_ext_driver_register(struct hdac_driver *drv)
117 {
118         drv->type = HDA_DEV_ASOC;
119         drv->driver.bus = &snd_hda_bus_type;
120         /* we use default match */
121 
122         if (drv->probe)
123                 drv->driver.probe = hda_ext_drv_probe;
124         if (drv->remove)
125                 drv->driver.remove = hdac_ext_drv_remove;
126         if (drv->shutdown)
127                 drv->driver.shutdown = hdac_ext_drv_shutdown;
128 
129         return driver_register(&drv->driver);
130 }
131 EXPORT_SYMBOL_GPL(snd_hda_ext_driver_register);
132 
133 /**
134  * snd_hda_ext_driver_unregister - unregister a driver for ext hda devices
135  *
136  * @drv: ext hda driver structure
137  */
138 void snd_hda_ext_driver_unregister(struct hdac_driver *drv)
139 {
140         driver_unregister(&drv->driver);
141 }
142 EXPORT_SYMBOL_GPL(snd_hda_ext_driver_unregister);
143 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php