mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 12:58:12 -04:00
msm: kgsl: Consolidate zap shader loading
The zap shader is loaded the same way for both a5xx and a6xx targets so consolidate the support in the generic Adreno code. Change-Id: Ic0dedbad964eef9054b549d0df9ba7e84d653f62 Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
This commit is contained in:
parent
669c13845d
commit
a6dcc0db77
5 changed files with 46 additions and 43 deletions
|
|
@ -3,6 +3,7 @@ config QCOM_KGSL
|
|||
tristate "Qualcomm Technologies, Inc. 3D Graphics driver"
|
||||
depends on ARCH_QCOM
|
||||
depends on QCOM_QFPROM
|
||||
select MSM_SUBSYSTEM_RESTART
|
||||
help
|
||||
3D graphics driver for the Adreno family of GPUs from QTI.
|
||||
Required to use hardware accelerated OpenGL, compute and Vulkan
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/nvmem-consumer.h>
|
||||
#include <linux/soc/qcom/llcc-qcom.h>
|
||||
#include <soc/qcom/subsystem_restart.h>
|
||||
|
||||
#include "adreno.h"
|
||||
#include "adreno_a3xx.h"
|
||||
|
|
@ -124,6 +125,23 @@ int adreno_get_firmware(struct adreno_device *adreno_dev,
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int adreno_zap_shader_load(struct adreno_device *adreno_dev,
|
||||
const char *name)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
if (!name || adreno_dev->zap_loaded)
|
||||
return 0;
|
||||
|
||||
ptr = subsystem_get(name);
|
||||
|
||||
if (!IS_ERR(ptr))
|
||||
adreno_dev->zap_loaded = true;
|
||||
|
||||
return PTR_ERR_OR_ZERO(ptr);
|
||||
}
|
||||
|
||||
void adreno_reglist_write(struct adreno_device *adreno_dev,
|
||||
const struct adreno_reglist *list, u32 count)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1705,4 +1705,15 @@ void adreno_gmu_send_nmi(struct adreno_device *adreno_dev);
|
|||
*/
|
||||
int adreno_get_firmware(struct adreno_device *adreno_dev,
|
||||
const char *fwfile, struct adreno_firmware *firmware);
|
||||
/**
|
||||
* adreno_zap_shader_load - Helper function for loading the zap shader
|
||||
* adreno_dev: A handle to an Adreno GPU device
|
||||
* name: Name of the zap shader to load
|
||||
*
|
||||
* A target indepedent helper function for loading the zap shader.
|
||||
*
|
||||
* Return: 0 on success or negative on failure.
|
||||
*/
|
||||
int adreno_zap_shader_load(struct adreno_device *adreno_dev,
|
||||
const char *name);
|
||||
#endif /*__ADRENO_H */
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
#include <linux/of.h>
|
||||
#include <linux/qcom_scm.h>
|
||||
#include <linux/slab.h>
|
||||
#include <soc/qcom/subsystem_restart.h>
|
||||
|
||||
#include "adreno.h"
|
||||
#include "adreno_a5xx.h"
|
||||
|
|
@ -1681,13 +1680,23 @@ static int a5xx_gpmu_init(struct adreno_device *adreno_dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int a5xx_zap_shader_resume(struct kgsl_device *device)
|
||||
{
|
||||
int ret = qcom_scm_set_remote_state(0, 13);
|
||||
|
||||
if (ret)
|
||||
dev_err(device->dev,
|
||||
"SCM zap resume call failed: %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* a5xx_microcode_load() - Load microcode
|
||||
* @adreno_dev: Pointer to adreno device
|
||||
*/
|
||||
static int a5xx_microcode_load(struct adreno_device *adreno_dev)
|
||||
{
|
||||
void *ptr;
|
||||
struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
|
||||
struct adreno_firmware *pm4_fw = ADRENO_FW(adreno_dev, ADRENO_FW_PM4);
|
||||
struct adreno_firmware *pfp_fw = ADRENO_FW(adreno_dev, ADRENO_FW_PFP);
|
||||
|
|
@ -1713,32 +1722,11 @@ static int a5xx_microcode_load(struct adreno_device *adreno_dev)
|
|||
if (!device->mmu.secured)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Resume call to write the zap shader base address into the
|
||||
* appropriate register,
|
||||
* skip if retention is supported for the CPZ register
|
||||
*/
|
||||
if (adreno_dev->zap_loaded && !(ADRENO_FEATURE(adreno_dev,
|
||||
ADRENO_CPZ_RETENTION))) {
|
||||
int ret = qcom_scm_set_remote_state(0, 13);
|
||||
ADRENO_CPZ_RETENTION)))
|
||||
return a5xx_zap_shader_resume(device);
|
||||
|
||||
if (ret)
|
||||
dev_err(KGSL_DEVICE(adreno_dev)->dev,
|
||||
"Unable to resume the zap shader: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Load the zap shader firmware through PIL if its available */
|
||||
if (a5xx_core->zap_name && !adreno_dev->zap_loaded) {
|
||||
ptr = subsystem_get(a5xx_core->zap_name);
|
||||
|
||||
/* Return error if the zap shader cannot be loaded */
|
||||
if (IS_ERR_OR_NULL(ptr))
|
||||
return (ptr == NULL) ? -ENODEV : PTR_ERR(ptr);
|
||||
adreno_dev->zap_loaded = 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return adreno_zap_shader_load(adreno_dev, a5xx_core->zap_name);
|
||||
}
|
||||
|
||||
static int _me_init_ucode_workarounds(struct adreno_device *adreno_dev)
|
||||
|
|
|
|||
|
|
@ -3,11 +3,10 @@
|
|||
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/clk/qcom.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_fdt.h>
|
||||
#include <linux/soc/qcom/llcc-qcom.h>
|
||||
#include <soc/qcom/subsystem_restart.h>
|
||||
#include <linux/clk/qcom.h>
|
||||
|
||||
#include "adreno.h"
|
||||
#include "adreno_a6xx.h"
|
||||
|
|
@ -567,8 +566,6 @@ static int a6xx_microcode_load(struct adreno_device *adreno_dev)
|
|||
struct adreno_firmware *fw = ADRENO_FW(adreno_dev, ADRENO_FW_SQE);
|
||||
const struct adreno_a6xx_core *a6xx_core = to_a6xx_core(adreno_dev);
|
||||
uint64_t gpuaddr;
|
||||
void *zap;
|
||||
int ret = 0;
|
||||
|
||||
gpuaddr = fw->memdesc->gpuaddr;
|
||||
kgsl_regwrite(device, A6XX_CP_SQE_INSTR_BASE_LO,
|
||||
|
|
@ -576,19 +573,7 @@ static int a6xx_microcode_load(struct adreno_device *adreno_dev)
|
|||
kgsl_regwrite(device, A6XX_CP_SQE_INSTR_BASE_HI,
|
||||
upper_32_bits(gpuaddr));
|
||||
|
||||
/* Load the zap shader firmware through PIL if its available */
|
||||
if (a6xx_core->zap_name && !adreno_dev->zap_loaded) {
|
||||
zap = subsystem_get(a6xx_core->zap_name);
|
||||
|
||||
/* Return error if the zap shader cannot be loaded */
|
||||
if (IS_ERR_OR_NULL(zap)) {
|
||||
ret = (zap == NULL) ? -ENODEV : PTR_ERR(zap);
|
||||
zap = NULL;
|
||||
} else
|
||||
adreno_dev->zap_loaded = 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return adreno_zap_shader_load(adreno_dev, a6xx_core->zap_name);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue