]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - sound/x86/intel_hdmi_audio.h
Merge tag 'openrisc-for-linus' of git://github.com/openrisc/linux
[mirror_ubuntu-artful-kernel.git] / sound / x86 / intel_hdmi_audio.h
CommitLineData
5dab11d8
JA
1/*
2 * Copyright (C) 2016 Intel Corporation
3 * Authors: Sailaja Bandarupalli <sailaja.bandarupalli@intel.com>
4 * Ramesh Babu K V <ramesh.babu@intel.com>
5 * Vaibhav Agarwal <vaibhav.agarwal@intel.com>
6 * Jerome Anand <jerome.anand@intel.com>
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files
10 * (the "Software"), to deal in the Software without restriction,
11 * including without limitation the rights to use, copy, modify, merge,
12 * publish, distribute, sublicense, and/or sell copies of the Software,
13 * and to permit persons to whom the Software is furnished to do so,
14 * subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial
18 * portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
24 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * SOFTWARE.
28 */
29
30#ifndef _INTEL_HDMI_AUDIO_H_
31#define _INTEL_HDMI_AUDIO_H_
32
5dab11d8
JA
33#include "intel_hdmi_lpe_audio.h"
34
35#define PCM_INDEX 0
36#define MAX_PB_STREAMS 1
37#define MAX_CAP_STREAMS 0
5dab11d8 38#define BYTES_PER_WORD 0x4
77531bee
TI
39#define INTEL_HAD "HdmiLpeAudio"
40
41/*
42 * CEA speaker placement:
43 *
44 * FL FLC FC FRC FR
45 *
46 * LFE
47 *
48 * RL RLC RC RRC RR
49 *
50 * The Left/Right Surround channel _notions_ LS/RS in SMPTE 320M
51 * corresponds to CEA RL/RR; The SMPTE channel _assignment_ C/LFE is
52 * swapped to CEA LFE/FC.
53 */
54enum cea_speaker_placement {
55 FL = (1 << 0), /* Front Left */
56 FC = (1 << 1), /* Front Center */
57 FR = (1 << 2), /* Front Right */
58 FLC = (1 << 3), /* Front Left Center */
59 FRC = (1 << 4), /* Front Right Center */
60 RL = (1 << 5), /* Rear Left */
61 RC = (1 << 6), /* Rear Center */
62 RR = (1 << 7), /* Rear Right */
63 RLC = (1 << 8), /* Rear Left Center */
64 RRC = (1 << 9), /* Rear Right Center */
65 LFE = (1 << 10), /* Low Frequency Effect */
66};
5dab11d8 67
77531bee
TI
68struct cea_channel_speaker_allocation {
69 int ca_index;
70 int speakers[8];
5dab11d8 71
77531bee
TI
72 /* derived values, just for convenience */
73 int channels;
74 int spk_mask;
75};
76
77struct channel_map_table {
78 unsigned char map; /* ALSA API channel map position */
79 unsigned char cea_slot; /* CEA slot value */
80 int spk_mask; /* speaker position bit mask */
81};
5dab11d8
JA
82
83struct pcm_stream_info {
313d9f28 84 struct snd_pcm_substream *substream;
313d9f28 85 int substream_refcount;
5dab11d8
JA
86};
87
03c34377 88/*
5dab11d8
JA
89 * struct snd_intelhad - intelhad driver structure
90 *
91 * @card: ptr to hold card details
91b0cb0c 92 * @connected: the monitor connection status
5dab11d8 93 * @stream_info: stream information
da864809 94 * @eld: holds ELD info
5dab11d8
JA
95 * @curr_buf: pointer to hold current active ring buf
96 * @valid_buf_cnt: ring buffer count for stream
97 * @had_spinlock: driver lock
98 * @aes_bits: IEC958 status bits
99 * @buff_done: id of current buffer done intr
100 * @dev: platoform device handle
5dab11d8 101 * @chmap: holds channel map info
5dab11d8
JA
102 */
103struct snd_intelhad {
104 struct snd_card *card;
91b0cb0c 105 bool connected;
5dab11d8 106 struct pcm_stream_info stream_info;
df0435db 107 unsigned char eld[HDMI_MAX_ELD_BYTES];
964ca808 108 bool dp_output;
5dab11d8 109 unsigned int aes_bits;
5dab11d8 110 spinlock_t had_spinlock;
5dab11d8 111 struct device *dev;
5dab11d8 112 struct snd_pcm_chmap *chmap;
da864809
TI
113 int tmds_clock_speed;
114 int link_rate;
115
e1b239f3
TI
116 /* ring buffer (BD) position index */
117 unsigned int bd_head;
118 /* PCM buffer position indices */
119 unsigned int pcmbuf_head; /* being processed */
120 unsigned int pcmbuf_filled; /* to be filled */
121
122 unsigned int num_bds; /* number of BDs */
123 unsigned int period_bytes; /* PCM period size in bytes */
124
da864809
TI
125 /* internal stuff */
126 int irq;
127 void __iomem *mmio_start;
128 unsigned int had_config_offset;
40ce4b5d 129 union aud_cfg aud_config; /* AUD_CONFIG reg value cache */
da864809 130 struct work_struct hdmi_audio_wq;
0e9c67d7 131 struct mutex mutex; /* for protecting chmap and eld */
e2acecf2 132 bool need_reset;
b9bacf27 133 struct snd_jack *jack;
5dab11d8
JA
134};
135
5dab11d8 136#endif /* _INTEL_HDMI_AUDIO_ */