diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h index d9d86b63a..49f386d8e 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 3a739cb60..813053e0e 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,