Dylan Reid | 05e8487 | 2014-02-28 15:41:22 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Common functionality for the alsa driver code base for HD Audio. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it |
| 5 | * under the terms of the GNU General Public License as published by the Free |
| 6 | * Software Foundation; either version 2 of the License, or (at your option) |
| 7 | * any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 12 | * more details. |
| 13 | */ |
| 14 | |
| 15 | #ifndef __SOUND_HDA_CONTROLLER_H |
| 16 | #define __SOUND_HDA_CONTROLLER_H |
| 17 | |
| 18 | #include <sound/core.h> |
| 19 | #include <sound/initval.h> |
| 20 | #include "hda_codec.h" |
| 21 | #include "hda_priv.h" |
| 22 | |
| 23 | /* PCM setup */ |
| 24 | int azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, |
| 25 | struct hda_pcm *cpcm); |
| 26 | static inline struct azx_dev *get_azx_dev(struct snd_pcm_substream *substream) |
| 27 | { |
| 28 | return substream->runtime->private_data; |
| 29 | } |
| 30 | unsigned int azx_get_position(struct azx *chip, |
| 31 | struct azx_dev *azx_dev, |
| 32 | bool with_check); |
| 33 | |
| 34 | /* Stream control. */ |
Dylan Reid | 05e8487 | 2014-02-28 15:41:22 -0800 | [diff] [blame] | 35 | void azx_stream_stop(struct azx *chip, struct azx_dev *azx_dev); |
Dylan Reid | 05e8487 | 2014-02-28 15:41:22 -0800 | [diff] [blame] | 36 | |
Dylan Reid | 05e8487 | 2014-02-28 15:41:22 -0800 | [diff] [blame] | 37 | #ifdef CONFIG_SND_HDA_DSP_LOADER |
Dylan Reid | 2b5fd6c | 2014-02-28 15:41:24 -0800 | [diff] [blame] | 38 | int azx_load_dsp_prepare(struct hda_bus *bus, unsigned int format, |
| 39 | unsigned int byte_size, |
| 40 | struct snd_dma_buffer *bufp); |
| 41 | void azx_load_dsp_trigger(struct hda_bus *bus, bool start); |
| 42 | void azx_load_dsp_cleanup(struct hda_bus *bus, |
| 43 | struct snd_dma_buffer *dmab); |
Dylan Reid | 05e8487 | 2014-02-28 15:41:22 -0800 | [diff] [blame] | 44 | #endif |
| 45 | |
Dylan Reid | 6790899 | 2014-02-28 15:41:23 -0800 | [diff] [blame] | 46 | /* Allocation functions. */ |
| 47 | int azx_alloc_stream_pages(struct azx *chip); |
| 48 | void azx_free_stream_pages(struct azx *chip); |
| 49 | |
Dylan Reid | 6e85ddd | 2014-02-28 15:41:25 -0800 | [diff] [blame] | 50 | /* |
| 51 | * CORB / RIRB interface |
| 52 | */ |
Dylan Reid | 6e85ddd | 2014-02-28 15:41:25 -0800 | [diff] [blame] | 53 | void azx_init_cmd_io(struct azx *chip); |
| 54 | void azx_free_cmd_io(struct azx *chip); |
| 55 | void azx_update_rirb(struct azx *chip); |
| 56 | int azx_send_cmd(struct hda_bus *bus, unsigned int val); |
| 57 | unsigned int azx_get_response(struct hda_bus *bus, |
| 58 | unsigned int addr); |
| 59 | |
Dylan Reid | 05e8487 | 2014-02-28 15:41:22 -0800 | [diff] [blame] | 60 | #endif /* __SOUND_HDA_CONTROLLER_H */ |