Files
linux-nvgpu/drivers/gpu/nvgpu/clk/clk_vf_point.h
Vijayakumar 1b10905120 gpu: nvgpu: support to parse VF table
JIRA DNVGPU-123

function was added to retrieve V for F or
F for V for a given clock domain.
Clock domain can be master or slave.
F or V can be intermediate point between two
successive V or F values in VF table.
VF table should be cached before calling this function.
A F value below Fmin will return Vmin.
F > Fmax will return error
A V value above Vmax wil return F max.
A V value below Vmin will return error.

Change-Id: I28b4e8647510c6933e9e1204cfff31d74616e11a
Signed-off-by: Vijayakumar <vsubbu@nvidia.com>
Reviewed-on: http://git-master/r/1211234
(cherry-picked from commit 5b83b03f2454fbec8d49a064ed09b09c92d3e9fa)
Reviewed-on: http://git-master/r/1235054
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
2016-12-27 15:26:50 +05:30

75 lines
2.4 KiB
C

/*
* Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#ifndef _CLKVFPOINT_H_
#define _CLKVFPOINT_H_
#include "ctrl/ctrlclk.h"
#include "ctrl/ctrlboardobj.h"
#include "pmuif/gpmuifclk.h"
#include "boardobj/boardobjgrp_e32.h"
#include "boardobj/boardobjgrpmask.h"
u32 clk_vf_point_sw_setup(struct gk20a *g);
u32 clk_vf_point_pmu_setup(struct gk20a *g);
u32 clk_vf_point_cache(struct gk20a *g);
struct clk_vf_points {
struct boardobjgrp_e255 super;
};
struct clk_vf_point {
struct boardobj super;
u8 vfe_equ_idx;
u8 volt_rail_idx;
struct ctrl_clk_vf_pair pair;
};
struct clk_vf_point_volt {
struct clk_vf_point super;
u32 source_voltage_uv;
int freq_delta_khz;
};
struct clk_vf_point_freq {
struct clk_vf_point super;
int volt_delta_uv;
};
#define CLK_CLK_VF_POINT_GET(pclk, idx) \
((struct clk_vf_point *)BOARDOBJGRP_OBJ_GET_BY_IDX( \
&pclk->clk_vf_pointobjs.super.super, (u8)(idx)))
#define clkvfpointpairget(pvfpoint) \
(&((pvfpoint)->pair))
#define clkvfpointfreqmhzget(pgpu, pvfpoint) \
CTRL_CLK_VF_PAIR_FREQ_MHZ_GET(clkvfpointpairget(pvfpoint))
#define clkvfpointfreqdeltamhzGet(pgpu, pvfPoint) \
((BOARDOBJ_GET_TYPE(pvfpoint) == CTRL_CLK_CLK_VF_POINT_TYPE_VOLT) ? \
(((struct clk_vf_point_volt *)(pvfpoint))->freq_delta_khz / 1000) : 0)
#define clkvfpointfreqmhzset(pgpu, pvfpoint, _freqmhz) \
CTRL_CLK_VF_PAIR_FREQ_MHZ_SET(clkvfpointpairget(pvfpoint), _freqmhz)
#define clkvfpointvoltageuvset(pgpu, pvfpoint, _voltageuv) \
CTRL_CLK_VF_PAIR_VOLTAGE_UV_SET(clkvfpointpairget(pvfpoint), \
_voltageuv)
#define clkvfpointvoltageuvget(pgpu, pvfpoint) \
CTRL_CLK_VF_PAIR_VOLTAGE_UV_GET(clkvfpointpairget(pvfpoint)) \
struct clk_vf_point *construct_clk_vf_point(struct gk20a *g, void *pargs);
#endif