aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorImre Deak <imre.deak@intel.com>2015-01-08 10:54:16 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-01-11 20:48:22 -0500
commit926981ae3325257d0bffcf7ff7ba359edb4fd7e8 (patch)
tree173ba54d4e0c7a69d78e1ba1ffc90efe99b1a3d6
parent347de1f8625199d177caf7668cfa1c00717faedb (diff)
ALSA: hda: pass intel_hda to all i915 interface functions
chip is already passed to most of the i915 interface functions. Unify the interface by passing intel_hda instead of chip and passing it to all functions. Passing intel_hda instead of chip makes more sense since this is an intel specific interface. Also in an upcoming patch we will use intel_hda in all of these functions so by passing intel_hda we can save on some pointer casts from chip to intel_hda. This will be needed by an upcoming patch adding component support. No functional change. v2-3: unchanged v4: - pass intel_hda instead of chip Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--sound/pci/hda/hda_i915.c12
-rw-r--r--sound/pci/hda/hda_intel.c28
-rw-r--r--sound/pci/hda/hda_intel.h19
3 files changed, 33 insertions, 26 deletions
diff --git a/sound/pci/hda/hda_i915.c b/sound/pci/hda/hda_i915.c
index 6a7854d8f2d9..66acd09f5da1 100644
--- a/sound/pci/hda/hda_i915.c
+++ b/sound/pci/hda/hda_i915.c
@@ -35,7 +35,7 @@ static int (*get_power)(void);
35static int (*put_power)(void); 35static int (*put_power)(void);
36static int (*get_cdclk)(void); 36static int (*get_cdclk)(void);
37 37
38int hda_display_power(bool enable) 38int hda_display_power(struct hda_intel *hda, bool enable)
39{ 39{
40 if (!get_power || !put_power) 40 if (!get_power || !put_power)
41 return -ENODEV; 41 return -ENODEV;
@@ -48,7 +48,7 @@ int hda_display_power(bool enable)
48 return put_power(); 48 return put_power();
49} 49}
50 50
51void haswell_set_bclk(struct azx *chip) 51void haswell_set_bclk(struct hda_intel *hda)
52{ 52{
53 int cdclk_freq; 53 int cdclk_freq;
54 unsigned int bclk_m, bclk_n; 54 unsigned int bclk_m, bclk_n;
@@ -80,12 +80,12 @@ void haswell_set_bclk(struct azx *chip)
80 break; 80 break;
81 } 81 }
82 82
83 azx_writew(chip, EM4, bclk_m); 83 azx_writew(&hda->chip, EM4, bclk_m);
84 azx_writew(chip, EM5, bclk_n); 84 azx_writew(&hda->chip, EM5, bclk_n);
85} 85}
86 86
87 87
88int hda_i915_init(void) 88int hda_i915_init(struct hda_intel *hda)
89{ 89{
90 int err = 0; 90 int err = 0;
91 91
@@ -111,7 +111,7 @@ int hda_i915_init(void)
111 return err; 111 return err;
112} 112}
113 113
114int hda_i915_exit(void) 114int hda_i915_exit(struct hda_intel *hda)
115{ 115{
116 if (get_power) { 116 if (get_power) {
117 symbol_put(i915_request_power_well); 117 symbol_put(i915_request_power_well);
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index e4bc0dc29fe5..323abf952d00 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -803,7 +803,7 @@ static int azx_suspend(struct device *dev)
803 pci_save_state(pci); 803 pci_save_state(pci);
804 pci_set_power_state(pci, PCI_D3hot); 804 pci_set_power_state(pci, PCI_D3hot);
805 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) 805 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
806 hda_display_power(false); 806 hda_display_power(hda, false);
807 return 0; 807 return 0;
808} 808}
809 809
@@ -823,8 +823,8 @@ static int azx_resume(struct device *dev)
823 return 0; 823 return 0;
824 824
825 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { 825 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
826 hda_display_power(true); 826 hda_display_power(hda, true);
827 haswell_set_bclk(chip); 827 haswell_set_bclk(hda);
828 } 828 }
829 pci_set_power_state(pci, PCI_D0); 829 pci_set_power_state(pci, PCI_D0);
830 pci_restore_state(pci); 830 pci_restore_state(pci);
@@ -876,7 +876,7 @@ static int azx_runtime_suspend(struct device *dev)
876 azx_enter_link_reset(chip); 876 azx_enter_link_reset(chip);
877 azx_clear_irq_pending(chip); 877 azx_clear_irq_pending(chip);
878 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) 878 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
879 hda_display_power(false); 879 hda_display_power(hda, false);
880 880
881 return 0; 881 return 0;
882} 882}
@@ -902,8 +902,8 @@ static int azx_runtime_resume(struct device *dev)
902 return 0; 902 return 0;
903 903
904 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { 904 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
905 hda_display_power(true); 905 hda_display_power(hda, true);
906 haswell_set_bclk(chip); 906 haswell_set_bclk(hda);
907 } 907 }
908 908
909 /* Read STATESTS before controller reset */ 909 /* Read STATESTS before controller reset */
@@ -1125,8 +1125,8 @@ static int azx_free(struct azx *chip)
1125 release_firmware(chip->fw); 1125 release_firmware(chip->fw);
1126#endif 1126#endif
1127 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { 1127 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
1128 hda_display_power(false); 1128 hda_display_power(hda, false);
1129 hda_i915_exit(); 1129 hda_i915_exit(hda);
1130 } 1130 }
1131 kfree(hda); 1131 kfree(hda);
1132 1132
@@ -1604,8 +1604,12 @@ static int azx_first_init(struct azx *chip)
1604 /* initialize chip */ 1604 /* initialize chip */
1605 azx_init_pci(chip); 1605 azx_init_pci(chip);
1606 1606
1607 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) 1607 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
1608 haswell_set_bclk(chip); 1608 struct hda_intel *hda;
1609
1610 hda = container_of(chip, struct hda_intel, chip);
1611 haswell_set_bclk(hda);
1612 }
1609 1613
1610 azx_init_chip(chip, (probe_only[dev] & 2) == 0); 1614 azx_init_chip(chip, (probe_only[dev] & 2) == 0);
1611 1615
@@ -1885,13 +1889,13 @@ static int azx_probe_continue(struct azx *chip)
1885 /* Request power well for Haswell HDA controller and codec */ 1889 /* Request power well for Haswell HDA controller and codec */
1886 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { 1890 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
1887#ifdef CONFIG_SND_HDA_I915 1891#ifdef CONFIG_SND_HDA_I915
1888 err = hda_i915_init(); 1892 err = hda_i915_init(hda);
1889 if (err < 0) { 1893 if (err < 0) {
1890 dev_err(chip->card->dev, 1894 dev_err(chip->card->dev,
1891 "Error request power-well from i915\n"); 1895 "Error request power-well from i915\n");
1892 goto out_free; 1896 goto out_free;
1893 } 1897 }
1894 err = hda_display_power(true); 1898 err = hda_display_power(hda, true);
1895 if (err < 0) { 1899 if (err < 0) {
1896 dev_err(chip->card->dev, 1900 dev_err(chip->card->dev,
1897 "Cannot turn on display power on i915\n"); 1901 "Cannot turn on display power on i915\n");
diff --git a/sound/pci/hda/hda_intel.h b/sound/pci/hda/hda_intel.h
index 434f254adb8b..70b8306fec23 100644
--- a/sound/pci/hda/hda_intel.h
+++ b/sound/pci/hda/hda_intel.h
@@ -44,18 +44,21 @@ struct hda_intel {
44}; 44};
45 45
46#ifdef CONFIG_SND_HDA_I915 46#ifdef CONFIG_SND_HDA_I915
47int hda_display_power(bool enable); 47int hda_display_power(struct hda_intel *hda, bool enable);
48void haswell_set_bclk(struct azx *chip); 48void haswell_set_bclk(struct hda_intel *hda);
49int hda_i915_init(void); 49int hda_i915_init(struct hda_intel *hda);
50int hda_i915_exit(void); 50int hda_i915_exit(struct hda_intel *hda);
51#else 51#else
52static inline int hda_display_power(bool enable) { return 0; } 52static inline int hda_display_power(struct hda_intel *hda, bool enable)
53static inline void haswell_set_bclk(struct azx *chip) { return; } 53{
54static inline int hda_i915_init(void) 54 return 0;
55}
56static inline void haswell_set_bclk(struct hda_intel *hda) { return; }
57static inline int hda_i915_init(struct hda_intel *hda)
55{ 58{
56 return -ENODEV; 59 return -ENODEV;
57} 60}
58static inline int hda_i915_exit(void) 61static inline int hda_i915_exit(struct hda_intel *hda)
59{ 62{
60 return 0; 63 return 0;
61} 64}