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>
31 #include <sound/jack.h>
33 #define DRIVER_NAME_MFLD "msic_audio"
34 #define DRIVER_NAME_MRST "pmic_audio"
35 #define DRIVER_NAME "intelmid_audio"
36 #define PMIC_SOUND_IRQ_TYPE_MASK (1 << 15)
37 #define AUDINT_BASE (0xFFFFEFF8 + (6 * sizeof(u8)))
40 /* will differ for different hw - to be taken from config */
43 #define MAX_RATE 48000
44 #define MAX_BUFFER (800*1024) /* for PCM */
45 #define MIN_BUFFER (800*1024)
46 #define MAX_PERIODS (1024*2)
48 #define MAX_PERIOD_BYTES MAX_BUFFER
49 #define MIN_PERIOD_BYTES 32
50 /*#define MIN_PERIOD_BYTES 160*/
56 #define MAX_CHANNEL_AMIC 2
57 #define MAX_CHANNEL_DMIC 5
58 #define FIFO_SIZE 0 /* fifo not being used */
59 #define INTEL_MAD "Intel MAD"
60 #define MAX_CTRL_MRST 8
61 #define MAX_CTRL_MFLD 7
68 #define PLAYBACK_COUNT 1
69 #define CAPTURE_COUNT 1
70 #define ADC_ONE_LSB_MULTIPLIER 2346
72 #define MID_JACK_HS_LONG_PRESS SND_JACK_BTN_0
73 #define MID_JACK_HS_SHORT_PRESS SND_JACK_BTN_1
75 extern int sst_card_vendor_id
;
81 struct timeval buttonpressed
;
82 struct timeval buttonreleased
;
85 struct mad_jack_msg_wq
{
87 struct snd_intelmad
*intelmaddata
;
88 struct work_struct wq
;
92 struct snd_intelmad_probe_info
{
94 unsigned int irq_cache
;
99 * struct snd_intelmad - intelmad driver structure
101 * @card: ptr to the card details
102 * @card_index: sound card index
103 * @card_id: sound card id detected
104 * @sstdrv_ops: ptr to sst driver ops
105 * @pdev: ptr to platform device
106 * @irq: interrupt number detected
107 * @pmic_status: Device status of sound card
108 * @int_base: ptr to MMIO interrupt region
109 * @output_sel: device selected as o/p
110 * @input_sel: device selected as i/p
111 * @master_mute: master mute status
113 * @playback_cnt: active pb streams
114 * @capture_cnt: active cp streams
115 * @mad_jack_msg: wq struct for jack interrupt processing
116 * @mad_jack_wq: wq for jack interrupt processing
117 * @jack_prev_state: Previos state of jack detected
118 * @cpu_id: current cpu id loaded for
120 struct snd_intelmad
{
121 struct snd_card
*card
; /* ptr to the card details */
122 int card_index
;/* card index */
123 char *card_id
; /* card id */
124 struct intel_sst_card_ops
*sstdrv_ops
;/* ptr to sst driver ops */
125 struct platform_device
*pdev
;
128 void __iomem
*int_base
;
133 struct mad_jack jack
[4];
137 struct mad_jack_msg_wq mad_jack_msg
;
138 struct workqueue_struct
*mad_jack_wq
;
143 struct snd_control_val
{
144 int playback_vol_max
;
145 int playback_vol_min
;
152 struct mad_stream_pvt
{
155 struct snd_pcm_substream
*substream
;
156 struct pcm_stream_info stream_info
;
157 ssize_t dbg_cum_bytes
;
158 enum snd_sst_device_type device
;
161 enum mad_drv_status
{
169 enum mad_pmic_status
{
183 enum _widget_ctrl_mfld
{
184 LINEOUT_SEL_MFLD
= 3,
193 void period_elapsed(void *mad_substream
);
194 int snd_intelmad_alloc_stream(struct snd_pcm_substream
*substream
);
195 int snd_intelmad_init_stream(struct snd_pcm_substream
*substream
);
197 int sst_sc_reg_access(struct sc_reg_access
*sc_access
,
198 int type
, int num_val
);
199 #define CPU_CHIP_LINCROFT 1 /* System running lincroft */
200 #define CPU_CHIP_PENWELL 2 /* System running penwell */
202 extern struct snd_control_val intelmad_ctrl_val
[];
203 extern struct snd_kcontrol_new snd_intelmad_controls_mrst
[];
204 extern struct snd_kcontrol_new snd_intelmad_controls_mfld
[];
205 extern struct snd_pmic_ops
*intelmad_vendor_ops
[];
206 void sst_mad_send_jack_report(struct snd_jack
*jack
,
207 int buttonpressevent
, int status
);
209 #endif /* __INTELMID_H */