From 88dcd53516e6519799c38859de507586d8cc3233 Mon Sep 17 00:00:00 2001 From: Jordan Crouse Date: Mon, 24 Feb 2020 15:09:50 -0700 Subject: [PATCH] msm: kgsl: Make a device specific scales_bandwidth function To make it easier for the upcoming change to move GMU to a component device make a real function to test if the target is capable of scaling the bus bandwidth on the GMU. Change-Id: Ic0dedbad255622428de2ac01a5833a9e28c9c3ac Signed-off-by: Jordan Crouse --- drivers/gpu/msm/adreno_a6xx_gmu.c | 8 ++++++++ drivers/gpu/msm/kgsl_gmu_core.c | 11 +++++------ drivers/gpu/msm/kgsl_gmu_core.h | 3 ++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/msm/adreno_a6xx_gmu.c b/drivers/gpu/msm/adreno_a6xx_gmu.c index 59a54ea76e45..e5dde885f890 100644 --- a/drivers/gpu/msm/adreno_a6xx_gmu.c +++ b/drivers/gpu/msm/adreno_a6xx_gmu.c @@ -1748,6 +1748,13 @@ static int a6xx_gmu_wait_for_active_transition( return -ETIMEDOUT; } +static bool a6xx_gmu_scales_bandwidth(struct kgsl_device *device) +{ + struct adreno_device *adreno_dev = ADRENO_DEVICE(device); + + return (ADRENO_GPUREV(adreno_dev) >= ADRENO_REV_A640); +} + struct gmu_dev_ops adreno_a6xx_gmudev = { .load_firmware = a6xx_gmu_load_firmware, .oob_set = a6xx_gmu_oob_set, @@ -1767,4 +1774,5 @@ struct gmu_dev_ops adreno_a6xx_gmudev = { .wait_for_active_transition = a6xx_gmu_wait_for_active_transition, .gmu2host_intr_mask = HFI_IRQ_MASK, .gmu_ao_intr_mask = GMU_AO_INT_MASK, + .scales_bandwidth = a6xx_gmu_scales_bandwidth, }; diff --git a/drivers/gpu/msm/kgsl_gmu_core.c b/drivers/gpu/msm/kgsl_gmu_core.c index 5ff963e25740..441a996c1f16 100644 --- a/drivers/gpu/msm/kgsl_gmu_core.c +++ b/drivers/gpu/msm/kgsl_gmu_core.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #include @@ -98,13 +98,12 @@ bool gmu_core_gpmu_isenabled(struct kgsl_device *device) bool gmu_core_scales_bandwidth(struct kgsl_device *device) { - struct adreno_device *adreno_dev = ADRENO_DEVICE(device); + struct gmu_dev_ops *ops = GMU_DEVICE_OPS(device); - if (device->gmu_core.type == GMU_CORE_TYPE_PCC) - return false; + if (ops && ops->scales_bandwidth) + return ops->scales_bandwidth(device); - return gmu_core_gpmu_isenabled(device) && - (ADRENO_GPUREV(adreno_dev) >= ADRENO_REV_A640); + return false; } int gmu_core_init(struct kgsl_device *device) diff --git a/drivers/gpu/msm/kgsl_gmu_core.h b/drivers/gpu/msm/kgsl_gmu_core.h index eb2c26bad1d5..8c231650cf52 100644 --- a/drivers/gpu/msm/kgsl_gmu_core.h +++ b/drivers/gpu/msm/kgsl_gmu_core.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */ #ifndef __KGSL_GMU_CORE_H #define __KGSL_GMU_CORE_H @@ -144,6 +144,7 @@ struct gmu_dev_ops { void (*cooperative_reset)(struct kgsl_device *device); void (*halt_execution)(struct kgsl_device *device); int (*wait_for_active_transition)(struct kgsl_device *device); + bool (*scales_bandwidth)(struct kgsl_device *device); const unsigned int gmu2host_intr_mask; const unsigned int gmu_ao_intr_mask; };