All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: video4linux-list@redhat.com
Subject: Re: [PATCH] Fix suspend/resume of pxa_camera driver
Date: Thu, 31 Jul 2008 23:51:12 +0200	[thread overview]
Message-ID: <87y73h204v.fsf@free.fr> (raw)
In-Reply-To: <87tze997uu.fsf@free.fr> (Robert Jarzmik's message of "Mon\, 28 Jul 2008 20\:33\:29 +0200")

> So, to sum up :
>  - I finish the mt9m111 driver
>  - I submit it
>  - I cook up a clean suspend/resume (unless you did it first of course :)

All right, I finished the pxa_camera part. The suspend/resume does work with a
opened video stream. The capture begins before the suspend and finished after
the resume.

I post the patch here attached for information. I'll submit later with the
complete suspend/resume serie. This is just for preliminary comments. Of course,
this patch superseeds the origin patch posted in this thread, which didn't work
for an opened video stream.

--
Robert

>From fb38f10c233a5b4e13f5ad42cf1c381ecc4215e9 Mon Sep 17 00:00:00 2001
From: Robert Jarzmik <robert.jarzmik@free.fr>
Date: Sun, 27 Jul 2008 00:52:22 +0200
Subject: [PATCH] Fix suspend/resume of pxa_camera driver

PXA suspend switches off DMA core, which looses all context
of previously assigned descriptors. As pxa_camera driver
relies on DMA transfers, setup the lost descriptors on
resume and retrigger frame acquisition if needed.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/media/video/pxa_camera.c |   49 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c
index efb2d19..f00844c 100644
--- a/drivers/media/video/pxa_camera.c
+++ b/drivers/media/video/pxa_camera.c
@@ -128,6 +128,8 @@ struct pxa_camera_dev {
 
 	struct pxa_buffer	*active;
 	struct pxa_dma_desc	*sg_tail[3];
+
+	u32			save_CICR[5];
 };
 
 static const char *pxa_cam_driver_description = "PXA_Camera";
@@ -1017,6 +1019,51 @@ static struct soc_camera_host pxa_soc_camera_host = {
 	.ops			= &pxa_soc_camera_host_ops,
 };
 
+static int pxa_camera_suspend(struct platform_device *pdev, pm_message_t state)
+{
+	struct pxa_camera_dev *pcdev = platform_get_drvdata(pdev);
+	int i = 0;
+
+	pcdev->save_CICR[i++] = CICR0;
+	pcdev->save_CICR[i++] = CICR1;
+	pcdev->save_CICR[i++] = CICR2;
+	pcdev->save_CICR[i++] = CICR3;
+	pcdev->save_CICR[i++] = CICR4;
+
+	return 0;
+}
+
+static int pxa_camera_resume(struct platform_device *pdev)
+{
+	struct pxa_camera_dev *pcdev = platform_get_drvdata(pdev);
+	int i = 0;
+
+	DRCMR68 = pcdev->dma_chans[0] | DRCMR_MAPVLD;
+	DRCMR69 = pcdev->dma_chans[1] | DRCMR_MAPVLD;
+	DRCMR70 = pcdev->dma_chans[2] | DRCMR_MAPVLD;
+
+	CICR0 = pcdev->save_CICR[i++] & ~CICR0_ENB;
+	CICR1 = pcdev->save_CICR[i++];
+	CICR2 = pcdev->save_CICR[i++];
+	CICR3 = pcdev->save_CICR[i++];
+	CICR4 = pcdev->save_CICR[i++];
+
+	if ((pcdev->icd) && (pcdev->icd->ops->resume))
+		pcdev->icd->ops->resume(pcdev->icd);
+
+	/* Restart frame capture if active buffer exists */
+	if (pcdev->active) {
+		/* Reset the FIFOs */
+		CIFR |= CIFR_RESET_F;
+		/* Enable End-Of-Frame Interrupt */
+		CICR0 &= ~CICR0_EOFM;
+		/* Restart the Capture Interface */
+		CICR0 |= CICR0_ENB;
+	}
+
+	return 0;
+}
+
 static int pxa_camera_probe(struct platform_device *pdev)
 {
 	struct pxa_camera_dev *pcdev;
@@ -1188,6 +1235,8 @@ static struct platform_driver pxa_camera_driver = {
 	},
 	.probe		= pxa_camera_probe,
 	.remove		= __exit_p(pxa_camera_remove),
+	.suspend	= pxa_camera_suspend,
+	.resume		= pxa_camera_resume,
 };
 
 
-- 
1.5.5.3

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

  parent reply	other threads:[~2008-07-31 21:52 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-26 23:07 [PATCH] Fix suspend/resume of pxa_camera driver Robert Jarzmik
2008-07-26 23:11 ` Robert Jarzmik
2008-07-27  0:07 ` Guennadi Liakhovetski
2008-07-27  7:17   ` Robert Jarzmik
2008-07-27 19:11     ` Guennadi Liakhovetski
2008-07-27 19:11     ` Guennadi Liakhovetski
2008-07-27 22:10       ` Alan Stern
2008-07-28 18:37         ` Robert Jarzmik
2008-07-28 18:37         ` [linux-pm] " Robert Jarzmik
2008-08-13 12:16           ` Pavel Machek
2008-07-28 18:33       ` Robert Jarzmik
2008-07-28 18:33       ` Robert Jarzmik
2008-07-29 17:16         ` Guennadi Liakhovetski
2008-07-29 17:16         ` Guennadi Liakhovetski
2008-07-30 21:47           ` Robert Jarzmik
2008-07-30 22:19             ` Guennadi Liakhovetski
2008-07-31 19:57               ` Robert Jarzmik
2008-07-31 21:49                 ` Guennadi Liakhovetski
2011-06-28 13:47               ` Guennadi Liakhovetski
2011-07-01 16:41                 ` Robert Jarzmik
2008-07-31 21:51         ` Robert Jarzmik [this message]
2008-08-01 20:16           ` Guennadi Liakhovetski
2008-08-01 20:16           ` Guennadi Liakhovetski
2008-08-01 20:58             ` Robert Jarzmik
2008-08-01 20:58             ` Robert Jarzmik
2008-08-01 21:26               ` Guennadi Liakhovetski
2008-08-01 22:23                 ` Robert Jarzmik
2008-08-01 22:26                   ` [PATCH] Add suspend/resume capabilities to soc_camera Robert Jarzmik
2008-08-01 22:26                     ` [PATCH] Fix suspend/resume of pxa_camera driver Robert Jarzmik
2008-08-01 23:31                       ` Guennadi Liakhovetski
2008-08-02  9:32                         ` Robert Jarzmik
2008-08-02 10:21                           ` Guennadi Liakhovetski
2008-08-02 10:35                             ` Robert Jarzmik
2008-08-01 23:28                     ` [PATCH] Add suspend/resume capabilities to soc_camera Guennadi Liakhovetski
2008-08-01 21:26               ` [PATCH] Fix suspend/resume of pxa_camera driver Guennadi Liakhovetski
2008-08-01 20:58             ` Robert Jarzmik

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=87y73h204v.fsf@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=g.liakhovetski@gmx.de \
    --cc=video4linux-list@redhat.com \
    /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.