Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
omap_device.c File Reference
#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/clkdev.h>
#include <linux/pm_runtime.h>
#include <linux/of.h>
#include <linux/notifier.h>
#include <plat/omap_device.h>
#include <plat/omap_hwmod.h>
#include <plat/clock.h>

Go to the source code of this file.

Macros

#define USE_WAKEUP_LAT   0
 
#define IGNORE_WAKEUP_LAT   1
 
#define _od_suspend_noirq   NULL
 
#define _od_resume_noirq   NULL
 

Functions

int omap_device_get_context_loss_count (struct platform_device *pdev)
 
struct omap_deviceomap_device_alloc (struct platform_device *pdev, struct omap_hwmod **ohs, int oh_cnt, struct omap_device_pm_latency *pm_lats, int pm_lats_cnt)
 
void omap_device_delete (struct omap_device *od)
 
struct platform_device __initomap_device_build (const char *pdev_name, int pdev_id, struct omap_hwmod *oh, void *pdata, int pdata_len, struct omap_device_pm_latency *pm_lats, int pm_lats_cnt, int is_early_device)
 
struct platform_device __initomap_device_build_ss (const char *pdev_name, int pdev_id, struct omap_hwmod **ohs, int oh_cnt, void *pdata, int pdata_len, struct omap_device_pm_latency *pm_lats, int pm_lats_cnt, int is_early_device)
 
int omap_device_register (struct platform_device *pdev)
 
int omap_device_enable (struct platform_device *pdev)
 
int omap_device_idle (struct platform_device *pdev)
 
int omap_device_shutdown (struct platform_device *pdev)
 

Variables

struct dev_pm_domain omap_device_pm_domain
 

on the IP blocks

associated with the hwmods backing the platform_device . All of the hwmods associated with must have the same hardreset line linked to them for this to work. Passes along the return value of omap_hwmod_deassert_hardreset() in the event of any failure, or returns 0 upon success.

int omap_device_assert_hardreset (struct platform_device *pdev, const char *name)
 
int omap_device_deassert_hardreset (struct platform_device *pdev, const char *name)
 
int omap_device_align_pm_lat (struct platform_device *pdev, u32 new_wakeup_lat_limit)
 
struct powerdomainomap_device_get_pwrdm (struct omap_device *od)
 
void __iomemomap_device_get_rt_va (struct omap_device *od)
 
struct deviceomap_device_get_by_hwmod_name (const char *oh_name)
 
 EXPORT_SYMBOL (omap_device_get_by_hwmod_name)
 
int omap_device_enable_hwmods (struct omap_device *od)
 
int omap_device_idle_hwmods (struct omap_device *od)
 
int omap_device_disable_clocks (struct omap_device *od)
 
int omap_device_enable_clocks (struct omap_device *od)
 
 core_initcall (omap_device_init)
 
 late_initcall (omap_device_late_init)
 

Macro Definition Documentation

#define _od_resume_noirq   NULL

Definition at line 843 of file omap_device.c.

#define _od_suspend_noirq   NULL

Definition at line 842 of file omap_device.c.

#define IGNORE_WAKEUP_LAT   1

Definition at line 98 of file omap_device.c.

#define USE_WAKEUP_LAT   0

Definition at line 97 of file omap_device.c.

Function Documentation

core_initcall ( omap_device_init  )
EXPORT_SYMBOL ( omap_device_get_by_hwmod_name  )
late_initcall ( omap_device_late_init  )
int omap_device_align_pm_lat ( struct platform_device pdev,
u32  new_wakeup_lat_limit 
)

omap_device_align_pm_lat - activate/deactivate device to match wakeup lat lim : struct omap_device *

When a device's maximum wakeup latency limit changes, call some of the .activate_func or .deactivate_func function pointers in the omap_device's pm_lats array to ensure that the device's maximum wakeup latency is less than or equal to the new latency limit. Intended to be called by OMAP PM code whenever a device's maximum wakeup latency limit changes (e.g., via omap_pm_set_dev_wakeup_lat()). Returns 0 if nothing needs to be done (e.g., if the omap_device is not currently idle, or if the wakeup latency is already current with the new limit) or passes along the return value of _omap_device_deactivate() or _omap_device_activate().

