From patchwork Fri Jan 18 10:28:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 2000651 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 4A6A8DF280 for ; Fri, 18 Jan 2013 10:28:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751300Ab3ARK2a (ORCPT ); Fri, 18 Jan 2013 05:28:30 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:52397 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751072Ab3ARK23 (ORCPT ); Fri, 18 Jan 2013 05:28:29 -0500 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MGT00EREH201L40@mailout1.w1.samsung.com> for linux-media@vger.kernel.org; Fri, 18 Jan 2013 10:28:27 +0000 (GMT) X-AuditID: cbfec7f4-b7f6d6d000001620-d1-50f923cbca38 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 6F.72.05664.BC329F05; Fri, 18 Jan 2013 10:28:27 +0000 (GMT) Received: from [106.116.147.32] by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0MGT00GPWH3F8V10@eusync2.samsung.com> for linux-media@vger.kernel.org; Fri, 18 Jan 2013 10:28:27 +0000 (GMT) Message-id: <50F923C9.8000205@samsung.com> Date: Fri, 18 Jan 2013 11:28:25 +0100 From: Sylwester Nawrocki User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-version: 1.0 To: Shaik Ameer Basha Cc: linux-media@vger.kernel.org Subject: Re: [PATCH] s5p-fimc: set m2m context to null at the end of fimc_m2m_resume References: <1358503278-13414-1-git-send-email-shaik.ameer@samsung.com> In-reply-to: <1358503278-13414-1-git-send-email-shaik.ameer@samsung.com> Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphluLIzCtJLcpLzFFi42I5/e/4Fd3Tyj8DDBY/Fbbo2bCV1YHR4/Mm uQDGKC6blNSczLLUIn27BK6MbX0HmAu+iFac/bSVsYFxv2AXIyeHhICJxIZlT1ggbDGJC/fW s3UxcnEICSxllDh5bRWUM4lJ4tyLu+wgVbwCWhJTn78F62ARUJU4dWULE4jNJmAo0Xu0jxHE FhUIkFi85BxUvaDEj8n3wOpFBPQlTs9cwgpiMwvIS8y/dBgsLiwQJvHy9newXiEBd4lFK6eA 9XIKeEjsv7OeGaJeXWLSvEXMML2b17xlnsAoMAvJillIymYhKVvAyLyKUTS1NLmgOCk911Cv ODG3uDQvXS85P3cTIyQEv+xgXHzM6hCjAAejEg8vp/qPACHWxLLiytxDjBIczEoivE+kfgYI 8aYkVlalFuXHF5XmpBYfYmTi4JRqYLQ9d3lncdy6uVUMEaIXfMwf/dw86YPfLYfrGeceWqu5 fSg78C55ZuG6Kqe6+RGqRS7XdjxXvZT2R/qO04w1bfbahyeyi0qWpFTyqW0vvaz+6qohx2uL s9G5a/3S9/uKhH34EHG055HcK6kZDJdXBTyKvzn1UbjWc9PbKT/UhX4flIvNu1r+4IoSS3FG oqEWc1FxIgBoZHqBHwIAAA== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Hi Shaik, On 01/18/2013 11:01 AM, Shaik Ameer Basha wrote: > fimc_m2m_job_finish() has to be called with the m2m context for the necessary > cleanup while resume. But currently fimc_m2m_job_finish() always passes > fimc->m2m.ctx as NULL. > > This patch changes the order of the calls for proper cleanup while resume. > > Signed-off-by: Shaik Ameer Basha > --- > drivers/media/platform/s5p-fimc/fimc-core.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/platform/s5p-fimc/fimc-core.c b/drivers/media/platform/s5p-fimc/fimc-core.c > index 2a1558a..5b11544 100644 > --- a/drivers/media/platform/s5p-fimc/fimc-core.c > +++ b/drivers/media/platform/s5p-fimc/fimc-core.c > @@ -868,14 +868,15 @@ static int fimc_m2m_resume(struct fimc_dev *fimc) > { > unsigned long flags; > > + if (test_and_clear_bit(ST_M2M_SUSPENDED, &fimc->state)) > + fimc_m2m_job_finish(fimc->m2m.ctx, > + VB2_BUF_STATE_ERROR); > + > spin_lock_irqsave(&fimc->slock, flags); > /* Clear for full H/W setup in first run after resume */ > fimc->m2m.ctx = NULL; > spin_unlock_irqrestore(&fimc->slock, flags); > > - if (test_and_clear_bit(ST_M2M_SUSPENDED, &fimc->state)) > - fimc_m2m_job_finish(fimc->m2m.ctx, > - VB2_BUF_STATE_ERROR); Thanks for the patch. Not sure how I managed to miss that... I'm not convince this is the right fix though. fimc->m2m.ctx should be reset so the device is properly configured in fimc_dma_run() callback. Since after suspend/resume cycle all previous registers' state is lost. So I think something more like below is needed. Can you check if it helps ? And what problem exactly are you observing ? Streaming is not resumed after system resume ? Regards, Sylwester diff --git a/drivers/media/platform/s5p-fimc/fimc-core.c b/drivers/media/platform/s5p-fimc/fimc-core.c index bdb544f..feb8620 100644 --- a/drivers/media/platform/s5p-fimc/fimc-core.c +++ b/drivers/media/platform/s5p-fimc/fimc-core.c @@ -869,16 +869,18 @@ static int fimc_m2m_suspend(struct fimc_dev *fimc) static int fimc_m2m_resume(struct fimc_dev *fimc) { + struct fimc_ctx *ctx; unsigned long flags; spin_lock_irqsave(&fimc->slock, flags); /* Clear for full H/W setup in first run after resume */ + ctx = fimc->m2m.ctx; fimc->m2m.ctx = NULL; spin_unlock_irqrestore(&fimc->slock, flags); if (test_and_clear_bit(ST_M2M_SUSPENDED, &fimc->state)) - fimc_m2m_job_finish(fimc->m2m.ctx, - VB2_BUF_STATE_ERROR); + fimc_m2m_job_finish(ctx, VB2_BUF_STATE_ERROR); + return 0; }