1 /* drivers/gpu/mali400/mali/platform/pegasus-m400/exynos4_pmm.h
3 * Copyright 2011 by S.LSI. Samsung Electronics Inc.
4 * San#24, Nongseo-Dong, Giheung-Gu, Yongin, Korea
6 * Samsung SoC Mali400 DVFS driver
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software FoundatIon.
15 * Platform specific Mali driver functions for the exynos 4XXX based platforms
18 #ifndef __EXYNOS4_PMM_H__
19 #define __EXYNOS4_PMM_H__
21 #include "mali_utgard.h"
23 #include <linux/platform_device.h>
24 /* @Enable or Disable Mali GPU Bottom Lock feature */
25 #define MALI_GPU_BOTTOM_LOCK 1
26 #define MALI_VOLTAGE_LOCK 1
32 /** @brief description of power change reasons
34 typedef enum mali_power_mode_tag
37 MALI_POWER_MODE_LIGHT_SLEEP,
38 MALI_POWER_MODE_DEEP_SLEEP,
41 /** @brief Platform specific setup and initialisation of MALI
43 * This is called from the entrypoint of the driver to initialize the platform
45 * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
47 _mali_osk_errcode_t mali_platform_init(struct device *dev);
49 /** @brief Platform specific deinitialisation of MALI
51 * This is called on the exit of the driver to terminate the platform
53 * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
55 _mali_osk_errcode_t mali_platform_deinit(struct device *dev);
57 /** @brief Platform specific powerdown sequence of MALI
59 * Call as part of platform init if there is no PMM support, else the
61 * There are three power modes defined:
62 * 1) MALI_POWER_MODE_ON
63 * 2) MALI_POWER_MODE_LIGHT_SLEEP
64 * 3) MALI_POWER_MODE_DEEP_SLEEP
65 * MALI power management module transitions to MALI_POWER_MODE_LIGHT_SLEEP mode when MALI is idle
66 * for idle timer (software timer defined in mali_pmm_policy_jobcontrol.h) duration, MALI transitions
67 * to MALI_POWER_MODE_LIGHT_SLEEP mode during timeout if there are no more jobs queued.
68 * MALI power management module transitions to MALI_POWER_MODE_DEEP_SLEEP mode when OS does system power
70 * Customer has to add power down code when MALI transitions to MALI_POWER_MODE_LIGHT_SLEEP or MALI_POWER_MODE_DEEP_SLEEP
72 * MALI_POWER_MODE_ON mode is entered when the MALI is to powered up. Some customers want to control voltage regulators during
73 * the whole system powers on/off. Customer can track in this function whether the MALI is powered up from
74 * MALI_POWER_MODE_LIGHT_SLEEP or MALI_POWER_MODE_DEEP_SLEEP mode and manage the voltage regulators as well.
75 * @param power_mode defines the power modes
76 * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
78 _mali_osk_errcode_t mali_platform_power_mode_change(struct device *dev, mali_power_mode power_mode);
81 /** @brief Platform specific handling of GPU utilization data
83 * When GPU utilization data is enabled, this function will be
84 * periodically called.
86 * @param utilization The workload utilization of the Mali GPU. 0 = no utilization, 256 = full utilization.
88 void mali_gpu_utilization_handler(struct mali_gpu_utilization_data *data);
90 _mali_osk_errcode_t g3d_power_domain_control(int bpower_on);
92 #ifdef CONFIG_REGULATOR
93 void mali_regulator_disable(void);
94 void mali_regulator_enable(void);
95 void mali_regulator_set_voltage(int min_uV, int max_uV);
98 #ifdef CONFIG_MALI_DVFS
99 ssize_t show_time_in_state(struct device *dev, struct device_attribute *attr, char *buf);
100 ssize_t set_time_in_state(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
101 #ifdef CONFIG_CPU_EXYNOS4210
102 #if MALI_GPU_BOTTOM_LOCK
103 int mali_dvfs_bottom_lock_push(void);
104 int mali_dvfs_bottom_lock_pop(void);
107 int mali_dvfs_bottom_lock_push(int lock_step);
108 int mali_dvfs_bottom_lock_pop(void);
112 #if MALI_VOLTAGE_LOCK
113 int mali_voltage_lock_push(int lock_vol);
114 int mali_voltage_lock_pop(void);
115 int mali_voltage_lock_init(void);
116 int mali_vol_get_from_table(int vol);