Skip to content

Commit

Permalink
Merge tag 'sound-4.20-rc5' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "As a usual pattern, we've got relatively large updates at rc5:

   - A fix for races in ALSA control user elements

   - ASoC DAPM regression due to component refactoring

   - A fix in error handling of ASoC iteration macro

   - ASoC Intel SST Skylake kconfig fix; a new Kconfig will appear as a
     consequence, but in the end it's a good cleanup

   - HD-audio and USB-audio quirks as always

   - Assort of ASoC driver fixes (pcm186x, Intel cht, rockchip, pcm3060,
     rsnd, omap, wm_adsp, qcom, sunxi, stm32)"

* tag 'sound-4.20-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (34 commits)
  ALSA: usb-audio: Add vendor and product name for Dell WD19 Dock
  ALSA: hda/realtek - Support ALC300
  ALSA: hda/realtek - Add auto-mute quirk for HP Spectre x360 laptop
  ALSA: hda/realtek - fix the pop noise on headphone for lenovo laptops
  ALSA: control: Fix race between adding and removing a user element
  ALSA: sparc: Fix invalid snd_free_pages() at error path
  ALSA: wss: Fix invalid snd_free_pages() at error path
  ALSA: hda/realtek - fix headset mic detection for MSI MS-B171
  ALSA: hda: Add ASRock N68C-S UCC the power_save blacklist
  ALSA: ac97: Fix incorrect bit shift at AC97-SPSA control write
  ASoC: omap-dmic: Add pm_qos handling to avoid overruns with CPU_IDLE
  ASoC: omap-mcpdm: Add pm_qos handling to avoid under/overruns with CPU_IDLE
  ASoC: omap-mcbsp: Fix latency value calculation for pm_qos
  ASoC: acpi: fix: continue searching when machine is ignored
  ASoC: Intel: Skylake: fix Kconfigs, make HDaudio codec optional
  MAINTAINERS: add ASoC maintainers for sound dt-bindings
  ASoC: pcm186x: Fix device reset-registers trigger value
  ASoC: dapm: Recalculate audio map forcely when card instantiated
  ASoC: omap-abe-twl6040: Fix missing audio card caused by deferred probing
  ASoC: pcm3060: Rename output widgets
  ...
  • Loading branch information
Linus Torvalds committed Nov 29, 2018
2 parents 9af33b5 + 8159a6a commit b905e2d
Show file tree
Hide file tree
Showing 33 changed files with 456 additions and 303 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -14010,6 +14010,7 @@ S: Supported
F: Documentation/devicetree/bindings/sound/
F: Documentation/sound/soc/
F: sound/soc/
F: include/dt-bindings/sound/
F: include/sound/soc*

SOUNDWIRE SUBSYSTEM
Expand Down
2 changes: 1 addition & 1 deletion include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ struct snd_soc_pcm_runtime {
((i) < rtd->num_codecs) && ((dai) = rtd->codec_dais[i]); \
(i)++)
#define for_each_rtd_codec_dai_rollback(rtd, i, dai) \
for (; ((i--) >= 0) && ((dai) = rtd->codec_dais[i]);)
for (; ((--i) >= 0) && ((dai) = rtd->codec_dais[i]);)


/* mixer control */
Expand Down
80 changes: 45 additions & 35 deletions sound/core/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,40 @@ static int snd_ctl_find_hole(struct snd_card *card, unsigned int count)
return 0;
}

/* add a new kcontrol object; call with card->controls_rwsem locked */
static int __snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
{
struct snd_ctl_elem_id id;
unsigned int idx;
unsigned int count;

id = kcontrol->id;
if (id.index > UINT_MAX - kcontrol->count)
return -EINVAL;

if (snd_ctl_find_id(card, &id)) {
dev_err(card->dev,
"control %i:%i:%i:%s:%i is already present\n",
id.iface, id.device, id.subdevice, id.name, id.index);
return -EBUSY;
}

if (snd_ctl_find_hole(card, kcontrol->count) < 0)
return -ENOMEM;

list_add_tail(&kcontrol->list, &card->controls);
card->controls_count += kcontrol->count;
kcontrol->id.numid = card->last_numid + 1;
card->last_numid += kcontrol->count;

id = kcontrol->id;
count = kcontrol->count;
for (idx = 0; idx < count; idx++, id.index++, id.numid++)
snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id);

return 0;
}

