2 * intelmid.h - Intel Sound card driver for MID
4 * Copyright (C) 2008-10 Intel Corp
5 * Authors: Harsha Priya <priya.harsha@intel.com>
6 * Vinod Koul <vinod.koul@intel.com>
7 * Dharageswari R <dharageswari.r@intel.com>
8 * KP Jeeja <jeeja.kp@intel.com>
9 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation version 2 of the License.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
24 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 * ALSA driver header for Intel MAD chipset
30 #include <linux/time.h>
32 #define DRIVER_NAME_MFLD "msic_audio"
33 #define DRIVER_NAME_MRST "pmic_audio"
34 #define DRIVER_NAME "intelmid_audio"
35 #define PMIC_SOUND_IRQ_TYPE_MASK (1 << 15)
36 #define AUDINT_BASE (0xFFFFEFF8 + (6 * sizeof(u8)))
39 /* will differ for different hw - to be taken from config */
42 #define MAX_RATE 48000
43 #define MAX_BUFFER (800*1024) /* for PCM */
44 #define MIN_BUFFER (800*1024)
45 #define MAX_PERIODS (1024*2)
47 #define MAX_PERIOD_BYTES MAX_BUFFER
48 #define MIN_PERIOD_BYTES 32
49 /*#define MIN_PERIOD_BYTES 160*/
55 #define MAX_CHANNEL_AMIC 2
56 #define MAX_CHANNEL_DMIC 4
57 #define FIFO_SIZE 0 /* fifo not being used */
58 #define INTEL_MAD "Intel MAD"
59 #define MAX_CTRL_MRST 7
60 #define MAX_CTRL_MFLD 2
67 #define PLAYBACK_COUNT 1
68 #define CAPTURE_COUNT 1
70 extern int sst_card_vendor_id;
75 struct timeval buttonpressed;
76 struct timeval buttonreleased;
79 struct mad_jack_msg_wq {
81 struct snd_intelmad *intelmaddata;
82 struct work_struct wq;
87 * struct snd_intelmad - intelmad driver structure
89 * @card: ptr to the card details
90 * @card_index: sound card index
91 * @card_id: sound card id detected
92 * @sstdrv_ops: ptr to sst driver ops
93 * @pdev: ptr to platfrom device
94 * @irq: interrupt number detected
95 * @pmic_status: Device status of sound card
96 * @int_base: ptr to MMIO interrupt region
97 * @output_sel: device slected as o/p
98 * @input_sel: device slected as i/p
99 * @master_mute: master mute status
101 * @playback_cnt: active pb streams
102 * @capture_cnt: active cp streams
103 * @mad_jack_msg: wq struct for jack interrupt processing
104 * @mad_jack_wq: wq for jack interrupt processing
105 * @jack_prev_state: Previos state of jack detected
106 * @cpu_id: current cpu id loaded for
108 struct snd_intelmad {
109 struct snd_card *card; /* ptr to the card details */
110 int card_index;/* card index */
111 char *card_id; /* card id */
112 struct intel_sst_card_ops *sstdrv_ops;/* ptr to sst driver ops */
113 struct platform_device *pdev;
116 void __iomem *int_base;
120 struct mad_jack jack[4];
123 struct mad_jack_msg_wq mad_jack_msg;
124 struct workqueue_struct *mad_jack_wq;
129 struct snd_control_val {
130 int playback_vol_max;
131 int playback_vol_min;
136 struct mad_stream_pvt {
139 struct snd_pcm_substream *substream;
140 struct pcm_stream_info stream_info;
141 ssize_t dbg_cum_bytes;
142 enum snd_sst_device_type device;
145 enum mad_drv_status {
153 enum mad_pmic_status {
167 void period_elapsed(void *mad_substream);
168 int snd_intelmad_alloc_stream(struct snd_pcm_substream *substream);
169 int snd_intelmad_init_stream(struct snd_pcm_substream *substream);
171 int sst_sc_reg_access(struct sc_reg_access *sc_access,
172 int type, int num_val);
173 #define CPU_CHIP_LINCROFT 1 /* System running lincroft */
174 #define CPU_CHIP_PENWELL 2 /* System running penwell */
176 extern struct snd_control_val intelmad_ctrl_val[];
177 extern struct snd_kcontrol_new snd_intelmad_controls_mrst[];
178 extern struct snd_kcontrol_new snd_intelmad_controls_mfld[];
179 extern struct snd_pmic_ops *intelmad_vendor_ops[];
181 /* This is an enabler hook as the platform detection logic isn't yet
182 present and depends on some firmware and DMI support to detect AAVA
183 devices. It will vanish once the AAVA platform support is merged */
186 #endif /* __INTELMID_H */