Re: [PATCH 3/6] i2c: i2c-qcom-geni: Add interconnect support

From: alokc
Date: Tue Jan 22 2019 - 01:54:16 EST


Please don't review this patch. I've resend patches after adding all the mailing list.
Sorry for inconvenience. Please review patches with spi/i2c/uart/kernel mailing list added.

On 2019-01-21 16:51, Alok Chauhan wrote:
Get the interconnect paths for I2C based Serial Engine device
and vote accordingly based on maximum supported I2C frequency.

Signed-off-by: Alok Chauhan <alokc@xxxxxxxxxxxxxx>
---
drivers/i2c/busses/i2c-qcom-geni.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/i2c/busses/i2c-qcom-geni.c
b/drivers/i2c/busses/i2c-qcom-geni.c
index db075bc..e8fe63a 100644
--- a/drivers/i2c/busses/i2c-qcom-geni.c
+++ b/drivers/i2c/busses/i2c-qcom-geni.c
@@ -14,6 +14,7 @@
#include <linux/pm_runtime.h>
#include <linux/qcom-geni-se.h>
#include <linux/spinlock.h>
+#include <linux/interconnect.h>

#define SE_I2C_TX_TRANS_LEN 0x26c
#define SE_I2C_RX_TRANS_LEN 0x270
@@ -508,6 +509,15 @@ static int geni_i2c_probe(struct platform_device *pdev)
return ret;
}

+ /* Set the bus quota to a reasonable value */
+ gi2c->se.avg_bw = Bps_to_icc(1000);
+ gi2c->se.peak_bw = Bps_to_icc(76800000);
+ ret = geni_interconnect_init(&gi2c->se);
+ if (ret) {
+ dev_err(&pdev->dev, "interconnect_init failed %d\n", ret);
+ return ret;
+ }
+
ret = device_property_read_u32(&pdev->dev, "clock-frequency",
&gi2c->clk_freq_out);
if (ret) {
@@ -611,6 +621,8 @@ static int __maybe_unused
geni_i2c_runtime_suspend(struct device *dev)
gi2c->suspended = 1;
}

+ geni_icc_update_bw(&gi2c->se, false);
+
return 0;
}

@@ -619,6 +631,7 @@ static int __maybe_unused
geni_i2c_runtime_resume(struct device *dev)
int ret;
struct geni_i2c_dev *gi2c = dev_get_drvdata(dev);

+ geni_icc_update_bw(&gi2c->se, true);
ret = geni_se_resources_on(&gi2c->se);
if (ret)
return ret;

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,a Linux Foundation Collaborative Project