/**
* snd_ctl_add - add the control instance to the card
* @card: the card instance
Expand All @@ -364,45 +398,18 @@ static int snd_ctl_find_hole(struct snd_card *card, unsigned int count)
*/
int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
{
struct snd_ctl_elem_id id;
unsigned int idx;
unsigned int count;
int err = -EINVAL;

if (! kcontrol)
return err;
if (snd_BUG_ON(!card || !kcontrol->info))
goto error;
id = kcontrol->id;
if (id.index > UINT_MAX - kcontrol->count)
goto error;

down_write(&card->controls_rwsem);
if (snd_ctl_find_id(card, &id)) {
up_write(&card->controls_rwsem);
dev_err(card->dev, "control %i:%i:%i:%s:%i is already present\n",
id.iface,
id.device,
id.subdevice,
id.name,
id.index);
err = -EBUSY;
goto error;
}
if (snd_ctl_find_hole(card, kcontrol->count) < 0) {
up_write(&card->controls_rwsem);
err = -ENOMEM;
goto error;
}
list_add_tail(&kcontrol->list, &card->controls);
card->controls_count += kcontrol->count;
kcontrol->id.numid = card->last_numid + 1;
card->last_numid += kcontrol->count;
id = kcontrol->id;
count = kcontrol->count;
err = __snd_ctl_add(card, kcontrol);
up_write(&card->controls_rwsem);
for (idx = 0; idx < count; idx++, id.index++, id.numid++)
snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id);
if (err < 0)
goto error;
return 0;

error:
Expand Down Expand Up @@ -1361,9 +1368,12 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
kctl->tlv.c = snd_ctl_elem_user_tlv;

/* This function manage to free the instance on failure. */
err = snd_ctl_add(card, kctl);
if (err < 0)
return err;
down_write(&card->controls_rwsem);
err = __snd_ctl_add(card, kctl);
if (err < 0) {
snd_ctl_free_one(kctl);
goto unlock;
}
offset = snd_ctl_get_ioff(kctl, &info->id);
snd_ctl_build_ioff(&info->id, kctl, offset);
/*
Expand All @@ -1374,10 +1384,10 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
* which locks the element.
*/

down_write(&card->controls_rwsem);
card->user_ctl_count++;
up_write(&card->controls_rwsem);

unlock:
up_write(&card->controls_rwsem);
return 0;
}

Expand Down
2 changes: 0 additions & 2 deletions sound/isa/wss/wss_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,6 @@ static int snd_wss_playback_open(struct snd_pcm_substream *substream)
if (err < 0) {
if (chip->release_dma)
chip->release_dma(chip, chip->dma_private_data, chip->dma1);
snd_free_pages(runtime->dma_area, runtime->dma_bytes);
return err;
}
chip->playback_substream = substream;
Expand Down Expand Up @@ -1572,7 +1571,6 @@ static int snd_wss_capture_open(struct snd_pcm_substream *substream)
if (err < 0) {
if (chip->release_dma)
chip->release_dma(chip, chip->dma_private_data, chip->dma2);
snd_free_pages(runtime->dma_area, runtime->dma_bytes);
return err;
}
chip->capture_substream = substream;
Expand Down
2 changes: 1 addition & 1 deletion sound/pci/ac97/ac97_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ static int snd_ac97_put_spsa(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
{
struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol);
int reg = kcontrol->private_value & 0xff;
int shift = (kcontrol->private_value >> 8) & 0xff;
int shift = (kcontrol->private_value >> 8) & 0x0f;
int mask = (kcontrol->private_value >> 16) & 0xff;
// int invert = (kcontrol->private_value >> 24) & 0xff;
unsigned short value, old, new;
Expand Down
2 changes: 2 additions & 0 deletions sound/pci/hda/hda_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2169,6 +2169,8 @@ static struct snd_pci_quirk power_save_blacklist[] = {
/* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */
SND_PCI_QUIRK(0x1849, 0xc892, "Asrock B85M-ITX", 0),
/* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */
SND_PCI_QUIRK(0x1849, 0x0397, "Asrock N68C-S UCC", 0),
/* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */
SND_PCI_QUIRK(0x1849, 0x7662, "Asrock H81M-HDS", 0),
/* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */
SND_PCI_QUIRK(0x1043, 0x8733, "Asus Prime X370-Pro", 0),
Expand Down
36 changes: 36 additions & 0 deletions sound/pci/hda/patch_realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
case 0x10ec0285:
case 0x10ec0298:
case 0x10ec0289:
case 0x10ec0300:
alc_update_coef_idx(codec, 0x10, 1<<9, 0);
break;
case 0x10ec0275:
Expand Down Expand Up @@ -2830,6 +2831,7 @@ enum {
ALC269_TYPE_ALC215,
ALC269_TYPE_ALC225,
ALC269_TYPE_ALC294,
ALC269_TYPE_ALC300,
ALC269_TYPE_ALC700,
};

Expand Down Expand Up @@ -2864,6 +2866,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
case ALC269_TYPE_ALC215:
case ALC269_TYPE_ALC225:
case ALC269_TYPE_ALC294:
case ALC269_TYPE_ALC300:
case ALC269_TYPE_ALC700:
ssids = alc269_ssids;
break;
Expand Down Expand Up @@ -5358,6 +5361,16 @@ static void alc274_fixup_bind_dacs(struct hda_codec *codec,
spec->gen.preferred_dacs = preferred_pairs;
}

/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
if (action != HDA_FIXUP_ACT_PRE_PROBE)
return;

snd_hda_override_wcaps(codec, 0x03, 0);
}

/* for hda_fixup_thinkpad_acpi() */
#include "thinkpad_helper.c"

Expand Down Expand Up @@ -5495,6 +5508,8 @@ enum {
ALC255_FIXUP_DELL_HEADSET_MIC,
ALC295_FIXUP_HP_X360,
ALC221_FIXUP_HP_HEADSET_MIC,
ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
ALC295_FIXUP_HP_AUTO_MUTE,
};

static const struct hda_fixup alc269_fixups[] = {
Expand Down Expand Up @@ -5659,6 +5674,8 @@ static const struct hda_fixup alc269_fixups[] = {
[ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
.type = HDA_FIXUP_FUNC,
.v.func = alc269_fixup_hp_mute_led_mic3,
.chained = true,
.chain_id = ALC295_FIXUP_HP_AUTO_MUTE
},
[ALC269_FIXUP_HP_GPIO_LED] = {
.type = HDA_FIXUP_FUNC,
Expand Down Expand Up @@ -6362,6 +6379,14 @@ static const struct hda_fixup alc269_fixups[] = {
.chained = true,
.chain_id = ALC269_FIXUP_HEADSET_MIC
},
[ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
.type = HDA_FIXUP_FUNC,
.v.func = alc285_fixup_invalidate_dacs,
},
[ALC295_FIXUP_HP_AUTO_MUTE] = {
.type = HDA_FIXUP_FUNC,
.v.func = alc_fixup_auto_mute_via_amp,
},
};

static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Expand Down Expand Up @@ -6532,6 +6557,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
Expand Down Expand Up @@ -7034,6 +7060,11 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x12, 0x90a60130},
{0x19, 0x03a11020},
{0x21, 0x0321101f}),
SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
{0x12, 0x90a60130},
{0x14, 0x90170110},
{0x19, 0x04a11040},
{0x21, 0x04211020}),
SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
{0x12, 0x90a60120},
{0x14, 0x90170110},
Expand Down Expand Up @@ -7295,6 +7326,10 @@ static int patch_alc269(struct hda_codec *codec)
spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
break;
case 0x10ec0300:
spec->codec_variant = ALC269_TYPE_ALC300;
spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
break;
case 0x10ec0700:
case 0x10ec0701:
case 0x10ec0703:
Expand Down Expand Up @@ -8405,6 +8440,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = {
HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
Expand Down
11 changes: 5 additions & 6 deletions sound/soc/codecs/hdac_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2187,11 +2187,6 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
*/
snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
AC_PWRST_D3);
err = snd_hdac_display_power(bus, false);
if (err < 0) {
dev_err(dev, "Cannot turn on display power on i915\n");
return err;
}

