ALSA: hda - Drop azx_sd_read*/write*() macros
[deliverable/linux.git] / sound / pci / hda / hda_codec.h
CommitLineData
1da177e4
LT
1/*
2 * Universal Interface for Intel High Definition Audio Codec
3 *
4 * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc., 59
18 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21#ifndef __SOUND_HDA_CODEC_H
22#define __SOUND_HDA_CODEC_H
23
bbbc7e85 24#include <linux/kref.h>
1da177e4
LT
25#include <sound/info.h>
26#include <sound/control.h>
27#include <sound/pcm.h>
2807314d 28#include <sound/hwdep.h>
e3d280fc 29#include <sound/hdaudio.h>
ed326363 30#include <sound/hda_verbs.h>
4d75faa0 31#include <sound/hda_regmap.h>
f43aa025 32
1da177e4
LT
33/*
34 * Structures
35 */
36
37struct hda_bus;
1cd2224c 38struct hda_beep;
1da177e4
LT
39struct hda_codec;
40struct hda_pcm;
41struct hda_pcm_stream;
1da177e4 42
1da177e4
LT
43/* bus operators */
44struct hda_bus_ops {
176d5335 45 /* attach a PCM stream */
33fa35ed
TI
46 int (*attach_pcm)(struct hda_bus *bus, struct hda_codec *codec,
47 struct hda_pcm *pcm);
8dd78330
TI
48 /* reset bus for retry verb */
49 void (*bus_reset)(struct hda_bus *bus);
1d1a4564
TI
50#ifdef CONFIG_SND_HDA_DSP_LOADER
51 /* prepare DSP transfer */
52 int (*load_dsp_prepare)(struct hda_bus *bus, unsigned int format,
53 unsigned int byte_size,
54 struct snd_dma_buffer *bufp);
55 /* start/stop DSP transfer */
56 void (*load_dsp_trigger)(struct hda_bus *bus, bool start);
57 /* clean up DSP transfer */
58 void (*load_dsp_cleanup)(struct hda_bus *bus,
59 struct snd_dma_buffer *dmab);
60#endif
1da177e4
LT
61};
62
1da177e4
LT
63/*
64 * codec bus
65 *
66 * each controller needs to creata a hda_bus to assign the accessor.
67 * A hda_bus contains several codecs in the list codec_list.
68 */
69struct hda_bus {
d068ebc2
TI
70 struct hdac_bus core;
71
c8b6bf9b 72 struct snd_card *card;
1da177e4 73
1da177e4
LT
74 struct pci_dev *pci;
75 const char *modelname;
76 struct hda_bus_ops ops;
77
3f50ac6a 78 struct mutex prepare_mutex;
1da177e4 79
529bd6c4
TI
80 /* assigned PCMs */
81 DECLARE_BITMAP(pcm_dev_bits, SNDRV_PCM_DEVICES);
82
52987656
TI
83 /* misc op flags */
84 unsigned int needs_damn_long_delay :1;
b20f3b83 85 unsigned int allow_bus_reset:1; /* allow bus reset at fatal error */
b20f3b83 86 /* status for codec/controller */
b94d3539 87 unsigned int shutdown :1; /* being unloaded */
8dd78330
TI
88 unsigned int response_reset:1; /* controller was reset */
89 unsigned int in_reset:1; /* during reset operation */
63e51fd7 90 unsigned int no_response_fallback:1; /* don't fallback at RIRB error */
ea9b43ad
TI
91
92 int primary_dig_out_type; /* primary digital out PCM type */
1da177e4
LT
93};
94
7e8be1b3
TI
95/* from hdac_bus to hda_bus */
96#define to_hda_bus(bus) container_of(bus, struct hda_bus, core)
97
1da177e4
LT
98/*
99 * codec preset
100 *
101 * Known codecs have the patch to build and set up the controls/PCMs
102 * better than the generic parser.
103 */
104struct hda_codec_preset {
105 unsigned int id;
106 unsigned int mask;
107 unsigned int subs;
108 unsigned int subs_mask;
109 unsigned int rev;
ca7cfae9 110 hda_nid_t afg, mfg;
1da177e4
LT
111 const char *name;
112 int (*patch)(struct hda_codec *codec);
113};
114
d8a766a1
TI
115#define HDA_CODEC_ID_GENERIC_HDMI 0x00000101
116#define HDA_CODEC_ID_GENERIC 0x00000201
117
118struct hda_codec_driver {
e3d280fc 119 struct hdac_driver core;
1289e9e8 120 const struct hda_codec_preset *preset;
1289e9e8
TI
121};
122
d8a766a1
TI
123int __hda_codec_driver_register(struct hda_codec_driver *drv, const char *name,
124 struct module *owner);
125#define hda_codec_driver_register(drv) \
126 __hda_codec_driver_register(drv, KBUILD_MODNAME, THIS_MODULE)
127void hda_codec_driver_unregister(struct hda_codec_driver *drv);
128#define module_hda_codec_driver(drv) \
129 module_driver(drv, hda_codec_driver_register, \
130 hda_codec_driver_unregister)
1289e9e8 131
1da177e4
LT
132/* ops set by the preset patch */
133struct hda_codec_ops {
134 int (*build_controls)(struct hda_codec *codec);
135 int (*build_pcms)(struct hda_codec *codec);
136 int (*init)(struct hda_codec *codec);
137 void (*free)(struct hda_codec *codec);
138 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
4d7fbdbc
TI
139 void (*set_power_state)(struct hda_codec *codec, hda_nid_t fg,
140 unsigned int power_state);
2a43952a 141#ifdef CONFIG_PM
68cb2b55 142 int (*suspend)(struct hda_codec *codec);
1da177e4 143 int (*resume)(struct hda_codec *codec);
cb53c626
TI
144 int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid);
145#endif
fb8d1a34 146 void (*reboot_notify)(struct hda_codec *codec);
e6feb5d0 147 void (*stream_pm)(struct hda_codec *codec, hda_nid_t nid, bool on);
1da177e4
LT
148};
149
1da177e4
LT
150/* PCM callbacks */
151struct hda_pcm_ops {
152 int (*open)(struct hda_pcm_stream *info, struct hda_codec *codec,
c8b6bf9b 153 struct snd_pcm_substream *substream);
1da177e4 154 int (*close)(struct hda_pcm_stream *info, struct hda_codec *codec,
c8b6bf9b 155 struct snd_pcm_substream *substream);
1da177e4
LT
156 int (*prepare)(struct hda_pcm_stream *info, struct hda_codec *codec,
157 unsigned int stream_tag, unsigned int format,
c8b6bf9b 158 struct snd_pcm_substream *substream);
1da177e4 159 int (*cleanup)(struct hda_pcm_stream *info, struct hda_codec *codec,
c8b6bf9b 160 struct snd_pcm_substream *substream);
21229613
TI
161 unsigned int (*get_delay)(struct hda_pcm_stream *info,
162 struct hda_codec *codec,
163 struct snd_pcm_substream *substream);
1da177e4
LT
164};
165
166/* PCM information for each substream */
167struct hda_pcm_stream {
d01ce99f 168 unsigned int substreams; /* number of substreams, 0 = not exist*/
1da177e4
LT
169 unsigned int channels_min; /* min. number of channels */
170 unsigned int channels_max; /* max. number of channels */
171 hda_nid_t nid; /* default NID to query rates/formats/bps, or set up */
172 u32 rates; /* supported rates */
173 u64 formats; /* supported formats (SNDRV_PCM_FMTBIT_) */
174 unsigned int maxbps; /* supported max. bit per sample */
ee81abb6 175 const struct snd_pcm_chmap_elem *chmap; /* chmap to override */
1da177e4
LT
176 struct hda_pcm_ops ops;
177};
178
7ba72ba1
TI
179/* PCM types */
180enum {
181 HDA_PCM_TYPE_AUDIO,
182 HDA_PCM_TYPE_SPDIF,
183 HDA_PCM_TYPE_HDMI,
184 HDA_PCM_TYPE_MODEM,
185 HDA_PCM_NTYPES
186};
187
1da177e4
LT
188/* for PCM creation */
189struct hda_pcm {
190 char *name;
191 struct hda_pcm_stream stream[2];
7ba72ba1 192 unsigned int pcm_type; /* HDA_PCM_TYPE_XXX */
176d5335
TI
193 int device; /* device number to assign */
194 struct snd_pcm *pcm; /* assigned PCM instance */
9c9a5175 195 bool own_chmap; /* codec driver provides own channel maps */
bbbc7e85
TI
196 /* private: */
197 struct hda_codec *codec;
198 struct kref kref;
199 struct list_head list;
1da177e4
LT
200};
201
202/* codec information */
203struct hda_codec {
e3d280fc 204 struct hdac_device core;
1da177e4 205 struct hda_bus *bus;
6efdd851 206 struct snd_card *card;
1da177e4 207 unsigned int addr; /* codec addr*/
d8a766a1 208 u32 probe_id; /* overridden id for probing */
1da177e4
LT
209
210 /* detected preset */
211 const struct hda_codec_preset *preset;
f44ac837 212 const char *modelname; /* model name for preset */
1da177e4
LT
213
214 /* set by patch */
215 struct hda_codec_ops patch_ops;
216
1da177e4 217 /* PCM to create, set by patch_ops.build_pcms callback */
bbbc7e85 218 struct list_head pcm_list_head;
1da177e4
LT
219
220 /* codec specific info */
221 void *spec;
222
1cd2224c
MR
223 /* beep device */
224 struct hda_beep *beep;
2dca0bba 225 unsigned int beep_mode;
1cd2224c 226
54d17403 227 /* widget capabilities cache */
54d17403
TI
228 u32 *wcaps;
229
d13bd412 230 struct snd_array mixers; /* list of assigned mixer elements */
5b0cb1d8 231 struct snd_array nids; /* list of mapped mixer elements */
d13bd412 232
ee8e765b 233 struct list_head conn_list; /* linked-list of connection-list */
a12d3e1e 234
62932df8 235 struct mutex spdif_mutex;
5a9e02e9 236 struct mutex control_mutex;
7c935976 237 struct snd_array spdif_out;
1da177e4 238 unsigned int spdif_in_enable; /* SPDIF input enable? */
dda14410 239 const hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */
3be14149 240 struct snd_array init_pins; /* initial (BIOS) pin configurations */
346ff70f 241 struct snd_array driver_pins; /* pin configs set by codec parser */
eb541337 242 struct snd_array cvt_setups; /* audio convert setups */
2807314d 243
09b70e85 244 struct mutex user_mutex;
b989d044 245#ifdef CONFIG_SND_HDA_RECONFIG
11aeff08 246 struct snd_array init_verbs; /* additional init verbs */
1e1be432 247 struct snd_array hints; /* additional hints */
346ff70f 248 struct snd_array user_pins; /* default pin configs to override */
11aeff08 249#endif
cb53c626 250
648a8d27
TI
251#ifdef CONFIG_SND_HDA_HWDEP
252 struct snd_hwdep *hwdep; /* assigned hwdep device */
253#endif
254
963f803f 255 /* misc flags */
9a6246ff 256 unsigned int in_freeing:1; /* being released */
c4c2533f 257 unsigned int registered:1; /* codec was registered */
963f803f
TI
258 unsigned int spdif_status_reset :1; /* needs to toggle SPDIF for each
259 * status change
260 * (e.g. Realtek codecs)
261 */
9421f954
TI
262 unsigned int pin_amp_workaround:1; /* pin out-amp takes index
263 * (e.g. Conexant codecs)
264 */
4f32456e
MK
265 unsigned int single_adc_amp:1; /* adc in-amp takes no index
266 * (e.g. CX20549 codec)
267 */
0e7adbe2 268 unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */
ac0547dc 269 unsigned int pins_shutup:1; /* pins are shut up */
729d55ba 270 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */
71b1e9e4 271 unsigned int no_jack_detect:1; /* Machine has no jack-detection */
ecac3ed1 272 unsigned int inv_eapd:1; /* broken h/w: inverted EAPD control */
9cc159c6 273 unsigned int inv_jack_detect:1; /* broken h/w: inverted detection bit */
ed360813 274 unsigned int pcm_format_first:1; /* PCM format must be set first */
c370dd6e 275 unsigned int cached_write:1; /* write only to caches */
f1aa0684 276 unsigned int dp_mst:1; /* support DP1.2 Multi-stream transport */
cd262518 277 unsigned int dump_coef:1; /* dump processing coefs in codec proc file */
967b1307 278 unsigned int power_save_node:1; /* advanced PM for each widget */
83012a7c 279#ifdef CONFIG_PM
a2f6309e
TI
280 unsigned long power_on_acct;
281 unsigned long power_off_acct;
282 unsigned long power_jiffies;
cb53c626 283#endif
daead538 284
9419ab6b
TI
285 /* filter the requested power state per nid */
286 unsigned int (*power_filter)(struct hda_codec *codec, hda_nid_t nid,
287 unsigned int power_state);
288
daead538
TI
289 /* codec-specific additional proc output */
290 void (*proc_widget_hook)(struct snd_info_buffer *buffer,
291 struct hda_codec *codec, hda_nid_t nid);
cd372fb3 292
1835a0f9
TI
293 /* jack detection */
294 struct snd_array jacktbl;
26a6cb6c
DH
295 unsigned long jackpoll_interval; /* In jiffies. Zero means no poll, rely on unsol events */
296 struct delayed_work jackpoll_work;
1835a0f9 297
cd372fb3
TI
298#ifdef CONFIG_SND_HDA_INPUT_JACK
299 /* jack detection */
300 struct snd_array jacks;
301#endif
c9ce6b26 302
7f132927
ML
303 int depop_delay; /* depop delay in ms, -1 for default delay time */
304
c9ce6b26
TI
305 /* fix-up list */
306 int fixup_id;
307 const struct hda_fixup *fixup_list;
308 const char *fixup_name;
309
310 /* additional init verbs */
311 struct snd_array verbs;
1da177e4
LT
312};
313
e3d280fc
TI
314#define dev_to_hda_codec(_dev) container_of(_dev, struct hda_codec, core.dev)
315#define hda_codec_dev(_dev) (&(_dev)->core.dev)
d8a766a1 316
d068ebc2
TI
317#define list_for_each_codec(c, bus) \
318 list_for_each_entry(c, &(bus)->core.codec_list, core.list)
319
63e51fd7
TI
320/* snd_hda_codec_read/write optional flags */
321#define HDA_RW_NO_RESPONSE_FALLBACK (1 << 0)
1da177e4
LT
322
323/*
324 * constructors
325 */
7e8be1b3
TI
326int snd_hda_bus_new(struct snd_card *card,
327 const struct hdac_bus_ops *ops,
a43ff5ba 328 const struct hdac_io_ops *io_ops,
7e8be1b3 329 struct hda_bus **busp);
6efdd851
TI
330int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,
331 unsigned int codec_addr, struct hda_codec **codecp);
a1e21c90 332int snd_hda_codec_configure(struct hda_codec *codec);
a15d05db 333int snd_hda_codec_update_widgets(struct hda_codec *codec);
1da177e4
LT
334
335/*
336 * low level functions
337 */
d01ce99f 338unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid,
e7ecc27e 339 int flags,
1da177e4 340 unsigned int verb, unsigned int parm);
e7ecc27e 341int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int flags,
1da177e4 342 unsigned int verb, unsigned int parm);
d01ce99f 343#define snd_hda_param_read(codec, nid, param) \
01ed3c06 344 snd_hdac_read_parm(&(codec)->core, nid, param)
7639a06c
TI
345#define snd_hda_get_sub_nodes(codec, nid, start_nid) \
346 snd_hdac_get_sub_nodes(&(codec)->core, nid, start_nid)
d01ce99f
TI
347int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
348 hda_nid_t *conn_list, int max_conns);
09cf03b8
TI
349static inline int
350snd_hda_get_num_conns(struct hda_codec *codec, hda_nid_t nid)
351{
352 return snd_hda_get_connections(codec, nid, NULL, 0);
353}
7639a06c
TI
354
355#define snd_hda_get_raw_connections(codec, nid, list, max_conns) \
356 snd_hdac_get_connections(&(codec)->core, nid, list, max_conns)
357#define snd_hda_get_num_raw_conns(codec, nid) \
358 snd_hdac_get_connections(&(codec)->core, nid, NULL, 0);
359
ee8e765b
TI
360int snd_hda_get_conn_list(struct hda_codec *codec, hda_nid_t nid,
361 const hda_nid_t **listp);
b2f934a0
TI
362int snd_hda_override_conn_list(struct hda_codec *codec, hda_nid_t nid, int nums,
363 const hda_nid_t *list);
8d087c76
TI
364int snd_hda_get_conn_index(struct hda_codec *codec, hda_nid_t mux,
365 hda_nid_t nid, int recursive);
f1aa0684
ML
366int snd_hda_get_devices(struct hda_codec *codec, hda_nid_t nid,
367 u8 *dev_list, int max_devices);
1da177e4
LT
368
369struct hda_verb {
370 hda_nid_t nid;
371 u32 verb;
372 u32 param;
373};
374
d01ce99f
TI
375void snd_hda_sequence_write(struct hda_codec *codec,
376 const struct hda_verb *seq);
1da177e4
LT
377
378/* unsolicited event */
d068ebc2
TI
379static inline void
380snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex)
381{
382 snd_hdac_bus_queue_event(&bus->core, res, res_ex);
383}
1da177e4 384
b3ac5636 385/* cached write */
a551d914
TI
386static inline int
387snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
388 int flags, unsigned int verb, unsigned int parm)
389{
390 return snd_hdac_regmap_write(&codec->core, nid, verb, parm);
391}
392
393#define snd_hda_codec_update_cache(codec, nid, flags, verb, parm) \
394 snd_hda_codec_write_cache(codec, nid, flags, verb, parm)
0c3d47b0 395
3be14149
TI
396/* the struct for codec->pin_configs */
397struct hda_pincfg {
398 hda_nid_t nid;
d7fdc00a
TI
399 unsigned char ctrl; /* original pin control value */
400 unsigned char target; /* target pin control value */
ac0547dc 401 unsigned int cfg; /* default configuration */
3be14149
TI
402};
403
404unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid);
405int snd_hda_codec_set_pincfg(struct hda_codec *codec, hda_nid_t nid,
406 unsigned int cfg);
407int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list,
408 hda_nid_t nid, unsigned int cfg); /* for hwdep */
92ee6162 409void snd_hda_shutup_pins(struct hda_codec *codec);
3be14149 410
7c935976
SW
411/* SPDIF controls */
412struct hda_spdif_out {
413 hda_nid_t nid; /* Converter nid values relate to */
414 unsigned int status; /* IEC958 status bits */
415 unsigned short ctls; /* SPDIF control bits */
416};
417struct hda_spdif_out *snd_hda_spdif_out_of_nid(struct hda_codec *codec,
418 hda_nid_t nid);
74b654c9
SW
419void snd_hda_spdif_ctls_unassign(struct hda_codec *codec, int idx);
420void snd_hda_spdif_ctls_assign(struct hda_codec *codec, int idx, hda_nid_t nid);
7c935976 421
1da177e4
LT
422/*
423 * Mixer
424 */
6c1f45ea 425int snd_hda_codec_build_controls(struct hda_codec *codec);
1da177e4
LT
426
427/*
428 * PCM
429 */
1a4ba30c 430int snd_hda_codec_parse_pcms(struct hda_codec *codec);
529bd6c4 431int snd_hda_codec_build_pcms(struct hda_codec *codec);
eb541337 432
bbbc7e85
TI
433__printf(2, 3)
434struct hda_pcm *snd_hda_codec_pcm_new(struct hda_codec *codec,
435 const char *fmt, ...);
436
437static inline void snd_hda_codec_pcm_get(struct hda_pcm *pcm)
438{
439 kref_get(&pcm->kref);
440}
441void snd_hda_codec_pcm_put(struct hda_pcm *pcm);
442
eb541337
TI
443int snd_hda_codec_prepare(struct hda_codec *codec,
444 struct hda_pcm_stream *hinfo,
445 unsigned int stream,
446 unsigned int format,
447 struct snd_pcm_substream *substream);
448void snd_hda_codec_cleanup(struct hda_codec *codec,
449 struct hda_pcm_stream *hinfo,
450 struct snd_pcm_substream *substream);
451
d01ce99f
TI
452void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid,
453 u32 stream_tag,
1da177e4 454 int channel_id, int format);
f0cea797
TI
455void __snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid,
456 int do_now);
457#define snd_hda_codec_cleanup_stream(codec, nid) \
458 __snd_hda_codec_cleanup_stream(codec, nid, 0)
b7d023e1
TI
459
460#define snd_hda_query_supported_pcm(codec, nid, ratesp, fmtsp, bpsp) \
461 snd_hdac_query_supported_pcm(&(codec)->core, nid, ratesp, fmtsp, bpsp)
462#define snd_hda_is_supported_format(codec, nid, fmt) \
463 snd_hdac_is_supported_format(&(codec)->core, nid, fmt)
1da177e4 464
ee81abb6
TI
465extern const struct snd_pcm_chmap_elem snd_pcm_2_1_chmaps[];
466
1da177e4
LT
467/*
468 * Misc
469 */
470void snd_hda_get_codec_name(struct hda_codec *codec, char *name, int namelen);
4d7fbdbc 471void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg,
9419ab6b 472 unsigned int power_state);
1da177e4 473
d3d020bd
TI
474int snd_hda_lock_devices(struct hda_bus *bus);
475void snd_hda_unlock_devices(struct hda_bus *bus);
59ed1ead 476void snd_hda_bus_reset(struct hda_bus *bus);
d3d020bd 477
1da177e4
LT
478/*
479 * power management
480 */
59ed1ead 481extern const struct dev_pm_ops hda_codec_driver_pm;
1da177e4 482
9e5341b9
TI
483static inline
484int hda_call_check_power_status(struct hda_codec *codec, hda_nid_t nid)
485{
83012a7c 486#ifdef CONFIG_PM
9e5341b9
TI
487 if (codec->patch_ops.check_power_status)
488 return codec->patch_ops.check_power_status(codec, nid);
ff2b7e2a 489#endif
9e5341b9
TI
490 return 0;
491}
9e5341b9 492
50a9f790
MR
493/*
494 * get widget information
495 */
496const char *snd_hda_get_jack_connectivity(u32 cfg);
497const char *snd_hda_get_jack_type(u32 cfg);
498const char *snd_hda_get_jack_location(u32 cfg);
499
cb53c626
TI
500/*
501 * power saving
502 */
7639a06c 503#define snd_hda_power_up(codec) snd_hdac_power_up(&(codec)->core)
664c7155 504#define snd_hda_power_up_pm(codec) snd_hdac_power_up_pm(&(codec)->core)
7639a06c 505#define snd_hda_power_down(codec) snd_hdac_power_down(&(codec)->core)
664c7155 506#define snd_hda_power_down_pm(codec) snd_hdac_power_down_pm(&(codec)->core)
83012a7c 507#ifdef CONFIG_PM
bb573928 508void snd_hda_set_power_save(struct hda_bus *bus, int delay);
a2f6309e 509void snd_hda_update_power_acct(struct hda_codec *codec);
cb53c626 510#else
bb573928 511static inline void snd_hda_set_power_save(struct hda_bus *bus, int delay) {}
cb53c626
TI
512#endif
513
4ea6fbc8
TI
514#ifdef CONFIG_SND_HDA_PATCH_LOADER
515/*
516 * patch firmware
517 */
4918cdab 518int snd_hda_load_patch(struct hda_bus *bus, size_t size, const void *buf);
4ea6fbc8
TI
519#endif
520
1d1a4564
TI
521#ifdef CONFIG_SND_HDA_DSP_LOADER
522static inline int
523snd_hda_codec_load_dsp_prepare(struct hda_codec *codec, unsigned int format,
524 unsigned int size,
525 struct snd_dma_buffer *bufp)
526{
527 return codec->bus->ops.load_dsp_prepare(codec->bus, format, size, bufp);
528}
529static inline void
530snd_hda_codec_load_dsp_trigger(struct hda_codec *codec, bool start)
531{
532 return codec->bus->ops.load_dsp_trigger(codec->bus, start);
533}
534static inline void
535snd_hda_codec_load_dsp_cleanup(struct hda_codec *codec,
536 struct snd_dma_buffer *dmab)
537{
538 return codec->bus->ops.load_dsp_cleanup(codec->bus, dmab);
539}
540#else
541static inline int
542snd_hda_codec_load_dsp_prepare(struct hda_codec *codec, unsigned int format,
543 unsigned int size,
544 struct snd_dma_buffer *bufp)
545{
a3af4807 546 return -ENOSYS;
1d1a4564
TI
547}
548static inline void
549snd_hda_codec_load_dsp_trigger(struct hda_codec *codec, bool start) {}
550static inline void
551snd_hda_codec_load_dsp_cleanup(struct hda_codec *codec,
552 struct snd_dma_buffer *dmab) {}
553#endif
554
1da177e4 555#endif /* __SOUND_HDA_CODEC_H */
This page took 0.568843 seconds and 5 git commands to generate.