Blame view

sound/x86/intel_hdmi_audio.h 4.44 KB
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  /*
   * Copyright (C) 2016 Intel Corporation
   *  Authors:	Sailaja Bandarupalli <sailaja.bandarupalli@intel.com>
   *		Ramesh Babu K V	<ramesh.babu@intel.com>
   *		Vaibhav Agarwal <vaibhav.agarwal@intel.com>
   *		Jerome Anand <jerome.anand@intel.com>
   *
   * Permission is hereby granted, free of charge, to any person obtaining
   * a copy of this software and associated documentation files
   * (the "Software"), to deal in the Software without restriction,
   * including without limitation the rights to use, copy, modify, merge,
   * publish, distribute, sublicense, and/or sell copies of the Software,
   * and to permit persons to whom the Software is furnished to do so,
   * subject to the following conditions:
   *
   * The above copyright notice and this permission notice (including the
   * next paragraph) shall be included in all copies or substantial
   * portions of the Software.
   *
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
   * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
   * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
   * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   * SOFTWARE.
   */
  
  #ifndef _INTEL_HDMI_AUDIO_H_
  #define _INTEL_HDMI_AUDIO_H_
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
32
  #include "intel_hdmi_lpe_audio.h"
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
33
34
  #define MAX_PB_STREAMS		1
  #define MAX_CAP_STREAMS		0
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
35
  #define BYTES_PER_WORD		0x4
77531beeb   Takashi Iwai   ALSA: x86: Rearra...
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  #define INTEL_HAD		"HdmiLpeAudio"
  
  /*
   *	CEA speaker placement:
   *
   *	FL  FLC   FC   FRC   FR
   *
   *						LFE
   *
   *	RL  RLC   RC   RRC   RR
   *
   *	The Left/Right Surround channel _notions_ LS/RS in SMPTE 320M
   *	corresponds to CEA RL/RR; The SMPTE channel _assignment_ C/LFE is
   *	swapped to CEA LFE/FC.
   */
  enum cea_speaker_placement {
  	FL  = (1 <<  0),        /* Front Left           */
  	FC  = (1 <<  1),        /* Front Center         */
  	FR  = (1 <<  2),        /* Front Right          */
  	FLC = (1 <<  3),        /* Front Left Center    */
  	FRC = (1 <<  4),        /* Front Right Center   */
  	RL  = (1 <<  5),        /* Rear Left            */
  	RC  = (1 <<  6),        /* Rear Center          */
  	RR  = (1 <<  7),        /* Rear Right           */
  	RLC = (1 <<  8),        /* Rear Left Center     */
  	RRC = (1 <<  9),        /* Rear Right Center    */
  	LFE = (1 << 10),        /* Low Frequency Effect */
  };
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
64

77531beeb   Takashi Iwai   ALSA: x86: Rearra...
65
66
67
  struct cea_channel_speaker_allocation {
  	int ca_index;
  	int speakers[8];
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
68

77531beeb   Takashi Iwai   ALSA: x86: Rearra...
69
70
71
72
73
74
75
76
77
78
  	/* derived values, just for convenience */
  	int channels;
  	int spk_mask;
  };
  
  struct channel_map_table {
  	unsigned char map;              /* ALSA API channel map position */
  	unsigned char cea_slot;         /* CEA slot value */
  	int spk_mask;                   /* speaker position bit mask */
  };
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
79
80
  
  struct pcm_stream_info {
313d9f28c   Takashi Iwai   ALSA: x86: Proper...
81
  	struct snd_pcm_substream *substream;
313d9f28c   Takashi Iwai   ALSA: x86: Proper...
82
  	int substream_refcount;
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
83
  };
03c343775   Takashi Iwai   ALSA: x86: Clean ...
84
  /*
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
85
86
87
   * struct snd_intelhad - intelhad driver structure
   *
   * @card: ptr to hold card details
91b0cb0cc   Takashi Iwai   ALSA: x86: Rename...
88
   * @connected: the monitor connection status
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
89
   * @stream_info: stream information
da8648097   Takashi Iwai   ALSA: x86: Flatte...
90
   * @eld: holds ELD info
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
91
92
93
94
95
96
   * @curr_buf: pointer to hold current active ring buf
   * @valid_buf_cnt: ring buffer count for stream
   * @had_spinlock: driver lock
   * @aes_bits: IEC958 status bits
   * @buff_done: id of current buffer done intr
   * @dev: platoform device handle
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
97
   * @chmap: holds channel map info
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
98
99
   */
  struct snd_intelhad {
b4eb0d522   Ville Syrjälä   ALSA: x86: Split ...
100
  	struct snd_intelhad_card *card_ctx;
91b0cb0cc   Takashi Iwai   ALSA: x86: Rename...
101
  	bool		connected;
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
102
  	struct		pcm_stream_info stream_info;
df0435db1   Takashi Iwai   ALSA: x86: Use th...
103
  	unsigned char	eld[HDMI_MAX_ELD_BYTES];
964ca8083   Pierre-Louis Bossart   ALSA: x86: intel_...
104
  	bool dp_output;
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
105
  	unsigned int	aes_bits;
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
106
  	spinlock_t had_spinlock;
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
107
  	struct device *dev;
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
108
  	struct snd_pcm_chmap *chmap;
da8648097   Takashi Iwai   ALSA: x86: Flatte...
109
110
  	int tmds_clock_speed;
  	int link_rate;
8a2d6ae1f   Ville Syrjälä   ALSA: x86: Regist...
111
112
  	int port; /* fixed */
  	int pipe; /* can change dynamically */
da8648097   Takashi Iwai   ALSA: x86: Flatte...
113

e1b239f37   Takashi Iwai   ALSA: x86: Refact...
114
115
116
117
118
119
120
121
  	/* 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 */
da8648097   Takashi Iwai   ALSA: x86: Flatte...
122
  	/* internal stuff */
40ce4b5d7   Takashi Iwai   ALSA: x86: Cache ...
123
  	union aud_cfg aud_config;	/* AUD_CONFIG reg value cache */
da8648097   Takashi Iwai   ALSA: x86: Flatte...
124
  	struct work_struct hdmi_audio_wq;
0e9c67d7c   Takashi Iwai   ALSA: x86: Drop s...
125
  	struct mutex mutex; /* for protecting chmap and eld */
e2acecf2c   Takashi Iwai   ALSA: x86: Handle...
126
  	bool need_reset;
b9bacf275   Takashi Iwai   ALSA: x86: Implem...
127
  	struct snd_jack *jack;
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
128
  };
b4eb0d522   Ville Syrjälä   ALSA: x86: Split ...
129
130
131
132
133
134
135
  struct snd_intelhad_card {
  	struct snd_card	*card;
  	struct device *dev;
  
  	/* internal stuff */
  	int irq;
  	void __iomem *mmio_start;
8a2d6ae1f   Ville Syrjälä   ALSA: x86: Regist...
136
  	int num_pipes;
b4eb0d522   Ville Syrjälä   ALSA: x86: Split ...
137
  	int num_ports;
8a2d6ae1f   Ville Syrjälä   ALSA: x86: Regist...
138
  	struct snd_intelhad pcm_ctx[3]; /* one for each port */
b4eb0d522   Ville Syrjälä   ALSA: x86: Split ...
139
  };
5dab11d89   Jerome Anand   ALSA: x86: hdmi: ...
140
  #endif /* _INTEL_HDMI_AUDIO_ */