From 2ad53bb4ca3877694853ac517c351ed1a9825772 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Tue, 27 May 2014 19:50:09 +0530 Subject: gpu: nvgpu: add is_railgated() callback Add is_railgated() platform callback to check status of gk20a power rail Bug 1376916 Bug 1487804 Change-Id: Ia0d909210dc409ab684eb6f20528b81500aecd5c Signed-off-by: Deepak Nibade --- drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 3 +++ drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h index d9d86b63..49f386d8 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h @@ -88,6 +88,9 @@ struct gk20a_platform { /* Called to turn on the device */ int (*unrailgate)(struct platform_device *dev); + /* Called to check state of device */ + bool (*is_railgated)(struct platform_device *dev); + /* Postscale callback is called after frequency change */ void (*postscale)(struct platform_device *pdev, unsigned long freq); diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c index 3a739cb6..813053e0 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c @@ -304,6 +304,17 @@ void gk20a_tegra_calibrate_emc(struct gk20a_emc_params *emc_params, emc_params->emc_dip_offset -= correction; } +/* + * gk20a_tegra_is_railgated() + * + * Check status of gk20a power rail + */ + +static bool gk20a_tegra_is_railgated(struct platform_device *pdev) +{ + return !tegra_powergate_is_powered(TEGRA_POWERGATE_GPU); +} + /* * gk20a_tegra_railgate() * @@ -504,6 +515,7 @@ struct gk20a_platform t132_gk20a_tegra_platform = { .suspend = gk20a_tegra_suspend, .railgate = gk20a_tegra_railgate, .unrailgate = gk20a_tegra_unrailgate, + .is_railgated = gk20a_tegra_is_railgated, /* frequency scaling configuration */ .prescale = gk20a_tegra_prescale, @@ -530,6 +542,7 @@ struct gk20a_platform gk20a_tegra_platform = { .suspend = gk20a_tegra_suspend, .railgate = gk20a_tegra_railgate, .unrailgate = gk20a_tegra_unrailgate, + .is_railgated = gk20a_tegra_is_railgated, /* frequency scaling configuration */ .prescale = gk20a_tegra_prescale, -- cgit v1.2.2