diff options
-rw-r--r-- | drivers/char/tpm/tpm_tis.c | 60 |
1 files changed, 24 insertions, 36 deletions
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 4519cb332987..5796d0157ce0 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -766,6 +766,25 @@ static void tpm_tis_reenable_interrupts(struct tpm_chip *chip) | |||
766 | } | 766 | } |
767 | #endif | 767 | #endif |
768 | 768 | ||
769 | #ifdef CONFIG_PM_SLEEP | ||
770 | static int tpm_tis_resume(struct device *dev) | ||
771 | { | ||
772 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
773 | int ret; | ||
774 | |||
775 | if (chip->vendor.irq) | ||
776 | tpm_tis_reenable_interrupts(chip); | ||
777 | |||
778 | ret = tpm_pm_resume(dev); | ||
779 | if (!ret) | ||
780 | tpm_do_selftest(chip); | ||
781 | |||
782 | return ret; | ||
783 | } | ||
784 | #endif | ||
785 | |||
786 | static SIMPLE_DEV_PM_OPS(tpm_tis_pm, tpm_pm_suspend, tpm_tis_resume); | ||
787 | |||
769 | #ifdef CONFIG_PNP | 788 | #ifdef CONFIG_PNP |
770 | static int tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | 789 | static int tpm_tis_pnp_init(struct pnp_dev *pnp_dev, |
771 | const struct pnp_device_id *pnp_id) | 790 | const struct pnp_device_id *pnp_id) |
@@ -787,26 +806,6 @@ static int tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | |||
787 | return tpm_tis_init(&pnp_dev->dev, start, len, irq); | 806 | return tpm_tis_init(&pnp_dev->dev, start, len, irq); |
788 | } | 807 | } |
789 | 808 | ||
790 | static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg) | ||
791 | { | ||
792 | return tpm_pm_suspend(&dev->dev); | ||
793 | } | ||
794 | |||
795 | static int tpm_tis_pnp_resume(struct pnp_dev *dev) | ||
796 | { | ||
797 | struct tpm_chip *chip = pnp_get_drvdata(dev); | ||
798 | int ret; | ||
799 | |||
800 | if (chip->vendor.irq) | ||
801 | tpm_tis_reenable_interrupts(chip); | ||
802 | |||
803 | ret = tpm_pm_resume(&dev->dev); | ||
804 | if (!ret) | ||
805 | tpm_do_selftest(chip); | ||
806 | |||
807 | return ret; | ||
808 | } | ||
809 | |||
810 | static struct pnp_device_id tpm_pnp_tbl[] = { | 809 | static struct pnp_device_id tpm_pnp_tbl[] = { |
811 | {"PNP0C31", 0}, /* TPM */ | 810 | {"PNP0C31", 0}, /* TPM */ |
812 | {"ATM1200", 0}, /* Atmel */ | 811 | {"ATM1200", 0}, /* Atmel */ |
@@ -835,9 +834,12 @@ static struct pnp_driver tis_pnp_driver = { | |||
835 | .name = "tpm_tis", | 834 | .name = "tpm_tis", |
836 | .id_table = tpm_pnp_tbl, | 835 | .id_table = tpm_pnp_tbl, |
837 | .probe = tpm_tis_pnp_init, | 836 | .probe = tpm_tis_pnp_init, |
838 | .suspend = tpm_tis_pnp_suspend, | ||
839 | .resume = tpm_tis_pnp_resume, | ||
840 | .remove = tpm_tis_pnp_remove, | 837 | .remove = tpm_tis_pnp_remove, |
838 | #ifdef CONFIG_PM_SLEEP | ||
839 | .driver = { | ||
840 | .pm = &tpm_tis_pm, | ||
841 | }, | ||
842 | #endif | ||
841 | }; | 843 | }; |
842 | 844 | ||
843 | #define TIS_HID_USR_IDX sizeof(tpm_pnp_tbl)/sizeof(struct pnp_device_id) -2 | 845 | #define TIS_HID_USR_IDX sizeof(tpm_pnp_tbl)/sizeof(struct pnp_device_id) -2 |
@@ -846,20 +848,6 @@ module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id, | |||
846 | MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); | 848 | MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); |
847 | #endif | 849 | #endif |
848 | 850 | ||
849 | #ifdef CONFIG_PM_SLEEP | ||
850 | static int tpm_tis_resume(struct device *dev) | ||
851 | { | ||
852 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
853 | |||
854 | if (chip->vendor.irq) | ||
855 | tpm_tis_reenable_interrupts(chip); | ||
856 | |||
857 | return tpm_pm_resume(dev); | ||
858 | } | ||
859 | #endif | ||
860 | |||
861 | static SIMPLE_DEV_PM_OPS(tpm_tis_pm, tpm_pm_suspend, tpm_tis_resume); | ||
862 | |||
863 | static struct platform_driver tis_drv = { | 851 | static struct platform_driver tis_drv = { |
864 | .driver = { | 852 | .driver = { |
865 | .name = "tpm_tis", | 853 | .name = "tpm_tis", |