Skip to content

Commit

Permalink
ALSA: oxygen: do not create useless S/PDIF controls
Browse files Browse the repository at this point in the history
Cards without S/PDIF output do not need those controls.

Signed-off-by: Clemens Ladisch <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
cladisch authored and tiwai committed Jan 16, 2015
1 parent 7046245 commit 20eb26a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sound/pci/oxygen/oxygen_mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,9 @@ static const struct snd_kcontrol_new controls[] = {
.get = upmix_get,
.put = upmix_put,
},
};

static const struct snd_kcontrol_new spdif_output_controls[] = {
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, SWITCH),
Expand Down Expand Up @@ -1073,6 +1076,12 @@ int oxygen_mixer_init(struct oxygen *chip)
err = add_controls(chip, controls, ARRAY_SIZE(controls));
if (err < 0)
return err;
if (chip->model.device_config & PLAYBACK_1_TO_SPDIF) {
err = add_controls(chip, spdif_output_controls,
ARRAY_SIZE(spdif_output_controls));
if (err < 0)
return err;
}
if (chip->model.device_config & CAPTURE_1_FROM_SPDIF) {
err = add_controls(chip, spdif_input_controls,
ARRAY_SIZE(spdif_input_controls));
Expand Down

0 comments on commit 20eb26a

Please sign in to comment.