aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-02-19 10:51:17 -0500
committerTakashi Iwai <tiwai@suse.de>2015-02-19 15:41:18 -0500
commit364aa716f43c991052cbb4fa05e3754bacccb95c (patch)
tree1fdf59c3151ebf48a433c9dd4a6cb2bfee9c0193 /sound/pci/hda
parent922c88a8368a61ee93653d4a2888a7f4ce263102 (diff)
ALSA: hda - Introduce azx_has_pm_runtime() macro
For making the debugging of runtime PM easier, introduce azx_has_pm_runtime() and use it in all places checking the runtime pm driver capability. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/hda_controller.c4
-rw-r--r--sound/pci/hda/hda_intel.c12
-rw-r--r--sound/pci/hda/hda_priv.h3
3 files changed, 10 insertions, 9 deletions
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 31ff8b55f386..3589fc2165b0 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -1681,7 +1681,7 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)
1681 int i; 1681 int i;
1682 1682
1683#ifdef CONFIG_PM 1683#ifdef CONFIG_PM
1684 if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME) 1684 if (azx_has_pm_runtime(chip))
1685 if (!pm_runtime_active(chip->card->dev)) 1685 if (!pm_runtime_active(chip->card->dev))
1686 return IRQ_NONE; 1686 return IRQ_NONE;
1687#endif 1687#endif
@@ -1784,7 +1784,7 @@ static void azx_power_notify(struct hda_bus *bus, bool power_up)
1784{ 1784{
1785 struct azx *chip = bus->private_data; 1785 struct azx *chip = bus->private_data;
1786 1786
1787 if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) 1787 if (!azx_has_pm_runtime(chip))
1788 return; 1788 return;
1789 1789
1790 if (power_up) 1790 if (power_up)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 36d2f20db7a4..589883291f4e 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -852,7 +852,7 @@ static int azx_runtime_suspend(struct device *dev)
852 if (chip->disabled || hda->init_failed) 852 if (chip->disabled || hda->init_failed)
853 return 0; 853 return 0;
854 854
855 if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) 855 if (!azx_has_pm_runtime(chip))
856 return 0; 856 return 0;
857 857
858 /* enable controller wake up event */ 858 /* enable controller wake up event */
@@ -885,7 +885,7 @@ static int azx_runtime_resume(struct device *dev)
885 if (chip->disabled || hda->init_failed) 885 if (chip->disabled || hda->init_failed)
886 return 0; 886 return 0;
887 887
888 if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) 888 if (!azx_has_pm_runtime(chip))
889 return 0; 889 return 0;
890 890
891 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { 891 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
@@ -928,8 +928,7 @@ static int azx_runtime_idle(struct device *dev)
928 if (chip->disabled || hda->init_failed) 928 if (chip->disabled || hda->init_failed)
929 return 0; 929 return 0;
930 930
931 if (!power_save_controller || 931 if (!power_save_controller || !azx_has_pm_runtime(chip))
932 !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
933 return -EBUSY; 932 return -EBUSY;
934 933
935 return 0; 934 return 0;
@@ -1071,8 +1070,7 @@ static int azx_free(struct azx *chip)
1071 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); 1070 struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
1072 int i; 1071 int i;
1073 1072
1074 if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) 1073 if (azx_has_pm_runtime(chip) && chip->running)
1075 && chip->running)
1076 pm_runtime_get_noresume(&pci->dev); 1074 pm_runtime_get_noresume(&pci->dev);
1077 1075
1078 azx_del_card_list(chip); 1076 azx_del_card_list(chip);
@@ -1938,7 +1936,7 @@ static int azx_probe_continue(struct azx *chip)
1938 power_down_all_codecs(chip); 1936 power_down_all_codecs(chip);
1939 azx_notifier_register(chip); 1937 azx_notifier_register(chip);
1940 azx_add_card_list(chip); 1938 azx_add_card_list(chip);
1941 if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) || hda->use_vga_switcheroo) 1939 if (azx_has_pm_runtime(chip) || hda->use_vga_switcheroo)
1942 pm_runtime_put_noidle(&pci->dev); 1940 pm_runtime_put_noidle(&pci->dev);
1943 1941
1944out_free: 1942out_free:
diff --git a/sound/pci/hda/hda_priv.h b/sound/pci/hda/hda_priv.h
index daf458299753..a7b4a25c571c 100644
--- a/sound/pci/hda/hda_priv.h
+++ b/sound/pci/hda/hda_priv.h
@@ -403,4 +403,7 @@ struct azx {
403#define azx_sd_readb(chip, dev, reg) \ 403#define azx_sd_readb(chip, dev, reg) \
404 ((chip)->ops->reg_readb((dev)->sd_addr + AZX_REG_##reg)) 404 ((chip)->ops->reg_readb((dev)->sd_addr + AZX_REG_##reg))
405 405
406#define azx_has_pm_runtime(chip) \
407 (!AZX_DCAPS_PM_RUNTIME || ((chip)->driver_caps & AZX_DCAPS_PM_RUNTIME))
408
406#endif /* __SOUND_HDA_PRIV_H */ 409#endif /* __SOUND_HDA_PRIV_H */