From: Connor McAdams <conmanx360@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: conmanx360@gmail.com, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
Takashi Sakamoto <o-takashi@sakamocchi.jp>,
Alastair Bridgewater <alastair.bridgewater@gmail.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: [PATCH 10/11] ALSA: hda/ca0132 - Add ZxR 600 ohm gain control
Date: Sat, 29 Sep 2018 23:03:25 -0400 [thread overview]
Message-ID: <1538276607-30234-11-git-send-email-conmanx360@gmail.com> (raw)
In-Reply-To: <1538276607-30234-1-git-send-email-conmanx360@gmail.com>
This patch adds a control for 600 ohm gain on the Sound Blaster ZxR.
Signed-off-by: Connor McAdams <conmanx360@gmail.com>
---
sound/pci/hda/patch_ca0132.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 42 insertions(+), 2 deletions(-)
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index f0781e4..90e6a96 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -154,7 +154,8 @@ enum {
SMART_VOLUME_ENUM,
MIC_BOOST_ENUM,
AE5_HEADPHONE_GAIN_ENUM,
- AE5_SOUND_FILTER_ENUM
+ AE5_SOUND_FILTER_ENUM,
+ ZXR_HEADPHONE_GAIN
#define EFFECTS_COUNT (EFFECT_END_NID - EFFECT_START_NID)
};
@@ -1031,7 +1032,8 @@ struct ca0132_spec {
/* AE-5 Control values */
unsigned char ae5_headphone_gain_val;
unsigned char ae5_filter_val;
-
+ /* ZxR Control Values */
+ unsigned char zxr_gain_set;
struct hda_codec *codec;
struct delayed_work unsol_hp_work;
@@ -4142,6 +4144,7 @@ static int ca0132_select_out(struct hda_codec *codec)
}
static int ae5_headphone_gain_set(struct hda_codec *codec, long val);
+static int zxr_headphone_gain_set(struct hda_codec *codec, long val);
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)
@@ -4178,6 +4181,7 @@ static void ca0132_alt_select_out_quirk_handler(struct hda_codec *codec)
ca0113_mmio_gpio_set(codec, 2, true);
ca0113_mmio_gpio_set(codec, 3, true);
ca0113_mmio_gpio_set(codec, 5, false);
+ zxr_headphone_gain_set(codec, 0);
chipio_set_control_param(codec, 0x0d, 0x24);
break;
case QUIRK_R3DI:
@@ -4211,6 +4215,7 @@ static void ca0132_alt_select_out_quirk_handler(struct hda_codec *codec)
ca0113_mmio_gpio_set(codec, 2, false);
ca0113_mmio_gpio_set(codec, 3, false);
ca0113_mmio_gpio_set(codec, 5, true);
+ zxr_headphone_gain_set(codec, spec->zxr_gain_set);
chipio_set_control_param(codec, 0x0d, 0x21);
break;
case QUIRK_R3DI:
@@ -4245,6 +4250,7 @@ static void ca0132_alt_select_out_quirk_handler(struct hda_codec *codec)
ca0113_mmio_gpio_set(codec, 2, true);
ca0113_mmio_gpio_set(codec, 3, true);
ca0113_mmio_gpio_set(codec, 5, false);
+ zxr_headphone_gain_set(codec, 0);
chipio_set_control_param(codec, 0x0d, 0x24);
break;
case QUIRK_R3DI:
@@ -5019,6 +5025,17 @@ static int ae5_headphone_gain_set(struct hda_codec *codec, long val)
return 0;
}
+/*
+ * gpio pin 1 is a relay that switches on/off, apparently setting the headphone
+ * amplifier to handle a 600 ohm load.
+ */
+static int zxr_headphone_gain_set(struct hda_codec *codec, long val)
+{
+ ca0113_mmio_gpio_set(codec, 1, val);
+
+ return 0;
+}
+
static int ca0132_vnode_switch_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
@@ -5777,6 +5794,16 @@ static int ca0132_switch_put(struct snd_kcontrol *kcontrol,
goto exit;
}
+ if (nid == ZXR_HEADPHONE_GAIN) {
+ spec->zxr_gain_set = *valp;
+ if (spec->cur_out_type == HEADPHONE_OUT)
+ changed = zxr_headphone_gain_set(codec, *valp);
+ else
+ changed = 0;
+
+ goto exit;
+ }
+
exit:
snd_hda_power_down(codec);
return changed;
@@ -6185,6 +6212,16 @@ static int ae5_add_sound_filter_enum(struct hda_codec *codec)
snd_ctl_new1(&knew, codec));
}
+static int zxr_add_headphone_gain_switch(struct hda_codec *codec)
+{
+ struct snd_kcontrol_new knew =
+ CA0132_CODEC_MUTE_MONO("ZxR: 600 Ohm Gain",
+ ZXR_HEADPHONE_GAIN, 1, HDA_OUTPUT);
+
+ return snd_hda_ctl_add(codec, ZXR_HEADPHONE_GAIN,
+ snd_ctl_new1(&knew, codec));
+}
+
/*
* Need to create slave controls for the alternate codecs that have surround
* capabilities.
@@ -6415,6 +6452,9 @@ static int ca0132_build_controls(struct hda_codec *codec)
ae5_add_headphone_gain_enum(codec);
ae5_add_sound_filter_enum(codec);
}
+
+ if (spec->quirk == QUIRK_ZXR)
+ zxr_add_headphone_gain_switch(codec);
#ifdef ENABLE_TUNING_CONTROLS
add_tuning_ctls(codec);
#endif
--
2.7.4
next prev parent reply other threads:[~2018-09-30 3:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-30 3:03 [PATCH 00/11] Add ZxR support + bugfixes Connor McAdams
2018-09-30 3:03 ` [PATCH 01/11] ALSA: hda/ca0132 - Fix AE-5 control type Connor McAdams
2018-09-30 3:03 ` [PATCH 02/11] ALSA: hda/ca0132 - Fix surround sound with output effects Connor McAdams
2018-09-30 3:03 ` [PATCH 03/11] ALSA: hda/ca0132 - Add ZxR quirks + new quirk check function Connor McAdams
2018-09-30 3:03 ` [PATCH 04/11] ALSA: hda/ca0132 - Add ZxR pincfg Connor McAdams
2018-09-30 3:03 ` [PATCH 05/11] ALSA: hda/ca0132 - Add DBpro hda_codec_ops Connor McAdams
2018-10-01 2:10 ` Takashi Sakamoto
2018-09-30 3:03 ` [PATCH 06/11] ALSA: hda/ca0132 - Add ZxR init commands Connor McAdams
2018-09-30 3:03 ` [PATCH 07/11] ALSA: hda/ca0132 - Add ZxR DSP post-download commands Connor McAdams
2018-09-30 3:03 ` [PATCH 08/11] ALSA: hda/ca0132 - Add ZxR input/output select commands Connor McAdams
2018-09-30 3:03 ` [PATCH 09/11] ALSA: hda/ca0132 - Remove input select enum for ZxR Connor McAdams
2018-09-30 3:03 ` Connor McAdams [this message]
2018-10-01 2:22 ` [PATCH 10/11] ALSA: hda/ca0132 - Add ZxR 600 ohm gain control Takashi Sakamoto
2018-09-30 3:03 ` [PATCH 11/11] ALSA: hda/ca0132 - Add ZxR exit commands Connor McAdams
2018-10-01 14:03 ` [PATCH 00/11] Add ZxR support + bugfixes Takashi Sakamoto
2018-10-02 15:23 ` Takashi Iwai
2018-10-07 17:05 ` Connor McAdams
2018-10-08 15:10 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1538276607-30234-11-git-send-email-conmanx360@gmail.com \
--to=conmanx360@gmail.com \
--cc=alastair.bridgewater@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=o-takashi@sakamocchi.jp \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome