aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/omap_device.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@ti.com>2012-07-10 18:06:11 -0400
committerKevin Hilman <khilman@ti.com>2012-09-12 13:52:03 -0400
commit9634c8dd6a729406e89aed4e29470e3ffb3cd060 (patch)
tree9ba7a4a13fdec2e17c5cce0b08b0dbf65dfdfde9 /arch/arm/plat-omap/omap_device.c
parent72bb6f9b51c82c820ddef892455a85b115460904 (diff)
ARM: OMAP: omap_device: idle devices with no driver bound
Under some circumstances, drivers may leave an omap_device enabled due to driver programming errors, or due to a failure in the drivers probe method. Using the recently added omap_device driver_status field, we can detect conditions where an omap_device is enabled but has no driver bound and then ensure that the device is properly idled until it can be probed again. The goal of this feature is not only to detect and warn on these error conditions, but also to ensure that devices are properly put in low-power states so they do not prevent SoC-wide low-power states. Reviewed-by: Paul Walmsley <paul@pwsan.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/plat-omap/omap_device.c')
-rw-r--r--arch/arm/plat-omap/omap_device.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index 150112e3ffc8..0f519829e795 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -1133,3 +1133,41 @@ static int __init omap_device_init(void)
1133 return 0; 1133 return 0;
1134} 1134}
1135core_initcall(omap_device_init); 1135core_initcall(omap_device_init);
1136
1137/**
1138 * omap_device_late_idle - idle devices without drivers
1139 * @dev: struct device * associated with omap_device
1140 * @data: unused
1141 *
1142 * Check the driver bound status of this device, and idle it
1143 * if there is no driver attached.
1144 */
1145static int __init omap_device_late_idle(struct device *dev, void *data)
1146{
1147 struct platform_device *pdev = to_platform_device(dev);
1148 struct omap_device *od = to_omap_device(pdev);
1149
1150 if (!od)
1151 return 0;
1152
1153 /*
1154 * If omap_device state is enabled, but has no driver bound,
1155 * idle it.
1156 */
1157 if (od->_driver_status != BUS_NOTIFY_BOUND_DRIVER) {
1158 if (od->_state == OMAP_DEVICE_STATE_ENABLED) {
1159 dev_warn(dev, "%s: enabled but no driver. Idling\n",
1160 __func__);
1161 omap_device_idle(pdev);
1162 }
1163 }
1164
1165 return 0;
1166}
1167
1168static int __init omap_device_late_init(void)
1169{
1170 bus_for_each_dev(&platform_bus_type, NULL, NULL, omap_device_late_idle);
1171 return 0;
1172}
1173late_initcall(omap_device_late_init);