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

Commit c57f970a authored by Harshdeep Dhatt's avatar Harshdeep Dhatt
Browse files

msm: kgsl: Add support for multiple bus scaling tables



It's possible that a target may have more than one bus
scaling table based on types of DDR that are supported.
In such a scenario we need to create a device node for
each table.

Change-Id: If5bfd4fee373625fca76d5cc060d4ecc274566ce
Signed-off-by: default avatarHarshdeep Dhatt <hdhatt@codeaurora.org>
parent 8c640de5
Loading
Loading
Loading
Loading
+30 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2008-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2008-2019, The Linux Foundation. All rights reserved.
 */
#include <linux/module.h>
#include <linux/fb.h>
@@ -26,6 +26,8 @@
#include <linux/ion.h>
#include <asm/cacheflush.h>
#include <uapi/linux/sched/types.h>
#include <linux/of_fdt.h>
#include <linux/msm-bus.h>

#include "kgsl.h"
#include "kgsl_debugfs.h"
@@ -1354,6 +1356,33 @@ static inline void kgsl_mem_entry_unset_pend(struct kgsl_mem_entry *entry)
	spin_unlock(&entry->priv->mem_lock);
}

struct msm_bus_scale_pdata *kgsl_get_bus_scale_table(struct kgsl_device *device)
{
	struct device_node *child = NULL, *parent;
	char str[24];

	parent = device->pdev->dev.of_node;

	snprintf(str, sizeof(str), "qcom,gpu-bus-table-ddr%d",
		of_fdt_get_ddrtype());

	child = of_find_compatible_node(parent, NULL, str);

	/* Go with the first bus table node */
	if (child == NULL)
		child = of_find_compatible_node(parent, NULL,
			"qcom,gpu-bus-table");

	if (child) {
		struct msm_bus_scale_pdata *data = msm_bus_pdata_from_node(
					device->pdev, child);
		of_node_put(child);
		return data;
	}

	return msm_bus_cl_get_pdata(device->pdev);
}

/**
 * kgsl_mem_entry_set_pend() - Set the pending free flag of a memory entry
 * @entry - The memory entry
+16 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) 2002,2007-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2002,2007-2019, The Linux Foundation. All rights reserved.
 */
#ifndef __KGSL_DEVICE_H
#define __KGSL_DEVICE_H
@@ -914,6 +914,21 @@ void kgsl_snapshot_add_section(struct kgsl_device *device, u16 id,
	size_t (*func)(struct kgsl_device *, u8 *, size_t, void *),
	void *priv);

/**
 * kgsl_get_bus_scale_table() - Get the bus scaling table from devicetree
 * @device: kgsl device handle
 *
 * This function will try to find the correct bus table data from the device
 * tree based on the the underlying ddr type. If no matching child is found,
 * it will fallback to the first child node containing the bus scaling data.
 * If no child is found, it will pass the current device node, hoping that
 * bus scaling data is provided as properties of the current device node.
 *
 * Return: Pointer to the structure containing the parsed bus scaling data
 */
struct msm_bus_scale_pdata *kgsl_get_bus_scale_table(
	struct kgsl_device *device);

/**
 * struct kgsl_pwr_limit - limit structure for each client
 * @node: Local list node for the limits list
+2 −2
Original line number Diff line number Diff line
@@ -1126,9 +1126,9 @@ static int gmu_clocks_probe(struct gmu_device *gmu, struct device_node *node)

static int gmu_gpu_bw_probe(struct kgsl_device *device, struct gmu_device *gmu)
{
	struct msm_bus_scale_pdata *bus_scale_table;
	struct msm_bus_scale_pdata *bus_scale_table =
		kgsl_get_bus_scale_table(device);

	bus_scale_table = msm_bus_cl_get_pdata(device->pdev);
	if (bus_scale_table == NULL) {
		dev_err(&gmu->pdev->dev, "dt: cannot get bus table\n");
		return -ENODEV;
+2 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2010-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2010-2019, The Linux Foundation. All rights reserved.
 */

#include <linux/export.h>
@@ -2044,7 +2044,7 @@ int kgsl_pwrctrl_init(struct kgsl_device *device)
	struct device_node *gpubw_dev_node = NULL;
	struct platform_device *p2dev;

	bus_scale_table = msm_bus_cl_get_pdata(device->pdev);
	bus_scale_table = kgsl_get_bus_scale_table(device);
	if (bus_scale_table == NULL)
		return -EINVAL;