Skip to content

Commit 365075b

Browse files
akhilpo-qcomRob Clark
authored andcommitted
drm/msm: Add support for IFPC
Add a new quirk to denote IFPC (Inter-Frame Power Collapse) support for a gpu. Based on this flag send the feature ctrl hfi message to GMU to enable IFPC support. Signed-off-by: Akhil P Oommen <akhilpo@oss.qualcomm.com> Patchwork: https://patchwork.freedesktop.org/patch/673375/ Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
1 parent 04ca842 commit 365075b

3 files changed

Lines changed: 32 additions & 8 deletions

File tree

drivers/gpu/drm/msm/adreno/a6xx_gmu.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,8 +1959,9 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node)
19591959
if (ret)
19601960
return ret;
19611961

1962-
/* Fow now, don't do anything fancy until we get our feet under us */
1963-
gmu->idle_level = GMU_IDLE_STATE_ACTIVE;
1962+
/* Set GMU idle level */
1963+
gmu->idle_level = (adreno_gpu->info->quirks & ADRENO_QUIRK_IFPC) ?
1964+
GMU_IDLE_STATE_IFPC : GMU_IDLE_STATE_ACTIVE;
19641965

19651966
pm_runtime_enable(gmu->dev);
19661967

drivers/gpu/drm/msm/adreno/a6xx_hfi.c

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ static const char * const a6xx_hfi_msg_id[] = {
2121
HFI_MSG_ID(HFI_H2F_MSG_PERF_TABLE),
2222
HFI_MSG_ID(HFI_H2F_MSG_TEST),
2323
HFI_MSG_ID(HFI_H2F_MSG_START),
24+
HFI_MSG_ID(HFI_H2F_FEATURE_CTRL),
2425
HFI_MSG_ID(HFI_H2F_MSG_CORE_FW_START),
2526
HFI_MSG_ID(HFI_H2F_MSG_GX_BW_PERF_VOTE),
2627
HFI_MSG_ID(HFI_H2F_MSG_PREPARE_SLUMBER),
@@ -765,23 +766,40 @@ static int a6xx_hfi_send_bw_table(struct a6xx_gmu *gmu)
765766
NULL, 0);
766767
}
767768

769+
static int a6xx_hfi_feature_ctrl_msg(struct a6xx_gmu *gmu, u32 feature, u32 enable, u32 data)
770+
{
771+
struct a6xx_hfi_msg_feature_ctrl msg = {
772+
.feature = feature,
773+
.enable = enable,
774+
.data = data,
775+
};
776+
777+
return a6xx_hfi_send_msg(gmu, HFI_H2F_FEATURE_CTRL, &msg, sizeof(msg), NULL, 0);
778+
}
779+
780+
#define HFI_FEATURE_IFPC 9
781+
#define IFPC_LONG_HYST 0x1680
782+
783+
static int a6xx_hfi_enable_ifpc(struct a6xx_gmu *gmu)
784+
{
785+
if (gmu->idle_level != GMU_IDLE_STATE_IFPC)
786+
return 0;
787+
788+
return a6xx_hfi_feature_ctrl_msg(gmu, HFI_FEATURE_IFPC, 1, IFPC_LONG_HYST);
789+
}
790+
768791
#define HFI_FEATURE_ACD 12
769792

770793
static int a6xx_hfi_enable_acd(struct a6xx_gmu *gmu)
771794
{
772795
struct a6xx_hfi_acd_table *acd_table = &gmu->acd_table;
773-
struct a6xx_hfi_msg_feature_ctrl msg = {
774-
.feature = HFI_FEATURE_ACD,
775-
.enable = 1,
776-
.data = 0,
777-
};
778796
int ret;
779797

780798
if (!acd_table->enable_by_level)
781799
return 0;
782800

783801
/* Enable ACD feature at GMU */
784-
ret = a6xx_hfi_send_msg(gmu, HFI_H2F_FEATURE_CTRL, &msg, sizeof(msg), NULL, 0);
802+
ret = a6xx_hfi_feature_ctrl_msg(gmu, HFI_FEATURE_ACD, 1, 0);
785803
if (ret) {
786804
DRM_DEV_ERROR(gmu->dev, "Unable to enable ACD (%d)\n", ret);
787805
return ret;
@@ -898,6 +916,10 @@ int a6xx_hfi_start(struct a6xx_gmu *gmu, int boot_state)
898916
if (ret)
899917
return ret;
900918

919+
ret = a6xx_hfi_enable_ifpc(gmu);
920+
if (ret)
921+
return ret;
922+
901923
ret = a6xx_hfi_send_core_fw_start(gmu);
902924
if (ret)
903925
return ret;

drivers/gpu/drm/msm/adreno/adreno_gpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ enum adreno_family {
5959
#define ADRENO_QUIRK_HAS_CACHED_COHERENT BIT(4)
6060
#define ADRENO_QUIRK_PREEMPTION BIT(5)
6161
#define ADRENO_QUIRK_4GB_VA BIT(6)
62+
#define ADRENO_QUIRK_IFPC BIT(7)
6263

6364
/* Helper for formating the chip_id in the way that userspace tools like
6465
* crashdec expect.

0 commit comments

Comments
 (0)