Loading Documentation/sound/alsa/HD-Audio-Models.txt +5 −0 Original line number Diff line number Diff line Loading @@ -286,6 +286,11 @@ STAC92HD83* hp-inv-led HP with broken BIOS for inverted mute LED auto BIOS setup (default) STAC92HD95 ========== hp-led LED support for HP laptops hp-bass Bass HPF setup for HP Spectre 13 STAC9872 ======== vaio VAIO laptop without SPDIF Loading include/uapi/sound/compress_offload.h +7 −7 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ struct snd_compressed_buffer { __u32 fragment_size; __u32 fragments; }; } __attribute__((packed, aligned(4))); /** * struct snd_compr_params: compressed stream params Loading @@ -51,7 +51,7 @@ struct snd_compr_params { struct snd_compressed_buffer buffer; struct snd_codec codec; __u8 no_wake_mode; }; } __attribute__((packed, aligned(4))); /** * struct snd_compr_tstamp: timestamp descriptor Loading @@ -70,7 +70,7 @@ struct snd_compr_tstamp { __u32 pcm_frames; __u32 pcm_io_frames; __u32 sampling_rate; }; } __attribute__((packed, aligned(4))); /** * struct snd_compr_avail: avail descriptor Loading @@ -80,7 +80,7 @@ struct snd_compr_tstamp { struct snd_compr_avail { __u64 avail; struct snd_compr_tstamp tstamp; } __attribute__((packed)); } __attribute__((packed, aligned(4))); enum snd_compr_direction { SND_COMPRESS_PLAYBACK = 0, Loading @@ -107,7 +107,7 @@ struct snd_compr_caps { __u32 max_fragments; __u32 codecs[MAX_NUM_CODECS]; __u32 reserved[11]; }; } __attribute__((packed, aligned(4))); /** * struct snd_compr_codec_caps: query capability of codec Loading @@ -119,7 +119,7 @@ struct snd_compr_codec_caps { __u32 codec; __u32 num_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 Loading @@ -140,7 +140,7 @@ enum { struct snd_compr_metadata { __u32 key; __u32 value[8]; }; } __attribute__((packed, aligned(4))); /** * compress path ioctl definitions Loading include/uapi/sound/compress_params.h +7 −7 Original line number Diff line number Diff line Loading @@ -268,7 +268,7 @@ struct snd_enc_vorbis { __u32 max_bit_rate; __u32 min_bit_rate; __u32 downmix; }; } __attribute__((packed, aligned(4))); /** Loading @@ -284,7 +284,7 @@ struct snd_enc_real { __u32 quant_bits; __u32 start_region; __u32 num_regions; }; } __attribute__((packed, aligned(4))); /** * struct snd_enc_flac Loading @@ -308,12 +308,12 @@ struct snd_enc_real { struct snd_enc_flac { __u32 num; __u32 gain; }; } __attribute__((packed, aligned(4))); struct snd_enc_generic { __u32 bw; /* encoder bandwidth */ __s32 reserved[15]; }; } __attribute__((packed, aligned(4))); union snd_codec_options { struct snd_enc_wma wma; Loading @@ -321,7 +321,7 @@ union snd_codec_options { struct snd_enc_real real; struct snd_enc_flac flac; struct snd_enc_generic generic; }; } __attribute__((packed, aligned(4))); /** struct snd_codec_desc - description of codec capabilities * @max_ch: Maximum number of audio channels Loading Loading @@ -358,7 +358,7 @@ struct snd_codec_desc { __u32 formats; __u32 min_buffer; __u32 reserved[15]; }; } __attribute__((packed, aligned(4))); /** struct snd_codec * @id: Identifies the supported audio encoder/decoder. Loading Loading @@ -399,6 +399,6 @@ struct snd_codec { __u32 align; union snd_codec_options options; __u32 reserved[3]; }; } __attribute__((packed, aligned(4))); #endif sound/pci/hda/hda_auto_parser.c +1 −0 Original line number Diff line number Diff line Loading @@ -898,6 +898,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec, if (!strcmp(codec->modelname, models->name)) { codec->fixup_id = models->id; codec->fixup_name = models->name; codec->fixup_list = fixlist; codec->fixup_forced = 1; return; } Loading sound/pci/hda/hda_intel.c +58 −7 Original line number Diff line number Diff line Loading @@ -288,6 +288,24 @@ static char *driver_short_names[] = { [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 static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) { Loading Loading @@ -580,6 +598,22 @@ static int param_set_xint(const char *val, const struct kernel_param *kp) #define azx_del_card_list(chip) /* NOP */ #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) /* * power management Loading @@ -606,6 +640,13 @@ static int azx_suspend(struct device *dev) free_irq(chip->irq, chip); 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) pci_disable_msi(chip->pci); pci_disable_device(pci); Loading @@ -625,8 +666,10 @@ static int azx_resume(struct device *dev) if (chip->disabled) return 0; if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { hda_display_power(true); haswell_restore_bclk(chip); } pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); if (pci_enable_device(pci) < 0) { Loading Loading @@ -670,8 +713,10 @@ static int azx_runtime_suspend(struct device *dev) azx_stop_chip(chip); azx_enter_link_reset(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); } return 0; } Loading @@ -689,8 +734,10 @@ static int azx_runtime_resume(struct device *dev) if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) return 0; if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { hda_display_power(true); haswell_restore_bclk(chip); } /* Read STATESTS before controller reset */ status = azx_readw(chip, STATESTS); Loading Loading @@ -883,6 +930,8 @@ static int register_vga_switcheroo(struct azx *chip) static int azx_free(struct azx *chip) { struct pci_dev *pci = chip->pci; struct hda_intel *hda = container_of(chip, struct hda_intel, chip); int i; if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) Loading Loading @@ -930,7 +979,7 @@ static int azx_free(struct azx *chip) hda_display_power(false); hda_i915_exit(); } kfree(chip); kfree(hda); return 0; } Loading Loading @@ -1174,6 +1223,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, static struct snd_device_ops ops = { .dev_free = azx_dev_free, }; struct hda_intel *hda; struct azx *chip; int err; Loading @@ -1183,13 +1233,14 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, if (err < 0) return err; chip = kzalloc(sizeof(*chip), GFP_KERNEL); if (!chip) { dev_err(card->dev, "Cannot allocate chip\n"); hda = kzalloc(sizeof(*hda), GFP_KERNEL); if (!hda) { dev_err(card->dev, "Cannot allocate hda\n"); pci_disable_device(pci); return -ENOMEM; } chip = &hda->chip; spin_lock_init(&chip->reg_lock); mutex_init(&chip->open_mutex); chip->card = card; Loading Loading
Documentation/sound/alsa/HD-Audio-Models.txt +5 −0 Original line number Diff line number Diff line Loading @@ -286,6 +286,11 @@ STAC92HD83* hp-inv-led HP with broken BIOS for inverted mute LED auto BIOS setup (default) STAC92HD95 ========== hp-led LED support for HP laptops hp-bass Bass HPF setup for HP Spectre 13 STAC9872 ======== vaio VAIO laptop without SPDIF Loading
include/uapi/sound/compress_offload.h +7 −7 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ struct snd_compressed_buffer { __u32 fragment_size; __u32 fragments; }; } __attribute__((packed, aligned(4))); /** * struct snd_compr_params: compressed stream params Loading @@ -51,7 +51,7 @@ struct snd_compr_params { struct snd_compressed_buffer buffer; struct snd_codec codec; __u8 no_wake_mode; }; } __attribute__((packed, aligned(4))); /** * struct snd_compr_tstamp: timestamp descriptor Loading @@ -70,7 +70,7 @@ struct snd_compr_tstamp { __u32 pcm_frames; __u32 pcm_io_frames; __u32 sampling_rate; }; } __attribute__((packed, aligned(4))); /** * struct snd_compr_avail: avail descriptor Loading @@ -80,7 +80,7 @@ struct snd_compr_tstamp { struct snd_compr_avail { __u64 avail; struct snd_compr_tstamp tstamp; } __attribute__((packed)); } __attribute__((packed, aligned(4))); enum snd_compr_direction { SND_COMPRESS_PLAYBACK = 0, Loading @@ -107,7 +107,7 @@ struct snd_compr_caps { __u32 max_fragments; __u32 codecs[MAX_NUM_CODECS]; __u32 reserved[11]; }; } __attribute__((packed, aligned(4))); /** * struct snd_compr_codec_caps: query capability of codec Loading @@ -119,7 +119,7 @@ struct snd_compr_codec_caps { __u32 codec; __u32 num_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 Loading @@ -140,7 +140,7 @@ enum { struct snd_compr_metadata { __u32 key; __u32 value[8]; }; } __attribute__((packed, aligned(4))); /** * compress path ioctl definitions Loading
include/uapi/sound/compress_params.h +7 −7 Original line number Diff line number Diff line Loading @@ -268,7 +268,7 @@ struct snd_enc_vorbis { __u32 max_bit_rate; __u32 min_bit_rate; __u32 downmix; }; } __attribute__((packed, aligned(4))); /** Loading @@ -284,7 +284,7 @@ struct snd_enc_real { __u32 quant_bits; __u32 start_region; __u32 num_regions; }; } __attribute__((packed, aligned(4))); /** * struct snd_enc_flac Loading @@ -308,12 +308,12 @@ struct snd_enc_real { struct snd_enc_flac { __u32 num; __u32 gain; }; } __attribute__((packed, aligned(4))); struct snd_enc_generic { __u32 bw; /* encoder bandwidth */ __s32 reserved[15]; }; } __attribute__((packed, aligned(4))); union snd_codec_options { struct snd_enc_wma wma; Loading @@ -321,7 +321,7 @@ union snd_codec_options { struct snd_enc_real real; struct snd_enc_flac flac; struct snd_enc_generic generic; }; } __attribute__((packed, aligned(4))); /** struct snd_codec_desc - description of codec capabilities * @max_ch: Maximum number of audio channels Loading Loading @@ -358,7 +358,7 @@ struct snd_codec_desc { __u32 formats; __u32 min_buffer; __u32 reserved[15]; }; } __attribute__((packed, aligned(4))); /** struct snd_codec * @id: Identifies the supported audio encoder/decoder. Loading Loading @@ -399,6 +399,6 @@ struct snd_codec { __u32 align; union snd_codec_options options; __u32 reserved[3]; }; } __attribute__((packed, aligned(4))); #endif
sound/pci/hda/hda_auto_parser.c +1 −0 Original line number Diff line number Diff line Loading @@ -898,6 +898,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec, if (!strcmp(codec->modelname, models->name)) { codec->fixup_id = models->id; codec->fixup_name = models->name; codec->fixup_list = fixlist; codec->fixup_forced = 1; return; } Loading
sound/pci/hda/hda_intel.c +58 −7 Original line number Diff line number Diff line Loading @@ -288,6 +288,24 @@ static char *driver_short_names[] = { [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 static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) { Loading Loading @@ -580,6 +598,22 @@ static int param_set_xint(const char *val, const struct kernel_param *kp) #define azx_del_card_list(chip) /* NOP */ #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) /* * power management Loading @@ -606,6 +640,13 @@ static int azx_suspend(struct device *dev) free_irq(chip->irq, chip); 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) pci_disable_msi(chip->pci); pci_disable_device(pci); Loading @@ -625,8 +666,10 @@ static int azx_resume(struct device *dev) if (chip->disabled) return 0; if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { hda_display_power(true); haswell_restore_bclk(chip); } pci_set_power_state(pci, PCI_D0); pci_restore_state(pci); if (pci_enable_device(pci) < 0) { Loading Loading @@ -670,8 +713,10 @@ static int azx_runtime_suspend(struct device *dev) azx_stop_chip(chip); azx_enter_link_reset(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); } return 0; } Loading @@ -689,8 +734,10 @@ static int azx_runtime_resume(struct device *dev) if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) return 0; if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { hda_display_power(true); haswell_restore_bclk(chip); } /* Read STATESTS before controller reset */ status = azx_readw(chip, STATESTS); Loading Loading @@ -883,6 +930,8 @@ static int register_vga_switcheroo(struct azx *chip) static int azx_free(struct azx *chip) { struct pci_dev *pci = chip->pci; struct hda_intel *hda = container_of(chip, struct hda_intel, chip); int i; if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) Loading Loading @@ -930,7 +979,7 @@ static int azx_free(struct azx *chip) hda_display_power(false); hda_i915_exit(); } kfree(chip); kfree(hda); return 0; } Loading Loading @@ -1174,6 +1223,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, static struct snd_device_ops ops = { .dev_free = azx_dev_free, }; struct hda_intel *hda; struct azx *chip; int err; Loading @@ -1183,13 +1233,14 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, if (err < 0) return err; chip = kzalloc(sizeof(*chip), GFP_KERNEL); if (!chip) { dev_err(card->dev, "Cannot allocate chip\n"); hda = kzalloc(sizeof(*hda), GFP_KERNEL); if (!hda) { dev_err(card->dev, "Cannot allocate hda\n"); pci_disable_device(pci); return -ENOMEM; } chip = &hda->chip; spin_lock_init(&chip->reg_lock); mutex_init(&chip->open_mutex); chip->card = card; Loading