[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1594786855-26506-16-git-send-email-skomatineni@nvidia.com>
Date: Tue, 14 Jul 2020 21:20:52 -0700
From: Sowjanya Komatineni <skomatineni@...dia.com>
To: <skomatineni@...dia.com>, <thierry.reding@...il.com>,
<jonathanh@...dia.com>, <frankc@...dia.com>, <hverkuil@...all.nl>,
<sakari.ailus@....fi>, <robh+dt@...nel.org>,
<helen.koike@...labora.com>
CC: <digetx@...il.com>, <sboyd@...nel.org>,
<gregkh@...uxfoundation.org>, <linux-media@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-tegra@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-i2c@...r.kernel.org>
Subject: [RFC PATCH v3 15/18] gpu: host1x: mipi: Use readl_relaxed_poll_timeout in tegra_mipi_wait
Use readl_relaxed_poll_timeout() in tegra_mipi_wait() to simplify
the code.
Signed-off-by: Sowjanya Komatineni <skomatineni@...dia.com>
---
drivers/gpu/host1x/mipi.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/host1x/mipi.c b/drivers/gpu/host1x/mipi.c
index 762d349..259e70c 100644
--- a/drivers/gpu/host1x/mipi.c
+++ b/drivers/gpu/host1x/mipi.c
@@ -21,9 +21,9 @@
*/
#include <linux/clk.h>
-#include <linux/delay.h>
#include <linux/host1x.h>
#include <linux/io.h>
+#include <linux/iopoll.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
@@ -295,19 +295,15 @@ EXPORT_SYMBOL(tegra_mipi_disable);
static int tegra_mipi_wait(struct tegra_mipi *mipi)
{
- unsigned long timeout = jiffies + msecs_to_jiffies(250);
+ void __iomem *status_reg = mipi->regs + (MIPI_CAL_STATUS << 2);
u32 value;
+ int err;
- while (time_before(jiffies, timeout)) {
- value = tegra_mipi_readl(mipi, MIPI_CAL_STATUS);
- if ((value & MIPI_CAL_STATUS_ACTIVE) == 0 &&
- (value & MIPI_CAL_STATUS_DONE) != 0)
- return 0;
-
- usleep_range(10, 50);
- }
-
- return -ETIMEDOUT;
+ err = readl_relaxed_poll_timeout(status_reg, value,
+ !(value & MIPI_CAL_STATUS_ACTIVE) &&
+ (value & MIPI_CAL_STATUS_DONE), 50,
+ 250000);
+ return err;
}
int tegra_mipi_calibrate(struct tegra_mipi_device *device)
--
2.7.4
Powered by blists - more mailing lists