All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
To: Eddie James <eajames@linux.ibm.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Joel Stanley <joel@jms.id.au>, Andrew Jeffery <andrew@aj.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linux-aspeed@lists.ozlabs.org, linux-media@vger.kernel.org,
	Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
Subject: [PATCH v3 08/10] media: aspeed: remove source buffer allocation before mode detection
Date: Fri, 31 May 2019 15:15:46 -0700	[thread overview]
Message-ID: <20190531221548.14757-9-jae.hyun.yoo@linux.intel.com> (raw)
In-Reply-To: <20190531221548.14757-1-jae.hyun.yoo@linux.intel.com>

Mode detection doesn't require source buffer allocation so this
commit removes that.

Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
Reviewed-by: Eddie James <eajames@linux.ibm.com>
---
v2 -> v3:
 Corrected re-allocation logic of source buffers.

v1 -> v2:
 New.

 drivers/media/platform/aspeed-video.c | 37 ++++-----------------------
 1 file changed, 5 insertions(+), 32 deletions(-)

diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c
index c0b889141b8f..d6708ddb0391 100644
--- a/drivers/media/platform/aspeed-video.c
+++ b/drivers/media/platform/aspeed-video.c
@@ -731,27 +731,6 @@ static void aspeed_video_get_resolution(struct aspeed_video *video)
 	det->height = MIN_HEIGHT;
 	video->v4l2_input_status = V4L2_IN_ST_NO_SIGNAL;
 
-	/*
-	 * Since we need max buffer size for detection, free the second source
-	 * buffer first.
-	 */
-	if (video->srcs[1].size)
-		aspeed_video_free_buf(video, &video->srcs[1]);
-
-	if (video->srcs[0].size < VE_MAX_SRC_BUFFER_SIZE) {
-		if (video->srcs[0].size)
-			aspeed_video_free_buf(video, &video->srcs[0]);
-
-		if (!aspeed_video_alloc_buf(video, &video->srcs[0],
-					    VE_MAX_SRC_BUFFER_SIZE)) {
-			dev_err(video->dev,
-				"Failed to allocate source buffers\n");
-			return;
-		}
-	}
-
-	aspeed_video_write(video, VE_SRC0_ADDR, video->srcs[0].dma);
-
 	do {
 		if (tries) {
 			set_current_state(TASK_INTERRUPTIBLE);
@@ -871,20 +850,14 @@ static void aspeed_video_set_resolution(struct aspeed_video *video)
 
 	size *= 4;
 
-	if (size == video->srcs[0].size / 2) {
-		aspeed_video_write(video, VE_SRC1_ADDR,
-				   video->srcs[0].dma + size);
-	} else if (size == video->srcs[0].size) {
-		if (!aspeed_video_alloc_buf(video, &video->srcs[1], size))
-			goto err_mem;
-
-		aspeed_video_write(video, VE_SRC1_ADDR, video->srcs[1].dma);
-	} else {
-		aspeed_video_free_buf(video, &video->srcs[0]);
+	if (size != video->srcs[0].size) {
+		if (video->srcs[0].size)
+			aspeed_video_free_buf(video, &video->srcs[0]);
+		if (video->srcs[1].size)
+			aspeed_video_free_buf(video, &video->srcs[1]);
 
 		if (!aspeed_video_alloc_buf(video, &video->srcs[0], size))
 			goto err_mem;
-
 		if (!aspeed_video_alloc_buf(video, &video->srcs[1], size))
 			goto err_mem;
 
-- 
2.21.0


  parent reply	other threads:[~2019-05-31 22:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31 22:15 [PATCH v3 00/10] Improve stability and add bug fixes of Aspeed video engine driver Jae Hyun Yoo
2019-05-31 22:15 ` [PATCH v3 01/10] media: aspeed: fix a kernel warning on clk control Jae Hyun Yoo
2019-05-31 22:15 ` [PATCH v3 02/10] media: aspeed: refine clock control logic Jae Hyun Yoo
2019-05-31 22:15 ` [PATCH v3 03/10] media: aspeed: change irq to threaded irq Jae Hyun Yoo
2019-05-31 22:15 ` [PATCH v3 04/10] media: aspeed: remove IRQF_SHARED flag Jae Hyun Yoo
2019-05-31 22:15 ` [PATCH v3 05/10] media: aspeed: reduce noisy log printing outs Jae Hyun Yoo
2019-05-31 22:15 ` [PATCH v3 06/10] media: aspeed: remove checking of VE_INTERRUPT_CAPTURE_COMPLETE Jae Hyun Yoo
2019-05-31 22:15 ` [PATCH v3 07/10] media: aspeed: refine interrupt handling logic Jae Hyun Yoo
2019-05-31 22:15 ` Jae Hyun Yoo [this message]
2019-05-31 22:15 ` [PATCH v3 09/10] media: aspeed: use different delays for triggering VE H/W reset Jae Hyun Yoo
2019-05-31 22:15 ` [PATCH v3 10/10] media: aspeed: add a workaround to fix a silicon bug Jae Hyun Yoo
2019-06-06  0:53   ` Jae Hyun Yoo
2019-06-12  7:17     ` Hans Verkuil
2019-06-12 15:03       ` Eddie James
2019-06-12 16:13         ` Jae Hyun Yoo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190531221548.14757-9-jae.hyun.yoo@linux.intel.com \
    --to=jae.hyun.yoo@linux.intel.com \
    --cc=andrew@aj.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=eajames@linux.ibm.com \
    --cc=joel@jms.id.au \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.