hlink = snd_hdac_ext_bus_get_link(bus, dev_name(dev));
if (!hlink) {
Expand All @@ -2201,7 +2196,11 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)

snd_hdac_ext_bus_link_put(bus, hlink);

return 0;
err = snd_hdac_display_power(bus, false);
if (err < 0)
dev_err(dev, "Cannot turn off display power on i915\n");

return err;
}

static int hdac_hdmi_runtime_resume(struct device *dev)
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/codecs/pcm186x.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ enum pcm186x_type {
#define PCM186X_MAX_REGISTER PCM186X_CURR_TRIM_CTRL

/* PCM186X_PAGE */
#define PCM186X_RESET 0xff
#define PCM186X_RESET 0xfe

/* PCM186X_ADCX_INPUT_SEL_X */
#define PCM186X_ADC_INPUT_SEL_POL BIT(7)
Expand Down
12 changes: 4 additions & 8 deletions sound/soc/codecs/pcm3060.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,16 @@ static const struct snd_kcontrol_new pcm3060_dapm_controls[] = {
};

static const struct snd_soc_dapm_widget pcm3060_dapm_widgets[] = {
SND_SOC_DAPM_OUTPUT("OUTL+"),
SND_SOC_DAPM_OUTPUT("OUTR+"),
SND_SOC_DAPM_OUTPUT("OUTL-"),
SND_SOC_DAPM_OUTPUT("OUTR-"),
SND_SOC_DAPM_OUTPUT("OUTL"),
SND_SOC_DAPM_OUTPUT("OUTR"),

SND_SOC_DAPM_INPUT("INL"),
SND_SOC_DAPM_INPUT("INR"),
};

static const struct snd_soc_dapm_route pcm3060_dapm_map[] = {
{ "OUTL+", NULL, "Playback" },
{ "OUTR+", NULL, "Playback" },
{ "OUTL-", NULL, "Playback" },
{ "OUTR-", NULL, "Playback" },
{ "OUTL", NULL, "Playback" },
{ "OUTR", NULL, "Playback" },

{ "Capture", NULL, "INL" },
{ "Capture", NULL, "INR" },
Expand Down
Loading

0 comments on commit b905e2d

Please sign in to comment.