Linux Audio

Check our new training course

Loading...
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * omap_device headers
 4 *
 5 * Copyright (C) 2009 Nokia Corporation
 6 * Paul Walmsley
 7 *
 8 * Developed in collaboration with (alphabetical order): Benoit
 9 * Cousson, Kevin Hilman, Tony Lindgren, Rajendra Nayak, Vikram
10 * Pandita, Sakari Poussa, Anand Sawant, Santosh Shilimkar, Richard
11 * Woodruff
12 *
 
 
 
 
13 * This type of functionality should be implemented as a proper
14 * omap_bus/omap_device in Linux.
15 *
16 * omap_device differs from omap_hwmod in that it includes external
17 * (e.g., board- and system-level) integration details.  omap_hwmod
18 * stores hardware data that is invariant for a given OMAP chip.
19 */
20#ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_DEVICE_H
21#define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_DEVICE_H
22
23#include <linux/kernel.h>
24#include <linux/platform_device.h>
25
26#include "omap_hwmod.h"
27
 
 
 
28/* omap_device._state values */
29#define OMAP_DEVICE_STATE_UNKNOWN	0
30#define OMAP_DEVICE_STATE_ENABLED	1
31#define OMAP_DEVICE_STATE_IDLE		2
32#define OMAP_DEVICE_STATE_SHUTDOWN	3
33
34/* omap_device.flags values */
35#define OMAP_DEVICE_SUSPENDED		BIT(0)
36
37/**
38 * struct omap_device - omap_device wrapper for platform_devices
39 * @pdev: platform_device
40 * @hwmods: (one .. many per omap_device)
41 * @hwmods_cnt: ARRAY_SIZE() of @hwmods
42 * @_state: one of OMAP_DEVICE_STATE_* (see above)
43 * @flags: device flags
44 * @_driver_status: one of BUS_NOTIFY_*_DRIVER from <linux/device.h>
45 *
46 * Integrates omap_hwmod data into Linux platform_device.
47 *
48 * Field names beginning with underscores are for the internal use of
49 * the omap_device code.
50 *
51 */
52struct omap_device {
53	struct platform_device		*pdev;
54	struct omap_hwmod		**hwmods;
55	unsigned long			_driver_status;
56	u8				hwmods_cnt;
57	u8				_state;
58	u8                              flags;
59};
60
61/* Device driver interface (call via platform_data fn ptrs) */
62
63int omap_device_enable(struct platform_device *pdev);
64int omap_device_idle(struct platform_device *pdev);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
66/* Other */
67
68int omap_device_assert_hardreset(struct platform_device *pdev,
69				 const char *name);
70int omap_device_deassert_hardreset(struct platform_device *pdev,
71				 const char *name);
72
73/* Get omap_device pointer from platform_device pointer */
74static inline struct omap_device *to_omap_device(struct platform_device *pdev)
75{
76	return pdev ? pdev->archdata.od : NULL;
77}
78#endif
v4.17
 
  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 *
 16 * This type of functionality should be implemented as a proper
 17 * omap_bus/omap_device in Linux.
 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.
 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;
 32extern struct dev_pm_domain omap_device_fail_pm_domain;
 33
 34/* omap_device._state values */
 35#define OMAP_DEVICE_STATE_UNKNOWN	0
 36#define OMAP_DEVICE_STATE_ENABLED	1
 37#define OMAP_DEVICE_STATE_IDLE		2
 38#define OMAP_DEVICE_STATE_SHUTDOWN	3
 39
 40/* omap_device.flags values */
 41#define OMAP_DEVICE_SUSPENDED		BIT(0)
 42
 43/**
 44 * struct omap_device - omap_device wrapper for platform_devices
 45 * @pdev: platform_device
 46 * @hwmods: (one .. many per omap_device)
 47 * @hwmods_cnt: ARRAY_SIZE() of @hwmods
 48 * @_state: one of OMAP_DEVICE_STATE_* (see above)
 49 * @flags: device flags
 50 * @_driver_status: one of BUS_NOTIFY_*_DRIVER from <linux/device.h>
 51 *
 52 * Integrates omap_hwmod data into Linux platform_device.
 53 *
 54 * Field names beginning with underscores are for the internal use of
 55 * the omap_device code.
 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/* Device driver interface (call via platform_data fn ptrs) */
 68
 69int omap_device_enable(struct platform_device *pdev);
 70int omap_device_idle(struct platform_device *pdev);
 71
 72/* Core code interface */
 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 omap_device *omap_device_alloc(struct platform_device *pdev,
 79				      struct omap_hwmod **ohs, int oh_cnt);
 80void omap_device_delete(struct omap_device *od);
 81int omap_device_register(struct platform_device *pdev);
 82
 83struct device *omap_device_get_by_hwmod_name(const char *oh_name);
 84
 85/* OMAP PM interface */
 86int omap_device_get_context_loss_count(struct platform_device *pdev);
 87
 88/* Other */
 89
 90int omap_device_assert_hardreset(struct platform_device *pdev,
 91				 const char *name);
 92int omap_device_deassert_hardreset(struct platform_device *pdev,
 93				 const char *name);
 94
 95/* Get omap_device pointer from platform_device pointer */
 96static inline struct omap_device *to_omap_device(struct platform_device *pdev)
 97{
 98	return pdev ? pdev->archdata.od : NULL;
 99}
100#endif