Lines Matching +full:codec +full:- +full:driver
1 /* SPDX-License-Identifier: GPL-2.0 */
3 * HD-audio core stuff
12 #include <linux/io-64-nonatomic-lo-hi.h>
23 /* codec node id */
50 * HD-audio codec base device
56 unsigned int addr; /* codec address */
73 const char *vendor_name; /* codec vendor name */
74 const char *chip_name; /* codec chip name */
98 unsigned int registered:1; /* codec was registered */
101 /* device/driver type used for matching */
110 SND_SKL_PCI_BIND_LEGACY,/* bind only with legacy driver */
111 SND_SKL_PCI_BIND_ASOC /* bind only with ASoC driver */
124 int snd_hdac_device_register(struct hdac_device *codec);
125 void snd_hdac_device_unregister(struct hdac_device *codec);
126 int snd_hdac_device_set_chip_name(struct hdac_device *codec, const char *name);
129 int snd_hdac_refresh_widgets(struct hdac_device *codec);
131 int snd_hdac_read(struct hdac_device *codec, hda_nid_t nid,
133 int _snd_hdac_read_parm(struct hdac_device *codec, hda_nid_t nid, int parm,
135 int snd_hdac_read_parm_uncached(struct hdac_device *codec, hda_nid_t nid,
137 int snd_hdac_override_parm(struct hdac_device *codec, hda_nid_t nid,
139 int snd_hdac_get_connections(struct hdac_device *codec, hda_nid_t nid,
141 int snd_hdac_get_sub_nodes(struct hdac_device *codec, hda_nid_t nid,
148 int snd_hdac_query_supported_pcm(struct hdac_device *codec, hda_nid_t nid,
151 bool snd_hdac_is_supported_format(struct hdac_device *codec, hda_nid_t nid,
163 * snd_hdac_read_parm - read a codec parameter
164 * @codec: the codec object
168 * Returns -1 for error. If you need to distinguish the error more
171 static inline int snd_hdac_read_parm(struct hdac_device *codec, hda_nid_t nid,
176 return _snd_hdac_read_parm(codec, nid, parm, &val) < 0 ? -1 : val;
180 int snd_hdac_power_up(struct hdac_device *codec);
181 int snd_hdac_power_down(struct hdac_device *codec);
182 int snd_hdac_power_up_pm(struct hdac_device *codec);
183 int snd_hdac_power_down_pm(struct hdac_device *codec);
184 int snd_hdac_keep_power_up(struct hdac_device *codec);
186 /* call this at entering into suspend/resume callbacks in codec driver */
187 static inline void snd_hdac_enter_pm(struct hdac_device *codec)
189 atomic_inc(&codec->in_pm);
192 /* call this at leaving from suspend/resume callbacks in codec driver */
193 static inline void snd_hdac_leave_pm(struct hdac_device *codec)
195 atomic_dec(&codec->in_pm);
198 static inline bool snd_hdac_is_in_pm(struct hdac_device *codec)
200 return atomic_read(&codec->in_pm);
203 static inline bool snd_hdac_is_power_on(struct hdac_device *codec)
205 return !pm_runtime_suspended(&codec->dev);
208 static inline int snd_hdac_power_up(struct hdac_device *codec) { return 0; }
209 static inline int snd_hdac_power_down(struct hdac_device *codec) { return 0; }
210 static inline int snd_hdac_power_up_pm(struct hdac_device *codec) { return 0; }
211 static inline int snd_hdac_power_down_pm(struct hdac_device *codec) { return 0; }
212 static inline int snd_hdac_keep_power_up(struct hdac_device *codec) { return 0; }
213 static inline void snd_hdac_enter_pm(struct hdac_device *codec) {}
214 static inline void snd_hdac_leave_pm(struct hdac_device *codec) {}
215 static inline bool snd_hdac_is_in_pm(struct hdac_device *codec) { return false; }
216 static inline bool snd_hdac_is_power_on(struct hdac_device *codec) { return true; }
220 * HD-audio codec base driver
223 struct device_driver driver;
235 #define drv_to_hdac_driver(_drv) container_of(_drv, struct hdac_driver, driver)
249 /* notify of codec link power-up/down */
254 * ops used for ASoC HDA codec drivers
278 * HD-audio bus base driver
307 /* codec linked list */
311 /* link caddr -> codec */
391 void snd_hdac_codec_link_up(struct hdac_device *codec);
392 void snd_hdac_codec_link_down(struct hdac_device *codec);
420 #define snd_hdac_aligned_mmio(bus) (bus)->aligned_mmio
466 snd_hdac_reg_writeb(chip, (chip)->remap_addr + (reg), value)
468 snd_hdac_reg_readb(chip, (chip)->remap_addr + (reg))
470 snd_hdac_reg_writew(chip, (chip)->remap_addr + (reg), value)
472 snd_hdac_reg_readw(chip, (chip)->remap_addr + (reg))
474 snd_hdac_reg_writel(chip, (chip)->remap_addr + (reg), value)
476 snd_hdac_reg_readl(chip, (chip)->remap_addr + (reg))
511 * HD-audio stream
541 * controller and the codec
613 snd_hdac_reg_writel((dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg, value)
615 snd_hdac_reg_writew((dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg, value)
617 snd_hdac_reg_writeb((dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg, value)
619 snd_hdac_reg_readl((dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg)
621 snd_hdac_reg_readw((dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg)
623 snd_hdac_reg_readb((dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg)
626 false, (dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg)
629 false, (dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg)
632 false, (dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg)
650 #define snd_hdac_dsp_lock_init(dev) mutex_init(&(dev)->dsp_mutex)
651 #define snd_hdac_dsp_lock(dev) mutex_lock(&(dev)->dsp_mutex)
652 #define snd_hdac_dsp_unlock(dev) mutex_unlock(&(dev)->dsp_mutex)
653 #define snd_hdac_stream_is_locked(dev) ((dev)->locked)
687 #define snd_hdac_get_wcaps(codec, nid) \
688 snd_hdac_read_parm(codec, nid, AC_PAR_AUDIO_WIDGET_CAP)
694 return -1; /* invalid type */
717 array->elem_size = size;
718 array->alloc_align = align;
723 return array->list + idx * array->elem_size;
728 return (unsigned long)(ptr - array->list) / array->elem_size;
733 for ((idx) = 0, (ptr) = (array)->list; (idx) < (array)->used; \