summaryrefslogtreecommitdiffstats
path: root/drivers/staging/intel_sst/intel_sst.h
blob: 1f19f0d1d316e81d156b6e24f1f200885ab75ee6 (plain)
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
32
33
34
35
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef __INTEL_SST_H__
#define __INTEL_SST_H__
/*
 *  intel_sst.h - Intel SST Driver for audio engine
 *
 *  Copyright (C) 2008-10 Intel Corporation
 *  Authors:	Vinod Koul <vinod.koul@intel.com>
 *		Harsha Priya <priya.harsha@intel.com>
 *		Dharageswari R <dharageswari.r@intel.com>
 *		KP Jeeja <jeeja.kp@intel.com>
 *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; version 2 of the License.
 *
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
 *
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 *
 *  This driver exposes the audio engine functionalities to the ALSA
 *	and middleware.
 *  This file is shared between the SST and MAD drivers
 */

#define SST_CARD_NAMES "intel_mid_card"

/* control list Pmic & Lpe */
/* Input controls */
enum port_status {
	ACTIVATE = 1,
	DEACTIVATE,
};

/* Card states */
enum sst_card_states {
	SND_CARD_UN_INIT = 0,
	SND_CARD_INIT_DONE,
};

enum sst_controls {
	SST_SND_ALLOC =			0x1000,
	SST_SND_PAUSE =			0x1001,
	SST_SND_RESUME =		0x1002,
	SST_SND_DROP =			0x1003,
	SST_SND_FREE =			0x1004,
	SST_SND_BUFFER_POINTER =	0x1005,
	SST_SND_STREAM_INIT =		0x1006,
	SST_SND_START	 =		0x1007,
	SST_SND_STREAM_PROCESS =	0x1008,
	SST_MAX_CONTROLS =		0x1008,
	SST_CONTROL_BASE =		0x1000,
	SST_ENABLE_RX_TIME_SLOT =	0x1009,
};

enum SND_CARDS {
	SND_FS = 0,
	SND_MX,
	SND_NC,
	SND_MSIC
};

struct pcm_stream_info {
	int str_id;
	void *mad_substream;
	void (*period_elapsed) (void *mad_substream);
	unsigned long long buffer_ptr;
	int sfreq;
};

struct snd_pmic_ops {
	int card_status;
	int master_mute;
	int num_channel;
	int input_dev_id;
	int mute_status;
	int pb_on;
	int cap_on;
	int output_dev_id;
	int (*set_input_dev) (u8 value);
	int (*set_output_dev) (u8 value);

	int (*set_mute) (int dev_id, u8 value);
	int (*get_mute) (int dev_id, u8 *value);

	int (*set_vol) (int dev_id, int value);
	int (*get_vol) (int dev_id, int *value);

	int (*init_card) (void);
	int (*set_pcm_audio_params)
		(int sfreq, int word_size , int num_channel);
	int (*set_pcm_voice_params) (void);
	int (*set_voice_port) (int status);
	int (*set_audio_port) (int status);

	int (*power_up_pmic_pb) (unsigned int port);
	int (*power_up_pmic_cp) (unsigned int port);
	int (*power_down_pmic_pb) (void);
	int (*power_down_pmic_cp) (void);
	int (*power_down_pmic) (void);
};

struct intel_sst_card_ops {
	char *module_name;
	unsigned int  vendor_id;
	int (*control_set) (int control_element, void *value);
	struct snd_pmic_ops *scard_ops;
};

/* modified for generic access */
struct sc_reg_access {
	u16 reg_addr;
	u8 value;
	u8 mask;
};
enum sc_reg_access_type {
	PMIC_READ = 0,
	PMIC_WRITE,
	PMIC_READ_MODIFY,
};

int register_sst_card(struct intel_sst_card_ops *card);
void unregister_sst_card(struct intel_sst_card_ops *card);
#endif /* __INTEL_SST_H__ */
OpenPOWER on IntegriCloud