aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-09 19:04:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-09 19:04:31 -0400
commit2e17c5a97e231f3cb426f4b7895eab5be5c5442e (patch)
tree80871817427250200d6931a45ccb4833c4add74a /sound/pci
parent5f097cd249f00683442c3e265d6f27d80fc83563 (diff)
parent774d8e34e46506222bb5e2888e3ef42b2775715f (diff)
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie: "Okay this is the big one, I was stalled on the fbdev pull req as I stupidly let fbdev guys merge a patch I required to fix a warning with some patches I had, they ended up merging the patch from the wrong place, but the warning should be fixed. In future I'll just take the patch myself! Outside drm: There are some snd changes for the HDMI audio interactions on haswell, they've been acked for inclusion via my tree. This relies on the wound/wait tree from Ingo which is already merged. Major changes: AMD finally released the dynamic power management code for all their GPUs from r600->present day, this is great, off by default for now but also a huge amount of code, in fact it is most of this pull request. Since it landed there has been a lot of community testing and Alex has sent a lot of fixes for any bugs found so far. I suspect radeon might now be the biggest kernel driver ever :-P p.s. radeon.dpm=1 to enable dynamic powermanagement for anyone. New drivers: Renesas r-car display unit. Other highlights: - core: GEM CMA prime support, use new w/w mutexs for TTM reservations, cursor hotspot, doc updates - dvo chips: chrontel 7010B support - i915: Haswell (fbc, ips, vecs, watermarks, audio powerwell), Valleyview (enabled by default, rc6), lots of pll reworking, 30bpp support (this time for sure) - nouveau: async buffer object deletion, context/register init updates, kernel vp2 engine support, GF117 support, GK110 accel support (with external nvidia ucode), context cleanups. - exynos: memory leak fixes, Add S3C64XX SoC series support, device tree updates, common clock framework support, - qxl: cursor hotspot support, multi-monitor support, suspend/resume support - mgag200: hw cursor support, g200 mode limiting - shmobile: prime support - tegra: fixes mostly I've been banging on this quite a lot due to the size of it, and it seems to okay on everything I've tested it on." * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (811 commits) drm/radeon/dpm: implement vblank_too_short callback for si drm/radeon/dpm: implement vblank_too_short callback for cayman drm/radeon/dpm: implement vblank_too_short callback for btc drm/radeon/dpm: implement vblank_too_short callback for evergreen drm/radeon/dpm: implement vblank_too_short callback for 7xx drm/radeon/dpm: add checks against vblank time drm/radeon/dpm: add helper to calculate vblank time drm/radeon: remove stray line in old pm code drm/radeon/dpm: fix display_gap programming on rv7xx drm/nvc0/gr: fix gpc firmware regression drm/nouveau: fix minor thinko causing bo moves to not be async on kepler drm/radeon/dpm: implement force performance level for TN drm/radeon/dpm: implement force performance level for ON/LN drm/radeon/dpm: implement force performance level for SI drm/radeon/dpm: implement force performance level for cayman drm/radeon/dpm: implement force performance levels for 7xx/eg/btc drm/radeon/dpm: add infrastructure to force performance levels drm/radeon: fix surface setup on r1xx drm/radeon: add support for 3d perf states on older asics drm/radeon: set default clocks for SI when DPM is disabled ...
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/Kconfig10
-rw-r--r--sound/pci/hda/Makefile2
-rw-r--r--sound/pci/hda/hda_i915.c75
-rw-r--r--sound/pci/hda/hda_i915.h35
-rw-r--r--sound/pci/hda/hda_intel.c87
5 files changed, 192 insertions, 17 deletions
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index 0c5371abecd2..59c5e9c03d53 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -151,6 +151,16 @@ config SND_HDA_CODEC_HDMI
151 snd-hda-codec-hdmi. 151 snd-hda-codec-hdmi.
152 This module is automatically loaded at probing. 152 This module is automatically loaded at probing.
153 153
154config SND_HDA_I915
155 bool "Build Display HD-audio controller/codec power well support for i915 cards"
156 depends on DRM_I915
157 help
158 Say Y here to include full HDMI and DisplayPort HD-audio controller/codec
159 power-well support for Intel Haswell graphics cards based on the i915 driver.
160
161 Note that this option must be enabled for Intel Haswell C+ stepping machines, otherwise
162 the GPU audio controller/codecs will not be initialized or damaged when exit from S3 mode.
163
154config SND_HDA_CODEC_CIRRUS 164config SND_HDA_CODEC_CIRRUS
155 bool "Build Cirrus Logic codec support" 165 bool "Build Cirrus Logic codec support"
156 default y 166 default y
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile
index 24a251497a1f..c091438286a3 100644
--- a/sound/pci/hda/Makefile
+++ b/sound/pci/hda/Makefile
@@ -1,4 +1,6 @@
1snd-hda-intel-objs := hda_intel.o 1snd-hda-intel-objs := hda_intel.o
2# for haswell power well
3snd-hda-intel-$(CONFIG_SND_HDA_I915) += hda_i915.o
2 4
3snd-hda-codec-y := hda_codec.o hda_jack.o hda_auto_parser.o 5snd-hda-codec-y := hda_codec.o hda_jack.o hda_auto_parser.o
4snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o 6snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o
diff --git a/sound/pci/hda/hda_i915.c b/sound/pci/hda/hda_i915.c
new file mode 100644
index 000000000000..76c13d5b3ca0
--- /dev/null
+++ b/sound/pci/hda/hda_i915.c
@@ -0,0 +1,75 @@
1/*
2 * hda_i915.c - routines for Haswell HDA controller power well support
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#include <linux/init.h>
20#include <linux/module.h>
21#include <sound/core.h>
22#include <drm/i915_powerwell.h>
23#include "hda_i915.h"
24
25static void (*get_power)(void);
26static void (*put_power)(void);
27
28void hda_display_power(bool enable)
29{
30 if (!get_power || !put_power)
31 return;
32
33 snd_printdd("HDA display power %s \n",
34 enable ? "Enable" : "Disable");
35 if (enable)
36 get_power();
37 else
38 put_power();
39}
40
41int hda_i915_init(void)
42{
43 int err = 0;
44
45 get_power = symbol_request(i915_request_power_well);
46 if (!get_power) {
47 snd_printk(KERN_WARNING "hda-i915: get_power symbol get fail\n");
48 return -ENODEV;
49 }
50
51 put_power = symbol_request(i915_release_power_well);
52 if (!put_power) {
53 symbol_put(i915_request_power_well);
54 get_power = NULL;
55 return -ENODEV;
56 }
57
58 snd_printd("HDA driver get symbol successfully from i915 module\n");
59
60 return err;
61}
62
63int hda_i915_exit(void)
64{
65 if (get_power) {
66 symbol_put(i915_request_power_well);
67 get_power = NULL;
68 }
69 if (put_power) {
70 symbol_put(i915_release_power_well);
71 put_power = NULL;
72 }
73
74 return 0;
75}
diff --git a/sound/pci/hda/hda_i915.h b/sound/pci/hda/hda_i915.h
new file mode 100644
index 000000000000..5a63da2c53e5
--- /dev/null
+++ b/sound/pci/hda/hda_i915.h
@@ -0,0 +1,35 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the Free
4 * Software Foundation; either version 2 of the License, or (at your option)
5 * any later version.
6 *
7 * This program is distributed in the hope that it will be useful, but WITHOUT
8 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
10 * more details.
11 *
12 * You should have received a copy of the GNU General Public License along with
13 * this program; if not, write to the Free Software Foundation, Inc., 59
14 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 */
16#ifndef __SOUND_HDA_I915_H
17#define __SOUND_HDA_I915_H
18
19#ifdef CONFIG_SND_HDA_I915
20void hda_display_power(bool enable);
21int hda_i915_init(void);
22int hda_i915_exit(void);
23#else
24static inline void hda_display_power(bool enable) {}
25static inline int hda_i915_init(void)
26{
27 return -ENODEV;
28}
29static inline int hda_i915_exit(void)
30{
31 return 0;
32}
33#endif
34
35#endif
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index f39de9055097..8860dd529520 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -62,6 +62,7 @@
62#include <linux/vga_switcheroo.h> 62#include <linux/vga_switcheroo.h>
63#include <linux/firmware.h> 63#include <linux/firmware.h>
64#include "hda_codec.h" 64#include "hda_codec.h"
65#include "hda_i915.h"
65 66
66 67
67static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 68static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
@@ -541,6 +542,10 @@ struct azx {
541 /* for pending irqs */ 542 /* for pending irqs */
542 struct work_struct irq_pending_work; 543 struct work_struct irq_pending_work;
543 544
545#ifdef CONFIG_SND_HDA_I915
546 struct work_struct probe_work;
547#endif
548
544 /* reboot notifier (for mysterious hangup problem at power-down) */ 549 /* reboot notifier (for mysterious hangup problem at power-down) */
545 struct notifier_block reboot_notifier; 550 struct notifier_block reboot_notifier;
546 551
@@ -594,6 +599,7 @@ enum {
594#define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */ 599#define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */
595#define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */ 600#define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */
596#define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ 601#define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */
602#define AZX_DCAPS_I915_POWERWELL (1 << 27) /* HSW i915 power well support */
597 603
598/* quirks for Intel PCH */ 604/* quirks for Intel PCH */
599#define AZX_DCAPS_INTEL_PCH_NOPM \ 605#define AZX_DCAPS_INTEL_PCH_NOPM \
@@ -2919,6 +2925,8 @@ static int azx_suspend(struct device *dev)
2919 pci_disable_device(pci); 2925 pci_disable_device(pci);
2920 pci_save_state(pci); 2926 pci_save_state(pci);
2921 pci_set_power_state(pci, PCI_D3hot); 2927 pci_set_power_state(pci, PCI_D3hot);
2928 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
2929 hda_display_power(false);
2922 return 0; 2930 return 0;
2923} 2931}
2924 2932
@@ -2931,6 +2939,8 @@ static int azx_resume(struct device *dev)
2931 if (chip->disabled) 2939 if (chip->disabled)
2932 return 0; 2940 return 0;
2933 2941
2942 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
2943 hda_display_power(true);
2934 pci_set_power_state(pci, PCI_D0); 2944 pci_set_power_state(pci, PCI_D0);
2935 pci_restore_state(pci); 2945 pci_restore_state(pci);
2936 if (pci_enable_device(pci) < 0) { 2946 if (pci_enable_device(pci) < 0) {
@@ -2964,6 +2974,8 @@ static int azx_runtime_suspend(struct device *dev)
2964 azx_stop_chip(chip); 2974 azx_stop_chip(chip);
2965 azx_enter_link_reset(chip); 2975 azx_enter_link_reset(chip);
2966 azx_clear_irq_pending(chip); 2976 azx_clear_irq_pending(chip);
2977 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
2978 hda_display_power(false);
2967 return 0; 2979 return 0;
2968} 2980}
2969 2981
@@ -2972,6 +2984,8 @@ static int azx_runtime_resume(struct device *dev)
2972 struct snd_card *card = dev_get_drvdata(dev); 2984 struct snd_card *card = dev_get_drvdata(dev);
2973 struct azx *chip = card->private_data; 2985 struct azx *chip = card->private_data;
2974 2986
2987 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
2988 hda_display_power(true);
2975 azx_init_pci(chip); 2989 azx_init_pci(chip);
2976 azx_init_chip(chip, 1); 2990 azx_init_chip(chip, 1);
2977 return 0; 2991 return 0;
@@ -3026,7 +3040,6 @@ static void azx_notifier_unregister(struct azx *chip)
3026 unregister_reboot_notifier(&chip->reboot_notifier); 3040 unregister_reboot_notifier(&chip->reboot_notifier);
3027} 3041}
3028 3042
3029static int azx_first_init(struct azx *chip);
3030static int azx_probe_continue(struct azx *chip); 3043static int azx_probe_continue(struct azx *chip);
3031 3044
3032#ifdef SUPPORT_VGA_SWITCHEROO 3045#ifdef SUPPORT_VGA_SWITCHEROO
@@ -3053,8 +3066,7 @@ static void azx_vs_set_state(struct pci_dev *pci,
3053 snd_printk(KERN_INFO SFX 3066 snd_printk(KERN_INFO SFX
3054 "%s: Start delayed initialization\n", 3067 "%s: Start delayed initialization\n",
3055 pci_name(chip->pci)); 3068 pci_name(chip->pci));
3056 if (azx_first_init(chip) < 0 || 3069 if (azx_probe_continue(chip) < 0) {
3057 azx_probe_continue(chip) < 0) {
3058 snd_printk(KERN_ERR SFX 3070 snd_printk(KERN_ERR SFX
3059 "%s: initialization error\n", 3071 "%s: initialization error\n",
3060 pci_name(chip->pci)); 3072 pci_name(chip->pci));
@@ -3140,8 +3152,13 @@ static int register_vga_switcheroo(struct azx *chip)
3140 */ 3152 */
3141static int azx_free(struct azx *chip) 3153static int azx_free(struct azx *chip)
3142{ 3154{
3155 struct pci_dev *pci = chip->pci;
3143 int i; 3156 int i;
3144 3157
3158 if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
3159 && chip->running)
3160 pm_runtime_get_noresume(&pci->dev);
3161
3145 azx_del_card_list(chip); 3162 azx_del_card_list(chip);
3146 3163
3147 azx_notifier_unregister(chip); 3164 azx_notifier_unregister(chip);
@@ -3193,6 +3210,10 @@ static int azx_free(struct azx *chip)
3193 if (chip->fw) 3210 if (chip->fw)
3194 release_firmware(chip->fw); 3211 release_firmware(chip->fw);
3195#endif 3212#endif
3213 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
3214 hda_display_power(false);
3215 hda_i915_exit();
3216 }
3196 kfree(chip); 3217 kfree(chip);
3197 3218
3198 return 0; 3219 return 0;
@@ -3418,6 +3439,13 @@ static void azx_check_snoop_available(struct azx *chip)
3418 } 3439 }
3419} 3440}
3420 3441
3442#ifdef CONFIG_SND_HDA_I915
3443static void azx_probe_work(struct work_struct *work)
3444{
3445 azx_probe_continue(container_of(work, struct azx, probe_work));
3446}
3447#endif
3448
3421/* 3449/*
3422 * constructor 3450 * constructor
3423 */ 3451 */
@@ -3493,7 +3521,13 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
3493 return err; 3521 return err;
3494 } 3522 }
3495 3523
3524#ifdef CONFIG_SND_HDA_I915
3525 /* continue probing in work context as may trigger request module */
3526 INIT_WORK(&chip->probe_work, azx_probe_work);
3527#endif
3528
3496 *rchip = chip; 3529 *rchip = chip;
3530
3497 return 0; 3531 return 0;
3498} 3532}
3499 3533
@@ -3750,11 +3784,6 @@ static int azx_probe(struct pci_dev *pci,
3750 } 3784 }
3751 3785
3752 probe_now = !chip->disabled; 3786 probe_now = !chip->disabled;
3753 if (probe_now) {
3754 err = azx_first_init(chip);
3755 if (err < 0)
3756 goto out_free;
3757 }
3758 3787
3759#ifdef CONFIG_SND_HDA_PATCH_LOADER 3788#ifdef CONFIG_SND_HDA_PATCH_LOADER
3760 if (patch[dev] && *patch[dev]) { 3789 if (patch[dev] && *patch[dev]) {
@@ -3769,15 +3798,22 @@ static int azx_probe(struct pci_dev *pci,
3769 } 3798 }
3770#endif /* CONFIG_SND_HDA_PATCH_LOADER */ 3799#endif /* CONFIG_SND_HDA_PATCH_LOADER */
3771 3800
3801 /* continue probing in work context, avoid request_module deadlock */
3802 if (probe_now && (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)) {
3803#ifdef CONFIG_SND_HDA_I915
3804 probe_now = false;
3805 schedule_work(&chip->probe_work);
3806#else
3807 snd_printk(KERN_ERR SFX "Haswell must build in CONFIG_SND_HDA_I915\n");
3808#endif
3809 }
3810
3772 if (probe_now) { 3811 if (probe_now) {
3773 err = azx_probe_continue(chip); 3812 err = azx_probe_continue(chip);
3774 if (err < 0) 3813 if (err < 0)
3775 goto out_free; 3814 goto out_free;
3776 } 3815 }
3777 3816
3778 if (pci_dev_run_wake(pci))
3779 pm_runtime_put_noidle(&pci->dev);
3780
3781 dev++; 3817 dev++;
3782 complete_all(&chip->probe_wait); 3818 complete_all(&chip->probe_wait);
3783 return 0; 3819 return 0;
@@ -3789,9 +3825,24 @@ out_free:
3789 3825
3790static int azx_probe_continue(struct azx *chip) 3826static int azx_probe_continue(struct azx *chip)
3791{ 3827{
3828 struct pci_dev *pci = chip->pci;
3792 int dev = chip->dev_index; 3829 int dev = chip->dev_index;
3793 int err; 3830 int err;
3794 3831
3832 /* Request power well for Haswell HDA controller and codec */
3833 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
3834 err = hda_i915_init();
3835 if (err < 0) {
3836 snd_printk(KERN_ERR SFX "Error request power-well from i915\n");
3837 goto out_free;
3838 }
3839 hda_display_power(true);
3840 }
3841
3842 err = azx_first_init(chip);
3843 if (err < 0)
3844 goto out_free;
3845
3795#ifdef CONFIG_SND_HDA_INPUT_BEEP 3846#ifdef CONFIG_SND_HDA_INPUT_BEEP
3796 chip->beep_mode = beep_mode[dev]; 3847 chip->beep_mode = beep_mode[dev];
3797#endif 3848#endif
@@ -3836,6 +3887,8 @@ static int azx_probe_continue(struct azx *chip)
3836 power_down_all_codecs(chip); 3887 power_down_all_codecs(chip);
3837 azx_notifier_register(chip); 3888 azx_notifier_register(chip);
3838 azx_add_card_list(chip); 3889 azx_add_card_list(chip);
3890 if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
3891 pm_runtime_put_noidle(&pci->dev);
3839 3892
3840 return 0; 3893 return 0;
3841 3894
@@ -3848,9 +3901,6 @@ static void azx_remove(struct pci_dev *pci)
3848{ 3901{
3849 struct snd_card *card = pci_get_drvdata(pci); 3902 struct snd_card *card = pci_get_drvdata(pci);
3850 3903
3851 if (pci_dev_run_wake(pci))
3852 pm_runtime_get_noresume(&pci->dev);
3853
3854 if (card) 3904 if (card)
3855 snd_card_free(card); 3905 snd_card_free(card);
3856} 3906}
@@ -3882,11 +3932,14 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
3882 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 3932 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
3883 /* Haswell */ 3933 /* Haswell */
3884 { PCI_DEVICE(0x8086, 0x0a0c), 3934 { PCI_DEVICE(0x8086, 0x0a0c),
3885 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH }, 3935 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH |
3936 AZX_DCAPS_I915_POWERWELL },
3886 { PCI_DEVICE(0x8086, 0x0c0c), 3937 { PCI_DEVICE(0x8086, 0x0c0c),
3887 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH }, 3938 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH |
3939 AZX_DCAPS_I915_POWERWELL },
3888 { PCI_DEVICE(0x8086, 0x0d0c), 3940 { PCI_DEVICE(0x8086, 0x0d0c),
3889 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH }, 3941 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH |
3942 AZX_DCAPS_I915_POWERWELL },
3890 /* 5 Series/3400 */ 3943 /* 5 Series/3400 */
3891 { PCI_DEVICE(0x8086, 0x3b56), 3944 { PCI_DEVICE(0x8086, 0x3b56),
3892 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, 3945 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },