Skip to contentSkip to conversation

Intel SST sound card headers

RFC PATCH In review Vinod Koul 1 participant 1 message Jul 3, 2009 Sound

lore
Share & tools
lore

Vinod Koul

author
#0 lore raw

RFC PATCH 12/13 Intel SST sound card headers

This adds header files of sound card driver, it defines some utility functions and common declarations for vendor sound cards as well

	new file:   sound/pci/sst/intelmid.h
	new file:   sound/pci/sst/intelmid_pvt.h
	new file:   sound/pci/sst/intelmid_snd_control.h
---
 sound/pci/sst/intelmid.h             |  274 ++++++++++++++++++++++++++++++++++
 sound/pci/sst/intelmid_pvt.h         |  198 ++++++++++++++++++++++++
 sound/pci/sst/intelmid_snd_control.h |  153 +++++++++++++++++++
 3 files changed, 625 insertions(+), 0 deletions(-)
 create mode 100644 sound/pci/sst/intelmid.h
 create mode 100644 sound/pci/sst/intelmid_pvt.h
 create mode 100644 sound/pci/sst/intelmid_snd_control.h
sound/pci/sst/intelmid.h new file +274 -0
new file mode 100644
index 0000000..938ad52
@@ -0,0 +1,274 @@
+/*
+ *  intelmid.c - Intel Sound card driver for MID
+ *
+ *  Copyright (C) 2008-09 Intel Corp
+ *  Authors:	Vinod Koul <[email protected]>
+ *		Harsha Priya <[email protected]>
+ *
+ *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  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.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *  ALSA driver  header for Intel MAD chipset
+ */
+#ifndef __INTELMID_H
+#define __INTELMID_H
+
+#include <linux/time.h>
+#define DRIVER_NAME "pmic_audio"
+#define PMIC_SOUND_IRQ_TYPE_MASK (1 << 15)
+#define AUDINT_BASE (0xFFFFEFF8 + (6 * sizeof(u8)))
+/*#define FULL_CTRL*/
+/*#define REG_IRQ*/
+/*values #defined  */
+/* will differ for different hw - to be taken from config */
+#define MAX_DEVICES		1
+#define MIN_RATE		8000
+#define MAX_RATE		48000
+#define MAX_BUFFER		(320*1024)
+#define MIN_BUFFER		(320*1024)
+#define MAX_PERIODS		(1024*2)
+#define MIN_PERIODS		1
+#define MAX_PERIOD_BYTES MAX_BUFFER
+#define MIN_PERIOD_BYTES 32
+#define MAX_MUTE		1
+#define MIN_MUTE		0
+#define MONO_CNTL		1
+#define STEREO_CNTL		2
+#define MIN_CHANNEL		1
+#define MAX_CHANNEL		2
+#define FIFO_SIZE		0 /*fifo not being used*/
+#define INTEL_MAD		"Intel MAD"
+#define MUTE_ALL_DEV	9
+/*TODO +6 db*/
+#define MAX_VOL 		64
+/*TODO -57 db*/
+#define MIN_VOL 		0
+#define PLAYBACK_COUNT  1
+#define CAPTURE_COUNT  	1
+
+struct mad_device {
+	unsigned int 	mic_plugged:1;
+	unsigned int 	headphones_plugged:1;
+	unsigned int 	line_in_plugged:1;
+};
+
+struct mad_wq {
+	struct snd_pcm_substream *substream;
+	struct work_struct	wq;
+	struct mutex wq_lock;
+};
+
+struct mad_capture_wq {
+	struct snd_pcm_substream *substream;
+	struct stream_buffer buffer_to_sst;
+	struct work_struct	wq;
+};
+struct snd_intelmad {
+	struct snd_card	*card; /*ptr to the card details*/
+	int		card_index;/* card index */
+	char		*card_id; /*card id*/
+	struct mad_device pin_sense; /*current pin sense */
+	struct intel_sst_card_ops *sstdrv_ops;/*ptr to sst driver ops*/
+	struct spi_device *spi;
+	int irq;
+	int pmic_status;
+	void __iomem *int_base;
+};
+
+struct snd_control_val {
+	int	mic1_vol_max;
+	int	mic1_vol_min;
+	int	mic2_vol_max;
+	int	mic2_vol_min;
+	int	dmic_vol_max;
+	int	dmic_vol_min;
+	int	linein_vol_max;
+	int	linein_vol_min;
+	int	hp_vol_max;
+	int	hp_vol_min;
+	int	speaker_vol_max;
+	int	speaker_vol_min;
+	int	earpiece_vol_max;
+	int	earpiece_vol_min;
+};
+
+struct mad_stream_pvt {
+	int 		stream_id;
+	int 		stream_status;
+	int		stream_ops;
+	unsigned int	stream_type; /*0:Audio 1:Voice Default:Audio*/
+	struct snd_pcm_substream *substream;
+	unsigned int 	pcm_size;
+	unsigned int 	pcm_jiffie;
+	unsigned int 	pcm_buf_pos;
+	struct snd_pcm_indirect pcm_indirect;
+	struct pcm_stream_info buf_ptr;
+	unsigned long	period_elapsed_ptr;
+	struct mad_wq 	mad_msg_wq;
+	struct mad_capture_wq 	mad_capture_wq;
+};
+
+enum mad_drv_status {
+    INIT = 1,
+    STARTED,
+    RUNNING,
+    PAUSED,
+    DROPPED,
+};
+
+enum mad_pmic_status {
+	PMIC_UNINIT = 1,
+	PMIC_INIT,
+};
+#ifdef FULL_CTRL
+enum _widget_ctrl {
+	LINE_IN_VOL  = 1,
+	LINE_IN_MUTE,
+	DMIC_VOL,
+	DMIC_MUTE,
+	MIC1_VOL,
+	MIC1_MUTE,
+	MIC2_VOL,
+	MIC2_MUTE,
+	INPUT_SEL,
+	HEADPHONES_VOL ,
+	HEADPHONES_MUTE,
+	INTERNAL_SPEAKERS_VOL,
+	INTERNAL_SPEAKERS_MUTE,
+	EARPIECE_VOL,
+	EARPIECE_MUTE,
+	OUTPUT_SEL,
+	MASTER_MUTE
+};
+#else
+enum _widget_ctrl {
+	HEADPHONES_VOL = 1 ,
+	HEADPHONES_MUTE,
+};
+#endif
+
+enum {
+	AUDIO_GENL_ATTR_UNSPEC = 0,
+	AUDIO_GENL_ATTR_EVENT,	/* Audio event info needed by user space */
+	AUDIO_GENL_ATTR_MAX,
+};
+enum {
+	AUDIO_GENL_CMD_UNSPEC,
+	AUDIO_GENL_CMD_EVENT,	/* kernel->user notifications for OSPM events */
+	AUDIO_GENL_CMD_MAX,
+};
+
+enum eaudio_events {
+	AUDIO_EVENT_HP_DETECT,
+	AUDIO_EVENT_HS_DETECT,
+	AUDIO_EVENT_SHORT_PRESS,
+	AUDIO_EVENT_LONG_PRESS,
+	AUDIO_EVENT_COUNT,
+};
+
+struct audio_genl_event {
+	u32 orig;
+	enum eaudio_events event;
+};
+
+struct snd_pmic_ops v[3] = {
+	{
+		.set_input_dev 	= 	fs_set_selected_input_dev,
+		.set_output_dev = 	fs_set_selected_output_dev,
+		.set_mute 	=	fs_set_mute,
+		.get_mute 	= 	fs_get_mute,
+		.set_vol 	= 	fs_set_vol,
+		.get_vol 	= 	fs_get_vol,
+		.init_card 	= 	fs_init_card,
+		.set_pcm_params	=	fs_set_pcm_params,
+		.init_card_capture = 	fs_init_capture_card,
+	},
+	{
+		.set_input_dev 	= 	mx_set_selected_input_dev,
+		.set_output_dev = 	mx_set_selected_output_dev,
+		.set_mute 	= 	mx_set_mute,
+		.get_mute 	= 	mx_get_mute,
+		.set_vol 	= 	mx_set_vol,
+		.get_vol 	= 	mx_get_vol,
+		.init_card 	= 	mx_init_card,
+		.set_pcm_params	=	mx_set_pcm_params,
+		.init_card_capture =	mx_init_capture_card,
+	},
+	{
+		.set_input_dev 	= 	nc_set_selected_input_dev,
+		.set_output_dev = 	nc_set_selected_output_dev,
+		.set_mute 	= 	nc_set_mute,
+		.get_mute 	= 	nc_get_mute,
+		.set_vol 	= 	nc_set_vol,
+		.get_vol 	= 	nc_get_vol,
+		.init_card 	= 	nc_init_card,
+		.set_pcm_params	=	nc_set_pcm_params,
+		.init_card_capture =	nc_init_capture_card,
+	},
+};
+
+struct snd_control_val ctrl_val[3] = {
+	{
+		.mic1_vol_max = MAX_VOL,
+		.mic1_vol_min = MIN_VOL,
+		.mic2_vol_max = MAX_VOL,
+		.mic2_vol_min = MIN_VOL,
+		.dmic_vol_max = MAX_VOL,
+		.dmic_vol_min = MIN_VOL,
+		.linein_vol_max = MAX_VOL,
+		.linein_vol_min = MIN_VOL,
+		.hp_vol_max = MAX_VOL,
+		.hp_vol_min = MIN_VOL,
+		.speaker_vol_max = MAX_VOL,
+		.speaker_vol_min = MIN_VOL,
+		.earpiece_vol_max = MAX_VOL,
+		.earpiece_vol_min = MIN_VOL,
+	},
+	{
+		.mic1_vol_max = MAX_VOL,
+		.mic1_vol_min = MIN_VOL,
+		.mic2_vol_max = MAX_VOL,
+		.mic2_vol_min = MIN_VOL,
+		.dmic_vol_max = MAX_VOL,
+		.dmic_vol_min = MIN_VOL,
+		.linein_vol_max = MAX_VOL,
+		.linein_vol_min = MIN_VOL,
+		.hp_vol_max = MAX_VOL,
+		.hp_vol_min = MIN_VOL,
+		.speaker_vol_max = MAX_VOL,
+		.speaker_vol_min = MIN_VOL,
+		.earpiece_vol_max = MAX_VOL,
+		.earpiece_vol_min = MIN_VOL,
+	},
+	{
+		.mic1_vol_max = 30,
+		.mic1_vol_min = 10,
+		.mic2_vol_max = 30,
+		.mic2_vol_min = 10,
+		.dmic_vol_max = 0,
+		.dmic_vol_min = -63,
+		.linein_vol_max = MAX_VOL,
+		.linein_vol_min = MIN_VOL,
+		.hp_vol_max = 6,
+		.hp_vol_min = -25,
+		.speaker_vol_max = 6,
+		.speaker_vol_min = -25,
+		.earpiece_vol_max = 6,
+		.earpiece_vol_min = -25,
+	},
+};
+
+#endif /*__INTELMID_H*/
sound/pci/sst/intelmid_pvt.h new file +198 -0

198 lines not on this page · raw message

sound/pci/sst/intelmid_snd_control.h new file +153 -0

153 lines not on this page · raw message

Signature · 1 line
1.5.4.5