Lines Matching +full:bus +full:- +full:addr

1 /* SPDX-License-Identifier: GPL-2.0 */
3 * HD-audio core stuff
12 #include <linux/io-64-nonatomic-lo-hi.h>
34 * exported bus type
50 * HD-audio codec base device
55 struct hdac_bus *bus; member
56 unsigned int addr; /* codec address */ member
57 struct list_head list; /* list point for bus codec_list */
121 int snd_hdac_device_init(struct hdac_device *dev, struct hdac_bus *bus,
122 const char *name, unsigned int addr);
163 * snd_hdac_read_parm - read a codec parameter
168 * Returns -1 for error. If you need to distinguish the error more
176 return _snd_hdac_read_parm(codec, nid, parm, &val) < 0 ? -1 : val; in snd_hdac_read_parm()
189 atomic_inc(&codec->in_pm); in snd_hdac_enter_pm()
195 atomic_dec(&codec->in_pm); in snd_hdac_leave_pm()
200 return atomic_read(&codec->in_pm); in snd_hdac_is_in_pm()
205 return !pm_runtime_suspended(&codec->dev); in snd_hdac_is_power_on()
220 * HD-audio codec base driver
229 /* fields used by ext bus APIs */
241 * Bus verb operators
245 int (*command)(struct hdac_bus *bus, unsigned int cmd);
247 int (*get_response)(struct hdac_bus *bus, unsigned int addr,
249 /* notify of codec link power-up/down */
271 dma_addr_t addr; /* physical address of CORB/RIRB buffer */ member
278 * HD-audio bus base driver
297 unsigned long addr; member
311 /* link caddr -> codec */
385 int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
387 void snd_hdac_bus_exit(struct hdac_bus *bus);
388 int snd_hdac_bus_exec_verb_unlocked(struct hdac_bus *bus, unsigned int addr,
394 int snd_hdac_bus_send_cmd(struct hdac_bus *bus, unsigned int val);
395 int snd_hdac_bus_get_response(struct hdac_bus *bus, unsigned int addr,
397 int snd_hdac_bus_parse_capabilities(struct hdac_bus *bus);
399 bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset);
400 void snd_hdac_bus_stop_chip(struct hdac_bus *bus);
401 void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus);
402 void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus);
403 void snd_hdac_bus_enter_link_reset(struct hdac_bus *bus);
404 void snd_hdac_bus_exit_link_reset(struct hdac_bus *bus);
405 int snd_hdac_bus_reset_link(struct hdac_bus *bus, bool full_reset);
408 void snd_hdac_bus_update_rirb(struct hdac_bus *bus);
409 int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
413 int snd_hdac_bus_alloc_stream_pages(struct hdac_bus *bus);
414 void snd_hdac_bus_free_stream_pages(struct hdac_bus *bus);
417 unsigned int snd_hdac_aligned_read(void __iomem *addr, unsigned int mask);
418 void snd_hdac_aligned_write(unsigned int val, void __iomem *addr,
420 #define snd_hdac_aligned_mmio(bus) (bus)->aligned_mmio argument
422 #define snd_hdac_aligned_mmio(bus) false argument
423 #define snd_hdac_aligned_read(addr, mask) 0 argument
424 #define snd_hdac_aligned_write(val, addr, mask) do {} while (0) argument
427 static inline void snd_hdac_reg_writeb(struct hdac_bus *bus, void __iomem *addr, in snd_hdac_reg_writeb() argument
430 if (snd_hdac_aligned_mmio(bus)) in snd_hdac_reg_writeb()
431 snd_hdac_aligned_write(val, addr, 0xff); in snd_hdac_reg_writeb()
433 writeb(val, addr); in snd_hdac_reg_writeb()
436 static inline void snd_hdac_reg_writew(struct hdac_bus *bus, void __iomem *addr, in snd_hdac_reg_writew() argument
439 if (snd_hdac_aligned_mmio(bus)) in snd_hdac_reg_writew()
440 snd_hdac_aligned_write(val, addr, 0xffff); in snd_hdac_reg_writew()
442 writew(val, addr); in snd_hdac_reg_writew()
445 static inline u8 snd_hdac_reg_readb(struct hdac_bus *bus, void __iomem *addr) in snd_hdac_reg_readb() argument
447 return snd_hdac_aligned_mmio(bus) ? in snd_hdac_reg_readb()
448 snd_hdac_aligned_read(addr, 0xff) : readb(addr); in snd_hdac_reg_readb()
451 static inline u16 snd_hdac_reg_readw(struct hdac_bus *bus, void __iomem *addr) in snd_hdac_reg_readw() argument
453 return snd_hdac_aligned_mmio(bus) ? in snd_hdac_reg_readw()
454 snd_hdac_aligned_read(addr, 0xffff) : readw(addr); in snd_hdac_reg_readw()
457 #define snd_hdac_reg_writel(bus, addr, val) writel(val, addr) argument
458 #define snd_hdac_reg_readl(bus, addr) readl(addr) argument
459 #define snd_hdac_reg_writeq(bus, addr, val) writeq(val, addr) argument
460 #define snd_hdac_reg_readq(bus, addr) readq(addr) argument
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))
504 #define snd_hdac_updatel(addr, reg, mask, val) \ argument
505 writel(((readl(addr + reg) & ~(mask)) | (val)), addr + reg)
507 #define snd_hdac_updatew(addr, reg, mask, val) \ argument
508 writew(((readw(addr + reg) & ~(mask)) | (val)), addr + reg)
511 * HD-audio stream
514 struct hdac_bus *bus; member
569 void snd_hdac_stream_init(struct hdac_bus *bus, struct hdac_stream *azx_dev,
571 struct hdac_stream *snd_hdac_stream_assign(struct hdac_bus *bus,
575 struct hdac_stream *snd_hdac_get_stream(struct hdac_bus *bus,
585 void snd_hdac_stop_streams(struct hdac_bus *bus);
586 void snd_hdac_stop_streams_and_chip(struct hdac_bus *bus);
594 int snd_hdac_get_stream_stripe_ctl(struct hdac_bus *bus,
599 int snd_hdac_stream_set_spib(struct hdac_bus *bus,
601 int snd_hdac_stream_get_spbmaxfifo(struct hdac_bus *bus,
603 void snd_hdac_stream_drsm_enable(struct hdac_bus *bus,
606 int snd_hdac_stream_set_dpibr(struct hdac_bus *bus,
615 snd_hdac_reg_writel((dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg, value)
617 snd_hdac_reg_writew((dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg, value)
619 snd_hdac_reg_writeb((dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg, value)
621 snd_hdac_reg_readl((dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg)
623 snd_hdac_reg_readw((dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg)
625 snd_hdac_reg_readb((dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg)
628 false, (dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg)
631 false, (dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg)
634 false, (dev)->bus, (dev)->sd_addr + AZX_REG_ ## reg)
652 #define snd_hdac_dsp_lock_init(dev) mutex_init(&(dev)->dsp_mutex)
653 #define snd_hdac_dsp_lock(dev) mutex_lock(&(dev)->dsp_mutex)
654 #define snd_hdac_dsp_unlock(dev) mutex_unlock(&(dev)->dsp_mutex)
655 #define snd_hdac_stream_is_locked(dev) ((dev)->locked)
694 array->elem_size = size; in snd_array_init()
695 array->alloc_align = align; in snd_array_init()
700 return array->list + idx * array->elem_size; in snd_array_elem()
705 return (unsigned long)(ptr - array->list) / array->elem_size; in snd_array_index()
710 for ((idx) = 0, (ptr) = (array)->list; (idx) < (array)->used; \