diff options
Diffstat (limited to 'arch/arm/plat-omap/omap_device.c')
-rw-r--r-- | arch/arm/plat-omap/omap_device.c | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c index e8d98693d2dd..6de28ea3cd65 100644 --- a/arch/arm/plat-omap/omap_device.c +++ b/arch/arm/plat-omap/omap_device.c | |||
@@ -1,3 +1,4 @@ | |||
1 | |||
1 | /* | 2 | /* |
2 | * omap_device implementation | 3 | * omap_device implementation |
3 | * | 4 | * |
@@ -97,14 +98,7 @@ | |||
97 | #define USE_WAKEUP_LAT 0 | 98 | #define USE_WAKEUP_LAT 0 |
98 | #define IGNORE_WAKEUP_LAT 1 | 99 | #define IGNORE_WAKEUP_LAT 1 |
99 | 100 | ||
100 | static int omap_device_register(struct platform_device *pdev); | ||
101 | static int omap_early_device_register(struct platform_device *pdev); | 101 | static int omap_early_device_register(struct platform_device *pdev); |
102 | static struct omap_device *omap_device_alloc(struct platform_device *pdev, | ||
103 | struct omap_hwmod **ohs, int oh_cnt, | ||
104 | struct omap_device_pm_latency *pm_lats, | ||
105 | int pm_lats_cnt); | ||
106 | static void omap_device_delete(struct omap_device *od); | ||
107 | |||
108 | 102 | ||
109 | static struct omap_device_pm_latency omap_default_latency[] = { | 103 | static struct omap_device_pm_latency omap_default_latency[] = { |
110 | { | 104 | { |
@@ -320,8 +314,6 @@ static void _add_hwmod_clocks_clkdev(struct omap_device *od, | |||
320 | } | 314 | } |
321 | 315 | ||
322 | 316 | ||
323 | static struct dev_pm_domain omap_device_pm_domain; | ||
324 | |||
325 | /** | 317 | /** |
326 | * omap_device_build_from_dt - build an omap_device with multiple hwmods | 318 | * omap_device_build_from_dt - build an omap_device with multiple hwmods |
327 | * @pdev_name: name of the platform_device driver to use | 319 | * @pdev_name: name of the platform_device driver to use |
@@ -509,7 +501,7 @@ static int omap_device_fill_resources(struct omap_device *od, | |||
509 | * | 501 | * |
510 | * Returns an struct omap_device pointer or ERR_PTR() on error; | 502 | * Returns an struct omap_device pointer or ERR_PTR() on error; |
511 | */ | 503 | */ |
512 | static struct omap_device *omap_device_alloc(struct platform_device *pdev, | 504 | struct omap_device *omap_device_alloc(struct platform_device *pdev, |
513 | struct omap_hwmod **ohs, int oh_cnt, | 505 | struct omap_hwmod **ohs, int oh_cnt, |
514 | struct omap_device_pm_latency *pm_lats, | 506 | struct omap_device_pm_latency *pm_lats, |
515 | int pm_lats_cnt) | 507 | int pm_lats_cnt) |
@@ -591,7 +583,7 @@ oda_exit1: | |||
591 | return ERR_PTR(ret); | 583 | return ERR_PTR(ret); |
592 | } | 584 | } |
593 | 585 | ||
594 | static void omap_device_delete(struct omap_device *od) | 586 | void omap_device_delete(struct omap_device *od) |
595 | { | 587 | { |
596 | if (!od) | 588 | if (!od) |
597 | return; | 589 | return; |
@@ -619,7 +611,7 @@ static void omap_device_delete(struct omap_device *od) | |||
619 | * information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise, | 611 | * information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise, |
620 | * passes along the return value of omap_device_build_ss(). | 612 | * passes along the return value of omap_device_build_ss(). |
621 | */ | 613 | */ |
622 | struct platform_device *omap_device_build(const char *pdev_name, int pdev_id, | 614 | struct platform_device __init *omap_device_build(const char *pdev_name, int pdev_id, |
623 | struct omap_hwmod *oh, void *pdata, | 615 | struct omap_hwmod *oh, void *pdata, |
624 | int pdata_len, | 616 | int pdata_len, |
625 | struct omap_device_pm_latency *pm_lats, | 617 | struct omap_device_pm_latency *pm_lats, |
@@ -652,7 +644,7 @@ struct platform_device *omap_device_build(const char *pdev_name, int pdev_id, | |||
652 | * platform_device record. Returns an ERR_PTR() on error, or passes | 644 | * platform_device record. Returns an ERR_PTR() on error, or passes |
653 | * along the return value of omap_device_register(). | 645 | * along the return value of omap_device_register(). |
654 | */ | 646 | */ |
655 | struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id, | 647 | struct platform_device __init *omap_device_build_ss(const char *pdev_name, int pdev_id, |
656 | struct omap_hwmod **ohs, int oh_cnt, | 648 | struct omap_hwmod **ohs, int oh_cnt, |
657 | void *pdata, int pdata_len, | 649 | void *pdata, int pdata_len, |
658 | struct omap_device_pm_latency *pm_lats, | 650 | struct omap_device_pm_latency *pm_lats, |
@@ -717,7 +709,7 @@ odbs_exit: | |||
717 | * platform_early_add_device() on the underlying platform_device. | 709 | * platform_early_add_device() on the underlying platform_device. |
718 | * Returns 0 by default. | 710 | * Returns 0 by default. |
719 | */ | 711 | */ |
720 | static int omap_early_device_register(struct platform_device *pdev) | 712 | static int __init omap_early_device_register(struct platform_device *pdev) |
721 | { | 713 | { |
722 | struct platform_device *devices[1]; | 714 | struct platform_device *devices[1]; |
723 | 715 | ||
@@ -762,14 +754,12 @@ static int _od_suspend_noirq(struct device *dev) | |||
762 | struct omap_device *od = to_omap_device(pdev); | 754 | struct omap_device *od = to_omap_device(pdev); |
763 | int ret; | 755 | int ret; |
764 | 756 | ||
765 | if (od->flags & OMAP_DEVICE_NO_IDLE_ON_SUSPEND) | ||
766 | return pm_generic_suspend_noirq(dev); | ||
767 | |||
768 | ret = pm_generic_suspend_noirq(dev); | 757 | ret = pm_generic_suspend_noirq(dev); |
769 | 758 | ||
770 | if (!ret && !pm_runtime_status_suspended(dev)) { | 759 | if (!ret && !pm_runtime_status_suspended(dev)) { |
771 | if (pm_generic_runtime_suspend(dev) == 0) { | 760 | if (pm_generic_runtime_suspend(dev) == 0) { |
772 | omap_device_idle(pdev); | 761 | if (!(od->flags & OMAP_DEVICE_NO_IDLE_ON_SUSPEND)) |
762 | omap_device_idle(pdev); | ||
773 | od->flags |= OMAP_DEVICE_SUSPENDED; | 763 | od->flags |= OMAP_DEVICE_SUSPENDED; |
774 | } | 764 | } |
775 | } | 765 | } |
@@ -782,13 +772,11 @@ static int _od_resume_noirq(struct device *dev) | |||
782 | struct platform_device *pdev = to_platform_device(dev); | 772 | struct platform_device *pdev = to_platform_device(dev); |
783 | struct omap_device *od = to_omap_device(pdev); | 773 | struct omap_device *od = to_omap_device(pdev); |
784 | 774 | ||
785 | if (od->flags & OMAP_DEVICE_NO_IDLE_ON_SUSPEND) | ||
786 | return pm_generic_resume_noirq(dev); | ||
787 | |||
788 | if ((od->flags & OMAP_DEVICE_SUSPENDED) && | 775 | if ((od->flags & OMAP_DEVICE_SUSPENDED) && |
789 | !pm_runtime_status_suspended(dev)) { | 776 | !pm_runtime_status_suspended(dev)) { |
790 | od->flags &= ~OMAP_DEVICE_SUSPENDED; | 777 | od->flags &= ~OMAP_DEVICE_SUSPENDED; |
791 | omap_device_enable(pdev); | 778 | if (!(od->flags & OMAP_DEVICE_NO_IDLE_ON_SUSPEND)) |
779 | omap_device_enable(pdev); | ||
792 | pm_generic_runtime_resume(dev); | 780 | pm_generic_runtime_resume(dev); |
793 | } | 781 | } |
794 | 782 | ||
@@ -799,7 +787,7 @@ static int _od_resume_noirq(struct device *dev) | |||
799 | #define _od_resume_noirq NULL | 787 | #define _od_resume_noirq NULL |
800 | #endif | 788 | #endif |
801 | 789 | ||
802 | static struct dev_pm_domain omap_device_pm_domain = { | 790 | struct dev_pm_domain omap_device_pm_domain = { |
803 | .ops = { | 791 | .ops = { |
804 | SET_RUNTIME_PM_OPS(_od_runtime_suspend, _od_runtime_resume, | 792 | SET_RUNTIME_PM_OPS(_od_runtime_suspend, _od_runtime_resume, |
805 | _od_runtime_idle) | 793 | _od_runtime_idle) |
@@ -817,11 +805,10 @@ static struct dev_pm_domain omap_device_pm_domain = { | |||
817 | * platform_device_register() on the underlying platform_device. | 805 | * platform_device_register() on the underlying platform_device. |
818 | * Returns the return value of platform_device_register(). | 806 | * Returns the return value of platform_device_register(). |
819 | */ | 807 | */ |
820 | static int omap_device_register(struct platform_device *pdev) | 808 | int omap_device_register(struct platform_device *pdev) |
821 | { | 809 | { |
822 | pr_debug("omap_device: %s: registering\n", pdev->name); | 810 | pr_debug("omap_device: %s: registering\n", pdev->name); |
823 | 811 | ||
824 | pdev->dev.parent = &omap_device_parent; | ||
825 | pdev->dev.pm_domain = &omap_device_pm_domain; | 812 | pdev->dev.pm_domain = &omap_device_pm_domain; |
826 | return platform_device_add(pdev); | 813 | return platform_device_add(pdev); |
827 | } | 814 | } |
@@ -1130,11 +1117,6 @@ int omap_device_enable_clocks(struct omap_device *od) | |||
1130 | return 0; | 1117 | return 0; |
1131 | } | 1118 | } |
1132 | 1119 | ||
1133 | struct device omap_device_parent = { | ||
1134 | .init_name = "omap", | ||
1135 | .parent = &platform_bus, | ||
1136 | }; | ||
1137 | |||
1138 | static struct notifier_block platform_nb = { | 1120 | static struct notifier_block platform_nb = { |
1139 | .notifier_call = _omap_device_notifier_call, | 1121 | .notifier_call = _omap_device_notifier_call, |
1140 | }; | 1122 | }; |
@@ -1142,6 +1124,6 @@ static struct notifier_block platform_nb = { | |||
1142 | static int __init omap_device_init(void) | 1124 | static int __init omap_device_init(void) |
1143 | { | 1125 | { |
1144 | bus_register_notifier(&platform_bus_type, &platform_nb); | 1126 | bus_register_notifier(&platform_bus_type, &platform_nb); |
1145 | return device_register(&omap_device_parent); | 1127 | return 0; |
1146 | } | 1128 | } |
1147 | core_initcall(omap_device_init); | 1129 | core_initcall(omap_device_init); |