sound fixes for 5.7 (rc8 or final)

Only a few last-minute small fixes: the change in ALSA core hwdep is
 about the undefined behavior of bit shift, which is almost harmless
 but still worth to pick up quickly.  The rest are all device-specific
 fixes for HD-audio and USB-audio, and safe to apply at the late
 stage.
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAl7PcrgOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE8uMRAA1LDDgWLNFSZHMfbN3usHHZryFXfCxUPXtEyi
 /EdNWvLcMmvYb/DftgQLfKk3u3NccNVczD0vCf9by15SgiAKi2++kF9rpA6UdlhC
 MW6xvhsHeEIcIvRyr8q4eddR1UvqDVW+mxlx8f8MtGQKFv6vQmIwWp7MScl9WT4W
 wDy7Tu/lHdYMjlWLEiDExSUIZPOCO7bVb09x1SEjsSZHrcuDuHeKJdhzaAbidmub
 GpsejaxZGY7F558mxfeCSh0fA32AF12LNzQKZwjHO+Ct0au7OIr9YmCtB9DtkriW
 /cUFDhn73Mzf9UgLUakmmFzh0LziTyWFMp8FK5GZALjW4DgtewOS/NHdqO2O345d
 /Yw0hOW58Mww/XYBYCKqgBLTos9QZZSQ4/J63t4FiGu4W0z6LYL7HWgbTAhk9GoE
 sRqmVhVF7XW4Apg/lQ5VKFLvwGvS3Htluv1C25TZqjEUdonwdHxTlhatHmeyDLCV
 pC/LxSwzM49iExPcg0XB+J6Kx+y6iBqofhpd1vgt4N4qd/jDH+jb5e/+U/X+VLCU
 iObQIQQAudwoRrQrRrn3sf47qvkNRYiG+iuSvHmcAqGZdHU64zubPZPXvNwI3hyR
 f/fSJzEsVED52YhUlglRtR5g5IrGeAt2+yvgGi7rsxptA5TIy7rG07lwegSltgOO
 TgF82eE=
 =9XXp
 -----END PGP SIGNATURE-----

Merge tag 'sound-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "Only a few last-minute small fixes: the change in ALSA core hwdep is
  about the undefined behavior of bit shift, which is almost harmless
  but still worth to pick up quickly.

  The rest are all device-specific fixes for HD-audio and USB-audio, and
  safe to apply at the late stage"

* tag 'sound-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda/realtek - Add new codec supported for ALC287
  ALSA: usb-audio: Quirks for Gigabyte TRX40 Aorus Master onboard audio
  ALSA: usb-audio: mixer: volume quirk for ESS Technology Asus USB DAC
  ALSA: hda/realtek - Add a model for Thinkpad T570 without DAC workaround
  ALSA: hwdep: fix a left shifting 1 by 31 UB bug
This commit is contained in:
Linus Torvalds 2020-05-29 13:31:01 -07:00
commit d54b64ef0d
5 changed files with 83 additions and 12 deletions

View File

@ -216,12 +216,12 @@ static int snd_hwdep_dsp_load(struct snd_hwdep *hw,
if (info.index >= 32)
return -EINVAL;
/* check whether the dsp was already loaded */
if (hw->dsp_loaded & (1 << info.index))
if (hw->dsp_loaded & (1u << info.index))
return -EBUSY;
err = hw->ops.dsp_load(hw, &info);
if (err < 0)
return err;
hw->dsp_loaded |= (1 << info.index);
hw->dsp_loaded |= (1u << info.index);
return 0;
}

View File

