Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 173934
b: refs/heads/master
c: b1de7ae
h: refs/heads/master
v: v3
  • Loading branch information
Kuninori Morimoto authored and Mauro Carvalho Chehab committed Dec 5, 2009
1 parent 7ae3b81 commit 4aa4e75
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 56f6f5582f7f422f142035dd92b521e72ffdb348
refs/heads/master: b1de7aeba1d7592b97507c21ea986ec6243a4165
42 changes: 36 additions & 6 deletions trunk/drivers/media/video/sh_mobile_ceu_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,40 @@ static u32 ceu_read(struct sh_mobile_ceu_dev *priv, unsigned long reg_offs)
return ioread32(priv->base + reg_offs);
}

static int sh_mobile_ceu_soft_reset(struct sh_mobile_ceu_dev *pcdev)
{
int i, success = 0;
struct soc_camera_device *icd = pcdev->icd;

ceu_write(pcdev, CAPSR, 1 << 16); /* reset */

/* wait CSTSR.CPTON bit */
for (i = 0; i < 1000; i++) {
if (!(ceu_read(pcdev, CSTSR) & 1)) {
success++;
break;
}
udelay(1);
}

/* wait CAPSR.CPKIL bit */
for (i = 0; i < 1000; i++) {
if (!(ceu_read(pcdev, CAPSR) & (1 << 16))) {
success++;
break;
}
udelay(1);
}


if (2 != success) {
dev_warn(&icd->dev, "soft reset time out\n");
return -EIO;
}

return 0;
}

/*
* Videobuf operations
*/
Expand Down Expand Up @@ -407,13 +441,9 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd)

pm_runtime_get_sync(ici->v4l2_dev.dev);

ceu_write(pcdev, CAPSR, 1 << 16); /* reset */
while (ceu_read(pcdev, CSTSR) & 1)
msleep(1);

pcdev->icd = icd;

return 0;
return sh_mobile_ceu_soft_reset(pcdev);
}

/* Called with .video_lock held */
Expand All @@ -427,7 +457,7 @@ static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd)

/* disable capture, disable interrupts */
ceu_write(pcdev, CEIER, 0);
ceu_write(pcdev, CAPSR, 1 << 16); /* reset */
sh_mobile_ceu_soft_reset(pcdev);

/* make sure active buffer is canceled */
spin_lock_irqsave(&pcdev->lock, flags);
Expand Down

0 comments on commit 4aa4e75

Please sign in to comment.