aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2013-06-21 04:57:19 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-24 19:01:05 -0400
commit0b92e2f40378d4426145467301f9a249bba5907d (patch)
treeff0ef795eacf429dcc1aee43653d52e67a2ad998
parentba776c18905d96d25ef1dcebdef8ef5e7c1b3f9a (diff)
staging: drm/imx: ipu-dmfc: fix bandwidth allocation
The IPU can request up to four pixels per access, which gives four times the bandwidth compared to what the driver currently assumes. After correcting this, we have to increase safety margins for bandwidth requirement calculations. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c b/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
index 91821bc30f41..1dc9817034b8 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
@@ -292,7 +292,7 @@ int ipu_dmfc_alloc_bandwidth(struct dmfc_channel *dmfc,
292{ 292{
293 struct ipu_dmfc_priv *priv = dmfc->priv; 293 struct ipu_dmfc_priv *priv = dmfc->priv;
294 int slots = dmfc_bandwidth_to_slots(priv, bandwidth_pixel_per_second); 294 int slots = dmfc_bandwidth_to_slots(priv, bandwidth_pixel_per_second);
295 int segment = 0, ret = 0; 295 int segment = -1, ret = 0;
296 296
297 dev_dbg(priv->dev, "dmfc: trying to allocate %ldMpixel/s for IPU channel %d\n", 297 dev_dbg(priv->dev, "dmfc: trying to allocate %ldMpixel/s for IPU channel %d\n",
298 bandwidth_pixel_per_second / 1000000, 298 bandwidth_pixel_per_second / 1000000,
@@ -307,7 +307,17 @@ int ipu_dmfc_alloc_bandwidth(struct dmfc_channel *dmfc,
307 goto out; 307 goto out;
308 } 308 }
309 309
310 segment = dmfc_find_slots(priv, slots); 310 /* Always allocate at least 128*4 bytes (2 slots) */
311 if (slots < 2)
312 slots = 2;
313
314 /* For the MEM_BG channel, first try to allocate twice the slots */
315 if (dmfc->data->ipu_channel == IPUV3_CHANNEL_MEM_BG_SYNC)
316 segment = dmfc_find_slots(priv, slots * 2);
317 if (segment >= 0)
318 slots *= 2;
319 else
320 segment = dmfc_find_slots(priv, slots);
311 if (segment < 0) { 321 if (segment < 0) {
312 ret = -EBUSY; 322 ret = -EBUSY;
313 goto out; 323 goto out;
@@ -391,7 +401,7 @@ int ipu_dmfc_init(struct ipu_soc *ipu, struct device *dev, unsigned long base,
391 * We have a total bandwidth of clkrate * 4pixel divided 401 * We have a total bandwidth of clkrate * 4pixel divided
392 * into 8 slots. 402 * into 8 slots.
393 */ 403 */
394 priv->bandwidth_per_slot = clk_get_rate(ipu_clk) / 8; 404 priv->bandwidth_per_slot = clk_get_rate(ipu_clk) * 4 / 8;
395 405
396 dev_dbg(dev, "dmfc: 8 slots with %ldMpixel/s bandwidth each\n", 406 dev_dbg(dev, "dmfc: 8 slots with %ldMpixel/s bandwidth each\n",
397 priv->bandwidth_per_slot / 1000000); 407 priv->bandwidth_per_slot / 1000000);