Definition at line 1056 of file omap_device.c.

struct omap_device* omap_device_alloc ( struct platform_device pdev,
struct omap_hwmod **  ohs,
int  oh_cnt,
struct omap_device_pm_latency pm_lats,
int  pm_lats_cnt 
)
read

omap_device_alloc - allocate an omap_device : platform_device that will be included in this omap_device : ptr to the single omap_hwmod that backs this omap_device : platform_data ptr to associate with the platform_device : amount of memory pointed to by : pointer to a omap_device_pm_latency array for this device : ARRAY_SIZE() of

Convenience function for allocating an omap_device structure and filling hwmods, resources and pm_latency attributes.

Returns an struct omap_device pointer or ERR_PTR() on error;

Definition at line 536 of file omap_device.c.

int omap_device_assert_hardreset ( struct platform_device pdev,
const char name 
)

Definition at line 997 of file omap_device.c.

struct platform_device __init* omap_device_build ( const char pdev_name,
int  pdev_id,
struct omap_hwmod oh,
void pdata,
int  pdata_len,
struct omap_device_pm_latency pm_lats,
int  pm_lats_cnt,
int  is_early_device 
)
read

omap_device_build - build and register an omap_device with one omap_hwmod : name of the platform_device driver to use : this platform_device's connection ID : ptr to the single omap_hwmod that backs this omap_device : platform_data ptr to associate with the platform_device : amount of memory pointed to by : pointer to a omap_device_pm_latency array for this device : ARRAY_SIZE() of : should the device be registered as an early device or not

Convenience function for building and registering a single omap_device record, which in turn builds and registers a platform_device record. See omap_device_build_ss() for more information. Returns ERR_PTR(-EINVAL) if is NULL; otherwise, passes along the return value of omap_device_build_ss().

Definition at line 666 of file omap_device.c.

struct platform_device __init* omap_device_build_ss ( const char pdev_name,
int  pdev_id,
struct omap_hwmod **  ohs,
int  oh_cnt,
void pdata,
int  pdata_len,
struct omap_device_pm_latency pm_lats,
int  pm_lats_cnt,
int  is_early_device 
)
read

omap_device_build_ss - build and register an omap_device with multiple hwmods : name of the platform_device driver to use : this platform_device's connection ID : ptr to the single omap_hwmod that backs this omap_device : platform_data ptr to associate with the platform_device : amount of memory pointed to by : pointer to a omap_device_pm_latency array for this device : ARRAY_SIZE() of : should the device be registered as an early device or not

Convenience function for building and registering an omap_device subsystem record. Subsystem records consist of multiple omap_hwmods. This function in turn builds and registers a platform_device record. Returns an ERR_PTR() on error, or passes along the return value of omap_device_register().

Definition at line 699 of file omap_device.c.

int omap_device_deassert_hardreset ( struct platform_device pdev,
const char name 
)

Definition at line 1024 of file omap_device.c.

void omap_device_delete ( struct omap_device od)

Definition at line 638 of file omap_device.c.

int omap_device_disable_clocks ( struct omap_device od)

omap_device_disable_clocks - disable all main and interface clocks : struct omap_device *od

Disable the main functional clock and interface clock for all of the omap_hwmods associated with the omap_device. Returns 0.

Definition at line 1202 of file omap_device.c.

int omap_device_enable ( struct platform_device pdev)

omap_device_enable - fully activate an omap_device : struct omap_device * to activate

Do whatever is necessary for the hwmods underlying omap_device to be accessible and ready to operate. This generally involves enabling clocks, setting SYSCONFIG registers; and in the future may involve remuxing pins. Device drivers should call this function (through platform_data function pointers) where they would normally enable clocks, etc. Returns -EINVAL if called when the omap_device is already enabled, or passes along the return value of _omap_device_activate().

Definition at line 888 of file omap_device.c.

int omap_device_enable_clocks ( struct omap_device od)

omap_device_enable_clocks - enable all main and interface clocks : struct omap_device *od

