Commit fffa1cca authored by Vinod Koul's avatar Vinod Koul Committed by Greg Kroah-Hartman

Staging: sst: Intel SST audio driver

This is the Intel SST audio driver.

As compared to the previous versions it has all the printks and other stuff
noted cleaned up and more hardware support. The Aava support is disabled in
this patch (is_aava resolves to 0) because the Aava board detection logic
is not yet upstream.

The driver itself is a combination of a traditional ALSA driver and a
hardware assisted offload driver which can play audio while the processor
is asleep but which can't do all the more interactive stuff.

In the general case most software would use the ALSA interface, but the
other interface is needed for certain classes of use such as music playback
on highly power consumption sensitive devices.

This is going to staging primarily because it depends upon the staging memrar
driver.
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
Signed-off-by: default avatarHarsha Priya <priya.harsha@intel.com>
[Merged together and tweaked for -next]
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a747d4b8
......@@ -171,5 +171,7 @@ source "drivers/staging/bcm/Kconfig"
source "drivers/staging/ft1000/Kconfig"
source "drivers/staging/intel_sst/Kconfig"
endif # !STAGING_EXCLUDE_BUILD
endif # STAGING
......@@ -66,3 +66,4 @@ obj-$(CONFIG_ATH6K_LEGACY) += ath6kl/
obj-$(CONFIG_USB_ENESTORAGE) += keucr/
obj-$(CONFIG_BCM_WIMAX) += bcm/
obj-$(CONFIG_FT1000) += ft1000/
obj-$(CONFIG_SND_INTEL_SST) += intel_sst/
config SND_INTEL_SST
tristate "Intel SST (LPE) Driver"
depends on X86 && INTEL_SCU_IPC
default n
help
Say Y here to include support for the Intel(R) MID SST DSP driver
On other PC platforms if you are unsure answer 'N'
config SND_INTELMID
tristate "Intel MID sound card driver"
select SND_PCM
select SND_SEQUENCER
select SND_JACK
depends on SND_INTEL_SST
default n
help
Say Y here to include support for the Intel(R) MID sound card driver
On other PC platforms if you are unsure answer 'N'
#
# Makefile for Intel MID Audio drivers
#
snd-intel-sst-objs := intel_sst.o intel_sst_ipc.o intel_sst_stream.o intel_sst_drv_interface.o intel_sst_dsp.o intel_sst_pvt.o intel_sst_stream_encoded.o intel_sst_app_interface.o
snd-intelmid-objs := intelmid.o intelmid_msic_control.o intelmid_ctrl.o intelmid_pvt.o intelmid_v0_control.o intelmid_v1_control.o intelmid_v2_control.o
obj-$(CONFIG_SND_INTEL_SST) += snd-intel-sst.o
obj-$(CONFIG_SND_INTELMID) += snd-intelmid.o
TODO
----
Get the memrar driver cleaned up and upstream (dependancy blocking SST)
Get the jack header entries accepted
Review the printks and kill off any left over ST_ERR: messages
Review the misc device ioctls for 32/64bit safety and sanity
Review the misc device ioctls for size safety depending on config and decide
if space/unused areas should be left
Anything the sound folks turn up on full review
This diff is collapsed.
#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__ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* intel_sst_pvt.c - Intel SST Driver for audio engine
*
* Copyright (C) 2008-10 Intel Corp
* 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 contains all private functions
*/
#include <linux/pci.h>
#include <linux/fs.h>
#include <linux/firmware.h>
#include <linux/sched.h>
#include "intel_sst.h"
#include "intel_sst_ioctl.h"
#include "intel_sst_fw_ipc.h"
#include "intel_sst_common.h"
/*
* sst_get_block_stream - get a new block stream
*
* @sst_drv_ctx: Driver context structure
*
* This function assigns a block for the calls that dont have stream context yet
* the blocks are used for waiting on Firmware's response for any operation
* Should be called with stream lock held
*/
int sst_get_block_stream(struct intel_sst_drv *sst_drv_ctx)
{
int i;
for (i = 0; i < MAX_ACTIVE_STREAM; i++) {
if (sst_drv_ctx->alloc_block[i].sst_id == BLOCK_UNINIT) {
sst_drv_ctx->alloc_block[i].ops_block.condition = false;
sst_drv_ctx->alloc_block[i].ops_block.ret_code = 0;
sst_drv_ctx->alloc_block[i].sst_id = 0;
break;
}
}
if (i == MAX_ACTIVE_STREAM) {
pr_err("sst: max alloc_stream reached");
i = -EBUSY; /* active stream limit reached */
}
return i;
}
/*
* sst_wait_interruptible - wait on event
*
* @sst_drv_ctx: Driver context
* @block: Driver block to wait on
*
* This function waits without a timeout (and is interruptable) for a
* given block event
*/
int sst_wait_interruptible(struct intel_sst_drv *sst_drv_ctx,
struct sst_block *block)
{
int retval = 0;
if (!wait_event_interruptible(sst_drv_ctx->wait_queue,
block->condition)) {
/* event wake */
if (block->ret_code < 0) {
pr_err("sst: stream failed %d\n", block->ret_code);
retval = -EBUSY;
} else {
pr_debug("sst: event up\n");
retval = 0;
}
} else {
pr_err("sst: signal interrupted\n");
retval = -EINTR;
}
return retval;
}
/*
* sst_wait_interruptible_timeout - wait on event interruptable
*
* @sst_drv_ctx: Driver context
* @block: Driver block to wait on
* @timeout: time for wait on
*
* This function waits with a timeout value (and is interruptible) on a
* given block event
*/
int sst_wait_interruptible_timeout(
struct intel_sst_drv *sst_drv_ctx,
struct sst_block *block, int timeout)
{
int retval = 0;
pr_debug("sst: sst_wait_interruptible_timeout - waiting....\n");
if (wait_event_interruptible_timeout(sst_drv_ctx->wait_queue,
block->condition,
msecs_to_jiffies(timeout))) {
if (block->ret_code < 0)
pr_err("sst: stream failed %d\n", block->ret_code);
else
pr_debug("sst: event up\n");
retval = block->ret_code;
} else {
block->on = false;
pr_err("sst: timeout occured...\n");
/*setting firmware state as uninit so that the
firmware will get re-downloaded on next request
this is because firmare not responding for 5 sec
is equalant to some unrecoverable error of FW
sst_drv_ctx->sst_state = SST_UN_INIT;*/
retval = -EBUSY;
}
return retval;
}
/*
* sst_wait_timeout - wait on event for timeout
*
* @sst_drv_ctx: Driver context
* @block: Driver block to wait on
*
* This function waits with a timeout value (and is not interruptible) on a
* given block event
*/
int sst_wait_timeout(struct intel_sst_drv *sst_drv_ctx,
struct stream_alloc_block *block)
{
int retval = 0;
/* NOTE:
Observed that FW processes the alloc msg and replies even
before the alloc thread has finished execution */
pr_debug("sst: waiting for %x, condition %x\n",
block->sst_id, block->ops_block.condition);
if (wait_event_interruptible_timeout(sst_drv_ctx->wait_queue,
block->ops_block.condition,
msecs_to_jiffies(SST_BLOCK_TIMEOUT))) {
/* event wake */
pr_debug("sst: Event wake %x\n", block->ops_block.condition);
pr_debug("sst: message ret: %d\n", block->ops_block.ret_code);
retval = block->ops_block.ret_code;
} else {
block->ops_block.on = false;
pr_err("sst: Wait timed-out %x\n", block->ops_block.condition);
/* settign firmware state as uninit so that the
firmware will get redownloaded on next request
this is because firmare not responding for 5 sec
is equalant to some unrecoverable error of FW
sst_drv_ctx->sst_state = SST_UN_INIT;*/
retval = -EBUSY;
}
return retval;
}
/*
* sst_create_large_msg - create a large IPC message
*
* @arg: ipc message
*
* this function allocates structures to send a large message to the firmware
*/
int sst_create_large_msg(struct ipc_post **arg)
{
struct ipc_post *msg;
msg = kzalloc(sizeof(struct ipc_post), GFP_ATOMIC);
if (!msg) {
pr_err("sst: kzalloc msg failed\n");
return -ENOMEM;
}
msg->mailbox_data = kzalloc(SST_MAILBOX_SIZE, GFP_ATOMIC);
if (!msg->mailbox_data) {
kfree(msg);
pr_err("sst: kzalloc mailbox_data failed");
return -ENOMEM;
};
*arg = msg;
return 0;
}
/*
* sst_create_short_msg - create a short IPC message
*
* @arg: ipc message
*
* this function allocates structures to send a short message to the firmware
*/
int sst_create_short_msg(struct ipc_post **arg)
{
struct ipc_post *msg;
msg = kzalloc(sizeof(*msg), GFP_ATOMIC);
if (!msg) {
pr_err("sst: kzalloc msg failed\n");
return -ENOMEM;
}
msg->mailbox_data = NULL;
*arg = msg;
return 0;
}
/*
* sst_clean_stream - clean the stream context
*
* @stream: stream structure
*
* this function resets the stream contexts
* should be called in free
*/
void sst_clean_stream(struct stream_info *stream)
{
struct sst_stream_bufs *bufs = NULL, *_bufs;
stream->status = STREAM_UN_INIT;
stream->prev = STREAM_UN_INIT;
mutex_lock(&stream->lock);
list_for_each_entry_safe(bufs, _bufs, &stream->bufs, node) {
list_del(&bufs->node);
kfree(bufs);
}
mutex_unlock(&stream->lock);
if (stream->ops != STREAM_OPS_PLAYBACK_DRM)
kfree(stream->decode_ibuf);
}
/*
* sst_wake_up_alloc_block - wake up waiting block
*
* @sst_drv_ctx: Driver context
* @sst_id: stream id
* @status: status of wakeup
* @data: data pointer of wakeup
*
* This function wakes up a sleeping block event based on the response
*/
void sst_wake_up_alloc_block(struct intel_sst_drv *sst_drv_ctx,
u8 sst_id, int status, void *data)
{
int i;
/* Unblock with retval code */
for (i = 0; i < MAX_ACTIVE_STREAM; i++) {
if (sst_id == sst_drv_ctx->alloc_block[i].sst_id) {
sst_drv_ctx->alloc_block[i].ops_block.condition = true;
sst_drv_ctx->alloc_block[i].ops_block.ret_code = status;
sst_drv_ctx->alloc_block[i].ops_block.data = data;
wake_up(&sst_drv_ctx->wait_queue);
break;
}
}
}
/*
* sst_enable_rx_timeslot - Send msg to query for stream parameters
* @status: rx timeslot to be enabled
*
* This function is called when the RX timeslot is required to be enabled
*/
int sst_enable_rx_timeslot(int status)
{
int retval = 0;
struct ipc_post *msg = NULL;
if (sst_create_short_msg(&msg)) {
pr_err("sst: mem allocation failed\n");
return -ENOMEM;
}
pr_debug("sst: ipc message sending: ENABLE_RX_TIME_SLOT\n");
sst_fill_header(&msg->header, IPC_IA_ENABLE_RX_TIME_SLOT, 0, 0);
msg->header.part.data = status;
sst_drv_ctx->hs_info_blk.condition = false;
sst_drv_ctx->hs_info_blk.ret_code = 0;
sst_drv_ctx->hs_info_blk.on = true;
spin_lock(&sst_drv_ctx->list_spin_lock);
list_add_tail(&msg->node,
&sst_drv_ctx->ipc_dispatch_list);
spin_unlock(&sst_drv_ctx->list_spin_lock);
sst_post_message(&sst_drv_ctx->ipc_post_msg_wq);
retval = sst_wait_interruptible_timeout(sst_drv_ctx,
&sst_drv_ctx->hs_info_blk, SST_BLOCK_TIMEOUT);
return retval;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* intelmid.h - Intel Sound card driver for MID
*
* Copyright (C) 2008-10 Intel Corp
* Authors: Harsha Priya <priya.harsha@intel.com>
* Vinod Koul <vinod.koul@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.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* ALSA driver header for Intel MAD chipset
*/
#ifndef __INTELMID_H
#define __INTELMID_H
#include <linux/time.h>
#define DRIVER_NAME_MFLD "msic_audio"
#define DRIVER_NAME_MRST "pmic_audio"
#define DRIVER_NAME "intelmid_audio"
#define PMIC_SOUND_IRQ_TYPE_MASK (1 << 15)
#define AUDINT_BASE (0xFFFFEFF8 + (6 * sizeof(u8)))
#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 (800*1024) /* for PCM */
#define MIN_BUFFER (800*1024)
#define MAX_PERIODS (1024*2)
#define MIN_PERIODS 1
#define MAX_PERIOD_BYTES MAX_BUFFER
#define MIN_PERIOD_BYTES 32
/*#define MIN_PERIOD_BYTES 160*/
#define MAX_MUTE 1
#define MIN_MUTE 0
#define MONO_CNTL 1
#define STEREO_CNTL 2
#define MIN_CHANNEL 1
#define MAX_CHANNEL_AMIC 2
#define MAX_CHANNEL_DMIC 4
#define FIFO_SIZE 0 /* fifo not being used */
#define INTEL_MAD "Intel MAD"
#define MAX_CTRL_MRST 7
#define MAX_CTRL_MFLD 2
#define MAX_CTRL 7
#define MAX_VENDORS 4
/* TODO +6 db */
#define MAX_VOL 64
/* TODO -57 db */
#define MIN_VOL 0
#define PLAYBACK_COUNT 1
#define CAPTURE_COUNT 1
extern int sst_card_vendor_id;
struct mad_jack {
struct snd_jack jack;
int jack_status;
struct timeval buttonpressed;
struct timeval buttonreleased;
};
struct mad_jack_msg_wq {
u8 intsts;
struct snd_intelmad *intelmaddata;
struct work_struct wq;
};
/**
* struct snd_intelmad - intelmad driver structure
*
* @card: ptr to the card details
* @card_index: sound card index
* @card_id: sound card id detected
* @sstdrv_ops: ptr to sst driver ops
* @pdev: ptr to platfrom device
* @irq: interrupt number detected
* @pmic_status: Device status of sound card
* @int_base: ptr to MMIO interrupt region
* @output_sel: device slected as o/p
* @input_sel: device slected as i/p
* @master_mute: master mute status
* @jack: jack status
* @playback_cnt: active pb streams
* @capture_cnt: active cp streams
* @mad_jack_msg: wq struct for jack interrupt processing
* @mad_jack_wq: wq for jack interrupt processing
* @jack_prev_state: Previos state of jack detected
* @cpu_id: current cpu id loaded for
*/
struct snd_intelmad {
struct snd_card *card; /* ptr to the card details */
int card_index;/* card index */
char *card_id; /* card id */
struct intel_sst_card_ops *sstdrv_ops;/* ptr to sst driver ops */
struct platform_device *pdev;
int irq;
int pmic_status;
void __iomem *int_base;
int output_sel;
int input_sel;
int master_mute;
struct mad_jack jack[4];
int playback_cnt;
int capture_cnt;
struct mad_jack_msg_wq mad_jack_msg;
struct workqueue_struct *mad_jack_wq;
u8 jack_prev_state;
unsigned int cpu_id;
};
struct snd_control_val {
int playback_vol_max;
int playback_vol_min;
int capture_vol_max;
int capture_vol_min;
};
struct mad_stream_pvt {
int stream_status;
int stream_ops;
struct snd_pcm_substream *substream;
struct pcm_stream_info stream_info;
ssize_t dbg_cum_bytes;
enum snd_sst_device_type device;
};
enum mad_drv_status {
INIT = 1,
STARTED,
RUNNING,
PAUSED,
DROPPED,
};
enum mad_pmic_status {
PMIC_UNINIT = 1,
PMIC_INIT,
};
enum _widget_ctrl {
OUTPUT_SEL = 1,
INPUT_SEL,
PLAYBACK_VOL,
PLAYBACK_MUTE,
CAPTURE_VOL,
CAPTURE_MUTE,
MASTER_MUTE
};
void period_elapsed(void *mad_substream);
int snd_intelmad_alloc_stream(struct snd_pcm_substream *substream);
int snd_intelmad_init_stream(struct snd_pcm_substream *substream);
int sst_sc_reg_access(struct sc_reg_access *sc_access,
int type, int num_val);
#define CPU_CHIP_LINCROFT 1 /* System running lincroft */
#define CPU_CHIP_PENWELL 2 /* System running penwell */
extern struct snd_control_val intelmad_ctrl_val[];
extern struct snd_kcontrol_new snd_intelmad_controls_mrst[];
extern struct snd_kcontrol_new snd_intelmad_controls_mfld[];
extern struct snd_pmic_ops *intelmad_vendor_ops[];
/* This is an enabler hook as the platform detection logic isn't yet
present and depends on some firmware and DMI support to detect AAVA
devices. It will vanish once the AAVA platform support is merged */
#define is_aava() 0
#endif /* __INTELMID_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef __INTELMID_SND_CTRL_H__
#define __INTELMID_SND_CTRL_H__
/*
* intelmid_snd_control.h - Intel Sound card driver for MID
*
* 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 file defines all snd control functions
*/
/*
Mask bits
*/
#define MASK0 0x01 /* 0000 0001 */
#define MASK1 0x02 /* 0000 0010 */
#define MASK2 0x04 /* 0000 0100 */
#define MASK3 0x08 /* 0000 1000 */
#define MASK4 0x10 /* 0001 0000 */
#define MASK5 0x20 /* 0010 0000 */
#define MASK6 0x40 /* 0100 0000 */
#define MASK7 0x80 /* 1000 0000 */
/*
value bits
*/
#define VALUE0 0x01 /* 0000 0001 */
#define VALUE1 0x02 /* 0000 0010 */
#define VALUE2 0x04 /* 0000 0100 */
#define VALUE3 0x08 /* 0000 1000 */
#define VALUE4 0x10 /* 0001 0000 */
#define VALUE5 0x20 /* 0010 0000 */
#define VALUE6 0x40 /* 0100 0000 */
#define VALUE7 0x80 /* 1000 0000 */
#define MUTE 0 /* ALSA Passes 0 for mute */
#define UNMUTE 1 /* ALSA Passes 1 for unmute */
#define MAX_VOL_PMIC_VENDOR0 0x3f /* max vol in dB for stereo & voice DAC */
#define MIN_VOL_PMIC_VENDOR0 0 /* min vol in dB for stereo & voice DAC */
/* Head phone volume control */
#define MAX_HP_VOL_PMIC_VENDOR1 6 /* max volume in dB for HP */
#define MIN_HP_VOL_PMIC_VENDOR1 (-84) /* min volume in dB for HP */
#define MAX_HP_VOL_INDX_PMIC_VENDOR1 40 /* Number of HP volume control values */
/* Mono Earpiece Volume control */
#define MAX_EP_VOL_PMIC_VENDOR1 0 /* max volume in dB for EP */
#define MIN_EP_VOL_PMIC_VENDOR1 (-75) /* min volume in dB for EP */
#define MAX_EP_VOL_INDX_PMIC_VENDOR1 32 /* Number of EP volume control values */
int sst_sc_reg_access(struct sc_reg_access *sc_access,
int type, int num_val);
extern struct snd_pmic_ops snd_pmic_ops_fs;
extern struct snd_pmic_ops snd_pmic_ops_mx;
extern struct snd_pmic_ops snd_pmic_ops_nc;
extern struct snd_pmic_ops snd_msic_ops;
/* device */
enum SND_INPUT_DEVICE {
AMIC,
DMIC,
HS_MIC,
IN_UNDEFINED
};
enum SND_OUTPUT_DEVICE {
STEREO_HEADPHONE,
MONO_EARPIECE,
INTERNAL_SPKR,
RECEIVER,
OUT_UNDEFINED
};
enum pmic_controls {
PMIC_SND_HP_MIC_MUTE = 0x0001,
PMIC_SND_AMIC_MUTE = 0x0002,
PMIC_SND_DMIC_MUTE = 0x0003,
PMIC_SND_CAPTURE_VOL = 0x0004,
/* Output controls */
PMIC_SND_LEFT_PB_VOL = 0x0010,
PMIC_SND_RIGHT_PB_VOL = 0x0011,
PMIC_SND_LEFT_HP_MUTE = 0x0012,
PMIC_SND_RIGHT_HP_MUTE = 0x0013,
PMIC_SND_LEFT_SPEAKER_MUTE = 0x0014,
PMIC_SND_RIGHT_SPEAKER_MUTE = 0x0015,
PMIC_SND_RECEIVER_VOL = 0x0016,
PMIC_SND_RECEIVER_MUTE = 0x0017,
/* Other controls */
PMIC_SND_MUTE_ALL = 0x0020,
PMIC_MAX_CONTROLS = 0x0020,
};
#endif /* __INTELMID_SND_CTRL_H__ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* Temporary staging glue */
#include <sound/jack.h>
/* These want adding to jack.h as enum entries once approved */
#define SND_JACK_HS_SHORT_PRESS (SND_JACK_HEADSET | 0x0020)
#define SND_JACK_HS_LONG_PRESS (SND_JACK_HEADSET | 0x0040)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment