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

Commit 58280e45 authored by Sharat Masetty's avatar Sharat Masetty
Browse files

msm: kgsl: Use nvmem to read the speed bin configuration



This patch uses the nvmem driver framework in the kernel to
read the speed bin efuse from qfprom. This was previously
read using raw register reads of ioremapped qfprom area.

Change-Id: I463471d35c9d02ab8e3ac3f8d961b1058698d430
Signed-off-by: default avatarSharat Masetty <smasetty@codeaurora.org>
parent 5294afaf
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ config QCOM_KGSL
	select FW_LOADER
	select PM_DEVFREQ
	select QCOM_SCM
	select NVMEM
	select DEVFREQ_GOV_SIMPLE_ONDEMAND
	select DEVFREQ_GOV_PERFORMANCE
	select DEVFREQ_GOV_QCOM_ADRENO_TZ
+29 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include <linux/module.h>
#include <linux/msm_kgsl.h>
#include <linux/regulator/consumer.h>
#include <linux/nvmem-consumer.h>
#include <soc/qcom/scm.h>

#include "adreno.h"
@@ -1283,6 +1284,30 @@ static bool adreno_is_gpu_disabled(struct adreno_device *adreno_dev)
			pte_row0_msb[1] ? true : false;
}

static int adreno_read_speed_bin(struct platform_device *pdev,
		struct adreno_device *adreno_dev)
{
	struct nvmem_cell *cell = nvmem_cell_get(&pdev->dev, "speed_bin");
	int ret = PTR_ERR_OR_ZERO(cell);

	if (ret) {
		/*
		 * If the cell isn't defined enabled, then revert to
		 * using the default bin
		 */
		if (ret == -ENOENT)
			return 0;

		return ret;
	}

	adreno_dev->speed_bin = *((unsigned int *) nvmem_cell_read(cell, NULL));

	nvmem_cell_put(cell);

	return 0;
}

static int adreno_probe(struct platform_device *pdev)
{
	const struct of_device_id *of_id =
@@ -1303,6 +1328,10 @@ static int adreno_probe(struct platform_device *pdev)

	adreno_update_soc_hw_revision_quirks(adreno_dev, pdev);

	status = adreno_read_speed_bin(pdev, adreno_dev);
	if (status)
		return status;

	/* Get the chip ID from the DT and set up target specific parameters */
	if (adreno_identify_gpu(adreno_dev))
		return -ENODEV;