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>
This commit is contained in:
parent
922c88a836
commit
364aa716f4
|
@ -1681,7 +1681,7 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)
|
|||
int i;
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
|
||||
if (azx_has_pm_runtime(chip))
|
||||
if (!pm_runtime_active(chip->card->dev))
|
||||
return IRQ_NONE;
|
||||
#endif
|
||||
|
@ -1784,7 +1784,7 @@ static void azx_power_notify(struct hda_bus *bus, bool power_up)
|
|||
{
|
||||
struct azx *chip = bus->private_data;
|
||||
|
||||
if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
|
||||
if (!azx_has_pm_runtime(chip))
|
||||
return;
|
||||
|
||||
if (power_up)
|
||||
|
|
|
@ -852,7 +852,7 @@ static int azx_runtime_suspend(struct device *dev)
|
|||
if (chip->disabled || hda->init_failed)
|
||||
return 0;
|
||||
|
||||
if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
|
||||
if (!azx_has_pm_runtime(chip))
|
||||
return 0;
|
||||
|
||||
/* enable controller wake up event */
|
||||
|
@ -885,7 +885,7 @@ static int azx_runtime_resume(struct device *dev)
|
|||
if (chip->disabled || hda->init_failed)
|
||||
return 0;
|
||||
|
||||
if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
|
||||
if (!azx_has_pm_runtime(chip))
|
||||
return 0;
|
||||
|
||||
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
|
||||
|
@ -928,8 +928,7 @@ static int azx_runtime_idle(struct device *dev)
|
|||
if (chip->disabled || hda->init_failed)
|
||||
return 0;
|
||||
|
||||
if (!power_save_controller ||
|
||||
!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
|
||||
if (!power_save_controller || !azx_has_pm_runtime(chip))
|
||||
return -EBUSY;
|
||||
|
||||
return 0;
|
||||
|
@ -1071,8 +1070,7 @@ static int azx_free(struct azx *chip)
|
|||
struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
|
||||
int i;
|
||||
|
||||
if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
|
||||
&& chip->running)
|
||||
if (azx_has_pm_runtime(chip) && chip->running)
|
||||
pm_runtime_get_noresume(&pci->dev);
|
||||
|
||||
azx_del_card_list(chip);
|
||||
|
@ -1938,7 +1936,7 @@ static int azx_probe_continue(struct azx *chip)
|
|||
power_down_all_codecs(chip);
|
||||
azx_notifier_register(chip);
|
||||
azx_add_card_list(chip);
|
||||
if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) || hda->use_vga_switcheroo)
|
||||
if (azx_has_pm_runtime(chip) || hda->use_vga_switcheroo)
|
||||
pm_runtime_put_noidle(&pci->dev);
|
||||
|
||||
out_free:
|
||||
|
|
|
@ -403,4 +403,7 @@ struct azx {
|
|||
#define azx_sd_readb(chip, dev, reg) \
|
||||
((chip)->ops->reg_readb((dev)->sd_addr + AZX_REG_##reg))
|
||||
|
||||
#define azx_has_pm_runtime(chip) \
|
||||
(!AZX_DCAPS_PM_RUNTIME || ((chip)->driver_caps & AZX_DCAPS_PM_RUNTIME))
|
||||
|
||||
#endif /* __SOUND_HDA_PRIV_H */
|
||||
|
|
Loading…
Reference in New Issue