summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_cs8409.h
diff options
context:
space:
mode:
authorLucas Tanure <tanureal@opensource.cirrus.com>2021-08-11 20:56:39 +0200
committerTakashi Iwai <tiwai@suse.de>2021-08-12 13:41:47 +0200
commitb2a887748e518b1c355e244ff847293a1bf39c64 (patch)
treeb9bbed25de283ef175ef6e035993c065bdcb429b /sound/pci/hda/patch_cs8409.h
parentALSA: hda/cs8409: Prevent I2C access during suspend time (diff)
downloadlinux-b2a887748e518b1c355e244ff847293a1bf39c64.tar.xz
linux-b2a887748e518b1c355e244ff847293a1bf39c64.zip
ALSA: hda/cs8409: Generalize volume controls
Use amp offsets as indexes for saved volumes. Remove dependencies on NID inside volume control functions. Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210811185654.6837-13-vitalyr@opensource.cirrus.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_cs8409.h')
-rw-r--r--sound/pci/hda/patch_cs8409.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/sound/pci/hda/patch_cs8409.h b/sound/pci/hda/patch_cs8409.h
index 0f2084b6ec8e..bf0e8a4cc4cc 100644
--- a/sound/pci/hda/patch_cs8409.h
+++ b/sound/pci/hda/patch_cs8409.h
@@ -215,16 +215,17 @@ enum cs8409_coefficient_index_registers {
/* CS42L42 Specific Definitions */
-#define CS42L42_HP_CH (2U)
-#define CS42L42_HS_MIC_CH (1U)
+#define CS42L42_VOLUMES (4U)
#define CS8409_CS42L42_HP_VOL_REAL_MIN (-63)
#define CS8409_CS42L42_HP_VOL_REAL_MAX (0)
#define CS8409_CS42L42_AMIC_VOL_REAL_MIN (-97)
#define CS8409_CS42L42_AMIC_VOL_REAL_MAX (12)
-#define CS8409_CS42L42_REG_HS_VOLUME_CHA (0x2301)
-#define CS8409_CS42L42_REG_HS_VOLUME_CHB (0x2303)
-#define CS8409_CS42L42_REG_AMIC_VOLUME (0x1D03)
+#define CS8409_CS42L42_REG_HS_VOL_CHA (0x2301)
+#define CS8409_CS42L42_REG_HS_VOL_CHB (0x2303)
+#define CS8409_CS42L42_REG_HS_VOL_MASK (0x003F)
+#define CS8409_CS42L42_REG_AMIC_VOL (0x1D03)
+#define CS8409_CS42L42_REG_AMIC_VOL_MASK (0x00FF)
#define CS42L42_HSDET_AUTO_DONE (0x02)
#define CS42L42_HSTYPE_MASK (0x03)
#define CS42L42_JACK_INSERTED (0x0C)
@@ -248,6 +249,11 @@ enum {
CS8409_FIXUPS,
};
+enum {
+ CS42L42_VOL_ADC,
+ CS42L42_VOL_DAC,
+};
+
struct cs8409_i2c_param {
unsigned int addr;
unsigned int reg;
@@ -268,10 +274,8 @@ struct cs8409_spec {
unsigned int cs42l42_hp_jack_in:1;
unsigned int cs42l42_mic_jack_in:1;
- unsigned int cs42l42_volume_init:1;
unsigned int cs42l42_suspended:1;
- char cs42l42_hp_volume[CS42L42_HP_CH];
- char cs42l42_hs_mic_volume[CS42L42_HS_MIC_CH];
+ s8 vol[CS42L42_VOLUMES];
struct mutex cs8409_i2c_mux;
@@ -280,6 +284,13 @@ struct cs8409_spec {
unsigned int *res);
};
+extern const struct snd_kcontrol_new cs42l42_dac_volume_mixer;
+extern const struct snd_kcontrol_new cs42l42_adc_volume_mixer;
+
+int cs8409_cs42l42_volume_info(struct snd_kcontrol *kctrl, struct snd_ctl_elem_info *uinfo);
+int cs8409_cs42l42_volume_get(struct snd_kcontrol *kctrl, struct snd_ctl_elem_value *uctrl);
+int cs8409_cs42l42_volume_put(struct snd_kcontrol *kctrl, struct snd_ctl_elem_value *uctrl);
+
extern const struct snd_pci_quirk cs8409_fixup_tbl[];
extern const struct hda_model_fixup cs8409_models[];
extern const struct hda_fixup cs8409_fixups[];