diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-04-14 06:53:28 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-04-16 01:28:27 -0400 |
commit | 8f3f600b52b100f254fc16a60af1261d2e4dc239 (patch) | |
tree | 5844bdbf91e4da1bb135469e29f7740559c33a27 /include/sound | |
parent | 14752412721c61d9ac1e8d8fb51d7148cb15f85b (diff) |
ALSA: hda - Add DSP loader to core library code
Copied from the legacy driver code, no transition done yet.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/hdaudio.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h index 9349ccf15a36..69f27bc49eb4 100644 --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h | |||
@@ -187,6 +187,11 @@ struct hdac_io_ops { | |||
187 | u16 (*reg_readw)(u16 __iomem *addr); | 187 | u16 (*reg_readw)(u16 __iomem *addr); |
188 | void (*reg_writeb)(u8 value, u8 __iomem *addr); | 188 | void (*reg_writeb)(u8 value, u8 __iomem *addr); |
189 | u8 (*reg_readb)(u8 __iomem *addr); | 189 | u8 (*reg_readb)(u8 __iomem *addr); |
190 | /* Allocation ops */ | ||
191 | int (*dma_alloc_pages)(struct hdac_bus *bus, int type, size_t size, | ||
192 | struct snd_dma_buffer *buf); | ||
193 | void (*dma_free_pages)(struct hdac_bus *bus, | ||
194 | struct snd_dma_buffer *buf); | ||
190 | }; | 195 | }; |
191 | 196 | ||
192 | #define HDA_UNSOL_QUEUE_SIZE 64 | 197 | #define HDA_UNSOL_QUEUE_SIZE 64 |
@@ -374,6 +379,7 @@ struct hdac_stream { | |||
374 | bool opened:1; | 379 | bool opened:1; |
375 | bool running:1; | 380 | bool running:1; |
376 | bool no_period_wakeup:1; | 381 | bool no_period_wakeup:1; |
382 | bool locked:1; | ||
377 | 383 | ||
378 | /* timestamp */ | 384 | /* timestamp */ |
379 | unsigned long start_wallclk; /* start + minimum wallclk */ | 385 | unsigned long start_wallclk; /* start + minimum wallclk */ |
@@ -383,6 +389,10 @@ struct hdac_stream { | |||
383 | int delay_negative_threshold; | 389 | int delay_negative_threshold; |
384 | 390 | ||
385 | struct list_head list; | 391 | struct list_head list; |
392 | #ifdef CONFIG_SND_HDA_DSP_LOADER | ||
393 | /* DSP access mutex */ | ||
394 | struct mutex dsp_mutex; | ||
395 | #endif | ||
386 | }; | 396 | }; |
387 | 397 | ||
388 | void snd_hdac_stream_init(struct hdac_bus *bus, struct hdac_stream *azx_dev, | 398 | void snd_hdac_stream_init(struct hdac_bus *bus, struct hdac_stream *azx_dev, |
@@ -440,6 +450,42 @@ void snd_hdac_stream_timecounter_init(struct hdac_stream *azx_dev, | |||
440 | (snd_hdac_stream_readb(dev, reg) & \ | 450 | (snd_hdac_stream_readb(dev, reg) & \ |
441 | ~(mask)) | (val)) | 451 | ~(mask)) | (val)) |
442 | 452 | ||
453 | #ifdef CONFIG_SND_HDA_DSP_LOADER | ||
454 | /* DSP lock helpers */ | ||
455 | #define snd_hdac_dsp_lock_init(dev) mutex_init(&(dev)->dsp_mutex) | ||
456 | #define snd_hdac_dsp_lock(dev) mutex_lock(&(dev)->dsp_mutex) | ||
457 | #define snd_hdac_dsp_unlock(dev) mutex_unlock(&(dev)->dsp_mutex) | ||
458 | #define snd_hdac_stream_is_locked(dev) ((dev)->locked) | ||
459 | /* DSP loader helpers */ | ||
460 | int snd_hdac_dsp_prepare(struct hdac_stream *azx_dev, unsigned int format, | ||
461 | unsigned int byte_size, struct snd_dma_buffer *bufp); | ||
462 | void snd_hdac_dsp_trigger(struct hdac_stream *azx_dev, bool start); | ||
463 | void snd_hdac_dsp_cleanup(struct hdac_stream *azx_dev, | ||
464 | struct snd_dma_buffer *dmab); | ||
465 | #else /* CONFIG_SND_HDA_DSP_LOADER */ | ||
466 | #define snd_hdac_dsp_lock_init(dev) do {} while (0) | ||
467 | #define snd_hdac_dsp_lock(dev) do {} while (0) | ||
468 | #define snd_hdac_dsp_unlock(dev) do {} while (0) | ||
469 | #define snd_hdac_stream_is_locked(dev) 0 | ||
470 | |||
471 | static inline int | ||
472 | snd_hdac_dsp_prepare(struct hdac_stream *azx_dev, unsigned int format, | ||
473 | unsigned int byte_size, struct snd_dma_buffer *bufp) | ||
474 | { | ||
475 | return 0; | ||
476 | } | ||
477 | |||
478 | static inline void snd_hdac_dsp_trigger(struct hdac_stream *azx_dev, bool start) | ||
479 | { | ||
480 | } | ||
481 | |||
482 | static inline void snd_hdac_dsp_cleanup(struct hdac_stream *azx_dev, | ||
483 | struct snd_dma_buffer *dmab) | ||
484 | { | ||
485 | } | ||
486 | #endif /* CONFIG_SND_HDA_DSP_LOADER */ | ||
487 | |||
488 | |||
443 | /* | 489 | /* |
444 | * generic array helpers | 490 | * generic array helpers |
445 | */ | 491 | */ |