Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f164753a authored by Przemyslaw Bruski's avatar Przemyslaw Bruski Committed by Takashi Iwai
Browse files

ALSA: ctxfi - Fix SPDIF status retrieval



SDPIF status retrieval always returned the default settings instead of
the actual ones.

Signed-off-by: default avatarPrzemyslaw Bruski <pbruskispam@op.pl>
Cc: <stable@kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 4c1847e8
Loading
Loading
Loading
Loading
+5 −14
Original line number Original line Diff line number Diff line
@@ -566,19 +566,6 @@ static int ct_spdif_get_mask(struct snd_kcontrol *kcontrol,
	return 0;
	return 0;
}
}


static int ct_spdif_default_get(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_value *ucontrol)
{
	unsigned int status = SNDRV_PCM_DEFAULT_CON_SPDIF;

	ucontrol->value.iec958.status[0] = (status >> 0) & 0xff;
	ucontrol->value.iec958.status[1] = (status >> 8) & 0xff;
	ucontrol->value.iec958.status[2] = (status >> 16) & 0xff;
	ucontrol->value.iec958.status[3] = (status >> 24) & 0xff;

	return 0;
}

static int ct_spdif_get(struct snd_kcontrol *kcontrol,
static int ct_spdif_get(struct snd_kcontrol *kcontrol,
			struct snd_ctl_elem_value *ucontrol)
			struct snd_ctl_elem_value *ucontrol)
{
{
@@ -586,6 +573,10 @@ static int ct_spdif_get(struct snd_kcontrol *kcontrol,
	unsigned int status;
	unsigned int status;


	atc->spdif_out_get_status(atc, &status);
	atc->spdif_out_get_status(atc, &status);

	if (status == 0)
		status = SNDRV_PCM_DEFAULT_CON_SPDIF;

	ucontrol->value.iec958.status[0] = (status >> 0) & 0xff;
	ucontrol->value.iec958.status[0] = (status >> 0) & 0xff;
	ucontrol->value.iec958.status[1] = (status >> 8) & 0xff;
	ucontrol->value.iec958.status[1] = (status >> 8) & 0xff;
	ucontrol->value.iec958.status[2] = (status >> 16) & 0xff;
	ucontrol->value.iec958.status[2] = (status >> 16) & 0xff;
@@ -629,7 +620,7 @@ static struct snd_kcontrol_new iec958_default_ctl = {
	.name		= SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT),
	.name		= SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT),
	.count		= 1,
	.count		= 1,
	.info		= ct_spdif_info,
	.info		= ct_spdif_info,
	.get		= ct_spdif_default_get,
	.get		= ct_spdif_get,
	.put		= ct_spdif_put,
	.put		= ct_spdif_put,
	.private_value	= MIXER_IEC958_DEFAULT
	.private_value	= MIXER_IEC958_DEFAULT
};
};