Skip to content

Commit

Permalink
intel_sst: Line out support
Browse files Browse the repository at this point in the history
This patch adds the support for lineout. The
lineout input can be selected as any input channel
by using a new alsa mixer kcontrol.

Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
Signed-off-by: Ramesh Babu K V <ramesh.babu@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Dharageswari R authored and Greg Kroah-Hartman committed May 10, 2011
1 parent c3e25a2 commit 5572a44
Show file tree
Hide file tree
Showing 12 changed files with 330 additions and 24 deletions.
6 changes: 4 additions & 2 deletions drivers/staging/intel_sst/intel_sst.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ struct snd_pmic_ops {
int num_channel;
int input_dev_id;
int mute_status;
int pb_on;
int pb_on, pbhs_on;
int cap_on;
int output_dev_id;
int lineout_dev_id, line_out_names_cnt;
int prev_lineout_dev_id;
int (*set_input_dev) (u8 value);
int (*set_output_dev) (u8 value);

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

Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/intel_sst/intel_sst_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
* Common private declarations for SST
*/

#define SST_DRIVER_VERSION "1.2.11"
#define SST_VERSION_NUM 0x1211
#define SST_DRIVER_VERSION "1.2.14"
#define SST_VERSION_NUM 0x1214

/* driver names */
#define SST_DRV_NAME "intel_sst_driver"
Expand Down
7 changes: 6 additions & 1 deletion drivers/staging/intel_sst/intel_sst_drv_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,14 @@ void free_stream_context(unsigned int str_id)
if (stream->ops == STREAM_OPS_PLAYBACK ||
stream->ops == STREAM_OPS_PLAYBACK_DRM) {
sst_drv_ctx->pb_streams--;
if (sst_drv_ctx->pb_streams == 0)
if (sst_drv_ctx->pci_id == SST_MFLD_PCI_ID)
sst_drv_ctx->scard_ops->power_down_pmic_pb(
stream->device);
else {
if (sst_drv_ctx->pb_streams == 0)
sst_drv_ctx->scard_ops->
power_down_pmic_pb(stream->device);
}
} else if (stream->ops == STREAM_OPS_CAPTURE) {
sst_drv_ctx->cp_streams--;
if (sst_drv_ctx->cp_streams == 0)
Expand Down
2 changes: 2 additions & 0 deletions drivers/staging/intel_sst/intel_sst_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ int sst_check_device_type(u32 device, u32 num_chan, u32 *pcm_slot)
*pcm_slot = 0x07;
else if (device == SND_SST_DEVICE_CAPTURE && num_chan == 4)
*pcm_slot = 0x0F;
else if (device == SND_SST_DEVICE_CAPTURE && num_chan > 4)
*pcm_slot = 0x1F;
else {
pr_debug("No condition satisfied.. ret err\n");
return -EINVAL;
Expand Down
3 changes: 2 additions & 1 deletion drivers/staging/intel_sst/intelmid.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static int snd_intelmad_pcm_prepare(struct snd_pcm_substream *substream)
return ret_val;
}

ret_val = snd_intelmad_alloc_stream(substream);
ret_val = snd_intelmad_alloc_stream(substream);
if (ret_val < 0)
return ret_val;
stream->dbg_cum_bytes = 0;
Expand Down Expand Up @@ -797,6 +797,7 @@ static int __devinit snd_intelmad_sst_register(
intelmaddata->sstdrv_ops->scard_ops->input_dev_id = DMIC;
intelmaddata->sstdrv_ops->scard_ops->output_dev_id =
STEREO_HEADPHONE;
intelmaddata->sstdrv_ops->scard_ops->lineout_dev_id = NONE;
}

/* registering with SST driver to get access to SST APIs to use */
Expand Down
8 changes: 6 additions & 2 deletions drivers/staging/intel_sst/intelmid.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
#define STEREO_CNTL 2
#define MIN_CHANNEL 1
#define MAX_CHANNEL_AMIC 2
#define MAX_CHANNEL_DMIC 4
#define MAX_CHANNEL_DMIC 5
#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_MFLD 3
#define MAX_CTRL 7
#define MAX_VENDORS 4
/* TODO +6 db */
Expand Down Expand Up @@ -116,6 +116,7 @@ struct snd_intelmad {
void __iomem *int_base;
int output_sel;
int input_sel;
int lineout_sel;
int master_mute;
struct mad_jack jack[4];
int playback_cnt;
Expand Down Expand Up @@ -163,6 +164,9 @@ enum _widget_ctrl {
CAPTURE_MUTE,
MASTER_MUTE
};
enum _widget_ctrl_mfld {
LINEOUT_SEL_MFLD = 3,
};

void period_elapsed(void *mad_substream);
int snd_intelmad_alloc_stream(struct snd_pcm_substream *substream);
Expand Down
46 changes: 44 additions & 2 deletions drivers/staging/intel_sst/intelmid_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ static char *out_names_mrst[] = {"Headphones",
static char *in_names_mrst[] = {"AMIC",
"DMIC",
"HS_MIC"};
static char *line_out_names_mfld[] = {"Headset",
"IHF ",
"Vibra1 ",
"Vibra2 ",
"NONE "};
static char *out_names_mfld[] = {"Headset ",
"EarPiece "};
static char *in_names_mfld[] = {"AMIC",
Expand Down Expand Up @@ -179,13 +184,27 @@ static int snd_intelmad_device_info_mrst(struct snd_kcontrol *kcontrol,
static int snd_intelmad_device_info_mfld(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
struct snd_pmic_ops *scard_ops;
struct snd_intelmad *intelmaddata;

WARN_ON(!kcontrol);
WARN_ON(!uinfo);

intelmaddata = kcontrol->private_data;

WARN_ON(!intelmaddata->sstdrv_ops);

scard_ops = intelmaddata->sstdrv_ops->scard_ops;
/* setup device select as drop down controls with different values */
if (kcontrol->id.numid == OUTPUT_SEL)
uinfo->value.enumerated.items = ARRAY_SIZE(out_names_mfld);
else
else if (kcontrol->id.numid == INPUT_SEL)
uinfo->value.enumerated.items = ARRAY_SIZE(in_names_mfld);
else if (kcontrol->id.numid == LINEOUT_SEL_MFLD) {
uinfo->value.enumerated.items = ARRAY_SIZE(line_out_names_mfld);
scard_ops->line_out_names_cnt = uinfo->value.enumerated.items;
} else
return -EINVAL;
uinfo->count = MONO_CNTL;
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;

Expand All @@ -195,10 +214,16 @@ static int snd_intelmad_device_info_mfld(struct snd_kcontrol *kcontrol,
strncpy(uinfo->value.enumerated.name,
out_names_mfld[uinfo->value.enumerated.item],
sizeof(uinfo->value.enumerated.name)-1);
else
else if (kcontrol->id.numid == INPUT_SEL)
strncpy(uinfo->value.enumerated.name,
in_names_mfld[uinfo->value.enumerated.item],
sizeof(uinfo->value.enumerated.name)-1);
else if (kcontrol->id.numid == LINEOUT_SEL_MFLD)
strncpy(uinfo->value.enumerated.name,
line_out_names_mfld[uinfo->value.enumerated.item],
sizeof(uinfo->value.enumerated.name)-1);
else
return -EINVAL;
return 0;
}

Expand Down Expand Up @@ -472,6 +497,9 @@ static int snd_intelmad_device_get(struct snd_kcontrol *kcontrol,
else if (kcontrol->id.numid == INPUT_SEL)
uval->value.enumerated.item[0] =
scard_ops->input_dev_id;
else if (kcontrol->id.numid == LINEOUT_SEL_MFLD)
uval->value.enumerated.item[0] =
scard_ops->lineout_dev_id;
else
return -EINVAL;
} else
Expand Down Expand Up @@ -534,6 +562,11 @@ static int snd_intelmad_device_set(struct snd_kcontrol *kcontrol,
uval->value.enumerated.item[0]);
intelmaddata->input_sel = uval->value.enumerated.item[0];
break;
case LINEOUT_SEL_MFLD:
ret_val = scard_ops->set_lineout_dev(
uval->value.enumerated.item[0]);
intelmaddata->lineout_sel = uval->value.enumerated.item[0];
break;
default:
return -EINVAL;
}
Expand Down Expand Up @@ -627,5 +660,14 @@ snd_intelmad_controls_mfld[MAX_CTRL_MFLD] __devinitdata = {
.put = snd_intelmad_device_set,
.private_value = 0,
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Line out",
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
.info = snd_intelmad_device_info_mfld,
.get = snd_intelmad_device_get,
.put = snd_intelmad_device_set,
.private_value = 0,
},
};

Loading

0 comments on commit 5572a44

Please sign in to comment.