File Index
Files and directories
Sign in
FILE

hdaudio_ext.h

File preview with syntax highlighting.

linux-6.19.14/include/sound/hdaudio_ext.h C
  1/* SPDX-License-Identifier: GPL-2.0 */
  2#ifndef __SOUND_HDAUDIO_EXT_H
  3#define __SOUND_HDAUDIO_EXT_H
  4
  5#include <sound/hdaudio.h>
  6
  7int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
  8		      const struct hdac_bus_ops *ops,
  9		      const struct hdac_ext_bus_ops *ext_ops);
 10
 11void snd_hdac_ext_bus_exit(struct hdac_bus *bus);
 12void snd_hdac_ext_bus_device_remove(struct hdac_bus *bus);
 13
 14#define HDA_CODEC_REV_EXT_ENTRY(_vid, _rev, _name, drv_data) \
 15	{ .vendor_id = (_vid), .rev_id = (_rev), .name = (_name), \
 16	  .api_version = HDA_DEV_ASOC, \
 17	  .driver_data = (unsigned long)(drv_data) }
 18#define HDA_CODEC_EXT_ENTRY(_vid, _revid, _name, _drv_data) \
 19	HDA_CODEC_REV_EXT_ENTRY(_vid, _revid, _name, _drv_data)
 20
 21void snd_hdac_ext_bus_ppcap_enable(struct hdac_bus *chip, bool enable);
 22void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_bus *chip, bool enable);
 23
 24int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_bus *bus);
 25struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_id(struct hdac_bus *bus, u32 id);
 26struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_addr(struct hdac_bus *bus, int addr);
 27struct hdac_ext_link *snd_hdac_ext_bus_get_hlink_by_name(struct hdac_bus *bus,
 28							 const char *codec_name);
 29
 30enum hdac_ext_stream_type {
 31	HDAC_EXT_STREAM_TYPE_COUPLED = 0,
 32	HDAC_EXT_STREAM_TYPE_HOST,
 33	HDAC_EXT_STREAM_TYPE_LINK
 34};
 35
 36/**
 37 * hdac_ext_stream: HDAC extended stream for extended HDA caps
 38 *
 39 * @hstream: hdac_stream
 40 * @pphc_addr: processing pipe host stream pointer
 41 * @pplc_addr: processing pipe link stream pointer
 42 * @decoupled: stream host and link is decoupled
 43 * @link_locked: link is locked
 44 * @link_prepared: link is prepared
 45 * @link_substream: link substream
 46 */
 47struct hdac_ext_stream {
 48	struct hdac_stream hstream;
 49
 50	void __iomem *pphc_addr;
 51	void __iomem *pplc_addr;
 52
 53	u32 pphcllpl;
 54	u32 pphcllpu;
 55	u32 pphcldpl;
 56	u32 pphcldpu;
 57
 58	u32 pplcllpl;
 59	u32 pplcllpu;
 60
 61	bool decoupled:1;
 62	bool link_locked:1;
 63	bool link_prepared;
 64
 65	int (*host_setup)(struct hdac_stream *, bool);
 66
 67	struct snd_pcm_substream *link_substream;
 68};
 69
 70#define hdac_stream(s)		(&(s)->hstream)
 71#define stream_to_hdac_ext_stream(s) \
 72	container_of(s, struct hdac_ext_stream, hstream)
 73
 74int snd_hdac_ext_stream_init_all(struct hdac_bus *bus, int start_idx,
 75				 int num_stream, int dir);
 76void snd_hdac_ext_stream_free_all(struct hdac_bus *bus);
 77void snd_hdac_ext_link_free_all(struct hdac_bus *bus);
 78struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus,
 79					   struct snd_pcm_substream *substream,
 80					   int type);
 81void snd_hdac_ext_stream_release(struct hdac_ext_stream *hext_stream, int type);
 82struct hdac_ext_stream *snd_hdac_ext_cstream_assign(struct hdac_bus *bus,
 83						    struct snd_compr_stream *cstream);
 84void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus,
 85					 struct hdac_ext_stream *hext_stream, bool decouple);
 86void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,
 87				struct hdac_ext_stream *azx_dev, bool decouple);
 88
 89void snd_hdac_ext_stream_start(struct hdac_ext_stream *hext_stream);
 90void snd_hdac_ext_stream_clear(struct hdac_ext_stream *hext_stream);
 91void snd_hdac_ext_stream_reset(struct hdac_ext_stream *hext_stream);
 92int snd_hdac_ext_stream_setup(struct hdac_ext_stream *hext_stream, int fmt);
 93int snd_hdac_ext_host_stream_setup(struct hdac_ext_stream *hext_stream, bool code_loading);
 94
 95struct hdac_ext_link {
 96	struct hdac_bus *bus;
 97	int index;
 98	void __iomem *ml_addr; /* link output stream reg pointer */
 99	u32 lcaps;   /* link capablities */
100	u16 lsdiid;  /* link sdi identifier */
101	u32 id;
102	u8 slcount;
103
104	int ref_count;
105
106	struct list_head list;
107};
108
109#define hdac_ext_link_alt(link)		((link)->lcaps & AZX_ML_HDA_LCAP_ALT)
110#define hdac_ext_link_ofls(link)	((link)->lcaps & AZX_ML_HDA_LCAP_OFLS)
111
112int snd_hdac_ext_bus_link_power_up(struct hdac_ext_link *hlink);
113int snd_hdac_ext_bus_link_power_down(struct hdac_ext_link *hlink);
114int snd_hdac_ext_bus_link_power_up_all(struct hdac_bus *bus);
115int snd_hdac_ext_bus_link_power_down_all(struct hdac_bus *bus);
116void snd_hdac_ext_bus_link_set_stream_id(struct hdac_ext_link *hlink,
117					 int stream);
118void snd_hdac_ext_bus_link_clear_stream_id(struct hdac_ext_link *hlink,
119					   int stream);
120
121int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, struct hdac_ext_link *hlink);
122int snd_hdac_ext_bus_link_put(struct hdac_bus *bus, struct hdac_ext_link *hlink);
123
124void snd_hdac_ext_bus_link_power(struct hdac_device *codec, bool enable);
125
126struct hdac_ext_device;
127
128/* ops common to all codec drivers */
129struct hdac_ext_codec_ops {
130	int (*build_controls)(struct hdac_ext_device *dev);
131	int (*init)(struct hdac_ext_device *dev);
132	void (*free)(struct hdac_ext_device *dev);
133};
134
135struct hda_dai_map {
136	char *dai_name;
137	hda_nid_t nid;
138	u32	maxbps;
139};
140
141struct hdac_ext_dma_params {
142	u32 format;
143	u8 stream_tag;
144};
145
146int snd_hda_ext_driver_register(struct hdac_driver *drv);
147void snd_hda_ext_driver_unregister(struct hdac_driver *drv);
148
149#endif /* __SOUND_HDAUDIO_EXT_H */
~/ Read-only file preview.