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

Commit 07a4e443 authored by Aniket Randive's avatar Aniket Randive Committed by Gerrit - the friendly Code Review server
Browse files

i2c: i2c-msm-geni: Selectively disable DMA and operate in FIFO mode



Currently for SSC QUP, we are not supporting the DMA mode
on SA8155 and SA8195 platform. so for some non-gsi transfer
if the mode of SE is DMA then it will switch to the FIFO
mode and complete the transfer.

Change-Id: I4cbc2ed9ceff7d1c4fdfec3a1efeda80af2fc2bf
Signed-off-by: default avatarAniket Randive <arandive@codeaurora.org>
parent a97a28d8
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/clk.h>
@@ -132,6 +132,7 @@ struct geni_i2c_dev {
	bool req_chan;
	bool first_resume;
	bool gpi_reset;
	bool disable_dma_mode;
};

static struct geni_i2c_dev *gi2c_dev_dbg[MAX_SE];
@@ -1030,6 +1031,14 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,
		qcom_geni_i2c_calc_timeout(gi2c);
		mode = msgs[i].len > 32 ? SE_DMA : FIFO_MODE;

		/* Complete the transfer in FIFO mode if DMA mode
		 * is not supported for some Automotive platform.
		 */
		if (gi2c->disable_dma_mode) {
			GENI_SE_DBG(gi2c->ipcl, false, gi2c->dev,
					"Disable DMA mode\n");
			mode = FIFO_MODE;
		}
		ret = geni_se_select_mode(gi2c->base, mode);
		if (ret) {
			dev_err(gi2c->dev, "%s: Error mode init %d:%d:%d\n",
@@ -1283,6 +1292,9 @@ static int geni_i2c_probe(struct platform_device *pdev)
			return ret;
		}

		gi2c->disable_dma_mode = of_property_read_bool(pdev->dev.of_node,
						"qcom,disable-dma");

		gi2c->irq = platform_get_irq(pdev, 0);
		if (gi2c->irq < 0)
			return gi2c->irq;