Skip to content

Commit dec9613

Browse files
committed
ALSA: hda/conexant: Rewrite to new probe method
Convert the Conexant codec driver to use the new hda_codec_ops probe. No functional changes. Signed-off-by: Takashi Iwai <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent e4c9f52 commit dec9613

File tree

1 file changed

+53
-51
lines changed

1 file changed

+53
-51
lines changed

sound/hda/codecs/conexant.c

Lines changed: 53 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
22
/*
3-
* HD audio interface patch for Conexant HDA audio codec
3+
* HD audio codec driver for Conexant HDA audio codec
44
*
55
* Copyright (c) 2006 Pototskiy Akex <[email protected]>
66
* Takashi Iwai <[email protected]>
@@ -185,7 +185,7 @@ static void cx_fixup_headset_recog(struct hda_codec *codec)
185185
snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20);
186186
}
187187

188-
static int cx_auto_init(struct hda_codec *codec)
188+
static int cx_init(struct hda_codec *codec)
189189
{
190190
struct conexant_spec *spec = codec->spec;
191191
snd_hda_gen_init(codec);
@@ -210,10 +210,10 @@ static void cx_auto_shutdown(struct hda_codec *codec)
210210
cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
211211
}
212212

213-
static void cx_auto_free(struct hda_codec *codec)
213+
static void cx_remove(struct hda_codec *codec)
214214
{
215215
cx_auto_shutdown(codec);
216-
snd_hda_gen_free(codec);
216+
snd_hda_gen_remove(codec);
217217
}
218218

219219
static void cx_process_headset_plugin(struct hda_codec *codec)
@@ -258,22 +258,12 @@ static void cx_update_headset_mic_vref(struct hda_codec *codec, struct hda_jack_
258258
cx_process_headset_plugin(codec);
259259
}
260260

261-
static int cx_auto_suspend(struct hda_codec *codec)
261+
static int cx_suspend(struct hda_codec *codec)
262262
{
263263
cx_auto_shutdown(codec);
264264
return 0;
265265
}
266266

267-
static const struct hda_codec_ops cx_auto_patch_ops = {
268-
.build_controls = snd_hda_gen_build_controls,
269-
.build_pcms = snd_hda_gen_build_pcms,
270-
.init = cx_auto_init,
271-
.free = cx_auto_free,
272-
.unsol_event = snd_hda_jack_unsol_event,
273-
.suspend = cx_auto_suspend,
274-
.check_power_status = snd_hda_gen_check_power_status,
275-
};
276-
277267
/*
278268
* pin fix-up
279269
*/
@@ -1178,7 +1168,7 @@ static void add_cx5051_fake_mutes(struct hda_codec *codec)
11781168
spec->gen.dac_min_mute = true;
11791169
}
11801170

