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 #include "intel_sst_ioctl.h"
33 
34 #define SST_CARD_NAMES "intel_mid_card"
35 
36 /* control list Pmic & Lpe */
37 /* Input controls */
38 enum port_status {
39 	ACTIVATE = 1,
40 	DEACTIVATE,
41 };
42 
43 /* Card states */
44 enum sst_card_states {
45 	SND_CARD_UN_INIT = 0,
46 	SND_CARD_INIT_DONE,
47 };
48 
49 enum sst_controls {
50 	SST_SND_ALLOC =			0x1000,
51 	SST_SND_PAUSE =			0x1001,
52 	SST_SND_RESUME =		0x1002,
53 	SST_SND_DROP =			0x1003,
54 	SST_SND_FREE =			0x1004,
55 	SST_SND_BUFFER_POINTER =	0x1005,
56 	SST_SND_STREAM_INIT =		0x1006,
57 	SST_SND_START	 =		0x1007,
58 	SST_SND_STREAM_PROCESS =	0x1008,
59 	SST_MAX_CONTROLS =		0x1008,
60 	SST_CONTROL_BASE =		0x1000,
61 	SST_ENABLE_RX_TIME_SLOT =	0x1009,
62 };
63 
64 enum SND_CARDS {
65 	SND_FS = 0,
66 	SND_MX,
67 	SND_NC,
68 	SND_MSIC
69 };
70 
71 struct pcm_stream_info {
72 	int str_id;
73 	void *mad_substream;
74 	void (*period_elapsed) (void *mad_substream);
75 	unsigned long long buffer_ptr;
76 	int sfreq;
77 };
78 
79 struct snd_pmic_ops {
80 	int card_status;
81 	int master_mute;
82 	int num_channel;
83 	int input_dev_id;
84 	int mute_status;
85 	int pb_on;
86 	int cap_on;
87 	int output_dev_id;
88 	int (*set_input_dev) (u8 value);
89 	int (*set_output_dev) (u8 value);
90 
91 	int (*set_mute) (int dev_id, u8 value);
92 	int (*get_mute) (int dev_id, u8 *value);
93 
94 	int (*set_vol) (int dev_id, int value);
95 	int (*get_vol) (int dev_id, int *value);
96 
97 	int (*init_card) (void);
98 	int (*set_pcm_audio_params)
99 		(int sfreq, int word_size , int num_channel);
100 	int (*set_pcm_voice_params) (void);
101 	int (*set_voice_port) (int status);
102 	int (*set_audio_port) (int status);
103 
104 	int (*power_up_pmic_pb) (unsigned int port);
105 	int (*power_up_pmic_cp) (unsigned int port);
106 	int (*power_down_pmic_pb) (void);
107 	int (*power_down_pmic_cp) (void);
108 	int (*power_down_pmic) (void);
109 };
110 
111 struct intel_sst_pcm_control {
112 	int (*open) (struct snd_sst_params *str_param);
113 	int (*device_control) (int cmd, void *arg);
114 	int (*close) (unsigned int str_id);
115 };
116 struct intel_sst_card_ops {
117 	char *module_name;
118 	unsigned int  vendor_id;
119 	struct intel_sst_pcm_control *pcm_control;
120 	struct snd_pmic_ops *scard_ops;
121 };
122 
123 /* modified for generic access */
124 struct sc_reg_access {
125 	u16 reg_addr;
126 	u8 value;
127 	u8 mask;
128 };
129 enum sc_reg_access_type {
130 	PMIC_READ = 0,
131 	PMIC_WRITE,
132 	PMIC_READ_MODIFY,
133 };
134 
135 int register_sst_card(struct intel_sst_card_ops *card);
136 void unregister_sst_card(struct intel_sst_card_ops *card);
137 #endif /* __INTEL_SST_H__ */
138