Commit e51a34f3 authored by Lu Guanqun's avatar Lu Guanqun Committed by Greg Kroah-Hartman

intel_sst: return correct output/input device id

Without this patch, the change of output/input device can't be reflected
correctly. The mismatch reflects insane design, and should be fixed when
switching to the ASoC framework.
Signed-off-by: default avatarLu Guanqun <guanqun.lu@intel.com>
Acked-by: default avatarWu Fengguang <fengguang.wu@intel.com>
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 24298b0e
...@@ -504,8 +504,8 @@ static int snd_intelmad_device_get(struct snd_kcontrol *kcontrol, ...@@ -504,8 +504,8 @@ static int snd_intelmad_device_get(struct snd_kcontrol *kcontrol,
WARN_ON(!kcontrol); WARN_ON(!kcontrol);
intelmaddata = kcontrol->private_data; intelmaddata = kcontrol->private_data;
scard_ops = intelmaddata->sstdrv_ops->scard_ops;
if (intelmaddata->cpu_id == CPU_CHIP_PENWELL) { if (intelmaddata->cpu_id == CPU_CHIP_PENWELL) {
scard_ops = intelmaddata->sstdrv_ops->scard_ops;
if (kcontrol->id.numid == OUTPUT_SEL) if (kcontrol->id.numid == OUTPUT_SEL)
uval->value.enumerated.item[0] = uval->value.enumerated.item[0] =
scard_ops->output_dev_id; scard_ops->output_dev_id;
...@@ -517,6 +517,25 @@ static int snd_intelmad_device_get(struct snd_kcontrol *kcontrol, ...@@ -517,6 +517,25 @@ static int snd_intelmad_device_get(struct snd_kcontrol *kcontrol,
scard_ops->lineout_dev_id; scard_ops->lineout_dev_id;
else else
return -EINVAL; return -EINVAL;
} else if (intelmaddata->cpu_id == CPU_CHIP_LINCROFT) {
if (kcontrol->id.numid == OUTPUT_SEL)
/* There is a mismatch here.
* ALSA expects 1 for internal speaker.
* But internally, we may give 2 for internal speaker.
*/
if (scard_ops->output_dev_id == MONO_EARPIECE ||
scard_ops->output_dev_id == INTERNAL_SPKR)
uval->value.enumerated.item[0] = MONO_EARPIECE;
else if (scard_ops->output_dev_id == STEREO_HEADPHONE)
uval->value.enumerated.item[0] =
STEREO_HEADPHONE;
else
return -EINVAL;
else if (kcontrol->id.numid == INPUT_SEL)
uval->value.enumerated.item[0] =
scard_ops->input_dev_id;
else
return -EINVAL;
} else } else
uval->value.enumerated.item[0] = kcontrol->private_value; uval->value.enumerated.item[0] = kcontrol->private_value;
return 0; return 0;
......
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