1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_DEVICE_H
24#define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_DEVICE_H
25
26#include <linux/kernel.h>
27#include <linux/platform_device.h>
28
29#include "omap_hwmod.h"
30
31extern struct dev_pm_domain omap_device_pm_domain;
32
33
34#define OMAP_DEVICE_STATE_UNKNOWN 0
35#define OMAP_DEVICE_STATE_ENABLED 1
36#define OMAP_DEVICE_STATE_IDLE 2
37#define OMAP_DEVICE_STATE_SHUTDOWN 3
38
39
40#define OMAP_DEVICE_SUSPENDED BIT(0)
41#define OMAP_DEVICE_NO_IDLE_ON_SUSPEND BIT(1)
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58struct omap_device {
59 struct platform_device *pdev;
60 struct omap_hwmod **hwmods;
61 unsigned long _driver_status;
62 u8 hwmods_cnt;
63 u8 _state;
64 u8 flags;
65};
66
67
68
69int omap_device_enable(struct platform_device *pdev);
70int omap_device_idle(struct platform_device *pdev);
71
72
73
74struct platform_device *omap_device_build(const char *pdev_name, int pdev_id,
75 struct omap_hwmod *oh, void *pdata,
76 int pdata_len);
77
78struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
79 struct omap_hwmod **oh, int oh_cnt,
80 void *pdata, int pdata_len);
81
82struct omap_device *omap_device_alloc(struct platform_device *pdev,
83 struct omap_hwmod **ohs, int oh_cnt);
84void omap_device_delete(struct omap_device *od);
85int omap_device_register(struct platform_device *pdev);
86
87struct device *omap_device_get_by_hwmod_name(const char *oh_name);
88
89
90int omap_device_get_context_loss_count(struct platform_device *pdev);
91
92
93
94int omap_device_assert_hardreset(struct platform_device *pdev,
95 const char *name);
96int omap_device_deassert_hardreset(struct platform_device *pdev,
97 const char *name);
98
99
100static inline struct omap_device *to_omap_device(struct platform_device *pdev)
101{
102 return pdev ? pdev->archdata.od : NULL;
103}
104
105static inline
106void omap_device_disable_idle_on_suspend(struct platform_device *pdev)
107{
108 struct omap_device *od = to_omap_device(pdev);
109
110 od->flags |= OMAP_DEVICE_NO_IDLE_ON_SUSPEND;
111}
112
113#endif
114