diff options
Diffstat (limited to 'sound/pci/hda/hda_codec.h')
-rw-r--r-- | sound/pci/hda/hda_codec.h | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 92938d2a52e2..1ffffaa3a30d 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -26,6 +26,10 @@ | |||
26 | #include <sound/pcm.h> | 26 | #include <sound/pcm.h> |
27 | #include <sound/hwdep.h> | 27 | #include <sound/hwdep.h> |
28 | 28 | ||
29 | #if defined(CONFIG_PM) || defined(CONFIG_SND_HDA_POWER_SAVE) | ||
30 | #define SND_HDA_NEEDS_RESUME /* resume control code is required */ | ||
31 | #endif | ||
32 | |||
29 | /* | 33 | /* |
30 | * nodes | 34 | * nodes |
31 | */ | 35 | */ |
@@ -412,6 +416,10 @@ struct hda_bus_ops { | |||
412 | unsigned int (*get_response)(struct hda_codec *codec); | 416 | unsigned int (*get_response)(struct hda_codec *codec); |
413 | /* free the private data */ | 417 | /* free the private data */ |
414 | void (*private_free)(struct hda_bus *); | 418 | void (*private_free)(struct hda_bus *); |
419 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
420 | /* notify power-up/down from codec to contoller */ | ||
421 | void (*pm_notify)(struct hda_codec *codec); | ||
422 | #endif | ||
415 | }; | 423 | }; |
416 | 424 | ||
417 | /* template to pass to the bus constructor */ | 425 | /* template to pass to the bus constructor */ |
@@ -473,10 +481,13 @@ struct hda_codec_ops { | |||
473 | int (*init)(struct hda_codec *codec); | 481 | int (*init)(struct hda_codec *codec); |
474 | void (*free)(struct hda_codec *codec); | 482 | void (*free)(struct hda_codec *codec); |
475 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); | 483 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
476 | #ifdef CONFIG_PM | 484 | #ifdef SND_HDA_NEEDS_RESUME |
477 | int (*suspend)(struct hda_codec *codec, pm_message_t state); | 485 | int (*suspend)(struct hda_codec *codec, pm_message_t state); |
478 | int (*resume)(struct hda_codec *codec); | 486 | int (*resume)(struct hda_codec *codec); |
479 | #endif | 487 | #endif |
488 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
489 | int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid); | ||
490 | #endif | ||
480 | }; | 491 | }; |
481 | 492 | ||
482 | /* record for amp information cache */ | 493 | /* record for amp information cache */ |
@@ -573,6 +584,12 @@ struct hda_codec { | |||
573 | unsigned int spdif_in_enable; /* SPDIF input enable? */ | 584 | unsigned int spdif_in_enable; /* SPDIF input enable? */ |
574 | 585 | ||
575 | struct snd_hwdep *hwdep; /* assigned hwdep device */ | 586 | struct snd_hwdep *hwdep; /* assigned hwdep device */ |
587 | |||
588 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
589 | int power_on; /* current (global) power-state */ | ||
590 | int power_count; /* current (global) power refcount */ | ||
591 | struct delayed_work power_work; /* delayed task for powerdown */ | ||
592 | #endif | ||
576 | }; | 593 | }; |
577 | 594 | ||
578 | /* direction */ | 595 | /* direction */ |
@@ -617,7 +634,7 @@ void snd_hda_sequence_write(struct hda_codec *codec, | |||
617 | int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex); | 634 | int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex); |
618 | 635 | ||
619 | /* cached write */ | 636 | /* cached write */ |
620 | #ifdef CONFIG_PM | 637 | #ifdef SND_HDA_NEEDS_RESUME |
621 | int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid, | 638 | int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid, |
622 | int direct, unsigned int verb, unsigned int parm); | 639 | int direct, unsigned int verb, unsigned int parm); |
623 | void snd_hda_sequence_write_cache(struct hda_codec *codec, | 640 | void snd_hda_sequence_write_cache(struct hda_codec *codec, |
@@ -662,4 +679,15 @@ int snd_hda_suspend(struct hda_bus *bus, pm_message_t state); | |||
662 | int snd_hda_resume(struct hda_bus *bus); | 679 | int snd_hda_resume(struct hda_bus *bus); |
663 | #endif | 680 | #endif |
664 | 681 | ||
682 | /* | ||
683 | * power saving | ||
684 | */ | ||
685 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
686 | void snd_hda_power_up(struct hda_codec *codec); | ||
687 | void snd_hda_power_down(struct hda_codec *codec); | ||
688 | #else | ||
689 | static inline void snd_hda_power_up(struct hda_codec *codec) {} | ||
690 | static inline void snd_hda_power_down(struct hda_codec *codec) {} | ||
691 | #endif | ||
692 | |||
665 | #endif /* __SOUND_HDA_CODEC_H */ | 693 | #endif /* __SOUND_HDA_CODEC_H */ |