Commit cf0d1356 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull sound fixes from Takashi Iwai:
 "Here includes a few patchset for fixing mostly HD-audio issues in
  addition to a patch assuring the compress API bytes alignment and a
  fix for the die-hard existing race condition at USB-audio
  disconnection.  The volume looks big in Realtek HD-audio code, but
  it's just a translation of the fixup tables, and the actual changes
  are rather trivial"

* tag 'sound-3.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda - restore BCLK M/N values when resuming HSW/BDW display controller
  ALSA: usb-audio: Fix races at disconnection and PCM closing
  ALSA: hda - Adjust speaker HPF and add LED support for HP Spectre 13
  ALSA: hda - Make the pin quirk tables use the SND_HDA_PIN_QUIRK macro
  ALSA: hda - Make a SND_HDA_PIN_QUIRK macro
  ALSA: hda - Add pin quirk for Dell XPS 15
  ALSA: hda - hdmi: call overridden init on resume
  ALSA: hda - Fix usage of "model" module parameter
  ALSA: compress: fix the struct alignment to 4 bytes
parents 5ded6ea4 a07187c9
...@@ -286,6 +286,11 @@ STAC92HD83* ...@@ -286,6 +286,11 @@ STAC92HD83*
hp-inv-led HP with broken BIOS for inverted mute LED hp-inv-led HP with broken BIOS for inverted mute LED
auto BIOS setup (default) auto BIOS setup (default)
STAC92HD95
==========
hp-led LED support for HP laptops
hp-bass Bass HPF setup for HP Spectre 13
STAC9872 STAC9872
======== ========
vaio VAIO laptop without SPDIF vaio VAIO laptop without SPDIF
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
struct snd_compressed_buffer { struct snd_compressed_buffer {
__u32 fragment_size; __u32 fragment_size;
__u32 fragments; __u32 fragments;
}; } __attribute__((packed, aligned(4)));
/** /**
* struct snd_compr_params: compressed stream params * struct snd_compr_params: compressed stream params
...@@ -51,7 +51,7 @@ struct snd_compr_params { ...@@ -51,7 +51,7 @@ struct snd_compr_params {
struct snd_compressed_buffer buffer; struct snd_compressed_buffer buffer;
struct snd_codec codec; struct snd_codec codec;
__u8 no_wake_mode; __u8 no_wake_mode;
}; } __attribute__((packed, aligned(4)));
/** /**
* struct snd_compr_tstamp: timestamp descriptor * struct snd_compr_tstamp: timestamp descriptor
...@@ -70,7 +70,7 @@ struct snd_compr_tstamp { ...@@ -70,7 +70,7 @@ struct snd_compr_tstamp {
__u32 pcm_frames; __u32 pcm_frames;
__u32 pcm_io_frames; __u32 pcm_io_frames;
__u32 sampling_rate; __u32 sampling_rate;
}; } __attribute__((packed, aligned(4)));
/** /**
* struct snd_compr_avail: avail descriptor * struct snd_compr_avail: avail descriptor
...@@ -80,7 +80,7 @@ struct snd_compr_tstamp { ...@@ -80,7 +80,7 @@ struct snd_compr_tstamp {
struct snd_compr_avail { struct snd_compr_avail {
__u64 avail; __u64 avail;
struct snd_compr_tstamp tstamp; struct snd_compr_tstamp tstamp;
} __attribute__((packed)); } __attribute__((packed, aligned(4)));
enum snd_compr_direction { enum snd_compr_direction {
SND_COMPRESS_PLAYBACK = 0, SND_COMPRESS_PLAYBACK = 0,
...@@ -107,7 +107,7 @@ struct snd_compr_caps { ...@@ -107,7 +107,7 @@ struct snd_compr_caps {
__u32 max_fragments; __u32 max_fragments;
__u32 codecs[MAX_NUM_CODECS]; __u32 codecs[MAX_NUM_CODECS];
__u32 reserved[11]; __u32 reserved[11];
}; } __attribute__((packed, aligned(4)));
/** /**
* struct snd_compr_codec_caps: query capability of codec * struct snd_compr_codec_caps: query capability of codec
...@@ -119,7 +119,7 @@ struct snd_compr_codec_caps { ...@@ -119,7 +119,7 @@ struct snd_compr_codec_caps {
__u32 codec; __u32 codec;
__u32 num_descriptors; __u32 num_descriptors;
struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS]; struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS];
}; } __attribute__((packed, aligned(4)));
/** /**
* @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the
...@@ -140,7 +140,7 @@ enum { ...@@ -140,7 +140,7 @@ enum {
struct snd_compr_metadata { struct snd_compr_metadata {
__u32 key; __u32 key;
__u32 value[8]; __u32 value[8];
}; } __attribute__((packed, aligned(4)));
/** /**
* compress path ioctl definitions * compress path ioctl definitions
......
...@@ -268,7 +268,7 @@ struct snd_enc_vorbis { ...@@ -268,7 +268,7 @@ struct snd_enc_vorbis {
__u32 max_bit_rate; __u32 max_bit_rate;
__u32 min_bit_rate; __u32 min_bit_rate;
__u32 downmix; __u32 downmix;
}; } __attribute__((packed, aligned(4)));
/** /**
...@@ -284,7 +284,7 @@ struct snd_enc_real { ...@@ -284,7 +284,7 @@ struct snd_enc_real {
__u32 quant_bits; __u32 quant_bits;
__u32 start_region; __u32 start_region;
__u32 num_regions; __u32 num_regions;
}; } __attribute__((packed, aligned(4)));
/** /**
* struct snd_enc_flac * struct snd_enc_flac
...@@ -308,12 +308,12 @@ struct snd_enc_real { ...@@ -308,12 +308,12 @@ struct snd_enc_real {
struct snd_enc_flac { struct snd_enc_flac {
__u32 num; __u32 num;
__u32 gain; __u32 gain;
}; } __attribute__((packed, aligned(4)));
struct snd_enc_generic { struct snd_enc_generic {
__u32 bw; /* encoder bandwidth */ __u32 bw; /* encoder bandwidth */
__s32 reserved[15]; __s32 reserved[15];
}; } __attribute__((packed, aligned(4)));
union snd_codec_options { union snd_codec_options {
struct snd_enc_wma wma; struct snd_enc_wma wma;
...@@ -321,7 +321,7 @@ union snd_codec_options { ...@@ -321,7 +321,7 @@ union snd_codec_options {
struct snd_enc_real real; struct snd_enc_real real;
struct snd_enc_flac flac; struct snd_enc_flac flac;
struct snd_enc_generic generic; struct snd_enc_generic generic;
}; } __attribute__((packed, aligned(4)));
/** struct snd_codec_desc - description of codec capabilities /** struct snd_codec_desc - description of codec capabilities
* @max_ch: Maximum number of audio channels * @max_ch: Maximum number of audio channels
...@@ -358,7 +358,7 @@ struct snd_codec_desc { ...@@ -358,7 +358,7 @@ struct snd_codec_desc {
__u32 formats; __u32 formats;
__u32 min_buffer; __u32 min_buffer;
__u32 reserved[15]; __u32 reserved[15];
}; } __attribute__((packed, aligned(4)));
/** struct snd_codec /** struct snd_codec
* @id: Identifies the supported audio encoder/decoder. * @id: Identifies the supported audio encoder/decoder.
...@@ -399,6 +399,6 @@ struct snd_codec { ...@@ -399,6 +399,6 @@ struct snd_codec {
__u32 align; __u32 align;
union snd_codec_options options; union snd_codec_options options;
__u32 reserved[3]; __u32 reserved[3];
}; } __attribute__((packed, aligned(4)));
#endif #endif
...@@ -898,6 +898,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec, ...@@ -898,6 +898,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
if (!strcmp(codec->modelname, models->name)) { if (!strcmp(codec->modelname, models->name)) {
codec->fixup_id = models->id; codec->fixup_id = models->id;
codec->fixup_name = models->name; codec->fixup_name = models->name;
codec->fixup_list = fixlist;
codec->fixup_forced = 1; codec->fixup_forced = 1;
return; return;
} }
......
...@@ -288,6 +288,24 @@ static char *driver_short_names[] = { ...@@ -288,6 +288,24 @@ static char *driver_short_names[] = {
[AZX_DRIVER_GENERIC] = "HD-Audio Generic", [AZX_DRIVER_GENERIC] = "HD-Audio Generic",
}; };
/* Intel HSW/BDW display HDA controller Extended Mode registers.
* EM4 (M value) and EM5 (N Value) are used to convert CDClk (Core Display
* Clock) to 24MHz BCLK: BCLK = CDCLK * M / N
* The values will be lost when the display power well is disabled.
*/
#define ICH6_REG_EM4 0x100c
#define ICH6_REG_EM5 0x1010
struct hda_intel {
struct azx chip;
/* HSW/BDW display HDA controller to restore BCLK from CDCLK */
unsigned int bclk_m;
unsigned int bclk_n;
};
#ifdef CONFIG_X86 #ifdef CONFIG_X86
static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on)
{ {
...@@ -580,6 +598,22 @@ static int param_set_xint(const char *val, const struct kernel_param *kp) ...@@ -580,6 +598,22 @@ static int param_set_xint(const char *val, const struct kernel_param *kp)
#define azx_del_card_list(chip) /* NOP */ #define azx_del_card_list(chip) /* NOP */
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
static void haswell_save_bclk(struct azx *chip)
{
struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
hda->bclk_m = azx_readw(chip, EM4);
hda->bclk_n = azx_readw(chip, EM5);
}
static void haswell_restore_bclk(struct azx *chip)
{
struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
azx_writew(chip, EM4, hda->bclk_m);
azx_writew(chip, EM5, hda->bclk_n);
}
#if defined(CONFIG_PM_SLEEP) || defined(SUPPORT_VGA_SWITCHEROO) #if defined(CONFIG_PM_SLEEP) || defined(SUPPORT_VGA_SWITCHEROO)
/* /*
* power management * power management
...@@ -606,6 +640,13 @@ static int azx_suspend(struct device *dev) ...@@ -606,6 +640,13 @@ static int azx_suspend(struct device *dev)
free_irq(chip->irq, chip); free_irq(chip->irq, chip);
chip->irq = -1; chip->irq = -1;
} }
/* Save BCLK M/N values before they become invalid in D3.
* Will test if display power well can be released now.
*/
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
haswell_save_bclk(chip);
if (chip->msi) if (chip->msi)
pci_disable_msi(chip->pci); pci_disable_msi(chip->pci);
pci_disable_device(pci); pci_disable_device(pci);
...@@ -625,8 +666,10 @@ static int azx_resume(struct device *dev) ...@@ -625,8 +666,10 @@ static int azx_resume(struct device *dev)
if (chip->disabled) if (chip->disabled)
return 0; return 0;
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
hda_display_power(true); hda_display_power(true);
haswell_restore_bclk(chip);
}
pci_set_power_state(pci, PCI_D0); pci_set_power_state(pci, PCI_D0);
pci_restore_state(pci); pci_restore_state(pci);
if (pci_enable_device(pci) < 0) { if (pci_enable_device(pci) < 0) {
...@@ -670,8 +713,10 @@ static int azx_runtime_suspend(struct device *dev) ...@@ -670,8 +713,10 @@ static int azx_runtime_suspend(struct device *dev)
azx_stop_chip(chip); azx_stop_chip(chip);
azx_enter_link_reset(chip); azx_enter_link_reset(chip);
azx_clear_irq_pending(chip); azx_clear_irq_pending(chip);
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
haswell_save_bclk(chip);
hda_display_power(false); hda_display_power(false);
}
return 0; return 0;
} }
...@@ -689,8 +734,10 @@ static int azx_runtime_resume(struct device *dev) ...@@ -689,8 +734,10 @@ static int azx_runtime_resume(struct device *dev)
if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
return 0; return 0;
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
hda_display_power(true); hda_display_power(true);
haswell_restore_bclk(chip);
}
/* Read STATESTS before controller reset */ /* Read STATESTS before controller reset */
status = azx_readw(chip, STATESTS); status = azx_readw(chip, STATESTS);
...@@ -883,6 +930,8 @@ static int register_vga_switcheroo(struct azx *chip) ...@@ -883,6 +930,8 @@ static int register_vga_switcheroo(struct azx *chip)
static int azx_free(struct azx *chip) static int azx_free(struct azx *chip)
{ {
struct pci_dev *pci = chip->pci; struct pci_dev *pci = chip->pci;
struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
int i; int i;
if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
...@@ -930,7 +979,7 @@ static int azx_free(struct azx *chip) ...@@ -930,7 +979,7 @@ static int azx_free(struct azx *chip)
hda_display_power(false); hda_display_power(false);
hda_i915_exit(); hda_i915_exit();
} }
kfree(chip); kfree(hda);
return 0; return 0;
} }
...@@ -1174,6 +1223,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, ...@@ -1174,6 +1223,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
static struct snd_device_ops ops = { static struct snd_device_ops ops = {
.dev_free = azx_dev_free, .dev_free = azx_dev_free,
}; };
struct hda_intel *hda;
struct azx *chip; struct azx *chip;
int err; int err;
...@@ -1183,13 +1233,14 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, ...@@ -1183,13 +1233,14 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
if (err < 0) if (err < 0)
return err; return err;
chip = kzalloc(sizeof(*chip), GFP_KERNEL); hda = kzalloc(sizeof(*hda), GFP_KERNEL);
if (!chip) { if (!hda) {
dev_err(card->dev, "Cannot allocate chip\n"); dev_err(card->dev, "Cannot allocate hda\n");
pci_disable_device(pci); pci_disable_device(pci);
return -ENOMEM; return -ENOMEM;
} }
chip = &hda->chip;
spin_lock_init(&chip->reg_lock); spin_lock_init(&chip->reg_lock);
mutex_init(&chip->open_mutex); mutex_init(&chip->open_mutex);
chip->card = card; chip->card = card;
......
...@@ -417,6 +417,27 @@ struct snd_hda_pin_quirk { ...@@ -417,6 +417,27 @@ struct snd_hda_pin_quirk {
int value; /* quirk value */ int value; /* quirk value */
}; };
#ifdef CONFIG_SND_DEBUG_VERBOSE
#define SND_HDA_PIN_QUIRK(_codec, _subvendor, _name, _value, _pins...) \
{ .codec = _codec,\
.subvendor = _subvendor,\
.name = _name,\
.value = _value,\
.pins = (const struct hda_pintbl[]) { _pins } \
}
#else
#define SND_HDA_PIN_QUIRK(_codec, _subvendor, _name, _value, _pins...) \
{ .codec = _codec,\
.subvendor = _subvendor,\
.value = _value,\
.pins = (const struct hda_pintbl[]) { _pins } \
}
#endif
/* fixup types */ /* fixup types */
enum { enum {
HDA_FIXUP_INVALID, HDA_FIXUP_INVALID,
......
...@@ -2204,7 +2204,7 @@ static int generic_hdmi_resume(struct hda_codec *codec) ...@@ -2204,7 +2204,7 @@ static int generic_hdmi_resume(struct hda_codec *codec)
struct hdmi_spec *spec = codec->spec; struct hdmi_spec *spec = codec->spec;
int pin_idx; int pin_idx;
generic_hdmi_init(codec); codec->patch_ops.init(codec);
snd_hda_codec_resume_amp(codec); snd_hda_codec_resume_amp(codec);
snd_hda_codec_resume_cache(codec); snd_hda_codec_resume_cache(codec);
......
...@@ -4962,13 +4962,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { ...@@ -4962,13 +4962,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
}; };
static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{ SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
.codec = 0x10ec0255,
.subvendor = 0x1028,
#ifdef CONFIG_SND_DEBUG_VERBOSE
.name = "Dell",
#endif
.pins = (const struct hda_pintbl[]) {
{0x12, 0x90a60140}, {0x12, 0x90a60140},
{0x14, 0x90170110}, {0x14, 0x90170110},
{0x17, 0x40000000}, {0x17, 0x40000000},
...@@ -4978,17 +4972,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { ...@@ -4978,17 +4972,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x1b, 0x411111f0}, {0x1b, 0x411111f0},
{0x1d, 0x40700001}, {0x1d, 0x40700001},
{0x1e, 0x411111f0}, {0x1e, 0x411111f0},
{0x21, 0x02211020}, {0x21, 0x02211020}),
}, SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
.value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
},
{
.codec = 0x10ec0255,
.subvendor = 0x1028,
#ifdef CONFIG_SND_DEBUG_VERBOSE
.name = "Dell",
#endif
.pins = (const struct hda_pintbl[]) {
{0x12, 0x90a60160}, {0x12, 0x90a60160},
{0x14, 0x90170120}, {0x14, 0x90170120},
{0x17, 0x40000000}, {0x17, 0x40000000},
...@@ -4998,17 +4983,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { ...@@ -4998,17 +4983,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x1b, 0x411111f0}, {0x1b, 0x411111f0},
{0x1d, 0x40700001}, {0x1d, 0x40700001},
{0x1e, 0x411111f0}, {0x1e, 0x411111f0},
{0x21, 0x02211030}, {0x21, 0x02211030}),
}, SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
.value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
},
{
.codec = 0x10ec0255,
.subvendor = 0x1028,
#ifdef CONFIG_SND_DEBUG_VERBOSE
.name = "Dell",
#endif
.pins = (const struct hda_pintbl[]) {
{0x12, 0x90a60160}, {0x12, 0x90a60160},
{0x14, 0x90170120}, {0x14, 0x90170120},
{0x17, 0x90170140}, {0x17, 0x90170140},
...@@ -5018,17 +4994,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { ...@@ -5018,17 +4994,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x1b, 0x411111f0}, {0x1b, 0x411111f0},
{0x1d, 0x41163b05}, {0x1d, 0x41163b05},
{0x1e, 0x411111f0}, {0x1e, 0x411111f0},
{0x21, 0x0321102f}, {0x21, 0x0321102f}),
}, SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
.value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
},
{
.codec = 0x10ec0255,
.subvendor = 0x1028,
#ifdef CONFIG_SND_DEBUG_VERBOSE
.name = "Dell",
#endif
.pins = (const struct hda_pintbl[]) {
{0x12, 0x90a60160}, {0x12, 0x90a60160},
{0x14, 0x90170130}, {0x14, 0x90170130},
{0x17, 0x40000000}, {0x17, 0x40000000},
...@@ -5038,17 +5005,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { ...@@ -5038,17 +5005,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x1b, 0x411111f0}, {0x1b, 0x411111f0},
{0x1d, 0x40700001}, {0x1d, 0x40700001},
{0x1e, 0x411111f0}, {0x1e, 0x411111f0},
{0x21, 0x02211040}, {0x21, 0x02211040}),
}, SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
.value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
},
{
.codec = 0x10ec0255,
.subvendor = 0x1028,
#ifdef CONFIG_SND_DEBUG_VERBOSE
.name = "Dell",
#endif
.pins = (const struct hda_pintbl[]) {
{0x12, 0x90a60160}, {0x12, 0x90a60160},
{0x14, 0x90170140}, {0x14, 0x90170140},
{0x17, 0x40000000}, {0x17, 0x40000000},
...@@ -5058,17 +5016,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { ...@@ -5058,17 +5016,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x1b, 0x411111f0}, {0x1b, 0x411111f0},
{0x1d, 0x40700001}, {0x1d, 0x40700001},
{0x1e, 0x411111f0}, {0x1e, 0x411111f0},
{0x21, 0x02211050}, {0x21, 0x02211050}),
}, SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
.value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
},
{
.codec = 0x10ec0255,
.subvendor = 0x1028,
#ifdef CONFIG_SND_DEBUG_VERBOSE
.name = "Dell",
#endif
.pins = (const struct hda_pintbl[]) {
{0x12, 0x90a60170}, {0x12, 0x90a60170},
{0x14, 0x90170120}, {0x14, 0x90170120},
{0x17, 0x40000000}, {0x17, 0x40000000},
...@@ -5078,17 +5027,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { ...@@ -5078,17 +5027,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x1b, 0x411111f0}, {0x1b, 0x411111f0},
{0x1d, 0x40700001}, {0x1d, 0x40700001},
{0x1e, 0x411111f0}, {0x1e, 0x411111f0},
{0x21, 0x02211030}, {0x21, 0x02211030}),
}, SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
.value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
},
{
.codec = 0x10ec0255,
.subvendor = 0x1028,
#ifdef CONFIG_SND_DEBUG_VERBOSE
.name = "Dell",
#endif
.pins = (const struct hda_pintbl[]) {
{0x12, 0x90a60170}, {0x12, 0x90a60170},
{0x14, 0x90170130}, {0x14, 0x90170130},
{0x17, 0x40000000}, {0x17, 0x40000000},
...@@ -5098,17 +5038,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { ...@@ -5098,17 +5038,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x1b, 0x411111f0}, {0x1b, 0x411111f0},
{0x1d, 0x40700001}, {0x1d, 0x40700001},
{0x1e, 0x411111f0}, {0x1e, 0x411111f0},
{0x21, 0x02211040}, {0x21, 0x02211040}),
}, SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
.value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
},
{
.codec = 0x10ec0283,
.subvendor = 0x1028,
#ifdef CONFIG_SND_DEBUG_VERBOSE
.name = "Dell",
#endif
.pins = (const struct hda_pintbl[]) {
{0x12, 0x90a60130}, {0x12, 0x90a60130},
{0x14, 0x90170110}, {0x14, 0x90170110},
{0x17, 0x40020008}, {0x17, 0x40020008},
...@@ -5118,17 +5049,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { ...@@ -5118,17 +5049,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x1b, 0x411111f0}, {0x1b, 0x411111f0},
{0x1d, 0x40e00001}, {0x1d, 0x40e00001},
{0x1e, 0x411111f0}, {0x1e, 0x411111f0},
{0x21, 0x0321101f}, {0x21, 0x0321101f}),
}, SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
.value = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
},
{
.codec = 0x10ec0283,
.subvendor = 0x1028,
#ifdef CONFIG_SND_DEBUG_VERBOSE
.name = "Dell",
#endif
.pins = (const struct hda_pintbl[]) {
{0x12, 0x90a60160}, {0x12, 0x90a60160},
{0x14, 0x90170120}, {0x14, 0x90170120},
{0x17, 0x40000000}, {0x17, 0x40000000},
...@@ -5138,17 +5060,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { ...@@ -5138,17 +5060,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x1b, 0x411111f0}, {0x1b, 0x411111f0},
{0x1d, 0x40700001}, {0x1d, 0x40700001},
{0x1e, 0x411111f0}, {0x1e, 0x411111f0},
{0x21, 0x02211030}, {0x21, 0x02211030}),
}, SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
.value = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
},
{
.codec = 0x10ec0292,
.subvendor = 0x1028,
#ifdef CONFIG_SND_DEBUG_VERBOSE
.name = "Dell",
#endif
.pins = (const struct hda_pintbl[]) {
{0x12, 0x90a60140}, {0x12, 0x90a60140},
{0x13, 0x411111f0}, {0x13, 0x411111f0},
{0x14, 0x90170110}, {0x14, 0x90170110},
...@@ -5159,17 +5072,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { ...@@ -5159,17 +5072,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x1a, 0x411111f0}, {0x1a, 0x411111f0},
{0x1b, 0x411111f0}, {0x1b, 0x411111f0},
{0x1d, 0x40700001}, {0x1d, 0x40700001},
{0x1e, 0x411111f0}, {0x1e, 0x411111f0}),
}, SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
.value = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
},
{
.codec = 0x10ec0293,
.subvendor = 0x1028,
#ifdef CONFIG_SND_DEBUG_VERBOSE
.name = "Dell",
#endif
.pins = (const struct hda_pintbl[]) {
{0x12, 0x40000000}, {0x12, 0x40000000},
{0x13, 0x90a60140}, {0x13, 0x90a60140},
{0x14, 0x90170110}, {0x14, 0x90170110},
...@@ -5180,10 +5084,7 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { ...@@ -5180,10 +5084,7 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
{0x1a, 0x411111f0}, {0x1a, 0x411111f0},
{0x1b, 0x411111f0}, {0x1b, 0x411111f0},
{0x1d, 0x40700001}, {0x1d, 0x40700001},
{0x1e, 0x411111f0}, {0x1e, 0x411111f0}),
},
.value = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
},
{} {}
}; };
...@@ -6039,13 +5940,7 @@ static const struct hda_model_fixup alc662_fixup_models[] = { ...@@ -6039,13 +5940,7 @@ static const struct hda_model_fixup alc662_fixup_models[] = {
}; };
static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
{ SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
.codec = 0x10ec0668,
.subvendor = 0x1028,
#ifdef CONFIG_SND_DEBUG_VERBOSE
.name = "Dell",
#endif
.pins = (const struct hda_pintbl[]) {
{0x12, 0x99a30130}, {0x12, 0x99a30130},
{0x14, 0x90170110}, {0x14, 0x90170110},
{0x15, 0x0321101f}, {0x15, 0x0321101f},
...@@ -6056,17 +5951,8 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { ...@@ -6056,17 +5951,8 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
{0x1b, 0x411111f0}, {0x1b, 0x411111f0},
{0x1d, 0x41000001}, {0x1d, 0x41000001},
{0x1e, 0x411111f0}, {0x1e, 0x411111f0},
{0x1f, 0x411111f0}, {0x1f, 0x411111f0}),
}, SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
.value = ALC668_FIXUP_AUTO_MUTE,
},
{
.codec = 0x10ec0668,
.subvendor = 0x1028,
#ifdef CONFIG_SND_DEBUG_VERBOSE
.name = "Dell",
#endif
.pins = (const struct hda_pintbl[]) {
{0x12, 0x99a30140}, {0x12, 0x99a30140},
{0x14, 0x90170110}, {0x14, 0x90170110},
{0x15, 0x0321101f}, {0x15, 0x0321101f},
...@@ -6077,17 +5963,8 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { ...@@ -6077,17 +5963,8 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
{0x1b, 0x411111f0}, {0x1b, 0x411111f0},
{0x1d, 0x41000001}, {0x1d, 0x41000001},
{0x1e, 0x411111f0}, {0x1e, 0x411111f0},
{0x1f, 0x411111f0}, {0x1f, 0x411111f0}),
}, SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
.value = ALC668_FIXUP_AUTO_MUTE,
},
{
.codec = 0x10ec0668,
.subvendor = 0x1028,
#ifdef CONFIG_SND_DEBUG_VERBOSE
.name = "Dell",
#endif
.pins = (const struct hda_pintbl[]) {
{0x12, 0x99a30150}, {0x12, 0x99a30150},
{0x14, 0x90170110}, {0x14, 0x90170110},
{0x15, 0x0321101f}, {0x15, 0x0321101f},
...@@ -6098,17 +5975,8 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { ...@@ -6098,17 +5975,8 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
{0x1b, 0x411111f0}, {0x1b, 0x411111f0},
{0x1d, 0x41000001}, {0x1d, 0x41000001},
{0x1e, 0x411111f0}, {0x1e, 0x411111f0},
{0x1f, 0x411111f0}, {0x1f, 0x411111f0}),
}, SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
.value = ALC668_FIXUP_AUTO_MUTE,
},
{
.codec = 0x10ec0668,
.subvendor = 0x1028,
#ifdef CONFIG_SND_DEBUG_VERBOSE
.name = "Dell",
#endif
.pins = (const struct hda_pintbl[]) {
{0x12, 0x411111f0}, {0x12, 0x411111f0},
{0x14, 0x90170110}, {0x14, 0x90170110},
{0x15, 0x0321101f}, {0x15, 0x0321101f},
...@@ -6119,10 +5987,19 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { ...@@ -6119,10 +5987,19 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
{0x1b, 0x411111f0}, {0x1b, 0x411111f0},
{0x1d, 0x41000001}, {0x1d, 0x41000001},
{0x1e, 0x411111f0}, {0x1e, 0x411111f0},
{0x1f, 0x411111f0}, {0x1f, 0x411111f0}),
}, SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
.value = ALC668_FIXUP_AUTO_MUTE, {0x12, 0x90a60130},
}, {0x14, 0x90170110},
{0x15, 0x0321101f},
{0x16, 0x40000000},
{0x18, 0x411111f0},
{0x19, 0x411111f0},
{0x1a, 0x411111f0},
{0x1b, 0x411111f0},
{0x1d, 0x40d6832d},
{0x1e, 0x411111f0},
{0x1f, 0x411111f0}),
{} {}
}; };
......
...@@ -121,6 +121,12 @@ enum { ...@@ -121,6 +121,12 @@ enum {
STAC_92HD71BXX_MODELS STAC_92HD71BXX_MODELS
}; };
enum {
STAC_92HD95_HP_LED,
STAC_92HD95_HP_BASS,
STAC_92HD95_MODELS
};
enum { enum {
STAC_925x_REF, STAC_925x_REF,
STAC_M1, STAC_M1,
...@@ -4128,6 +4134,48 @@ static const struct snd_pci_quirk stac9205_fixup_tbl[] = { ...@@ -4128,6 +4134,48 @@ static const struct snd_pci_quirk stac9205_fixup_tbl[] = {
{} /* terminator */ {} /* terminator */
}; };
static void stac92hd95_fixup_hp_led(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
struct sigmatel_spec *spec = codec->spec;
if (action != HDA_FIXUP_ACT_PRE_PROBE)
return;
if (find_mute_led_cfg(codec, spec->default_polarity))
codec_dbg(codec, "mute LED gpio %d polarity %d\n",
spec->gpio_led,
spec->gpio_led_polarity);
}
static const struct hda_fixup stac92hd95_fixups[] = {
[STAC_92HD95_HP_LED] = {
.type = HDA_FIXUP_FUNC,
.v.func = stac92hd95_fixup_hp_led,
},
[STAC_92HD95_HP_BASS] = {
.type = HDA_FIXUP_VERBS,
.v.verbs = (const struct hda_verb[]) {
{0x1a, 0x795, 0x00}, /* HPF to 100Hz */
{}
},
.chained = true,
.chain_id = STAC_92HD95_HP_LED,
},
};
static const struct snd_pci_quirk stac92hd95_fixup_tbl[] = {
SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1911, "HP Spectre 13", STAC_92HD95_HP_BASS),
{} /* terminator */
};
static const struct hda_model_fixup stac92hd95_models[] = {
{ .id = STAC_92HD95_HP_LED, .name = "hp-led" },
{ .id = STAC_92HD95_HP_BASS, .name = "hp-bass" },
{}
};
static int stac_parse_auto_config(struct hda_codec *codec) static int stac_parse_auto_config(struct hda_codec *codec)
{ {
struct sigmatel_spec *spec = codec->spec; struct sigmatel_spec *spec = codec->spec;
...@@ -4580,10 +4628,16 @@ static int patch_stac92hd95(struct hda_codec *codec) ...@@ -4580,10 +4628,16 @@ static int patch_stac92hd95(struct hda_codec *codec)
spec->gen.beep_nid = 0x19; /* digital beep */ spec->gen.beep_nid = 0x19; /* digital beep */
spec->pwr_nids = stac92hd95_pwr_nids; spec->pwr_nids = stac92hd95_pwr_nids;
spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids); spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids);
spec->default_polarity = -1; /* no default cfg */ spec->default_polarity = 0;
codec->patch_ops = stac_patch_ops; codec->patch_ops = stac_patch_ops;
snd_hda_pick_fixup(codec, stac92hd95_models, stac92hd95_fixup_tbl,
stac92hd95_fixups);
snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
stac_setup_gpio(codec);
err = stac_parse_auto_config(codec); err = stac_parse_auto_config(codec);
if (err < 0) { if (err < 0) {
stac_free(codec); stac_free(codec);
...@@ -4592,6 +4646,8 @@ static int patch_stac92hd95(struct hda_codec *codec) ...@@ -4592,6 +4646,8 @@ static int patch_stac92hd95(struct hda_codec *codec)
codec->proc_widget_hook = stac92hd_proc_hook; codec->proc_widget_hook = stac92hd_proc_hook;
snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
return 0; return 0;
} }
......
...@@ -307,6 +307,11 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) ...@@ -307,6 +307,11 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
static int snd_usb_audio_free(struct snd_usb_audio *chip) static int snd_usb_audio_free(struct snd_usb_audio *chip)
{ {
struct list_head *p, *n;
list_for_each_safe(p, n, &chip->ep_list)
snd_usb_endpoint_free(p);
mutex_destroy(&chip->mutex); mutex_destroy(&chip->mutex);
kfree(chip); kfree(chip);
return 0; return 0;
...@@ -585,7 +590,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, ...@@ -585,7 +590,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
struct snd_usb_audio *chip) struct snd_usb_audio *chip)
{ {
struct snd_card *card; struct snd_card *card;
struct list_head *p, *n; struct list_head *p;
if (chip == (void *)-1L) if (chip == (void *)-1L)
return; return;
...@@ -598,14 +603,16 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, ...@@ -598,14 +603,16 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
mutex_lock(&register_mutex); mutex_lock(&register_mutex);
chip->num_interfaces--; chip->num_interfaces--;
if (chip->num_interfaces <= 0) { if (chip->num_interfaces <= 0) {
struct snd_usb_endpoint *ep;
snd_card_disconnect(card); snd_card_disconnect(card);
/* release the pcm resources */ /* release the pcm resources */
list_for_each(p, &chip->pcm_list) { list_for_each(p, &chip->pcm_list) {
snd_usb_stream_disconnect(p); snd_usb_stream_disconnect(p);
} }
/* release the endpoint resources */ /* release the endpoint resources */
list_for_each_safe(p, n, &chip->ep_list) { list_for_each_entry(ep, &chip->ep_list, list) {
snd_usb_endpoint_free(p); snd_usb_endpoint_release(ep);
} }
/* release the midi resources */ /* release the midi resources */
list_for_each(p, &chip->midi_list) { list_for_each(p, &chip->midi_list) {
......
...@@ -986,20 +986,31 @@ void snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep) ...@@ -986,20 +986,31 @@ void snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep)
wait_clear_urbs(ep); wait_clear_urbs(ep);
} }
/**
* snd_usb_endpoint_release: Tear down an snd_usb_endpoint
*
* @ep: the endpoint to release
*
* This function does not care for the endpoint's use count but will tear
* down all the streaming URBs immediately.
*/
void snd_usb_endpoint_release(struct snd_usb_endpoint *ep)
{
release_urbs(ep, 1);
}
/** /**
* snd_usb_endpoint_free: Free the resources of an snd_usb_endpoint * snd_usb_endpoint_free: Free the resources of an snd_usb_endpoint
* *
* @ep: the list header of the endpoint to free * @ep: the list header of the endpoint to free
* *
* This function does not care for the endpoint's use count but will tear * This free all resources of the given ep.
* down all the streaming URBs immediately and free all resources.
*/ */
void snd_usb_endpoint_free(struct list_head *head) void snd_usb_endpoint_free(struct list_head *head)
{ {
struct snd_usb_endpoint *ep; struct snd_usb_endpoint *ep;
ep = list_entry(head, struct snd_usb_endpoint, list); ep = list_entry(head, struct snd_usb_endpoint, list);
release_urbs(ep, 1);
kfree(ep); kfree(ep);
} }
......
...@@ -23,6 +23,7 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep); ...@@ -23,6 +23,7 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep);
void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep); void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);
int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);
void snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep); void snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep);
void snd_usb_endpoint_release(struct snd_usb_endpoint *ep);
void snd_usb_endpoint_free(struct list_head *head); void snd_usb_endpoint_free(struct list_head *head);
int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep); int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep);
......
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