Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1452868

[PATCH v3 07/12] gpu: ipu-v3: Fix IRT usage

From Steve Longerbeam <slongerbeam@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v3 07/12] gpu: ipu-v3: Fix IRT usage
Date 2016-07-31 21:50 +0200
Message-ID <s14Ui-4mA-31@gated-at.bofh.it> (permalink)
References <s14Uh-4mA-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


There can be multiple IC tasks using the IRT, so the IRT needs
a separate use counter. Create a private ipu_irt_enable() to
enable the IRT module when any IC task requires rotation, and
ipu_irt_disable() when a task no longer needs the IRT.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>

---

v3: no changes
v2:
- cleaned up irt_use_count decrement in ipu_irt_disable()
---
 drivers/gpu/ipu-v3/ipu-ic.c | 40 +++++++++++++++++++++++++++++++---------
 1 file changed, 31 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/ipu-v3/ipu-ic.c b/drivers/gpu/ipu-v3/ipu-ic.c
index 1dcb96c..1a37afc 100644
--- a/drivers/gpu/ipu-v3/ipu-ic.c
+++ b/drivers/gpu/ipu-v3/ipu-ic.c
@@ -160,6 +160,7 @@ struct ipu_ic_priv {
 	spinlock_t lock;
 	struct ipu_soc *ipu;
 	int use_count;
+	int irt_use_count;
 	struct ipu_ic task[IC_NUM_TASKS];
 };
 
@@ -379,8 +380,6 @@ void ipu_ic_task_disable(struct ipu_ic *ic)
 
 	ipu_ic_write(ic, ic_conf, IC_CONF);
 
-	ic->rotation = ic->graphics = false;
-
 	spin_unlock_irqrestore(&priv->lock, flags);
 }
 EXPORT_SYMBOL_GPL(ipu_ic_task_disable);
@@ -629,22 +628,41 @@ unlock:
 }
 EXPORT_SYMBOL_GPL(ipu_ic_task_idma_init);
 
+static void ipu_irt_enable(struct ipu_ic *ic)
+{
+	struct ipu_ic_priv *priv = ic->priv;
+
+	if (!priv->irt_use_count)
+		ipu_module_enable(priv->ipu, IPU_CONF_ROT_EN);
+
+	priv->irt_use_count++;
+}
+
+static void ipu_irt_disable(struct ipu_ic *ic)
+{
+	struct ipu_ic_priv *priv = ic->priv;
+
+	if (priv->irt_use_count) {
+		if (!--priv->irt_use_count)
+			ipu_module_disable(priv->ipu, IPU_CONF_ROT_EN);
+	}
+}
+
 int ipu_ic_enable(struct ipu_ic *ic)
 {
 	struct ipu_ic_priv *priv = ic->priv;
 	unsigned long flags;
-	u32 module = IPU_CONF_IC_EN;
 
 	spin_lock_irqsave(&priv->lock, flags);
 
-	if (ic->rotation)
-		module |= IPU_CONF_ROT_EN;
-
 	if (!priv->use_count)
-		ipu_module_enable(priv->ipu, module);
+		ipu_module_enable(priv->ipu, IPU_CONF_IC_EN);
 
 	priv->use_count++;
 
+	if (ic->rotation)
+		ipu_irt_enable(ic);
+
 	spin_unlock_irqrestore(&priv->lock, flags);
 
 	return 0;
@@ -655,18 +673,22 @@ int ipu_ic_disable(struct ipu_ic *ic)
 {
 	struct ipu_ic_priv *priv = ic->priv;
 	unsigned long flags;
-	u32 module = IPU_CONF_IC_EN | IPU_CONF_ROT_EN;
 
 	spin_lock_irqsave(&priv->lock, flags);
 
 	priv->use_count--;
 
 	if (!priv->use_count)
-		ipu_module_disable(priv->ipu, module);
+		ipu_module_disable(priv->ipu, IPU_CONF_IC_EN);
 
 	if (priv->use_count < 0)
 		priv->use_count = 0;
 
+	if (ic->rotation)
+		ipu_irt_disable(ic);
+
+	ic->rotation = ic->graphics = false;
+
 	spin_unlock_irqrestore(&priv->lock, flags);
 
 	return 0;
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 00/12] IPUv3 prep for i.MX5/6 v4l2 staging drivers, v3 Steve Longerbeam <slongerbeam@gmail.com> - 2016-07-31 21:50 +0200
  [PATCH v3 09/12] gpu: ipu-v3: Add Video Deinterlacer unit Steve Longerbeam <slongerbeam@gmail.com> - 2016-07-31 21:50 +0200
    Re: [PATCH v3 09/12] gpu: ipu-v3: Add Video Deinterlacer unit Philipp Zabel <p.zabel@pengutronix.de> - 2016-08-01 11:20 +0200
      Re: [PATCH v3 09/12] gpu: ipu-v3: Add Video Deinterlacer unit Steve Longerbeam <steve_longerbeam@mentor.com> - 2016-08-01 23:40 +0200
  [PATCH v3 07/12] gpu: ipu-v3: Fix IRT usage Steve Longerbeam <slongerbeam@gmail.com> - 2016-07-31 21:50 +0200
  [PATCH v3 08/12] gpu: ipu-v3: rename CSI client device Steve Longerbeam <slongerbeam@gmail.com> - 2016-07-31 21:50 +0200
  [PATCH v3 04/12] gpu: ipu-v3: Add VDI input IDMAC channels Steve Longerbeam <slongerbeam@gmail.com> - 2016-07-31 21:50 +0200
  [PATCH v3 01/12] gpu: ipu-cpmem: Add ipu_cpmem_set_uv_offset() Steve Longerbeam <slongerbeam@gmail.com> - 2016-07-31 21:50 +0200
    Re: [PATCH v3 01/12] gpu: ipu-cpmem: Add ipu_cpmem_set_uv_offset() Philipp Zabel <p.zabel@pengutronix.de> - 2016-08-01 11:20 +0200
      Re: [PATCH v3 01/12] gpu: ipu-cpmem: Add ipu_cpmem_set_uv_offset() Steve Longerbeam <steve_longerbeam@mentor.com> - 2016-08-01 22:40 +0200
  [PATCH v3 10/12] gpu: ipu-v3: Add FSU channel linking support Steve Longerbeam <slongerbeam@gmail.com> - 2016-07-31 21:50 +0200
    Re: [PATCH v3 10/12] gpu: ipu-v3: Add FSU channel linking support Philipp Zabel <p.zabel@pengutronix.de> - 2016-08-01 11:20 +0200
      Re: [PATCH v3 10/12] gpu: ipu-v3: Add FSU channel linking support Steve Longerbeam <steve_longerbeam@mentor.com> - 2016-08-01 23:20 +0200
  [PATCH v3 05/12] gpu: ipu-v3: set correct full sensor frame for PAL/NTSC Steve Longerbeam <slongerbeam@gmail.com> - 2016-07-31 21:50 +0200
  [PATCH v3 03/12] gpu: ipu-v3: Add ipu_get_num() Steve Longerbeam <slongerbeam@gmail.com> - 2016-07-31 21:50 +0200
  [PATCH v3 06/12] gpu: ipu-v3: Fix CSI data format for 16-bit media bus formats Steve Longerbeam <slongerbeam@gmail.com> - 2016-07-31 21:50 +0200
  Re: [PATCH v3 00/12] IPUv3 prep for i.MX5/6 v4l2 staging drivers, v3 Steve Longerbeam <slongerbeam@gmail.com> - 2016-07-31 22:00 +0200

csiph-web