ARM: OMAP: omap_device: keep track of driver bound status

Use the bus notifier to keep track of driver bound status by adding a
new internal field to struct omap_device: _driver_status.

This will be useful for follow-up patches which need to know whether
or not a driver is bound in order to make intelligent omap_device
enable/idle decisions.

Reviewed-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
This commit is contained in:
Kevin Hilman 2012-07-10 11:13:16 -07:00
parent 0d7614f09c
commit e753345bec
2 changed files with 11 additions and 5 deletions

View File

@ -60,6 +60,7 @@ extern struct dev_pm_domain omap_device_pm_domain;
* @_dev_wakeup_lat_limit: dev wakeup latency limit in nsec - set by OMAP PM * @_dev_wakeup_lat_limit: dev wakeup latency limit in nsec - set by OMAP PM
* @_state: one of OMAP_DEVICE_STATE_* (see above) * @_state: one of OMAP_DEVICE_STATE_* (see above)
* @flags: device flags * @flags: device flags
* @_driver_status: one of BUS_NOTIFY_*_DRIVER from <linux/device.h>
* *
* Integrates omap_hwmod data into Linux platform_device. * Integrates omap_hwmod data into Linux platform_device.
* *
@ -73,6 +74,7 @@ struct omap_device {
struct omap_device_pm_latency *pm_lats; struct omap_device_pm_latency *pm_lats;
u32 dev_wakeup_lat; u32 dev_wakeup_lat;
u32 _dev_wakeup_lat_limit; u32 _dev_wakeup_lat_limit;
unsigned long _driver_status;
u8 pm_lats_cnt; u8 pm_lats_cnt;
s8 pm_lat_level; s8 pm_lat_level;
u8 hwmods_cnt; u8 hwmods_cnt;

View File

@ -385,17 +385,21 @@ static int _omap_device_notifier_call(struct notifier_block *nb,
unsigned long event, void *dev) unsigned long event, void *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
struct omap_device *od;
switch (event) { switch (event) {
case BUS_NOTIFY_ADD_DEVICE:
if (pdev->dev.of_node)
omap_device_build_from_dt(pdev);
break;
case BUS_NOTIFY_DEL_DEVICE: case BUS_NOTIFY_DEL_DEVICE:
if (pdev->archdata.od) if (pdev->archdata.od)
omap_device_delete(pdev->archdata.od); omap_device_delete(pdev->archdata.od);
break; break;
case BUS_NOTIFY_ADD_DEVICE:
if (pdev->dev.of_node)
omap_device_build_from_dt(pdev);
/* fall through */
default:
od = to_omap_device(pdev);
if (od)
od->_driver_status = event;
} }
return NOTIFY_DONE; return NOTIFY_DONE;