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

Commit 714b07ea authored by Tingwei Zhang's avatar Tingwei Zhang
Browse files

soc: qcom: dcc_v2: Add dynamic loop offset support



Loop offset of DCC is dynamic according to DCC SRAM size.
Add support to change loop offset according to SRAM size.

Change-Id: I1b0a992fc421ae05f091afe37919edb2ce32a1e1
Signed-off-by: default avatarTingwei Zhang <tingwei@codeaurora.org>
parent c7e62f77
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -149,6 +149,7 @@ struct dcc_drvdata {
	uint32_t		nr_config[DCC_MAX_LINK_LIST];
	uint8_t			curr_list;
	uint8_t			cti_trig;
	uint8_t			loopoff;
};

static int dcc_sram_writel(struct dcc_drvdata *drvdata,
@@ -271,7 +272,6 @@ static int __dcc_ll_cfg(struct dcc_drvdata *drvdata, int curr_list)
				/* write new offset = 1 to continue
				 * processing the list
				 */
				link |= ((0x1 << 8) & BM(8, 14));
				ret = dcc_sram_writel(drvdata,
							link, sram_offset);
				if (ret)
@@ -318,7 +318,8 @@ static int __dcc_ll_cfg(struct dcc_drvdata *drvdata, int curr_list)

			if (loop_start) {
				loop = (sram_offset - loop_off) / 4;
				loop |= (loop_cnt << 13) & BM(13, 27);
				loop |= (loop_cnt << drvdata->loopoff) &
					BM(drvdata->loopoff, 27);
				loop |= DCC_LOOP_DESCRIPTOR;
				total_len += (total_len - loop_len) * loop_cnt;

@@ -353,7 +354,6 @@ static int __dcc_ll_cfg(struct dcc_drvdata *drvdata, int curr_list)
				/* write new offset = 1 to continue
				 * processing the list
				 */
				link |= ((0x1 << 8) & BM(8, 14));
				ret = dcc_sram_writel(drvdata,
						link, sram_offset);
				if (ret)
@@ -1694,6 +1694,8 @@ static int dcc_probe(struct platform_device *pdev)
	if (ret)
		return -EINVAL;

	drvdata->loopoff = get_bitmask_order((drvdata->ram_size +
				drvdata->ram_offset) / 4 - 1);
	mutex_init(&drvdata->mutex);

	for (i = 0; i < DCC_MAX_LINK_LIST; i++) {