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

TOMOYO Linux Cross Reference
Linux/include/sound/hdaudio_ext.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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 */
  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 
  9 int 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 
 13 void snd_hdac_ext_bus_exit(struct hdac_bus *bus);
 14 void 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 
 23 void snd_hdac_ext_bus_ppcap_enable(struct hdac_bus *chip, bool enable);
 24 void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_bus *chip, bool enable);
 25 
 26 int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus);
 27 struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_addr(struct hdac_bus *bus, int addr);
 28 struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_name(struct hdac_bus *bus,
 29                                                          const char *codec_name);
 30 
 31 enum 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  */
 48 struct 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         u32 pplcllpl;
 60         u32 pplcllpu;
 61 
 62         bool decoupled:1;
 63         bool link_locked:1;
 64         bool link_prepared;
 65 
 66         int (*host_setup)(struct hdac_stream *, bool);
 67 
 68         struct snd_pcm_substream *link_substream;
 69 };
 70 
 71 #define hdac_stream(s)          (&(s)->hstream)
 72 #define stream_to_hdac_ext_stream(s) \
 73         container_of(s, struct hdac_ext_stream, hstream)
 74 
 75 int snd_hdac_ext_stream_init_all(struct hdac_bus *bus, int start_idx,
 76                                  int num_stream, int dir);
 77 void snd_hdac_ext_stream_free_all(struct hdac_bus *bus);
 78 void snd_hdac_ext_link_free_all(struct hdac_bus *bus);
 79 struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus,
 80                                            struct snd_pcm_substream *substream,
 81                                            int type);
 82 void snd_hdac_ext_stream_release(struct hdac_ext_stream *hext_stream, int type);
 83 struct hdac_ext_stream *snd_hdac_ext_cstream_assign(struct hdac_bus *bus,
 84                                                     struct snd_compr_stream *cstream);
 85 void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus,
 86                                          struct hdac_ext_stream *hext_stream, bool decouple);
 87 void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,
 88                                 struct hdac_ext_stream *azx_dev, bool decouple);
 89 
 90 void snd_hdac_ext_stream_start(struct hdac_ext_stream *hext_stream);
 91 void snd_hdac_ext_stream_clear(struct hdac_ext_stream *hext_stream);
 92 void snd_hdac_ext_stream_reset(struct hdac_ext_stream *hext_stream);
 93 int snd_hdac_ext_stream_setup(struct hdac_ext_stream *hext_stream, int fmt);
 94 int snd_hdac_ext_host_stream_setup(struct hdac_ext_stream *hext_stream, bool code_loading);
 95 
 96 struct hdac_ext_link {
 97         struct hdac_bus *bus;
 98         int index;
 99         void __iomem *ml_addr; /* link output stream reg pointer */
100         u32 lcaps;   /* link capablities */
101         u16 lsdiid;  /* link sdi identifier */
102 
103         int ref_count;
104 
105         struct list_head list;
106 };
107 
108 int snd_hdac_ext_bus_link_power_up(struct hdac_ext_link *hlink);
109 int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *hlink);
110 int snd_hdac_ext_bus_link_power_up_all(struct hdac_bus *bus);
111 int snd_hdac_ext_bus_link_power_down_all(struct hdac_bus *bus);
112 void snd_hdac_ext_bus_link_set_stream_id(struct hdac_ext_link *hlink,
113                                          int stream);
114 void snd_hdac_ext_bus_link_clear_stream_id(struct hdac_ext_link *hlink,
115                                            int stream);
116 
117 int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, struct hdac_ext_link *hlink);
118 int snd_hdac_ext_bus_link_put(struct hdac_bus *bus, struct hdac_ext_link *hlink);
119 
120 void snd_hdac_ext_bus_link_power(struct hdac_device *codec, bool enable);
121 
122 #define snd_hdac_adsp_writeb(chip, reg, value) \
123         snd_hdac_reg_writeb(chip, (chip)->dsp_ba + (reg), value)
124 #define snd_hdac_adsp_readb(chip, reg) \
125         snd_hdac_reg_readb(chip, (chip)->dsp_ba + (reg))
126 #define snd_hdac_adsp_writew(chip, reg, value) \
127         snd_hdac_reg_writew(chip, (chip)->dsp_ba + (reg), value)
128 #define snd_hdac_adsp_readw(chip, reg) \
129         snd_hdac_reg_readw(chip, (chip)->dsp_ba + (reg))
130 #define snd_hdac_adsp_writel(chip, reg, value) \
131         snd_hdac_reg_writel(chip, (chip)->dsp_ba + (reg), value)
132 #define snd_hdac_adsp_readl(chip, reg) \
133         snd_hdac_reg_readl(chip, (chip)->dsp_ba + (reg))
134 #define snd_hdac_adsp_writeq(chip, reg, value) \
135         snd_hdac_reg_writeq(chip, (chip)->dsp_ba + (reg), value)
136 #define snd_hdac_adsp_readq(chip, reg) \
137         snd_hdac_reg_readq(chip, (chip)->dsp_ba + (reg))
138 
139 #define snd_hdac_adsp_updateb(chip, reg, mask, val) \
140         snd_hdac_adsp_writeb(chip, reg, \
141                         (snd_hdac_adsp_readb(chip, reg) & ~(mask)) | (val))
142 #define snd_hdac_adsp_updatew(chip, reg, mask, val) \
143         snd_hdac_adsp_writew(chip, reg, \
144                         (snd_hdac_adsp_readw(chip, reg) & ~(mask)) | (val))
145 #define snd_hdac_adsp_updatel(chip, reg, mask, val) \
146         snd_hdac_adsp_writel(chip, reg, \
147                         (snd_hdac_adsp_readl(chip, reg) & ~(mask)) | (val))
148 #define snd_hdac_adsp_updateq(chip, reg, mask, val) \
149         snd_hdac_adsp_writeq(chip, reg, \
150                         (snd_hdac_adsp_readq(chip, reg) & ~(mask)) | (val))
151 
152 #define snd_hdac_adsp_readb_poll(chip, reg, val, cond, delay_us, timeout_us) \
153         readb_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
154                            delay_us, timeout_us)
155 #define snd_hdac_adsp_readw_poll(chip, reg, val, cond, delay_us, timeout_us) \
156         readw_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
157                            delay_us, timeout_us)
158 #define snd_hdac_adsp_readl_poll(chip, reg, val, cond, delay_us, timeout_us) \
159         readl_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
160                            delay_us, timeout_us)
161 #define snd_hdac_adsp_readq_poll(chip, reg, val, cond, delay_us, timeout_us) \
162         readq_poll_timeout((chip)->dsp_ba + (reg), val, cond, \
163                            delay_us, timeout_us)
164 
165 struct hdac_ext_device;
166 
167 /* ops common to all codec drivers */
168 struct hdac_ext_codec_ops {
169         int (*build_controls)(struct hdac_ext_device *dev);
170         int (*init)(struct hdac_ext_device *dev);
171         void (*free)(struct hdac_ext_device *dev);
172 };
173 
174 struct hda_dai_map {
175         char *dai_name;
176         hda_nid_t nid;
177         u32     maxbps;
178 };
179 
180 struct hdac_ext_dma_params {
181         u32 format;
182         u8 stream_tag;
183 };
184 
185 int snd_hda_ext_driver_register(struct hdac_driver *drv);
186 void snd_hda_ext_driver_unregister(struct hdac_driver *drv);
187 
188 #endif /* __SOUND_HDAUDIO_EXT_H */
189 

~ [ 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