Commit a4eed138 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] hda-codec - Fix number of pin widgets with STAC codecs

Use ARRAY_SIZE() to calculate the number of pin widgets for each codec
chip.
This also fixes a typo in STAC9205 code that gives a wrong number (14
instead of 12), which resulted in fatal communication errors.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 47a2327e
...@@ -1958,7 +1958,7 @@ static int patch_stac9200(struct hda_codec *codec) ...@@ -1958,7 +1958,7 @@ static int patch_stac9200(struct hda_codec *codec)
return -ENOMEM; return -ENOMEM;
codec->spec = spec; codec->spec = spec;
spec->num_pins = 8; spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
spec->pin_nids = stac9200_pin_nids; spec->pin_nids = stac9200_pin_nids;
spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
stac9200_models, stac9200_models,
...@@ -2008,7 +2008,7 @@ static int patch_stac925x(struct hda_codec *codec) ...@@ -2008,7 +2008,7 @@ static int patch_stac925x(struct hda_codec *codec)
return -ENOMEM; return -ENOMEM;
codec->spec = spec; codec->spec = spec;
spec->num_pins = 8; spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
spec->pin_nids = stac925x_pin_nids; spec->pin_nids = stac925x_pin_nids;
spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
stac925x_models, stac925x_models,
...@@ -2080,7 +2080,7 @@ static int patch_stac922x(struct hda_codec *codec) ...@@ -2080,7 +2080,7 @@ static int patch_stac922x(struct hda_codec *codec)
return -ENOMEM; return -ENOMEM;
codec->spec = spec; codec->spec = spec;
spec->num_pins = 10; spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
spec->pin_nids = stac922x_pin_nids; spec->pin_nids = stac922x_pin_nids;
spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
stac922x_models, stac922x_models,
...@@ -2181,7 +2181,7 @@ static int patch_stac927x(struct hda_codec *codec) ...@@ -2181,7 +2181,7 @@ static int patch_stac927x(struct hda_codec *codec)
return -ENOMEM; return -ENOMEM;
codec->spec = spec; codec->spec = spec;
spec->num_pins = 14; spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
spec->pin_nids = stac927x_pin_nids; spec->pin_nids = stac927x_pin_nids;
spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
stac927x_models, stac927x_models,
...@@ -2266,7 +2266,7 @@ static int patch_stac9205(struct hda_codec *codec) ...@@ -2266,7 +2266,7 @@ static int patch_stac9205(struct hda_codec *codec)
return -ENOMEM; return -ENOMEM;
codec->spec = spec; codec->spec = spec;
spec->num_pins = 14; spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
spec->pin_nids = stac9205_pin_nids; spec->pin_nids = stac9205_pin_nids;
spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS, spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
stac9205_models, stac9205_models,
......
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