Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ecryptfs...
[pandora-kernel.git] / drivers / staging / intel_sst / intel_sst.h
1 #ifndef __INTEL_SST_H__
2 #define __INTEL_SST_H__
3 /*
4  *  intel_sst.h - Intel SST Driver for audio engine
5  *
6  *  Copyright (C) 2008-10 Intel Corporation
7  *  Authors:    Vinod Koul <vinod.koul@intel.com>
8  *              Harsha Priya <priya.harsha@intel.com>
9  *              Dharageswari R <dharageswari.r@intel.com>
10  *              KP Jeeja <jeeja.kp@intel.com>
11  *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12  *
13  *  This program is free software; you can redistribute it and/or modify
14  *  it under the terms of the GNU General Public License as published by
15  *  the Free Software Foundation; version 2 of the License.
16  *
17  *  This program is distributed in the hope that it will be useful, but
18  *  WITHOUT ANY WARRANTY; without even the implied warranty of
19  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  *  General Public License for more details.
21  *
22  *  You should have received a copy of the GNU General Public License along
23  *  with this program; if not, write to the Free Software Foundation, Inc.,
24  *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25  *
26  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27  *
28  *  This driver exposes the audio engine functionalities to the ALSA
29  *      and middleware.
30  *  This file is shared between the SST and MAD drivers
31  */
32
33 #define SST_CARD_NAMES "intel_mid_card"
34
35 /* control list Pmic & Lpe */
36 /* Input controls */
37 enum port_status {
38         ACTIVATE = 1,
39         DEACTIVATE,
40 };
41
42 /* Card states */
43 enum sst_card_states {
44         SND_CARD_UN_INIT = 0,
45         SND_CARD_INIT_DONE,
46 };
47
48 enum sst_controls {
49         SST_SND_ALLOC =                 0x1000,
50         SST_SND_PAUSE =                 0x1001,
51         SST_SND_RESUME =                0x1002,
52         SST_SND_DROP =                  0x1003,
53         SST_SND_FREE =                  0x1004,
54         SST_SND_BUFFER_POINTER =        0x1005,
55         SST_SND_STREAM_INIT =           0x1006,
56         SST_SND_START    =              0x1007,
57         SST_SND_STREAM_PROCESS =        0x1008,
58         SST_MAX_CONTROLS =              0x1008,
59         SST_CONTROL_BASE =              0x1000,
60         SST_ENABLE_RX_TIME_SLOT =       0x1009,
61 };
62
63 enum SND_CARDS {
64         SND_FS = 0,
65         SND_MX,
66         SND_NC,
67         SND_MSIC
68 };
69
70 struct pcm_stream_info {
71         int str_id;
72         void *mad_substream;
73         void (*period_elapsed) (void *mad_substream);
74         unsigned long long buffer_ptr;
75         int sfreq;
76 };
77
78 struct snd_pmic_ops {
79         int card_status;
80         int master_mute;
81         int num_channel;
82         int input_dev_id;
83         int mute_status;
84         int pb_on;
85         int cap_on;
86         int output_dev_id;
87         int (*set_input_dev) (u8 value);
88         int (*set_output_dev) (u8 value);
89
90         int (*set_mute) (int dev_id, u8 value);
91         int (*get_mute) (int dev_id, u8 *value);
92
93         int (*set_vol) (int dev_id, int value);
94         int (*get_vol) (int dev_id, int *value);
95
96         int (*init_card) (void);
97         int (*set_pcm_audio_params)
98                 (int sfreq, int word_size , int num_channel);
99         int (*set_pcm_voice_params) (void);
100         int (*set_voice_port) (int status);
101         int (*set_audio_port) (int status);
102
103         int (*power_up_pmic_pb) (unsigned int port);
104         int (*power_up_pmic_cp) (unsigned int port);
105         int (*power_down_pmic_pb) (void);
106         int (*power_down_pmic_cp) (void);
107         int (*power_down_pmic) (void);
108 };
109
110 struct intel_sst_card_ops {
111         char *module_name;
112         unsigned int  vendor_id;
113         int (*control_set) (int control_element, void *value);
114         struct snd_pmic_ops *scard_ops;
115 };
116
117 /* modified for generic access */
118 struct sc_reg_access {
119         u16 reg_addr;
120         u8 value;
121         u8 mask;
122 };
123 enum sc_reg_access_type {
124         PMIC_READ = 0,
125         PMIC_WRITE,
126         PMIC_READ_MODIFY,
127 };
128
129 int register_sst_card(struct intel_sst_card_ops *card);
130 void unregister_sst_card(struct intel_sst_card_ops *card);
131 #endif /* __INTEL_SST_H__ */