@ -384,6 +384,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
case 0x10ec0282:
case 0x10ec0283:
case 0x10ec0286:
case 0x10ec0287:
case 0x10ec0288:
case 0x10ec0285:
case 0x10ec0298:
@ -5484,18 +5485,9 @@ static void alc_fixup_tpt470_dock(struct hda_codec *codec,
{ 0x19, 0x21a11010 }, /* dock mic */
{ }
};
/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
* the speaker output becomes too low by some reason on Thinkpads with
* ALC298 codec
*/
static const hda_nid_t preferred_pairs[] = {
0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
0
};
struct alc_spec *spec = codec->spec;
if (action == HDA_FIXUP_ACT_PRE_PROBE) {
spec->gen.preferred_dacs = preferred_pairs;
spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
snd_hda_apply_pincfgs(codec, pincfgs);
} else if (action == HDA_FIXUP_ACT_INIT) {
@ -5508,6 +5500,23 @@ static void alc_fixup_tpt470_dock(struct hda_codec *codec,
}
}
static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
* the speaker output becomes too low by some reason on Thinkpads with
* ALC298 codec
*/
static const hda_nid_t preferred_pairs[] = {
0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
0
};
struct alc_spec *spec = codec->spec;
if (action == HDA_FIXUP_ACT_PRE_PROBE)
spec->gen.preferred_dacs = preferred_pairs;
}
static void alc_shutup_dell_xps13(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
@ -6063,6 +6072,7 @@ enum {
ALC700_FIXUP_INTEL_REFERENCE,
ALC274_FIXUP_DELL_BIND_DACS,
ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
ALC298_FIXUP_TPT470_DOCK_FIX,
ALC298_FIXUP_TPT470_DOCK,
ALC255_FIXUP_DUMMY_LINEOUT_VERB,
ALC255_FIXUP_DELL_HEADSET_MIC,
@ -6994,12 +7004,18 @@ static const struct hda_fixup alc269_fixups[] = {
.chained = true,
.chain_id = ALC274_FIXUP_DELL_BIND_DACS
},
[ALC298_FIXUP_TPT470_DOCK] = {
[ALC298_FIXUP_TPT470_DOCK_FIX] = {
.type = HDA_FIXUP_FUNC,
.v.func = alc_fixup_tpt470_dock,
.chained = true,
.chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
},
[ALC298_FIXUP_TPT470_DOCK] = {
.type = HDA_FIXUP_FUNC,
.v.func = alc_fixup_tpt470_dacs,
.chained = true,
.chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
},
[ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
.type = HDA_FIXUP_PINS,
.v.pins = (const struct hda_pintbl[]) {
@ -7638,6 +7654,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
{.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
@ -8276,6 +8293,7 @@ static int patch_alc269(struct hda_codec *codec)
case 0x10ec0215:
case 0x10ec0245:
case 0x10ec0285:
case 0x10ec0287:
case 0x10ec0289:
spec->codec_variant = ALC269_TYPE_ALC215;
spec->shutup = alc225_shutup;
@ -9554,6 +9572,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = {
HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),

View File

@ -1182,6 +1182,14 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
cval->res = 384;
}
break;
case USB_ID(0x0495, 0x3042): /* ESS Technology Asus USB DAC */
if ((strstr(kctl->id.name, "Playback Volume") != NULL) ||
strstr(kctl->id.name, "Capture Volume") != NULL) {
cval->min >>= 8;
cval->max = 0;
cval->res = 1;
}
break;
}
}

View File

@ -397,6 +397,21 @@ static const struct usbmix_connector_map trx40_mobo_connector_map[] = {
{}
};
/* Rear panel + front mic on Gigabyte TRX40 Aorus Master with ALC1220-VB */
static const struct usbmix_name_map aorus_master_alc1220vb_map[] = {
{ 17, NULL }, /* OT, IEC958?, disabled */
{ 19, NULL, 12 }, /* FU, Input Gain Pad - broken response, disabled */
{ 16, "Line Out" }, /* OT */
{ 22, "Line Out Playback" }, /* FU */
{ 7, "Line" }, /* IT */
{ 19, "Line Capture" }, /* FU */
{ 8, "Mic" }, /* IT */
{ 20, "Mic Capture" }, /* FU */
{ 9, "Front Mic" }, /* IT */
{ 21, "Front Mic Capture" }, /* FU */
{}
};
/*
* Control map entries
*/
@ -526,6 +541,10 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = {
.id = USB_ID(0x1b1c, 0x0a42),
.map = corsair_virtuoso_map,
},
{ /* Gigabyte TRX40 Aorus Master (rear panel + front mic) */
.id = USB_ID(0x0414, 0xa001),
.map = aorus_master_alc1220vb_map,
},
{ /* Gigabyte TRX40 Aorus Pro WiFi */
.id = USB_ID(0x0414, 0xa002),
.map = trx40_mobo_map,

View File

@ -3566,4 +3566,29 @@ ALC1220_VB_DESKTOP(0x0db0, 0x543d), /* MSI TRX40 */
ALC1220_VB_DESKTOP(0x26ce, 0x0a01), /* Asrock TRX40 Creator */
#undef ALC1220_VB_DESKTOP
/* Two entries for Gigabyte TRX40 Aorus Master:
* TRX40 Aorus Master has two USB-audio devices, one for the front headphone
* with ESS SABRE9218 DAC chip, while another for the rest I/O (the rear
* panel and the front mic) with Realtek ALC1220-VB.
* Here we provide two distinct names for making UCM profiles easier.
*/
{
USB_DEVICE(0x0414, 0xa000),
.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
.vendor_name = "Gigabyte",
.product_name = "Aorus Master Front Headphone",
.profile_name = "Gigabyte-Aorus-Master-Front-Headphone",
.ifnum = QUIRK_NO_INTERFACE
}
},
{
USB_DEVICE(0x0414, 0xa001),
.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
.vendor_name = "Gigabyte",
.product_name = "Aorus Master Main Audio",
.profile_name = "Gigabyte-Aorus-Master-Main-Audio",
.ifnum = QUIRK_NO_INTERFACE
}
},
#undef USB_DEVICE_VENDOR_SPEC