diff options
author | Vikas Sajjan <vikas.sajjan@linaro.org> | 2012-11-28 15:34:01 +0530 |
---|---|---|
committer | Tushar Behera <tushar.behera@linaro.org> | 2013-03-14 10:47:21 +0530 |
commit | 1eb02a0125000a1893d869e161f0dfe9aa024497 (patch) | |
tree | 1a2fe6819ab877c7cdf6251c5d4cbe310f163fdd /drivers/gpu/arm/mali/platform/mali_platform.h | |
parent | 7c461ce6389ed1bcd04970866b1493c5987b3bd9 (diff) |
gpu: mali: Add devfreq platform support
This patch adds the devfreq platform support for Origen board.
Signed-off-by: Vikas C Sajjan <vikas.sajjan@linaro.org>
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Diffstat (limited to 'drivers/gpu/arm/mali/platform/mali_platform.h')
-rw-r--r-- | drivers/gpu/arm/mali/platform/mali_platform.h | 116 |
1 files changed, 85 insertions, 31 deletions
diff --git a/drivers/gpu/arm/mali/platform/mali_platform.h b/drivers/gpu/arm/mali/platform/mali_platform.h index f1bb2b5c7ad4..3d2a4ee56cb3 100644 --- a/drivers/gpu/arm/mali/platform/mali_platform.h +++ b/drivers/gpu/arm/mali/platform/mali_platform.h @@ -1,25 +1,31 @@ /* * Copyright (C) 2010-2012 ARM Limited. All rights reserved. * - * This program is free software and is provided to you under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence. + * This program is free software and is provided to you under the terms of + * the GNU General Public License version 2 as published by the Free Software + * Foundation, and any use by you of this program is subject to the terms of + * such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained from Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * A copy of the licence is included with the program, and can also be + * obtained from Free Software Foundation, Inc., 51 + * Franklin Street Fifth Floor, Boston, MA 02110-1301, USA. */ - -/** - * @file mali_platform.h - * Platform specific Mali driver functions - */ - #ifndef __MALI_PLATFORM_H__ #define __MALI_PLATFORM_H__ +#include <linux/clk.h> +#include <linux/err.h> +#include <linux/platform_device.h> +#include <linux/regulator/consumer.h> +#include <linux/regulator/driver.h> + + #include "mali_osk.h" #if !USING_MALI_PMM -/* @brief System power up/down cores that can be passed into mali_platform_powerdown/up() */ +/* @brief System power up/down cores that can be passed into + * mali_platform_powerdown/up() + */ #define MALI_PLATFORM_SYSTEM 0 #endif @@ -27,8 +33,14 @@ extern "C" { #endif -/** @brief description of power change reasons - */ +#define MPLLCLK_NAME "mout_mpll" +#define GPUMOUT0CLK_NAME "mout_g3d0" +#define GPUCLK_NAME "sclk_g3d" +#define CLK_DIV_STAT_G3D 0x1003C62C +#define CLK_DESC "clk-divider-status" + +extern struct platform_device mali_gpu_device; +/* @brief description of power change reasons */ typedef enum mali_power_mode_tag { MALI_POWER_MODE_ON, @@ -36,11 +48,45 @@ typedef enum mali_power_mode_tag MALI_POWER_MODE_DEEP_SLEEP, } mali_power_mode; +struct regulator { + struct device *dev; + struct list_head list; + unsigned int always_on:1; + unsigned int bypass:1; + int uA_load; + int min_uV; + int max_uV; + char *supply_name; + struct device_attribute dev_attr; + struct regulator_dev *rdev; + struct dentry *debugfs; +}; + +int mali_regulator_get_usecount(void); + +void mali_regulator_disable(void); + +void mali_regulator_enable(void); + +void mali_regulator_set_voltage(int min_uV, int max_uV); + +mali_bool mali_clk_set_rate(unsigned int clk, unsigned int mhz); + +unsigned long mali_clk_get_rate(void); + +void mali_clk_put(mali_bool binc_mali_clock); + +mali_bool init_mali_regulator(void); + +mali_bool deinit_mali_regulator(void); + + /** @brief Platform specific setup and initialisation of MALI * * This is called from the entrypoint of the driver to initialize the platform * - * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error. + * @return _MALI_OSK_ERR_OK on success otherwise, a suitable + * _mali_osk_errcode_t error. */ _mali_osk_errcode_t mali_platform_init(void); @@ -48,48 +94,56 @@ _mali_osk_errcode_t mali_platform_init(void); * * This is called on the exit of the driver to terminate the platform * - * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error. + * @return _MALI_OSK_ERR_OK on success otherwise, a suitable + * _mali_osk_errcode_t error. */ _mali_osk_errcode_t mali_platform_deinit(void); /** @brief Platform specific powerdown sequence of MALI * * Call as part of platform init if there is no PMM support, else the - * PMM will call it. + * PMM will call it. * There are three power modes defined: * 1) MALI_POWER_MODE_ON * 2) MALI_POWER_MODE_LIGHT_SLEEP * 3) MALI_POWER_MODE_DEEP_SLEEP - * MALI power management module transitions to MALI_POWER_MODE_LIGHT_SLEEP mode when MALI is idle - * for idle timer (software timer defined in mali_pmm_policy_jobcontrol.h) duration, MALI transitions - * to MALI_POWER_MODE_LIGHT_SLEEP mode during timeout if there are no more jobs queued. - * MALI power management module transitions to MALI_POWER_MODE_DEEP_SLEEP mode when OS does system power - * off. - * Customer has to add power down code when MALI transitions to MALI_POWER_MODE_LIGHT_SLEEP or MALI_POWER_MODE_DEEP_SLEEP + * MALI power management module transitions to MALI_POWER_MODE_LIGHT_SLEEP mode + * when MALI is idle for idle timer (software timer defined in + * mali_pmm_policy_jobcontrol.h) duration, MALI transitions to + * MALI_POWER_MODE_LIGHT_SLEEP mode during timeout if there are no more + * jobs queued. + * MALI power management module transitions to MALI_POWER_MODE_DEEP_SLEEP mode + * when OS does system power off. + * Customer has to add power down code when MALI transitions to + * MALI_POWER_MODE_LIGHT_SLEEP or MALI_POWER_MODE_DEEP_SLEEP * mode. - * MALI_POWER_MODE_ON mode is entered when the MALI is to powered up. Some customers want to control voltage regulators during - * the whole system powers on/off. Customer can track in this function whether the MALI is powered up from - * MALI_POWER_MODE_LIGHT_SLEEP or MALI_POWER_MODE_DEEP_SLEEP mode and manage the voltage regulators as well. + * MALI_POWER_MODE_ON mode is entered when the MALI is to powered up. + * Some customers want to control voltage regulators during the whole system + * powers on/off. Customer can track in this function whether the MALI is + * powered up from MALI_POWER_MODE_LIGHT_SLEEP or MALI_POWER_MODE_DEEP_SLEEP + * mode and manage the voltage regulators as well. * @param power_mode defines the power modes - * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error. + * @return _MALI_OSK_ERR_OK on success otherwise, a suitable + * _mali_osk_errcode_t error. */ _mali_osk_errcode_t mali_platform_power_mode_change(mali_power_mode power_mode); - /** @brief Platform specific handling of GPU utilization data * * When GPU utilization data is enabled, this function will be * periodically called. * - * @param utilization The workload utilization of the Mali GPU. 0 = no utilization, 256 = full utilization. + * @param utilization The workload utilization of the Mali GPU. + * 0 = no utilization, 256 = full utilization. */ void mali_gpu_utilization_handler(u32 utilization); /** @brief Setting the power domain of MALI * - * This function sets the power domain of MALI if Linux run time power management is enabled - * - * @param dev Reference to struct platform_device (defined in linux) used by MALI GPU + * This function sets the power domain of MALI if Linux run time power + * management is enabled + * @param dev Reference to struct platform_device (defined in linux) used by + * MALI GPU */ void set_mali_parent_power_domain(void* dev); |