Commit 2ae048e1 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull sound fixes from Takashi Iwai:
 "A collection of small fixes.

   - The optimization of PM resume with HD-audio HDMI codecs, which
     eventually work around weird issues

   - A correction of Intel Icelake HDMI audio code

   - Quirks for Dell machines with Realtek HD-audio codecs

   - The fix for too long sequencer write stall that was spotted by
     syzkaller

   - A few trivial cleanups reported by coccinelle"

* tag 'sound-fix-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda - Don't resume forcibly i915 HDMI/DP codec
  ALSA: hda/hdmi - Fix i915 reverse port/pin mapping
  ALSA: hda/hdmi - Remove duplicated define
  ALSA: seq: Break too long mutex context in the write loop
  ALSA: hda/realtek: apply ALC891 headset fixup to one Dell machine
  ALSA: rme9652: Unneeded variable: "result".
  ALSA: emu10k1: Remove unneeded variable "change"
  ALSA: au88x0: Remove unneeded variable: "changed"
  ALSA: hda/realtek - Fixed Headphone Mic can't record on Dell platform
  ALSA: ps3: Remove Unneeded variable: "ret"
  ALSA: lx6464es: Remove unneeded variable err
parents d0411ec8 4914da2f
...@@ -252,6 +252,8 @@ struct hda_codec { ...@@ -252,6 +252,8 @@ struct hda_codec {
unsigned int auto_runtime_pm:1; /* enable automatic codec runtime pm */ unsigned int auto_runtime_pm:1; /* enable automatic codec runtime pm */
unsigned int force_pin_prefix:1; /* Add location prefix */ unsigned int force_pin_prefix:1; /* Add location prefix */
unsigned int link_down_at_suspend:1; /* link down at runtime suspend */ unsigned int link_down_at_suspend:1; /* link down at runtime suspend */
unsigned int relaxed_resume:1; /* don't resume forcibly for jack */
#ifdef CONFIG_PM #ifdef CONFIG_PM
unsigned long power_on_acct; unsigned long power_on_acct;
unsigned long power_off_acct; unsigned long power_off_acct;
......
...@@ -1021,7 +1021,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, ...@@ -1021,7 +1021,7 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf,
{ {
struct snd_seq_client *client = file->private_data; struct snd_seq_client *client = file->private_data;
int written = 0, len; int written = 0, len;
int err; int err, handled;
struct snd_seq_event event; struct snd_seq_event event;
if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_OUTPUT)) if (!(snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_OUTPUT))
...@@ -1034,6 +1034,8 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, ...@@ -1034,6 +1034,8 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf,
if (!client->accept_output || client->pool == NULL) if (!client->accept_output || client->pool == NULL)
return -ENXIO; return -ENXIO;
repeat:
handled = 0;
/* allocate the pool now if the pool is not allocated yet */ /* allocate the pool now if the pool is not allocated yet */
mutex_lock(&client->ioctl_mutex); mutex_lock(&client->ioctl_mutex);
if (client->pool->size > 0 && !snd_seq_write_pool_allocated(client)) { if (client->pool->size > 0 && !snd_seq_write_pool_allocated(client)) {
...@@ -1093,12 +1095,19 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, ...@@ -1093,12 +1095,19 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf,
0, 0, &client->ioctl_mutex); 0, 0, &client->ioctl_mutex);
if (err < 0) if (err < 0)
break; break;
handled++;
__skip_event: __skip_event:
/* Update pointers and counts */ /* Update pointers and counts */
count -= len; count -= len;
buf += len; buf += len;
written += len; written += len;
/* let's have a coffee break if too many events are queued */
if (++handled >= 200) {
mutex_unlock(&client->ioctl_mutex);
goto repeat;
}
} }
out: out:
......
...@@ -765,7 +765,7 @@ snd_vortex_a3d_hrtf_put(struct snd_kcontrol *kcontrol, ...@@ -765,7 +765,7 @@ snd_vortex_a3d_hrtf_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
a3dsrc_t *a = kcontrol->private_data; a3dsrc_t *a = kcontrol->private_data;
int changed = 1, i; int i;
int coord[6]; int coord[6];
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
coord[i] = ucontrol->value.integer.value[i]; coord[i] = ucontrol->value.integer.value[i];
...@@ -774,7 +774,7 @@ snd_vortex_a3d_hrtf_put(struct snd_kcontrol *kcontrol, ...@@ -774,7 +774,7 @@ snd_vortex_a3d_hrtf_put(struct snd_kcontrol *kcontrol,
vortex_a3d_coord2hrtf(a->hrtf[1], coord); vortex_a3d_coord2hrtf(a->hrtf[1], coord);
a3dsrc_SetHrtfTarget(a, a->hrtf[0], a->hrtf[1]); a3dsrc_SetHrtfTarget(a, a->hrtf[0], a->hrtf[1]);
a3dsrc_SetHrtfCurrent(a, a->hrtf[0], a->hrtf[1]); a3dsrc_SetHrtfCurrent(a, a->hrtf[0], a->hrtf[1]);
return changed; return 1;
} }
static int static int
...@@ -783,7 +783,7 @@ snd_vortex_a3d_itd_put(struct snd_kcontrol *kcontrol, ...@@ -783,7 +783,7 @@ snd_vortex_a3d_itd_put(struct snd_kcontrol *kcontrol,
{ {
a3dsrc_t *a = kcontrol->private_data; a3dsrc_t *a = kcontrol->private_data;
int coord[6]; int coord[6];
int i, changed = 1; int i;
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
coord[i] = ucontrol->value.integer.value[i]; coord[i] = ucontrol->value.integer.value[i];
/* Translate orientation coordinates to a3d params. */ /* Translate orientation coordinates to a3d params. */
...@@ -793,7 +793,7 @@ snd_vortex_a3d_itd_put(struct snd_kcontrol *kcontrol, ...@@ -793,7 +793,7 @@ snd_vortex_a3d_itd_put(struct snd_kcontrol *kcontrol,
a3dsrc_SetItdTarget(a, a->itd[0], a->itd[1]); a3dsrc_SetItdTarget(a, a->itd[0], a->itd[1]);
a3dsrc_SetItdCurrent(a, a->itd[0], a->itd[1]); a3dsrc_SetItdCurrent(a, a->itd[0], a->itd[1]);
a3dsrc_SetItdDline(a, a->dline); a3dsrc_SetItdDline(a, a->dline);
return changed; return 1;
} }
static int static int
...@@ -801,7 +801,6 @@ snd_vortex_a3d_ild_put(struct snd_kcontrol *kcontrol, ...@@ -801,7 +801,6 @@ snd_vortex_a3d_ild_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
a3dsrc_t *a = kcontrol->private_data; a3dsrc_t *a = kcontrol->private_data;
int changed = 1;
int l, r; int l, r;
/* There may be some scale tranlation needed here. */ /* There may be some scale tranlation needed here. */
l = ucontrol->value.integer.value[0]; l = ucontrol->value.integer.value[0];
...@@ -810,7 +809,7 @@ snd_vortex_a3d_ild_put(struct snd_kcontrol *kcontrol, ...@@ -810,7 +809,7 @@ snd_vortex_a3d_ild_put(struct snd_kcontrol *kcontrol,
/* Left Right panning. */ /* Left Right panning. */
a3dsrc_SetGainTarget(a, l, r); a3dsrc_SetGainTarget(a, l, r);
a3dsrc_SetGainCurrent(a, l, r); a3dsrc_SetGainCurrent(a, l, r);
return changed; return 1;
} }
static int static int
...@@ -818,7 +817,7 @@ snd_vortex_a3d_filter_put(struct snd_kcontrol *kcontrol, ...@@ -818,7 +817,7 @@ snd_vortex_a3d_filter_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
a3dsrc_t *a = kcontrol->private_data; a3dsrc_t *a = kcontrol->private_data;
int i, changed = 1; int i;
int params[6]; int params[6];
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
params[i] = ucontrol->value.integer.value[i]; params[i] = ucontrol->value.integer.value[i];
...@@ -831,7 +830,7 @@ snd_vortex_a3d_filter_put(struct snd_kcontrol *kcontrol, ...@@ -831,7 +830,7 @@ snd_vortex_a3d_filter_put(struct snd_kcontrol *kcontrol,
a3dsrc_SetAtmosCurrent(a, a->filter[0], a3dsrc_SetAtmosCurrent(a, a->filter[0],
a->filter[1], a->filter[2], a->filter[1], a->filter[2],
a->filter[3], a->filter[4]); a->filter[3], a->filter[4]);
return changed; return 1;
} }
static const struct snd_kcontrol_new vortex_a3d_kcontrol = { static const struct snd_kcontrol_new vortex_a3d_kcontrol = {
......
...@@ -1074,7 +1074,6 @@ static int snd_emu10k1x_shared_spdif_put(struct snd_kcontrol *kcontrol, ...@@ -1074,7 +1074,6 @@ static int snd_emu10k1x_shared_spdif_put(struct snd_kcontrol *kcontrol,
{ {
struct emu10k1x *emu = snd_kcontrol_chip(kcontrol); struct emu10k1x *emu = snd_kcontrol_chip(kcontrol);
unsigned int val; unsigned int val;
int change = 0;
val = ucontrol->value.integer.value[0] ; val = ucontrol->value.integer.value[0] ;
...@@ -1089,7 +1088,7 @@ static int snd_emu10k1x_shared_spdif_put(struct snd_kcontrol *kcontrol, ...@@ -1089,7 +1088,7 @@ static int snd_emu10k1x_shared_spdif_put(struct snd_kcontrol *kcontrol,
snd_emu10k1x_ptr_write(emu, ROUTING, 0, 0x1003F); snd_emu10k1x_ptr_write(emu, ROUTING, 0, 0x1003F);
snd_emu10k1x_gpio_write(emu, 0x1080); snd_emu10k1x_gpio_write(emu, 0x1080);
} }
return change; return 0;
} }
static const struct snd_kcontrol_new snd_emu10k1x_shared_spdif = static const struct snd_kcontrol_new snd_emu10k1x_shared_spdif =
......
...@@ -2941,15 +2941,19 @@ static int hda_codec_runtime_resume(struct device *dev) ...@@ -2941,15 +2941,19 @@ static int hda_codec_runtime_resume(struct device *dev)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int hda_codec_force_resume(struct device *dev) static int hda_codec_force_resume(struct device *dev)
{ {
struct hda_codec *codec = dev_to_hda_codec(dev);
bool forced_resume = !codec->relaxed_resume;
int ret; int ret;
/* The get/put pair below enforces the runtime resume even if the /* The get/put pair below enforces the runtime resume even if the
* device hasn't been used at suspend time. This trick is needed to * device hasn't been used at suspend time. This trick is needed to
* update the jack state change during the sleep. * update the jack state change during the sleep.
*/ */
pm_runtime_get_noresume(dev); if (forced_resume)
pm_runtime_get_noresume(dev);
ret = pm_runtime_force_resume(dev); ret = pm_runtime_force_resume(dev);
pm_runtime_put(dev); if (forced_resume)
pm_runtime_put(dev);
return ret; return ret;
} }
......
...@@ -2292,8 +2292,10 @@ static void generic_hdmi_free(struct hda_codec *codec) ...@@ -2292,8 +2292,10 @@ static void generic_hdmi_free(struct hda_codec *codec)
struct hdmi_spec *spec = codec->spec; struct hdmi_spec *spec = codec->spec;
int pin_idx, pcm_idx; int pin_idx, pcm_idx;
if (codec_has_acomp(codec)) if (codec_has_acomp(codec)) {
snd_hdac_acomp_register_notifier(&codec->bus->core, NULL); snd_hdac_acomp_register_notifier(&codec->bus->core, NULL);
codec->relaxed_resume = 0;
}
for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
...@@ -2416,7 +2418,6 @@ static void intel_haswell_fixup_connect_list(struct hda_codec *codec, ...@@ -2416,7 +2418,6 @@ static void intel_haswell_fixup_connect_list(struct hda_codec *codec,
snd_hda_override_conn_list(codec, nid, spec->num_cvts, spec->cvt_nids); snd_hda_override_conn_list(codec, nid, spec->num_cvts, spec->cvt_nids);
} }
#define INTEL_GET_VENDOR_VERB 0xf81
#define INTEL_GET_VENDOR_VERB 0xf81 #define INTEL_GET_VENDOR_VERB 0xf81
#define INTEL_SET_VENDOR_VERB 0x781 #define INTEL_SET_VENDOR_VERB 0x781
#define INTEL_EN_DP12 0x02 /* enable DP 1.2 features */ #define INTEL_EN_DP12 0x02 /* enable DP 1.2 features */
...@@ -2525,18 +2526,32 @@ static int intel_pin2port(void *audio_ptr, int pin_nid) ...@@ -2525,18 +2526,32 @@ static int intel_pin2port(void *audio_ptr, int pin_nid)
return -1; return -1;
} }
static int intel_port2pin(struct hda_codec *codec, int port)
{
struct hdmi_spec *spec = codec->spec;
if (!spec->port_num) {
/* we assume only from port-B to port-D */
if (port < 1 || port > 3)
return 0;
/* intel port is 1-based */
return port + intel_base_nid(codec) - 1;
}
if (port < 1 || port > spec->port_num)
return 0;
return spec->port_map[port - 1];
}
static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe) static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe)
{ {
struct hda_codec *codec = audio_ptr; struct hda_codec *codec = audio_ptr;
int pin_nid; int pin_nid;
int dev_id = pipe; int dev_id = pipe;
/* we assume only from port-B to port-D */ pin_nid = intel_port2pin(codec, port);
if (port < 1 || port > 3) if (!pin_nid)
return; return;
pin_nid = port + intel_base_nid(codec) - 1; /* intel port is 1-based */
/* skip notification during system suspend (but not in runtime PM); /* skip notification during system suspend (but not in runtime PM);
* the state will be updated at resume * the state will be updated at resume
*/ */
...@@ -2566,6 +2581,8 @@ static void register_i915_notifier(struct hda_codec *codec) ...@@ -2566,6 +2581,8 @@ static void register_i915_notifier(struct hda_codec *codec)
spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify; spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify;
snd_hdac_acomp_register_notifier(&codec->bus->core, snd_hdac_acomp_register_notifier(&codec->bus->core,
&spec->drm_audio_ops); &spec->drm_audio_ops);
/* no need for forcible resume for jack check thanks to notifier */
codec->relaxed_resume = 1;
} }
/* setup_stream ops override for HSW+ */ /* setup_stream ops override for HSW+ */
......
...@@ -7657,9 +7657,12 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { ...@@ -7657,9 +7657,12 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x12, 0x90a60130}, {0x12, 0x90a60130},
{0x17, 0x90170110}, {0x17, 0x90170110},
{0x21, 0x03211020}), {0x21, 0x03211020}),
SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
{0x14, 0x90170110}, {0x14, 0x90170110},
{0x21, 0x04211020}), {0x21, 0x04211020}),
SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
{0x14, 0x90170110},
{0x21, 0x04211030}),
SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
ALC295_STANDARD_PINS, ALC295_STANDARD_PINS,
{0x17, 0x21014020}, {0x17, 0x21014020},
...@@ -8800,6 +8803,11 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { ...@@ -8800,6 +8803,11 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
{0x18, 0x01a19030}, {0x18, 0x01a19030},
{0x1a, 0x01813040}, {0x1a, 0x01813040},
{0x21, 0x01014020}), {0x21, 0x01014020}),
SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
{0x16, 0x01813030},
{0x17, 0x02211010},
{0x18, 0x01a19040},
{0x21, 0x01014020}),
SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE, SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
{0x14, 0x01014010}, {0x14, 0x01014010},
{0x18, 0x01a19020}, {0x18, 0x01a19020},
......
...@@ -253,9 +253,8 @@ static int lx_pcm_open(struct snd_pcm_substream *substream) ...@@ -253,9 +253,8 @@ static int lx_pcm_open(struct snd_pcm_substream *substream)
static int lx_pcm_close(struct snd_pcm_substream *substream) static int lx_pcm_close(struct snd_pcm_substream *substream)
{ {
int err = 0;
dev_dbg(substream->pcm->card->dev, "->lx_pcm_close\n"); dev_dbg(substream->pcm->card->dev, "->lx_pcm_close\n");
return err; return 0;
} }
static snd_pcm_uframes_t lx_pcm_stream_pointer(struct snd_pcm_substream static snd_pcm_uframes_t lx_pcm_stream_pointer(struct snd_pcm_substream
......
...@@ -2158,13 +2158,12 @@ static int snd_rme9652_prepare(struct snd_pcm_substream *substream) ...@@ -2158,13 +2158,12 @@ static int snd_rme9652_prepare(struct snd_pcm_substream *substream)
{ {
struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream);
unsigned long flags; unsigned long flags;
int result = 0;
spin_lock_irqsave(&rme9652->lock, flags); spin_lock_irqsave(&rme9652->lock, flags);
if (!rme9652->running) if (!rme9652->running)
rme9652_reset_hw_pointer(rme9652); rme9652_reset_hw_pointer(rme9652);
spin_unlock_irqrestore(&rme9652->lock, flags); spin_unlock_irqrestore(&rme9652->lock, flags);
return result; return 0;
} }
static const struct snd_pcm_hardware snd_rme9652_playback_subinfo = static const struct snd_pcm_hardware snd_rme9652_playback_subinfo =
......
...@@ -628,7 +628,6 @@ static int snd_ps3_pcm_trigger(struct snd_pcm_substream *substream, ...@@ -628,7 +628,6 @@ static int snd_ps3_pcm_trigger(struct snd_pcm_substream *substream,
int cmd) int cmd)
{ {
struct snd_ps3_card_info *card = snd_pcm_substream_chip(substream); struct snd_ps3_card_info *card = snd_pcm_substream_chip(substream);
int ret = 0;
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
...@@ -665,7 +664,7 @@ static int snd_ps3_pcm_trigger(struct snd_pcm_substream *substream, ...@@ -665,7 +664,7 @@ static int snd_ps3_pcm_trigger(struct snd_pcm_substream *substream,
} }
return ret; return 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