aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/omap_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-omap/omap_device.c')
-rw-r--r--arch/arm/plat-omap/omap_device.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index 26aee5cc1fc1..f832f92013b2 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -844,6 +844,42 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od)
844 return omap_hwmod_get_mpu_rt_va(od->hwmods[0]); 844 return omap_hwmod_get_mpu_rt_va(od->hwmods[0]);
845} 845}
846 846
847/**
848 * omap_device_get_by_hwmod_name() - convert a hwmod name to
849 * device pointer.
850 * @oh_name: name of the hwmod device
851 *
852 * Returns back a struct device * pointer associated with a hwmod
853 * device represented by a hwmod_name
854 */
855struct device *omap_device_get_by_hwmod_name(const char *oh_name)
856{
857 struct omap_hwmod *oh;
858
859 if (!oh_name) {
860 WARN(1, "%s: no hwmod name!\n", __func__);
861 return ERR_PTR(-EINVAL);
862 }
863
864 oh = omap_hwmod_lookup(oh_name);
865 if (IS_ERR_OR_NULL(oh)) {
866 WARN(1, "%s: no hwmod for %s\n", __func__,
867 oh_name);
868 return ERR_PTR(oh ? PTR_ERR(oh) : -ENODEV);
869 }
870 if (IS_ERR_OR_NULL(oh->od)) {
871 WARN(1, "%s: no omap_device for %s\n", __func__,
872 oh_name);
873 return ERR_PTR(oh->od ? PTR_ERR(oh->od) : -ENODEV);
874 }
875
876 if (IS_ERR_OR_NULL(oh->od->pdev))
877 return ERR_PTR(oh->od->pdev ? PTR_ERR(oh->od->pdev) : -ENODEV);
878
879 return &oh->od->pdev->dev;
880}
881EXPORT_SYMBOL(omap_device_get_by_hwmod_name);
882
847/* 883/*
848 * Public functions intended for use in omap_device_pm_latency 884 * Public functions intended for use in omap_device_pm_latency
849 * .activate_func and .deactivate_func function pointers 885 * .activate_func and .deactivate_func function pointers