Commit 91b94a93 authored by Connor McAdams's avatar Connor McAdams Committed by Takashi Iwai

ALSA: hda/ca0132 - Add output selection for SoundBlaster AE-7.

Add output selection quirk table information for SoundBlaster AE-7, and
slightly modify the AE-5's ca0113 command table to accommodate the AE-7.
Signed-off-by: default avatarConnor McAdams <conmanx360@gmail.com>
Link: https://lore.kernel.org/r/20200825201040.30339-18-conmanx360@gmail.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent e5b21888
...@@ -727,22 +727,29 @@ static const struct ct_dsp_volume_ctl ca0132_alt_vol_ctls[] = { ...@@ -727,22 +727,29 @@ static const struct ct_dsp_volume_ctl ca0132_alt_vol_ctls[] = {
}; };
/* Values for ca0113_mmio_command_set for selecting output. */ /* Values for ca0113_mmio_command_set for selecting output. */
#define AE5_CA0113_OUT_SET_COMMANDS 6 #define AE_CA0113_OUT_SET_COMMANDS 6
struct ae5_ca0113_output_set { struct ae_ca0113_output_set {
unsigned int group[AE5_CA0113_OUT_SET_COMMANDS]; unsigned int group[AE_CA0113_OUT_SET_COMMANDS];
unsigned int target[AE5_CA0113_OUT_SET_COMMANDS]; unsigned int target[AE_CA0113_OUT_SET_COMMANDS];
unsigned int vals[AE5_CA0113_OUT_SET_COMMANDS]; unsigned int vals[NUM_OF_OUTPUTS][AE_CA0113_OUT_SET_COMMANDS];
}; };
static const struct ae5_ca0113_output_set ae5_ca0113_output_presets[] = { static const struct ae_ca0113_output_set ae5_ca0113_output_presets = {
{ .group = { 0x30, 0x30, 0x48, 0x48, 0x48, 0x30 }, .group = { 0x30, 0x30, 0x48, 0x48, 0x48, 0x30 },
.target = { 0x2e, 0x30, 0x0d, 0x17, 0x19, 0x32 }, .target = { 0x2e, 0x30, 0x0d, 0x17, 0x19, 0x32 },
.vals = { 0x00, 0x00, 0x40, 0x00, 0x00, 0x3f } /* Speakers. */
}, .vals = { { 0x00, 0x00, 0x40, 0x00, 0x00, 0x3f },
{ .group = { 0x30, 0x30, 0x48, 0x48, 0x48, 0x30 }, /* Headphones. */
{ 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00 } },
};
static const struct ae_ca0113_output_set ae7_ca0113_output_presets = {
.group = { 0x30, 0x30, 0x48, 0x48, 0x48, 0x30 },
.target = { 0x2e, 0x30, 0x0d, 0x17, 0x19, 0x32 }, .target = { 0x2e, 0x30, 0x0d, 0x17, 0x19, 0x32 },
.vals = { 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00 } /* Speakers. */
} .vals = { { 0x00, 0x00, 0x40, 0x00, 0x00, 0x3f },
/* Headphones. */
{ 0x3f, 0x3f, 0x00, 0x00, 0x02, 0x00 } },
}; };
/* ae5 ca0113 command sequences to set headphone gain levels. */ /* ae5 ca0113 command sequences to set headphone gain levels. */
...@@ -1427,6 +1434,41 @@ static const struct ca0132_alt_out_set_quirk_data quirk_out_set_data[] = { ...@@ -1427,6 +1434,41 @@ static const struct ca0132_alt_out_set_quirk_data quirk_out_set_data[] = {
.chipio_write_addr = 0x0018b03c, .chipio_write_addr = 0x0018b03c,
.chipio_write_data = 0x00000012 .chipio_write_data = 0x00000012
} }, } },
},
{ .quirk_id = QUIRK_AE7,
.has_headphone_gain = true,
.is_ae_series = true,
.out_set_info = {
/* Speakers. */
{ .dac2port = 0x58,
.has_hda_gpio = false,
.mmio_gpio_count = 1,
.mmio_gpio_pin = { 0 },
.mmio_gpio_set = { 1 },
.scp_cmds_count = 2,
.scp_cmd_mid = { 0x96, 0x96 },
.scp_cmd_req = { SPEAKER_TUNING_FRONT_LEFT_INVERT,
SPEAKER_TUNING_FRONT_RIGHT_INVERT },
.scp_cmd_val = { FLOAT_ZERO, FLOAT_ZERO },
.has_chipio_write = true,
.chipio_write_addr = 0x0018b03c,
.chipio_write_data = 0x00000000
},
/* Headphones. */
{ .dac2port = 0x58,
.has_hda_gpio = false,
.mmio_gpio_count = 1,
.mmio_gpio_pin = { 0 },
.mmio_gpio_set = { 1 },
.scp_cmds_count = 2,
.scp_cmd_mid = { 0x96, 0x96 },
.scp_cmd_req = { SPEAKER_TUNING_FRONT_LEFT_INVERT,
SPEAKER_TUNING_FRONT_RIGHT_INVERT },
.scp_cmd_val = { FLOAT_ONE, FLOAT_ONE },
.has_chipio_write = true,
.chipio_write_addr = 0x0018b03c,
.chipio_write_data = 0x00000010
} },
} }
}; };
...@@ -4383,18 +4425,24 @@ static int ca0132_effects_set(struct hda_codec *codec, hda_nid_t nid, long val); ...@@ -4383,18 +4425,24 @@ static int ca0132_effects_set(struct hda_codec *codec, hda_nid_t nid, long val);
static void ae5_mmio_select_out(struct hda_codec *codec) static void ae5_mmio_select_out(struct hda_codec *codec)
{ {
struct ca0132_spec *spec = codec->spec; struct ca0132_spec *spec = codec->spec;
const struct ae_ca0113_output_set *out_cmds;
unsigned int i; unsigned int i;
for (i = 0; i < AE5_CA0113_OUT_SET_COMMANDS; i++) if (ca0132_quirk(spec) == QUIRK_AE5)
ca0113_mmio_command_set(codec, out_cmds = &ae5_ca0113_output_presets;
ae5_ca0113_output_presets[spec->cur_out_type].group[i], else
ae5_ca0113_output_presets[spec->cur_out_type].target[i], out_cmds = &ae7_ca0113_output_presets;
ae5_ca0113_output_presets[spec->cur_out_type].vals[i]);
for (i = 0; i < AE_CA0113_OUT_SET_COMMANDS; i++)
ca0113_mmio_command_set(codec, out_cmds->group[i],
out_cmds->target[i],
out_cmds->vals[spec->cur_out_type][i]);
} }
static int ca0132_alt_set_full_range_speaker(struct hda_codec *codec) static int ca0132_alt_set_full_range_speaker(struct hda_codec *codec)
{ {
struct ca0132_spec *spec = codec->spec; struct ca0132_spec *spec = codec->spec;
int quirk = ca0132_quirk(spec);
unsigned int tmp; unsigned int tmp;
int err; int err;
...@@ -4426,7 +4474,7 @@ static int ca0132_alt_set_full_range_speaker(struct hda_codec *codec) ...@@ -4426,7 +4474,7 @@ static int ca0132_alt_set_full_range_speaker(struct hda_codec *codec)
* Only the AE series cards set this value when setting full-range, * Only the AE series cards set this value when setting full-range,
* and it's always 1.0f. * and it's always 1.0f.
*/ */
if (ca0132_quirk(spec) == QUIRK_AE5) { if (quirk == QUIRK_AE5 || quirk == QUIRK_AE7) {
err = dspio_set_uint_param(codec, 0x96, err = dspio_set_uint_param(codec, 0x96,
SPEAKER_FULL_RANGE_SURROUND_L_R, FLOAT_ONE); SPEAKER_FULL_RANGE_SURROUND_L_R, FLOAT_ONE);
if (err < 0) if (err < 0)
......
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