Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73ad9c51 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Improve rGMU firmware loading time"

parents 49c56f45 033e1440
Loading
Loading
Loading
Loading
+6 −13
Original line number Diff line number Diff line
@@ -371,8 +371,8 @@ static int a6xx_rgmu_fw_start(struct kgsl_device *device,
		unsigned int boot_state)
{
	struct rgmu_device *rgmu = KGSL_RGMU_DEVICE(device);
	const struct firmware *fw = rgmu->fw_image;
	unsigned int status;
	int i;

	switch (boot_state) {
	case GMU_COLD_BOOT:
@@ -381,9 +381,8 @@ static int a6xx_rgmu_fw_start(struct kgsl_device *device,
		gmu_core_regwrite(device, A6XX_GMU_GENERAL_7, 1);

		/* Load RGMU FW image via AHB bus */
		for (i = 0; i < rgmu->fw_size; i++)
			gmu_core_regwrite(device, A6XX_GMU_CM3_ITCM_START + i,
					rgmu->fw_hostptr[i]);
		gmu_core_blkwrite(device, A6XX_GMU_CM3_ITCM_START, fw->data,
				fw->size);
		/*
		 * Enable power counter because it was disabled before
		 * slumber.
@@ -531,7 +530,7 @@ static int a6xx_rgmu_load_firmware(struct kgsl_device *device)
	int ret;

	/* RGMU fw already saved and verified so do nothing new */
	if (rgmu->fw_hostptr)
	if (rgmu->fw_image)
		return 0;

	ret = request_firmware(&fw, gpucore->gpmufw_name, device->dev);
@@ -541,14 +540,8 @@ static int a6xx_rgmu_load_firmware(struct kgsl_device *device)
		return ret;
	}

	rgmu->fw_hostptr = devm_kmemdup(&rgmu->pdev->dev, fw->data,
					fw->size, GFP_KERNEL);

	if (rgmu->fw_hostptr)
		rgmu->fw_size = (fw->size / sizeof(u32));

	release_firmware(fw);
	return rgmu->fw_hostptr ? 0 : -ENOMEM;
	rgmu->fw_image = fw;
	return rgmu->fw_image ? 0 : -ENOMEM;
}

/* Halt RGMU execution */
+15 −1
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#include <linux/io.h>
#include <linux/of_platform.h>
#include <linux/clk-provider.h>
#include <linux/firmware.h>

#include "kgsl_device.h"
#include "kgsl_rgmu.h"
@@ -310,6 +311,19 @@ static void rgmu_stop(struct kgsl_device *device)
	set_bit(GMU_FAULT, &device->gmu_core.flags);
	rgmu_snapshot(device);
}
static void rgmu_remove(struct kgsl_device *device)
{
	struct rgmu_device *rgmu = KGSL_RGMU_DEVICE(device);

	if (rgmu == NULL || rgmu->pdev == NULL)
		return;

	rgmu_stop(device);
	if (rgmu->fw_image) {
		release_firmware(rgmu->fw_image);
		rgmu->fw_image = NULL;
	}
}

/* Do not access any RGMU registers in RGMU probe function */
static int rgmu_probe(struct kgsl_device *device, struct device_node *node)
@@ -478,7 +492,7 @@ static bool rgmu_regulator_isenabled(struct kgsl_device *device)

struct gmu_core_ops rgmu_ops = {
	.probe = rgmu_probe,
	.remove = rgmu_stop,
	.remove = rgmu_remove,
	.start = rgmu_start,
	.stop = rgmu_stop,
	.dcvs_set = rgmu_dcvs_set,
+2 −4
Original line number Diff line number Diff line
@@ -31,8 +31,6 @@
 * @reg_len: RGMU CSR range
 * @rgmu_interrupt_num: RGMU interrupt number
 * @oob_interrupt_num: number of RGMU asserted OOB interrupt
 * @fw_hostptr: Buffer which holds the RGMU firmware
 * @fw_size: Size of RGMU firmware buffer
 * @cx_gdsc: CX headswitch that controls power of RGMU and
		subsystem peripherals
 * @clks: RGMU clocks including the GPU
@@ -43,6 +41,7 @@
 * @flags: RGMU flags
 * @idle_level: Minimal GPU idle power level
 * @fault_count: RGMU fault count
 * @fw_image: RGMU firmware image
 */
struct rgmu_device {
	u32 ver;
@@ -51,8 +50,6 @@ struct rgmu_device {
	unsigned int reg_len;
	unsigned int rgmu_interrupt_num;
	unsigned int oob_interrupt_num;
	unsigned int *fw_hostptr;
	uint32_t fw_size;
	struct regulator *cx_gdsc;
	struct regulator *gx_gdsc;
	struct clk *clks[MAX_RGMU_CLKS];
@@ -62,6 +59,7 @@ struct rgmu_device {
	unsigned int num_gpupwrlevels;
	unsigned int idle_level;
	unsigned int fault_count;
	const struct firmware *fw_image;
};

extern struct gmu_dev_ops adreno_a6xx_rgmudev;