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

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

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

parents 553b0f52 58280e45
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -6,6 +6,7 @@ config QCOM_KGSL
	select FW_LOADER
	select FW_LOADER
	select PM_DEVFREQ
	select PM_DEVFREQ
	select QCOM_SCM
	select QCOM_SCM
	select NVMEM
	select DEVFREQ_GOV_SIMPLE_ONDEMAND
	select DEVFREQ_GOV_SIMPLE_ONDEMAND
	select DEVFREQ_GOV_PERFORMANCE
	select DEVFREQ_GOV_PERFORMANCE
	select DEVFREQ_GOV_QCOM_ADRENO_TZ
	select DEVFREQ_GOV_QCOM_ADRENO_TZ
+29 −0
Original line number Original line Diff line number Diff line
@@ -11,6 +11,7 @@
#include <linux/module.h>
#include <linux/module.h>
#include <linux/msm_kgsl.h>
#include <linux/msm_kgsl.h>
#include <linux/regulator/consumer.h>
#include <linux/regulator/consumer.h>
#include <linux/nvmem-consumer.h>
#include <soc/qcom/scm.h>
#include <soc/qcom/scm.h>


#include "adreno.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;
			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)
static int adreno_probe(struct platform_device *pdev)
{
{
	const struct of_device_id *of_id =
	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);
	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 */
	/* Get the chip ID from the DT and set up target specific parameters */
	if (adreno_identify_gpu(adreno_dev))
	if (adreno_identify_gpu(adreno_dev))
		return -ENODEV;
		return -ENODEV;