⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hda_codec.h

📁 linux 内核源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* Jack location (0x0-0x3f) *//* common case */enum {	AC_JACK_LOC_NONE,	AC_JACK_LOC_REAR,	AC_JACK_LOC_FRONT,	AC_JACK_LOC_LEFT,	AC_JACK_LOC_RIGHT,	AC_JACK_LOC_TOP,	AC_JACK_LOC_BOTTOM,};/* bits 4-5 */enum {	AC_JACK_LOC_EXTERNAL = 0x00,	AC_JACK_LOC_INTERNAL = 0x10,	AC_JACK_LOC_SEPARATE = 0x20,	AC_JACK_LOC_OTHER    = 0x30,};enum {	/* external on primary chasis */	AC_JACK_LOC_REAR_PANEL = 0x07,	AC_JACK_LOC_DRIVE_BAY,	/* internal */	AC_JACK_LOC_RISER = 0x17,	AC_JACK_LOC_HDMI,	AC_JACK_LOC_ATAPI,	/* others */	AC_JACK_LOC_MOBILE_IN = 0x37,	AC_JACK_LOC_MOBILE_OUT,};/* Port connectivity (0-3) */enum {	AC_JACK_PORT_COMPLEX,	AC_JACK_PORT_NONE,	AC_JACK_PORT_FIXED,	AC_JACK_PORT_BOTH,};/* max. connections to a widget */#define HDA_MAX_CONNECTIONS	32/* max. codec address */#define HDA_MAX_CODEC_ADDRESS	0x0f/* * Structures */struct hda_bus;struct hda_codec;struct hda_pcm;struct hda_pcm_stream;struct hda_bus_unsolicited;/* NID type */typedef u16 hda_nid_t;/* bus operators */struct hda_bus_ops {	/* send a single command */	int (*command)(struct hda_codec *codec, hda_nid_t nid, int direct,		       unsigned int verb, unsigned int parm);	/* get a response from the last command */	unsigned int (*get_response)(struct hda_codec *codec);	/* free the private data */	void (*private_free)(struct hda_bus *);#ifdef CONFIG_SND_HDA_POWER_SAVE	/* notify power-up/down from codec to contoller */	void (*pm_notify)(struct hda_codec *codec);#endif};/* template to pass to the bus constructor */struct hda_bus_template {	void *private_data;	struct pci_dev *pci;	const char *modelname;	struct hda_bus_ops ops;};/* * codec bus * * each controller needs to creata a hda_bus to assign the accessor. * A hda_bus contains several codecs in the list codec_list. */struct hda_bus {	struct snd_card *card;	/* copied from template */	void *private_data;	struct pci_dev *pci;	const char *modelname;	struct hda_bus_ops ops;	/* codec linked list */	struct list_head codec_list;	/* link caddr -> codec */	struct hda_codec *caddr_tbl[HDA_MAX_CODEC_ADDRESS + 1];	struct mutex cmd_mutex;	/* unsolicited event queue */	struct hda_bus_unsolicited *unsol;	struct snd_info_entry *proc;};/* * codec preset * * Known codecs have the patch to build and set up the controls/PCMs * better than the generic parser. */struct hda_codec_preset {	unsigned int id;	unsigned int mask;	unsigned int subs;	unsigned int subs_mask;	unsigned int rev;	const char *name;	int (*patch)(struct hda_codec *codec);};	/* ops set by the preset patch */struct hda_codec_ops {	int (*build_controls)(struct hda_codec *codec);	int (*build_pcms)(struct hda_codec *codec);	int (*init)(struct hda_codec *codec);	void (*free)(struct hda_codec *codec);	void (*unsol_event)(struct hda_codec *codec, unsigned int res);#ifdef SND_HDA_NEEDS_RESUME	int (*suspend)(struct hda_codec *codec, pm_message_t state);	int (*resume)(struct hda_codec *codec);#endif#ifdef CONFIG_SND_HDA_POWER_SAVE	int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid);#endif};/* record for amp information cache */struct hda_cache_head {	u32 key;		/* hash key */	u16 val;		/* assigned value */	u16 next;		/* next link; -1 = terminal */};struct hda_amp_info {	struct hda_cache_head head;	u32 amp_caps;		/* amp capabilities */	u16 vol[2];		/* current volume & mute */};struct hda_cache_rec {	u16 hash[64];			/* hash table for index */	unsigned int num_entries;	/* number of assigned entries */	unsigned int size;		/* allocated size */	unsigned int record_size;	/* record size (including header) */	void *buffer;			/* hash table entries */};/* PCM callbacks */struct hda_pcm_ops {	int (*open)(struct hda_pcm_stream *info, struct hda_codec *codec,		    struct snd_pcm_substream *substream);	int (*close)(struct hda_pcm_stream *info, struct hda_codec *codec,		     struct snd_pcm_substream *substream);	int (*prepare)(struct hda_pcm_stream *info, struct hda_codec *codec,		       unsigned int stream_tag, unsigned int format,		       struct snd_pcm_substream *substream);	int (*cleanup)(struct hda_pcm_stream *info, struct hda_codec *codec,		       struct snd_pcm_substream *substream);};/* PCM information for each substream */struct hda_pcm_stream {	unsigned int substreams;	/* number of substreams, 0 = not exist*/	unsigned int channels_min;	/* min. number of channels */	unsigned int channels_max;	/* max. number of channels */	hda_nid_t nid;	/* default NID to query rates/formats/bps, or set up */	u32 rates;	/* supported rates */	u64 formats;	/* supported formats (SNDRV_PCM_FMTBIT_) */	unsigned int maxbps;	/* supported max. bit per sample */	struct hda_pcm_ops ops;};/* for PCM creation */struct hda_pcm {	char *name;	struct hda_pcm_stream stream[2];	unsigned int is_modem;	/* modem codec? */};/* codec information */struct hda_codec {	struct hda_bus *bus;	unsigned int addr;	/* codec addr*/	struct list_head list;	/* list point */	hda_nid_t afg;	/* AFG node id */	hda_nid_t mfg;	/* MFG node id */	/* ids */	u32 vendor_id;	u32 subsystem_id;	u32 revision_id;	/* detected preset */	const struct hda_codec_preset *preset;	/* set by patch */	struct hda_codec_ops patch_ops;	/* PCM to create, set by patch_ops.build_pcms callback */	unsigned int num_pcms;	struct hda_pcm *pcm_info;	/* codec specific info */	void *spec;	/* widget capabilities cache */	unsigned int num_nodes;	hda_nid_t start_nid;	u32 *wcaps;	struct hda_cache_rec amp_cache;	/* cache for amp access */	struct hda_cache_rec cmd_cache;	/* cache for other commands */	struct mutex spdif_mutex;	unsigned int spdif_status;	/* IEC958 status bits */	unsigned short spdif_ctls;	/* SPDIF control bits */	unsigned int spdif_in_enable;	/* SPDIF input enable? */	struct snd_hwdep *hwdep;	/* assigned hwdep device */#ifdef CONFIG_SND_HDA_POWER_SAVE	unsigned int power_on :1;	/* current (global) power-state */	unsigned int power_transition :1; /* power-state in transition */	int power_count;	/* current (global) power refcount */	struct delayed_work power_work; /* delayed task for powerdown */#endif};/* direction */enum {	HDA_INPUT, HDA_OUTPUT};/* * constructors */int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp,		    struct hda_bus **busp);int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,		      struct hda_codec **codecp);/* * low level functions */unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid,				int direct,				unsigned int verb, unsigned int parm);int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int direct,			unsigned int verb, unsigned int parm);#define snd_hda_param_read(codec, nid, param) \	snd_hda_codec_read(codec, nid, 0, AC_VERB_PARAMETERS, param)int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid,			  hda_nid_t *start_id);int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,			    hda_nid_t *conn_list, int max_conns);struct hda_verb {	hda_nid_t nid;	u32 verb;	u32 param;};void snd_hda_sequence_write(struct hda_codec *codec,			    const struct hda_verb *seq);/* unsolicited event */int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex);/* cached write */#ifdef SND_HDA_NEEDS_RESUMEint snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,			      int direct, unsigned int verb, unsigned int parm);void snd_hda_sequence_write_cache(struct hda_codec *codec,				  const struct hda_verb *seq);void snd_hda_codec_resume_cache(struct hda_codec *codec);#else#define snd_hda_codec_write_cache	snd_hda_codec_write#define snd_hda_sequence_write_cache	snd_hda_sequence_write#endif/* * Mixer */int snd_hda_build_controls(struct hda_bus *bus);/* * PCM */int snd_hda_build_pcms(struct hda_bus *bus);void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid,				u32 stream_tag,				int channel_id, int format);unsigned int snd_hda_calc_stream_format(unsigned int rate,					unsigned int channels,					unsigned int format,					unsigned int maxbps);int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid,				u32 *ratesp, u64 *formatsp, unsigned int *bpsp);int snd_hda_is_supported_format(struct hda_codec *codec, hda_nid_t nid,				unsigned int format);/* * Misc */void snd_hda_get_codec_name(struct hda_codec *codec, char *name, int namelen);/* * power management */#ifdef CONFIG_PMint snd_hda_suspend(struct hda_bus *bus, pm_message_t state);int snd_hda_resume(struct hda_bus *bus);#endif/* * power saving */#ifdef CONFIG_SND_HDA_POWER_SAVEvoid snd_hda_power_up(struct hda_codec *codec);void snd_hda_power_down(struct hda_codec *codec);#define snd_hda_codec_needs_resume(codec) codec->power_countint snd_hda_codecs_inuse(struct hda_bus *bus);#elsestatic inline void snd_hda_power_up(struct hda_codec *codec) {}static inline void snd_hda_power_down(struct hda_codec *codec) {}#define snd_hda_codec_needs_resume(codec) 1#define snd_hda_codecs_inuse(bus) 1#endif#endif /* __SOUND_HDA_CODEC_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -