static int gk20a_scale_target(struct device *dev, unsigned long *freq,
			      u32 flags)
{
	struct gk20a *g = get_gk20a(to_platform_device(dev));
	struct gk20a_platform *platform = dev_get_drvdata(dev);
	struct gk20a_scale_profile *profile = g->scale_profile;
	unsigned long rounded_rate = gk20a_clk_round_rate(g, *freq);

	if (gk20a_clk_get_rate(g) == rounded_rate)
		*freq = rounded_rate;
	else {
		gk20a_clk_set_rate(g, rounded_rate);
		*freq = gk20a_clk_get_rate(g);
	}

	/* postscale will only scale emc (dram clock) if evaluating
	 * gk20a_tegra_get_emc_rate() produces a new or different emc
	 * target because the load or_and gpufreq has changed */
	if (platform->postscale)
		platform->postscale(profile->pdev, rounded_rate);

	return 0;
}
static int gk20a_scale_get_dev_status(struct device *dev,
				      struct devfreq_dev_status *stat)
{
	struct gk20a *g = get_gk20a(to_platform_device(dev));
	struct gk20a_scale_profile *profile = g->scale_profile;

	/* Make sure there are correct values for the current frequency */
	profile->dev_stat.current_frequency = gk20a_clk_get_rate(g);

	/* Update load estimate */
	update_load_estimate_gpmu(to_platform_device(dev));

	/* Copy the contents of the current device status */
	*stat = profile->dev_stat;

	/* Finally, clear out the local values */
	profile->dev_stat.total_time = 0;
	profile->dev_stat.busy_time = 0;

	return 0;
}
コード例 #3
0
ファイル: clk_gk20a.c プロジェクト: JamesLinus/nvgpu
static int rate_get(void *data, u64 *val)
{
	struct gk20a *g = (struct gk20a *)data;
	*val = (u64)gk20a_clk_get_rate(g);
	return 0;
}