Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * omap_device headers
0004  *
0005  * Copyright (C) 2009 Nokia Corporation
0006  * Paul Walmsley
0007  *
0008  * Developed in collaboration with (alphabetical order): Benoit
0009  * Cousson, Kevin Hilman, Tony Lindgren, Rajendra Nayak, Vikram
0010  * Pandita, Sakari Poussa, Anand Sawant, Santosh Shilimkar, Richard
0011  * Woodruff
0012  *
0013  * This type of functionality should be implemented as a proper
0014  * omap_bus/omap_device in Linux.
0015  *
0016  * omap_device differs from omap_hwmod in that it includes external
0017  * (e.g., board- and system-level) integration details.  omap_hwmod
0018  * stores hardware data that is invariant for a given OMAP chip.
0019  */
0020 #ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_DEVICE_H
0021 #define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_OMAP_DEVICE_H
0022 
0023 #include <linux/kernel.h>
0024 #include <linux/platform_device.h>
0025 
0026 #include "omap_hwmod.h"
0027 
0028 extern struct dev_pm_domain omap_device_pm_domain;
0029 extern struct dev_pm_domain omap_device_fail_pm_domain;
0030 
0031 /* omap_device._state values */
0032 #define OMAP_DEVICE_STATE_UNKNOWN   0
0033 #define OMAP_DEVICE_STATE_ENABLED   1
0034 #define OMAP_DEVICE_STATE_IDLE      2
0035 #define OMAP_DEVICE_STATE_SHUTDOWN  3
0036 
0037 /* omap_device.flags values */
0038 #define OMAP_DEVICE_SUSPENDED       BIT(0)
0039 
0040 /**
0041  * struct omap_device - omap_device wrapper for platform_devices
0042  * @pdev: platform_device
0043  * @hwmods: (one .. many per omap_device)
0044  * @hwmods_cnt: ARRAY_SIZE() of @hwmods
0045  * @_state: one of OMAP_DEVICE_STATE_* (see above)
0046  * @flags: device flags
0047  * @_driver_status: one of BUS_NOTIFY_*_DRIVER from <linux/device.h>
0048  *
0049  * Integrates omap_hwmod data into Linux platform_device.
0050  *
0051  * Field names beginning with underscores are for the internal use of
0052  * the omap_device code.
0053  *
0054  */
0055 struct omap_device {
0056     struct platform_device      *pdev;
0057     struct omap_hwmod       **hwmods;
0058     unsigned long           _driver_status;
0059     u8              hwmods_cnt;
0060     u8              _state;
0061     u8                              flags;
0062 };
0063 
0064 /* Device driver interface (call via platform_data fn ptrs) */
0065 
0066 int omap_device_enable(struct platform_device *pdev);
0067 int omap_device_idle(struct platform_device *pdev);
0068 
0069 /* Core code interface */
0070 
0071 struct omap_device *omap_device_alloc(struct platform_device *pdev,
0072                       struct omap_hwmod **ohs, int oh_cnt);
0073 void omap_device_delete(struct omap_device *od);
0074 
0075 struct device *omap_device_get_by_hwmod_name(const char *oh_name);
0076 
0077 /* OMAP PM interface */
0078 int omap_device_get_context_loss_count(struct platform_device *pdev);
0079 
0080 /* Other */
0081 
0082 int omap_device_assert_hardreset(struct platform_device *pdev,
0083                  const char *name);
0084 int omap_device_deassert_hardreset(struct platform_device *pdev,
0085                  const char *name);
0086 
0087 /* Get omap_device pointer from platform_device pointer */
0088 static inline struct omap_device *to_omap_device(struct platform_device *pdev)
0089 {
0090     return pdev ? pdev->archdata.od : NULL;
0091 }
0092 #endif