* [PATCH] s5p-fimc: set m2m context to null at the end of fimc_m2m_resume
@ 2013-01-18 10:01 Shaik Ameer Basha
2013-01-18 10:28 ` Sylwester Nawrocki
0 siblings, 1 reply; 3+ messages in thread
From: Shaik Ameer Basha @ 2013-01-18 10:01 UTC (permalink / raw)
To: linux-media; +Cc: s.nawrocki
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 <shaik.ameer@samsung.com>
---
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);
return 0;
}
--
1.8.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] s5p-fimc: set m2m context to null at the end of fimc_m2m_resume
2013-01-18 10:01 [PATCH] s5p-fimc: set m2m context to null at the end of fimc_m2m_resume Shaik Ameer Basha
@ 2013-01-18 10:28 ` Sylwester Nawrocki
2013-01-18 11:56 ` Shaik Ameer Basha
0 siblings, 1 reply; 3+ messages in thread
From: Sylwester Nawrocki @ 2013-01-18 10:28 UTC (permalink / raw)
To: Shaik Ameer Basha; +Cc: linux-media
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 <shaik.ameer@samsung.com>
> ---
> 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 ?
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;
}
Regards,
Sylwester
--
Sylwester Nawrocki
Samsung Poland R&D Center
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] s5p-fimc: set m2m context to null at the end of fimc_m2m_resume
2013-01-18 10:28 ` Sylwester Nawrocki
@ 2013-01-18 11:56 ` Shaik Ameer Basha
0 siblings, 0 replies; 3+ messages in thread
From: Shaik Ameer Basha @ 2013-01-18 11:56 UTC (permalink / raw)
To: Sylwester Nawrocki; +Cc: Shaik Ameer Basha, linux-media
Hi Sylwester,
On Fri, Jan 18, 2013 at 3:58 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> 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 <shaik.ameer@samsung.com>
>> ---
>> 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.
Yes, you are right. In case, more buffers are queued for the same
context, there can be issues.
I think you can apply this patch with your modified changes.
> 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 ?
>
I was reviewing my gsc-m2m code and found out this issue.
As you know gsc-m2m mostly follows fimc-m2m ;)
Regards,
Shaik Ameer Basha
>
> 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;
> }
>
> Regards,
> Sylwester
>
> --
> Sylwester Nawrocki
> Samsung Poland R&D Center
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-18 11:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-18 10:01 [PATCH] s5p-fimc: set m2m context to null at the end of fimc_m2m_resume Shaik Ameer Basha
2013-01-18 10:28 ` Sylwester Nawrocki
2013-01-18 11:56 ` Shaik Ameer Basha
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.