From patchwork Fri Oct 4 04:47:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun Kumar K X-Patchwork-Id: 2987061 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9A17FBFF0B for ; Fri, 4 Oct 2013 04:46:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8372B20255 for ; Fri, 4 Oct 2013 04:46:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0F9B720212 for ; Fri, 4 Oct 2013 04:46:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750868Ab3JDEql (ORCPT ); Fri, 4 Oct 2013 00:46:41 -0400 Received: from mail-pb0-f49.google.com ([209.85.160.49]:61896 "EHLO mail-pb0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750828Ab3JDEqk (ORCPT ); Fri, 4 Oct 2013 00:46:40 -0400 Received: by mail-pb0-f49.google.com with SMTP id xb4so3422307pbc.36 for ; Thu, 03 Oct 2013 21:46:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=w2rU3znF3GjrBJ5FH5FLEZfdzfI8vvvMNMEHCgqWdl0=; b=jr3/suexkORZnX89hYCfsCBu82lr9SdVEGZYd0YI9c+PtiVwl98M8jku8b2LbVSMed gtmTrTIpyHnbQqZW4Wfhn8g477iWYVEWIK8+04p9CktmSSU0qf7jluaE4nxRcTH0P1l/ 6YM4uiOMt4/njZglFBw/38Df4KazFZrK6CuHAn/leK/nFTmtlIy7kYoK5bj04aiW46LM siVq4r1XFJU5vsCjTbYLK0+iCNGhhxJruR4d3m+hwYWruofSeqsvr+qXa2UvDmGWYVWJ oOrilnFdFR0+NFhEatQ7ZI4K6+W8X9CtbYmDEA3r78UBAAGA4m8HCz6fmaw0y9rQqMyE QMaQ== X-Received: by 10.67.4.227 with SMTP id ch3mr13669785pad.74.1380861999981; Thu, 03 Oct 2013 21:46:39 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id xv2sm11863944pbb.39.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Oct 2013 21:46:39 -0700 (PDT) From: Arun Kumar K To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: k.debski@samsung.com, s.nawrocki@samsung.com, prathyush.k@samsung.com, arun.m@samsung.com, arunkk.samsung@gmail.com Subject: [PATCH] [media] s5p-mfc: call wake_up_dev if in suspend mode Date: Fri, 4 Oct 2013 10:17:19 +0530 Message-Id: <1380862039-30819-1-git-send-email-arun.kk@samsung.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Prathyush K If a frame is still decoding when system enters suspend mode, we wait on the device queue for a interrupt condition. This sometimes leads to a timeout because the device queue might not be woken up everytime. Usually, the context queue gets woken up when that context's frame gets decoded. This patch adds a condition to wake up the device queue along with the context queue when the system is in suspend mode. Since the device queue is now woken up, we don't have to check the context's int_cond flag while waiting. Also, we can skip calling try_run after waking up the device queue to ensure that we don't have to wait for more than one frame to be processed. Signed-off-by: Prathyush K Signed-off-by: Arun Mankuzhi Signed-off-by: Arun Kumar K --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index 084263d..bec0f61 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -404,7 +404,11 @@ leave_handle_frame: if (test_and_clear_bit(0, &dev->hw_lock) == 0) BUG(); s5p_mfc_clock_off(); - s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); + /* if suspending, wake up device and do not try_run again*/ + if (test_bit(0, &dev->enter_suspend)) + wake_up_dev(dev, reason, err); + else + s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); } /* Error handling for interrupt */ @@ -1286,9 +1290,7 @@ static int s5p_mfc_suspend(struct device *dev) /* Try and lock the HW */ /* Wait on the interrupt waitqueue */ ret = wait_event_interruptible_timeout(m_dev->queue, - m_dev->int_cond || m_dev->ctx[m_dev->curr_ctx]->int_cond, - msecs_to_jiffies(MFC_INT_TIMEOUT)); - + m_dev->int_cond, msecs_to_jiffies(MFC_INT_TIMEOUT)); if (ret == 0) { mfc_err("Waiting for hardware to finish timed out\n"); return -EIO;