Enable the main functional clock and interface clock for all of the omap_hwmods associated with the omap_device. Returns 0.

Definition at line 1220 of file omap_device.c.

int omap_device_enable_hwmods ( struct omap_device od)

omap_device_enable_hwmods - call omap_hwmod_enable() on all hwmods : struct omap_device *od

Enable all underlying hwmods. Returns 0.

Definition at line 1167 of file omap_device.c.

struct device* omap_device_get_by_hwmod_name ( const char oh_name)
read

omap_device_get_by_hwmod_name() - convert a hwmod name to device pointer. : name of the hwmod device

Returns back a struct device * pointer associated with a hwmod device represented by a hwmod_name

Definition at line 1128 of file omap_device.c.

int omap_device_get_context_loss_count ( struct platform_device pdev)

omap_device_get_context_loss_count - get lost context count : struct omap_device *

Using the primary hwmod, query the context loss count for this device.

Callers should consider context for this device lost any time this function returns a value different than the value the caller got the last time it called this function.

If any hwmods exist for the omap_device assoiated with , return the context loss counter for that hwmod, otherwise return zero.

Definition at line 429 of file omap_device.c.

struct powerdomain* omap_device_get_pwrdm ( struct omap_device od)
read

omap_device_get_pwrdm - return the powerdomain * associated with : struct omap_device *

Return the powerdomain associated with the first underlying omap_hwmod for this omap_device. Intended for use by core OMAP PM code. Returns NULL on error or a struct powerdomain * upon success.

Definition at line 1088 of file omap_device.c.

void __iomem* omap_device_get_rt_va ( struct omap_device od)

omap_device_get_mpu_rt_va - return the MPU's virtual addr for the hwmod base : struct omap_device *

Return the MPU's virtual address for the base of the hwmod, from the ioremap() that the hwmod code does. Only valid if there is one hwmod associated with this device. Returns NULL if there are zero or more than one hwmods associated with this omap_device; otherwise, passes along the return value from omap_hwmod_get_mpu_rt_va().

Definition at line 1112 of file omap_device.c.

int omap_device_idle ( struct platform_device pdev)

omap_device_idle - idle an omap_device : struct omap_device * to idle

Idle omap_device by calling as many .deactivate_func() entries in the omap_device's pm_lats table as is possible without exceeding the device's maximum wakeup latency limit, pm_lat_limit. Device drivers should call this function (through platform_data function pointers) where they would normally disable clocks after operations complete, etc.. Returns -EINVAL if the omap_device is not currently enabled, or passes along the return value of _omap_device_deactivate().

Definition at line 928 of file omap_device.c.

int omap_device_idle_hwmods ( struct omap_device od)

omap_device_idle_hwmods - call omap_hwmod_idle() on all hwmods : struct omap_device *od

Idle all underlying hwmods. Returns 0.

Definition at line 1184 of file omap_device.c.

int omap_device_register ( struct platform_device pdev)

omap_device_register - register an omap_device with one omap_hwmod : struct omap_device * to register

Register the omap_device structure. This currently just calls platform_device_register() on the underlying platform_device. Returns the return value of platform_device_register().

Definition at line 864 of file omap_device.c.

int omap_device_shutdown ( struct platform_device pdev)

omap_device_shutdown - shut down an omap_device : struct omap_device * to shut down

Shut down omap_device by calling all .deactivate_func() entries in the omap_device's pm_lats table and then shutting down all of the underlying omap_hwmods. Used when a device is being "removed" or a device driver is being unloaded. Returns -EINVAL if the omap_device is not currently enabled or idle, or passes along the return value of _omap_device_deactivate().

Definition at line 960 of file omap_device.c.

Variable Documentation

struct dev_pm_domain omap_device_pm_domain
Initial value:
= {
.ops = {
SET_RUNTIME_PM_OPS(_od_runtime_suspend, _od_runtime_resume,
_od_runtime_idle)
.suspend_noirq = _od_suspend_noirq,
.resume_noirq = _od_resume_noirq,
}
}

Definition at line 846 of file omap_device.c.