summaryrefslogtreecommitdiffstats
path: root/sound/x86/intel_hdmi_audio.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-02-03 00:01:18 +0100
committerTakashi Iwai <tiwai@suse.de>2017-02-06 12:21:10 +0100
commite1b239f371c0c745542cb8108d085ec728e8a69c (patch)
tree5b79452798a340db7c2aabded15f4edf92465c80 /sound/x86/intel_hdmi_audio.h
parentALSA: pcm: Define dummy snd_pcm_suspend() for CONFIG_PM=n (diff)
downloadlinux-e1b239f371c0c745542cb8108d085ec728e8a69c.tar.xz
linux-e1b239f371c0c745542cb8108d085ec728e8a69c.zip
ALSA: x86: Refactor PCM process engine
This is again a big rewrite of the driver; now it touches the code to process PCM stream transfers. The most fundamental change is that the driver may support more than four periods. Instead of keeping the same index between both the ring buffer (with the fixed four buffer descriptors) and the PCM buffer periods, we keep difference indices for both (bd_head and pcm_head fields). In addition, when the periods are more than four, we need to track both head and next indices. That is, we now have three indices: bd_head, pcm_head and pcm_filled. Also, the driver works better for periods < 4, too: the remaining BDs out of four are marked as invalid, so that the hardware skips those BDs in its loop. By this flexibility, we can use even ALSA-lib dmix plugin, which requires 16 periods as default. The buffer size could be up to 20bit, so the max buffer size was increased accordingly. However, the buffer pre-allocation is kept as the old value (600kB) as default. The reason is the limited number of BDs: since it doesn't suffice for the useful SG page management that can fit with the usual page allocator like some other drivers, we have to still allocate continuous pages, hence we shouldn't take too big memories there. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/x86/intel_hdmi_audio.h')
-rw-r--r--sound/x86/intel_hdmi_audio.h24
1 files changed, 9 insertions, 15 deletions
diff --git a/sound/x86/intel_hdmi_audio.h b/sound/x86/intel_hdmi_audio.h
index 9f713a8a88bc..7e2546b853ca 100644
--- a/sound/x86/intel_hdmi_audio.h
+++ b/sound/x86/intel_hdmi_audio.h
@@ -64,24 +64,15 @@
struct pcm_stream_info {
struct snd_pcm_substream *substream;
- u64 buffer_rendered;
- u32 ring_buf_size;
int substream_refcount;
bool running;
};
-struct ring_buf_info {
- u32 buf_addr;
- u32 buf_size;
- u8 is_valid;
-};
-
/*
* struct snd_intelhad - intelhad driver structure
*
* @card: ptr to hold card details
* @connected: the monitor connection status
- * @buf_info: ring buffer info
* @stream_info: stream information
* @eld: holds ELD info
* @curr_buf: pointer to hold current active ring buf
@@ -91,26 +82,29 @@ struct ring_buf_info {
* @buff_done: id of current buffer done intr
* @dev: platoform device handle
* @chmap: holds channel map info
- * @underrun_count: PCM stream underrun counter
*/
struct snd_intelhad {
struct snd_card *card;
bool connected;
- struct ring_buf_info buf_info[HAD_NUM_OF_RING_BUFS];
struct pcm_stream_info stream_info;
unsigned char eld[HDMI_MAX_ELD_BYTES];
bool dp_output;
- enum intel_had_aud_buf_type curr_buf;
- int valid_buf_cnt;
unsigned int aes_bits;
spinlock_t had_spinlock;
- enum intel_had_aud_buf_type buff_done;
struct device *dev;
struct snd_pcm_chmap *chmap;
- int underrun_count;
int tmds_clock_speed;
int link_rate;
+ /* ring buffer (BD) position index */
+ unsigned int bd_head;
+ /* PCM buffer position indices */
+ unsigned int pcmbuf_head; /* being processed */
+ unsigned int pcmbuf_filled; /* to be filled */
+
+ unsigned int num_bds; /* number of BDs */
+ unsigned int period_bytes; /* PCM period size in bytes */
+
/* internal stuff */
int irq;
void __iomem *mmio_start;