Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v6.7 185 lines 6.8 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef __SOUND_HDAUDIO_EXT_H 3#define __SOUND_HDAUDIO_EXT_H 4 5#include <linux/io-64-nonatomic-lo-hi.h> 6#include <linux/iopoll.h> 7#include <sound/hdaudio.h> 8 9int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev, 10 const struct hdac_bus_ops *ops, 11 const struct hdac_ext_bus_ops *ext_ops); 12 13void snd_hdac_ext_bus_exit(struct hdac_bus *bus); 14void snd_hdac_ext_bus_device_remove(struct hdac_bus *bus); 15 16#define HDA_CODEC_REV_EXT_ENTRY(_vid, _rev, _name, drv_data) \ 17 { .vendor_id = (_vid), .rev_id = (_rev), .name = (_name), \ 18 .api_version = HDA_DEV_ASOC, \ 19 .driver_data = (unsigned long)(drv_data) } 20#define HDA_CODEC_EXT_ENTRY(_vid, _revid, _name, _drv_data) \ 21 HDA_CODEC_REV_EXT_ENTRY(_vid, _revid, _name, _drv_data) 22 23void snd_hdac_ext_bus_ppcap_enable(struct hdac_bus *chip, bool enable); 24void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_bus *chip, bool enable); 25 26int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus); 27struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_addr(struct hdac_bus *bus, int addr); 28struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_name(struct hdac_bus *bus, 29 const char *codec_name); 30 31enum hdac_ext_stream_type { 32 HDAC_EXT_STREAM_TYPE_COUPLED = 0, 33 HDAC_EXT_STREAM_TYPE_HOST, 34 HDAC_EXT_STREAM_TYPE_LINK 35}; 36 37/** 38 * hdac_ext_stream: HDAC extended stream for extended HDA caps 39 * 40 * @hstream: hdac_stream 41 * @pphc_addr: processing pipe host stream pointer 42 * @pplc_addr: processing pipe link stream pointer 43 * @decoupled: stream host and link is decoupled 44 * @link_locked: link is locked 45 * @link_prepared: link is prepared 46 * @link_substream: link substream 47 */ 48struct hdac_ext_stream { 49 struct hdac_stream hstream; 50 51 void __iomem *pphc_addr; 52 void __iomem *pplc_addr; 53 54 u32 pphcllpl; 55 u32 pphcllpu; 56 u32 pphcldpl; 57 u32 pphcldpu; 58 59 bool decoupled:1; 60 bool link_locked:1; 61 bool link_prepared; 62 63 int (*host_setup)(struct hdac_stream *, bool); 64 65 struct snd_pcm_substream *link_substream; 66}; 67 68#define hdac_stream(s) (&(s)->hstream) 69#define stream_to_hdac_ext_stream(s) \ 70 container_of(s, struct hdac_ext_stream, hstream) 71 72int snd_hdac_ext_stream_init_all(struct hdac_bus *bus, int start_idx, 73 int num_stream, int dir); 74void snd_hdac_ext_stream_free_all(struct hdac_bus *bus); 75void snd_hdac_ext_link_free_all(struct hdac_bus *bus); 76struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus, 77 struct snd_pcm_substream *substream, 78 int type); 79void snd_hdac_ext_stream_release(struct hdac_ext_stream *hext_stream, int type); 80struct hdac_ext_stream *snd_hdac_ext_cstream_assign(struct hdac_bus *bus, 81 struct snd_compr_stream *cstream); 82void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus, 83 struct hdac_ext_stream *hext_stream, bool decouple); 84void snd_hdac_ext_stream_decouple(struct hdac_bus *bus, 85 struct hdac_ext_stream *azx_dev, bool decouple); 86 87void snd_hdac_ext_stream_start(struct hdac_ext_stream *hext_stream); 88void snd_hdac_ext_stream_clear(struct hdac_ext_stream *hext_stream); 89void snd_hdac_ext_stream_reset(struct hdac_ext_stream *hext_stream); 90int snd_hdac_ext_stream_setup(struct hdac_ext_stream *hext_stream, int fmt); 91int snd_hdac_ext_host_stream_setup(struct hdac_ext_stream *hext_stream, bool code_loading); 92 93struct hdac_ext_link { 94 struct hdac_bus *bus; 95 int index; 96 void __iomem *ml_addr; /* link output stream reg pointer */ 97 u32 lcaps; /* link capablities */ 98 u16 lsdiid; /* link sdi identifier */ 99 100 int ref_count; 101 102 struct list_head list; 103}; 104 105int snd_hdac_ext_bus_link_power_up(struct hdac_ext_link *hlink); 106int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *hlink); 107int snd_hdac_ext_bus_link_power_up_all(struct hdac_bus *bus); 108int snd_hdac_ext_bus_link_power_down_all(struct hdac_bus *bus); 109void snd_hdac_ext_bus_link_set_stream_id(struct hdac_ext_link *hlink, 110 int stream); 111void snd_hdac_ext_bus_link_clear_stream_id(struct hdac_ext_link *hlink, 112 int stream); 113 114int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, struct hdac_ext_link *hlink); 115int snd_hdac_ext_bus_link_put(struct hdac_bus *bus, struct hdac_ext_link *hlink); 116 117void snd_hdac_ext_bus_link_power(struct hdac_device *codec, bool enable); 118 119#define snd_hdac_adsp_writeb(chip, reg, value) \ 120 snd_hdac_reg_writeb(chip, (chip)->dsp_ba + (reg), value) 121#define snd_hdac_adsp_readb(chip, reg) \ 122 snd_hdac_reg_readb(chip, (chip)->dsp_ba + (reg)) 123#define snd_hdac_adsp_writew(chip, reg, value) \ 124 snd_hdac_reg_writew(chip, (chip)->dsp_ba + (reg), value) 125#define snd_hdac_adsp_readw(chip, reg) \ 126 snd_hdac_reg_readw(chip, (chip)->dsp_ba + (reg)) 127#define snd_hdac_adsp_writel(chip, reg, value) \ 128 snd_hdac_reg_writel(chip, (chip)->dsp_ba + (reg), value) 129#define snd_hdac_adsp_readl(chip, reg) \ 130 snd_hdac_reg_readl(chip, (chip)->dsp_ba + (reg)) 131#define snd_hdac_adsp_writeq(chip, reg, value) \ 132 snd_hdac_reg_writeq(chip, (chip)->dsp_ba + (reg), value) 133#define snd_hdac_adsp_readq(chip, reg) \ 134 snd_hdac_reg_readq(chip, (chip)->dsp_ba + (reg)) 135 136#define snd_hdac_adsp_updateb(chip, reg, mask, val) \ 137 snd_hdac_adsp_writeb(chip, reg, \ 138 (snd_hdac_adsp_readb(chip, reg) & ~(mask)) | (val)) 139#define snd_hdac_adsp_updatew(chip, reg, mask, val) \ 140 snd_hdac_adsp_writew(chip, reg, \ 141 (snd_hdac_adsp_readw(chip, reg) & ~(mask)) | (val)) 142#define snd_hdac_adsp_updatel(chip, reg, mask, val) \ 143 snd_hdac_adsp_writel(chip, reg, \ 144 (snd_hdac_adsp_readl(chip, reg) & ~(mask)) | (val)) 145#define snd_hdac_adsp_updateq(chip, reg, mask, val) \ 146 snd_hdac_adsp_writeq(chip, reg, \ 147 (snd_hdac_adsp_readq(chip, reg) & ~(mask)) | (val)) 148 149#define snd_hdac_adsp_readb_poll(chip, reg, val, cond, delay_us, timeout_us) \ 150 readb_poll_timeout((chip)->dsp_ba + (reg), val, cond, \ 151 delay_us, timeout_us) 152#define snd_hdac_adsp_readw_poll(chip, reg, val, cond, delay_us, timeout_us) \ 153 readw_poll_timeout((chip)->dsp_ba + (reg), val, cond, \ 154 delay_us, timeout_us) 155#define snd_hdac_adsp_readl_poll(chip, reg, val, cond, delay_us, timeout_us) \ 156 readl_poll_timeout((chip)->dsp_ba + (reg), val, cond, \ 157 delay_us, timeout_us) 158#define snd_hdac_adsp_readq_poll(chip, reg, val, cond, delay_us, timeout_us) \ 159 readq_poll_timeout((chip)->dsp_ba + (reg), val, cond, \ 160 delay_us, timeout_us) 161 162struct hdac_ext_device; 163 164/* ops common to all codec drivers */ 165struct hdac_ext_codec_ops { 166 int (*build_controls)(struct hdac_ext_device *dev); 167 int (*init)(struct hdac_ext_device *dev); 168 void (*free)(struct hdac_ext_device *dev); 169}; 170 171struct hda_dai_map { 172 char *dai_name; 173 hda_nid_t nid; 174 u32 maxbps; 175}; 176 177struct hdac_ext_dma_params { 178 u32 format; 179 u8 stream_tag; 180}; 181 182int snd_hda_ext_driver_register(struct hdac_driver *drv); 183void snd_hda_ext_driver_unregister(struct hdac_driver *drv); 184 185#endif /* __SOUND_HDAUDIO_EXT_H */