Skip to content

Commit 7c00529

Browse files
committed
ALSA: hda/ca0132: Use standard HD-audio quirk matching helpers
CA0132 used the PCI SSID lookup helper that doesn't support the model string matching or quirk aliasing. Replace it with the standard HD-audio quirk helpers for supporting those, and add the definition of the model strings for supported quirks, too. There should be no visible change to the outside for the working system, but the driver will parse the model option and apply the quirk based on it from now on. Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 82fdcf9 commit 7c00529

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

sound/pci/hda/patch_ca0132.c

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,6 @@ struct ca0132_spec {
11341134

11351135
struct hda_codec *codec;
11361136
struct delayed_work unsol_hp_work;
1137-
int quirk;
11381137

11391138
#ifdef ENABLE_TUNING_CONTROLS
11401139
long cur_ctl_vals[TUNING_CTLS_COUNT];
@@ -1166,7 +1165,6 @@ struct ca0132_spec {
11661165
* CA0132 quirks table
11671166
*/
11681167
enum {
1169-
QUIRK_NONE,
11701168
QUIRK_ALIENWARE,
11711169
QUIRK_ALIENWARE_M17XR4,
11721170
QUIRK_SBZ,
@@ -1176,10 +1174,11 @@ enum {
11761174
QUIRK_R3D,
11771175
QUIRK_AE5,
11781176
QUIRK_AE7,
1177+
QUIRK_NONE = HDA_FIXUP_ID_NOT_SET,
11791178
};
11801179

11811180
#ifdef CONFIG_PCI
1182-
#define ca0132_quirk(spec) ((spec)->quirk)
1181+
#define ca0132_quirk(spec) ((spec)->codec->fixup_id)
11831182
#define ca0132_use_pci_mmio(spec) ((spec)->use_pci_mmio)
11841183
#define ca0132_use_alt_functions(spec) ((spec)->use_alt_functions)
11851184
#define ca0132_use_alt_controls(spec) ((spec)->use_alt_controls)
@@ -1293,7 +1292,7 @@ static const struct hda_pintbl ae7_pincfgs[] = {
12931292
{}
12941293
};
12951294

1296-
static const struct snd_pci_quirk ca0132_quirks[] = {
1295+
static const struct hda_quirk ca0132_quirks[] = {
12971296
SND_PCI_QUIRK(0x1028, 0x057b, "Alienware M17x R4", QUIRK_ALIENWARE_M17XR4),
12981297
SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15 2015", QUIRK_ALIENWARE),
12991298
SND_PCI_QUIRK(0x1028, 0x0688, "Alienware 17 2015", QUIRK_ALIENWARE),
@@ -1316,6 +1315,19 @@ static const struct snd_pci_quirk ca0132_quirks[] = {
13161315
{}
13171316
};
13181317

1318+
static const struct hda_model_fixup ca0132_quirk_models[] = {
1319+
{ .id = QUIRK_ALIENWARE, .name = "alienware" },
1320+
{ .id = QUIRK_ALIENWARE_M17XR4, .name = "alienware-m17xr4" },
1321+
{ .id = QUIRK_SBZ, .name = "sbz" },
1322+
{ .id = QUIRK_ZXR, .name = "zxr" },
1323+
{ .id = QUIRK_ZXR_DBPRO, .name = "zxr-dbpro" },
1324+
{ .id = QUIRK_R3DI, .name = "r3di" },
1325+
{ .id = QUIRK_R3D, .name = "r3d" },
1326+
{ .id = QUIRK_AE5, .name = "ae5" },
1327+
{ .id = QUIRK_AE7, .name = "ae7" },
1328+
{}
1329+
};
1330+
13191331
/* Output selection quirk info structures. */
13201332
#define MAX_QUIRK_MMIO_GPIO_SET_VALS 3
13211333
#define MAX_QUIRK_SCP_SET_VALS 2
@@ -9957,17 +9969,15 @@ static int ca0132_prepare_verbs(struct hda_codec *codec)
99579969
*/
99589970
static void sbz_detect_quirk(struct hda_codec *codec)
99599971
{
9960-
struct ca0132_spec *spec = codec->spec;
9961-
99629972
switch (codec->core.subsystem_id) {
99639973
case 0x11020033:
9964-
spec->quirk = QUIRK_ZXR;
9974+
codec->fixup_id = QUIRK_ZXR;
99659975
break;
99669976
case 0x1102003f:
9967-
spec->quirk = QUIRK_ZXR_DBPRO;
9977+
codec->fixup_id = QUIRK_ZXR_DBPRO;
99689978
break;
99699979
default:
9970-
spec->quirk = QUIRK_SBZ;
9980+
codec->fixup_id = QUIRK_SBZ;
99719981
break;
99729982
}
99739983
}
@@ -9976,7 +9986,6 @@ static int patch_ca0132(struct hda_codec *codec)
99769986
{
99779987
struct ca0132_spec *spec;
99789988
int err;
9979-
const struct snd_pci_quirk *quirk;
99809989

99819990
codec_dbg(codec, "patch_ca0132\n");
99829991

@@ -9987,11 +9996,7 @@ static int patch_ca0132(struct hda_codec *codec)
99879996
spec->codec = codec;
99889997

99899998
/* Detect codec quirk */
9990-
quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks);
9991-
if (quirk)
9992-
spec->quirk = quirk->value;
9993-
else
9994-
spec->quirk = QUIRK_NONE;
9999+
snd_hda_pick_fixup(codec, ca0132_quirk_models, ca0132_quirks, NULL);
999510000
if (ca0132_quirk(spec) == QUIRK_SBZ)
999610001
sbz_detect_quirk(codec);
999710002

@@ -10068,7 +10073,7 @@ static int patch_ca0132(struct hda_codec *codec)
1006810073
spec->mem_base = pci_iomap(codec->bus->pci, 2, 0xC20);
1006910074
if (spec->mem_base == NULL) {
1007010075
codec_warn(codec, "pci_iomap failed! Setting quirk to QUIRK_NONE.");
10071-
spec->quirk = QUIRK_NONE;
10076+
codec->fixup_id = QUIRK_NONE;
1007210077
}
1007310078
}
1007410079
#endif

0 commit comments

Comments
 (0)