Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
[deliverable/linux.git] / arch / arm / mach-omap2 / omap_device.h
CommitLineData
b04b65ab
PW
1/*
2 * omap_device headers
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 * Paul Walmsley
6 *
7 * Developed in collaboration with (alphabetical order): Benoit
8 * Cousson, Kevin Hilman, Tony Lindgren, Rajendra Nayak, Vikram
9 * Pandita, Sakari Poussa, Anand Sawant, Santosh Shilimkar, Richard
10 * Woodruff
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 *
c1d1cd59
PW
16 * This type of functionality should be implemented as a proper
17 * omap_bus/omap_device in Linux.
b04b65ab
PW
18 *
19 * omap_device differs from omap_hwmod in that it includes external
20 * (e.g., board- and system-level) integration details. omap_hwmod
21 * stores hardware data that is invariant for a given OMAP chip.
b04b65ab
PW
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
2a296c8f 29#include "omap_hwmod.h"
b04b65ab 30
3ec2decb 31extern struct dev_pm_domain omap_device_pm_domain;
0d5e8252 32
b04b65ab
PW
33/* omap_device._state values */
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
c03f007a 39/* omap_device.flags values */
c1d1cd59 40#define OMAP_DEVICE_SUSPENDED BIT(0)
c03f007a 41
b04b65ab
PW
42/**
43 * struct omap_device - omap_device wrapper for platform_devices
44 * @pdev: platform_device
45 * @hwmods: (one .. many per omap_device)
46 * @hwmods_cnt: ARRAY_SIZE() of @hwmods
b04b65ab
PW
47 * @_state: one of OMAP_DEVICE_STATE_* (see above)
48 * @flags: device flags
e753345b 49 * @_driver_status: one of BUS_NOTIFY_*_DRIVER from <linux/device.h>
b04b65ab
PW
50 *
51 * Integrates omap_hwmod data into Linux platform_device.
52 *
53 * Field names beginning with underscores are for the internal use of
54 * the omap_device code.
55 *
56 */
57struct omap_device {
d66b3fe4 58 struct platform_device *pdev;
b04b65ab 59 struct omap_hwmod **hwmods;
e753345b 60 unsigned long _driver_status;
b04b65ab
PW
61 u8 hwmods_cnt;
62 u8 _state;
c03f007a 63 u8 flags;
b04b65ab
PW
64};
65
66/* Device driver interface (call via platform_data fn ptrs) */
67
68int omap_device_enable(struct platform_device *pdev);
69int omap_device_idle(struct platform_device *pdev);
b04b65ab
PW
70
71/* Core code interface */
72
3528c58e 73struct platform_device *omap_device_build(const char *pdev_name, int pdev_id,
c1d1cd59
PW
74 struct omap_hwmod *oh, void *pdata,
75 int pdata_len);
b04b65ab 76
3528c58e 77struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
b04b65ab 78 struct omap_hwmod **oh, int oh_cnt,
c1d1cd59 79 void *pdata, int pdata_len);
b04b65ab 80
993e4fbd 81struct omap_device *omap_device_alloc(struct platform_device *pdev,
c1d1cd59 82 struct omap_hwmod **ohs, int oh_cnt);
993e4fbd
OBC
83void omap_device_delete(struct omap_device *od);
84int omap_device_register(struct platform_device *pdev);
85
1f8a7d52 86struct device *omap_device_get_by_hwmod_name(const char *oh_name);
db2a60bf 87
b04b65ab 88/* OMAP PM interface */
fc013873 89int omap_device_get_context_loss_count(struct platform_device *pdev);
b04b65ab
PW
90
91/* Other */
92
8bb9fde2
ORL
93int omap_device_assert_hardreset(struct platform_device *pdev,
94 const char *name);
95int omap_device_deassert_hardreset(struct platform_device *pdev,
96 const char *name);
b04b65ab 97
a470c42c 98/* Get omap_device pointer from platform_device pointer */
d66b3fe4
KH
99static inline struct omap_device *to_omap_device(struct platform_device *pdev)
100{
101 return pdev ? pdev->archdata.od : NULL;
102}
a470c42c 103#endif
This page took 0.354828 seconds and 5 git commands to generate.