1181-
static int patch_conexant_auto(struct hda_codec *codec)
1171+
static int cx_probe(struct hda_codec *codec, const struct hda_device_id *id)
11821172
{
11831173
struct conexant_spec *spec;
11841174
int err;
@@ -1190,7 +1180,6 @@ static int patch_conexant_auto(struct hda_codec *codec)
11901180
return -ENOMEM;
11911181
snd_hda_gen_spec_init(&spec->gen);
11921182
codec->spec = spec;
1193-
codec->patch_ops = cx_auto_patch_ops;
11941183

11951184
/* init cx11880/sn6140 flag and reset headset_present_flag */
11961185
switch (codec->core.vendor_id) {
@@ -1276,47 +1265,59 @@ static int patch_conexant_auto(struct hda_codec *codec)
12761265
return 0;
12771266

12781267
error:
1279-
cx_auto_free(codec);
1268+
cx_remove(codec);
12801269
return err;
12811270
}
12821271

1272+
static const struct hda_codec_ops cx_codec_ops = {
1273+
.probe = cx_probe,
1274+
.remove = cx_remove,
1275+
.build_controls = snd_hda_gen_build_controls,
1276+
.build_pcms = snd_hda_gen_build_pcms,
1277+
.init = cx_init,
1278+
.unsol_event = snd_hda_jack_unsol_event,
1279+
.suspend = cx_suspend,
1280+
.check_power_status = snd_hda_gen_check_power_status,
1281+
.stream_pm = snd_hda_gen_stream_pm,
1282+
};
1283+
12831284
/*
12841285
*/
12851286

12861287
static const struct hda_device_id snd_hda_id_conexant[] = {
1287-
HDA_CODEC_ENTRY(0x14f11f86, "CX11880", patch_conexant_auto),
1288-
HDA_CODEC_ENTRY(0x14f11f87, "SN6140", patch_conexant_auto),
1289-
HDA_CODEC_ENTRY(0x14f12008, "CX8200", patch_conexant_auto),
1290-
HDA_CODEC_ENTRY(0x14f120d0, "CX11970", patch_conexant_auto),
1291-
HDA_CODEC_ENTRY(0x14f120d1, "SN6180", patch_conexant_auto),
1292-
HDA_CODEC_ENTRY(0x14f15045, "CX20549 (Venice)", patch_conexant_auto),
1293-
HDA_CODEC_ENTRY(0x14f15047, "CX20551 (Waikiki)", patch_conexant_auto),
1294-
HDA_CODEC_ENTRY(0x14f15051, "CX20561 (Hermosa)", patch_conexant_auto),
1295-
HDA_CODEC_ENTRY(0x14f15066, "CX20582 (Pebble)", patch_conexant_auto),
1296-
HDA_CODEC_ENTRY(0x14f15067, "CX20583 (Pebble HSF)", patch_conexant_auto),
1297-
HDA_CODEC_ENTRY(0x14f15068, "CX20584", patch_conexant_auto),
1298-
HDA_CODEC_ENTRY(0x14f15069, "CX20585", patch_conexant_auto),
1299-
HDA_CODEC_ENTRY(0x14f1506c, "CX20588", patch_conexant_auto),
1300-
HDA_CODEC_ENTRY(0x14f1506e, "CX20590", patch_conexant_auto),
1301-
HDA_CODEC_ENTRY(0x14f15097, "CX20631", patch_conexant_auto),
1302-
HDA_CODEC_ENTRY(0x14f15098, "CX20632", patch_conexant_auto),
1303-
HDA_CODEC_ENTRY(0x14f150a1, "CX20641", patch_conexant_auto),
1304-
HDA_CODEC_ENTRY(0x14f150a2, "CX20642", patch_conexant_auto),
1305-
HDA_CODEC_ENTRY(0x14f150ab, "CX20651", patch_conexant_auto),
1306-
HDA_CODEC_ENTRY(0x14f150ac, "CX20652", patch_conexant_auto),
1307-
HDA_CODEC_ENTRY(0x14f150b8, "CX20664", patch_conexant_auto),
1308-
HDA_CODEC_ENTRY(0x14f150b9, "CX20665", patch_conexant_auto),
1309-
HDA_CODEC_ENTRY(0x14f150f1, "CX21722", patch_conexant_auto),
1310-
HDA_CODEC_ENTRY(0x14f150f2, "CX20722", patch_conexant_auto),
1311-
HDA_CODEC_ENTRY(0x14f150f3, "CX21724", patch_conexant_auto),
1312-
HDA_CODEC_ENTRY(0x14f150f4, "CX20724", patch_conexant_auto),
1313-
HDA_CODEC_ENTRY(0x14f1510f, "CX20751/2", patch_conexant_auto),
1314-
HDA_CODEC_ENTRY(0x14f15110, "CX20751/2", patch_conexant_auto),
1315-
HDA_CODEC_ENTRY(0x14f15111, "CX20753/4", patch_conexant_auto),
1316-
HDA_CODEC_ENTRY(0x14f15113, "CX20755", patch_conexant_auto),
1317-
HDA_CODEC_ENTRY(0x14f15114, "CX20756", patch_conexant_auto),
1318-
HDA_CODEC_ENTRY(0x14f15115, "CX20757", patch_conexant_auto),
1319-
HDA_CODEC_ENTRY(0x14f151d7, "CX20952", patch_conexant_auto),
1288+
HDA_CODEC_ID(0x14f11f86, "CX11880"),
1289+
HDA_CODEC_ID(0x14f11f87, "SN6140"),
1290+
HDA_CODEC_ID(0x14f12008, "CX8200"),
1291+
HDA_CODEC_ID(0x14f120d0, "CX11970"),
1292+
HDA_CODEC_ID(0x14f120d1, "SN6180"),
1293+
HDA_CODEC_ID(0x14f15045, "CX20549 (Venice)"),
1294+
HDA_CODEC_ID(0x14f15047, "CX20551 (Waikiki)"),
1295+
HDA_CODEC_ID(0x14f15051, "CX20561 (Hermosa)"),
1296+
HDA_CODEC_ID(0x14f15066, "CX20582 (Pebble)"),
1297+
HDA_CODEC_ID(0x14f15067, "CX20583 (Pebble HSF)"),
1298+
HDA_CODEC_ID(0x14f15068, "CX20584"),
1299+
HDA_CODEC_ID(0x14f15069, "CX20585"),
1300+
HDA_CODEC_ID(0x14f1506c, "CX20588"),
1301+
HDA_CODEC_ID(0x14f1506e, "CX20590"),
1302+
HDA_CODEC_ID(0x14f15097, "CX20631"),
1303+
HDA_CODEC_ID(0x14f15098, "CX20632"),
1304+
HDA_CODEC_ID(0x14f150a1, "CX20641"),
1305+
HDA_CODEC_ID(0x14f150a2, "CX20642"),
1306+
HDA_CODEC_ID(0x14f150ab, "CX20651"),
1307+
HDA_CODEC_ID(0x14f150ac, "CX20652"),
1308+
HDA_CODEC_ID(0x14f150b8, "CX20664"),
1309+
HDA_CODEC_ID(0x14f150b9, "CX20665"),
1310+
HDA_CODEC_ID(0x14f150f1, "CX21722"),
1311+
HDA_CODEC_ID(0x14f150f2, "CX20722"),
1312+
HDA_CODEC_ID(0x14f150f3, "CX21724"),
1313+
HDA_CODEC_ID(0x14f150f4, "CX20724"),
1314+
HDA_CODEC_ID(0x14f1510f, "CX20751/2"),
1315+
HDA_CODEC_ID(0x14f15110, "CX20751/2"),
1316+
HDA_CODEC_ID(0x14f15111, "CX20753/4"),
1317+
HDA_CODEC_ID(0x14f15113, "CX20755"),
1318+
HDA_CODEC_ID(0x14f15114, "CX20756"),
1319+
HDA_CODEC_ID(0x14f15115, "CX20757"),
1320+
HDA_CODEC_ID(0x14f151d7, "CX20952"),
13201321
{} /* terminator */
13211322
};
13221323
MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_conexant);
@@ -1326,6 +1327,7 @@ MODULE_DESCRIPTION("Conexant HD-audio codec");
13261327

13271328
static struct hda_codec_driver conexant_driver = {
13281329
.id = snd_hda_id_conexant,
1330+
.ops = &cx_codec_ops,
13291331
};
13301332

13311333
module_hda_codec_driver(conexant_driver);

0 commit comments

Comments
 (0)