1 /**************************************************************************
2 * Copyright (c) 2009, Intel Corporation.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * Benjamin Defnet <benjamin.r.defnet@intel.com>
26 * Rajesh Poornachandran <rajesh.poornachandran@intel.com>
29 #ifndef _PSB_POWERMGMT_H_
30 #define _PSB_POWERMGMT_H_
32 #include <linux/pci.h>
34 #include <drm/drm_crtc.h>
35 #include <linux/intel_mid_pm.h>
36 #ifdef CONFIG_PM_RUNTIME
37 #include <linux/pm_runtime.h>
40 #define OSPM_GRAPHICS_ISLAND 0x1
41 #define OSPM_VIDEO_ENC_ISLAND 0x2
42 #define OSPM_VIDEO_DEC_ISLAND 0x4
43 #define OSPM_DISPLAY_ISLAND 0x8
44 #define OSPM_GL3_CACHE_ISLAND 0x10
45 #define OSPM_ALL_ISLANDS (OSPM_GRAPHICS_ISLAND | OSPM_VIDEO_ENC_ISLAND \
46 | OSPM_VIDEO_DEC_ISLAND | OSPM_DISPLAY_ISLAND \
47 | OSPM_GL3_CACHE_ISLAND)
49 /* IPC message and command defines used to enable/disable mipi panel voltages */
50 #define IPC_MSG_PANEL_ON_OFF 0xE9
51 #define IPC_CMD_PANEL_ON 1
52 #define IPC_CMD_PANEL_OFF 0
54 typedef enum _UHBUsage
56 OSPM_UHB_ONLY_IF_ON = 0,
57 OSPM_UHB_FORCE_POWER_ON,
60 //extern int psb_check_msvdx_idle(struct drm_device *dev);
61 //extern int lnc_check_topaz_idle(struct drm_device *dev);
62 /* Use these functions to power down video HW for D0i3 purpose */
63 void ospm_apm_power_down_msvdx(struct drm_device *dev);
64 void ospm_apm_power_down_topaz(struct drm_device *dev);
66 void ospm_power_init(struct drm_device *dev);
67 void ospm_power_uninit(struct drm_device *dev);
71 * OSPM will call these functions
73 int ospm_power_suspend(struct device *dev);
74 int ospm_power_resume(struct device *dev);
77 * These are the functions the driver should use to wrap all hw access
78 * (i.e. register reads and writes)
80 bool ospm_power_using_hw_begin(int hw_island, bool force_on);
81 bool ospm_power_using_hw_begin_atomic(int hw_island); /* force_on == false */
82 void ospm_power_using_hw_end(int hw_island);
85 * Use this function to do an instantaneous check for if the hw is on.
86 * Only use this in cases where you know the g_state_change_mutex
87 * is already held such as in irq install/uninstall and you need to
88 * prevent a deadlock situation. Otherwise use ospm_power_using_hw_begin().
90 bool ospm_power_is_hw_on(int hw_islands);
93 * Power up/down different hw component rails/islands
95 void ospm_power_island_down(int hw_islands);
96 void ospm_power_island_up(int hw_islands);
98 * GFX-Runtime PM callbacks
100 int psb_runtime_suspend(struct device *dev);
101 int psb_runtime_resume(struct device *dev);
102 int psb_runtime_idle(struct device *dev);
104 extern struct drm_device *gpDrmDevice;
106 #endif /*_PSB_POWERMGMT_H_*/