msm: kgsl: Add support for multiple ddr tables

The lahaina device can have either LP4X or LP5 DDR. So
look for the corresponding ddr table in the device tree.
If ddr specific table is not found, fall back to a generic
table for devices that may have only one type of ddr.

Change-Id: I92cb802820eeb61e4afd0a79ed38a7f8b4a5916d
Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
This commit is contained in:
Harshdeep Dhatt 2020-01-13 14:44:03 -07:00
commit e91214d3d4

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/interconnect.h>
@ -147,15 +147,28 @@ u32 *kgsl_bus_get_table(struct platform_device *pdev,
int kgsl_bus_init(struct kgsl_device *device, struct platform_device *pdev)
{
struct kgsl_pwrctrl *pwr = &device->pwrctrl;
int ret, count;
int count;
int ddr = of_fdt_get_ddrtype();
if (ddr >= 0) {
char str[32];
snprintf(str, sizeof(str), "qcom,bus-table-ddr%d", ddr);
pwr->ddr_table = kgsl_bus_get_table(pdev, str, &count);
if (!IS_ERR(pwr->ddr_table))
goto done;
}
/* Look if a generic table is present */
pwr->ddr_table = kgsl_bus_get_table(pdev, "qcom,bus-table-ddr", &count);
if (IS_ERR(pwr->ddr_table)) {
ret = PTR_ERR(pwr->ddr_table);
int ret = PTR_ERR(pwr->ddr_table);
pwr->ddr_table = NULL;
return ret;
}
done:
pwr->ddr_table_count = count;
validate_pwrlevels(device, pwr->ddr_table, pwr->ddr_table_count);