aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/mx1_camera.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-08-25 10:47:00 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:19:15 -0400
commit0166b74374cae3fa8bff0caef726a3d960a9a50a (patch)
treeb09ce8c3211f86dd3ff79baae5648c10711697ea /drivers/media/video/mx1_camera.c
parent2aa58db47f5c70635ea278f6a5ff9e1e920bfe6a (diff)
V4L/DVB (12533): soc-camera: Use video device object for output in host drivers
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/mx1_camera.c')
-rw-r--r--drivers/media/video/mx1_camera.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c
index ed7856bdad48..1f1324a1d493 100644
--- a/drivers/media/video/mx1_camera.c
+++ b/drivers/media/video/mx1_camera.c
@@ -135,7 +135,7 @@ static int mx1_videobuf_setup(struct videobuf_queue *vq, unsigned int *count,
135 while (*size * *count > MAX_VIDEO_MEM * 1024 * 1024) 135 while (*size * *count > MAX_VIDEO_MEM * 1024 * 1024)
136 (*count)--; 136 (*count)--;
137 137
138 dev_dbg(&icd->dev, "count=%d, size=%d\n", *count, *size); 138 dev_dbg(icd->dev.parent, "count=%d, size=%d\n", *count, *size);
139 139
140 return 0; 140 return 0;
141} 141}
@@ -147,7 +147,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx1_buffer *buf)
147 147
148 BUG_ON(in_interrupt()); 148 BUG_ON(in_interrupt());
149 149
150 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, 150 dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
151 vb, vb->baddr, vb->bsize); 151 vb, vb->baddr, vb->bsize);
152 152
153 /* This waits until this buffer is out of danger, i.e., until it is no 153 /* This waits until this buffer is out of danger, i.e., until it is no
@@ -165,7 +165,7 @@ static int mx1_videobuf_prepare(struct videobuf_queue *vq,
165 struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); 165 struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb);
166 int ret; 166 int ret;
167 167
168 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, 168 dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
169 vb, vb->baddr, vb->bsize); 169 vb, vb->baddr, vb->bsize);
170 170
171 /* Added list head initialization on alloc */ 171 /* Added list head initialization on alloc */
@@ -216,10 +216,11 @@ out:
216static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev) 216static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev)
217{ 217{
218 struct videobuf_buffer *vbuf = &pcdev->active->vb; 218 struct videobuf_buffer *vbuf = &pcdev->active->vb;
219 struct device *dev = pcdev->icd->dev.parent;
219 int ret; 220 int ret;
220 221
221 if (unlikely(!pcdev->active)) { 222 if (unlikely(!pcdev->active)) {
222 dev_err(pcdev->icd->dev.parent, "DMA End IRQ with no active buffer\n"); 223 dev_err(dev, "DMA End IRQ with no active buffer\n");
223 return -EFAULT; 224 return -EFAULT;
224 } 225 }
225 226
@@ -229,7 +230,7 @@ static int mx1_camera_setup_dma(struct mx1_camera_dev *pcdev)
229 vbuf->size, pcdev->res->start + 230 vbuf->size, pcdev->res->start +
230 CSIRXR, DMA_MODE_READ); 231 CSIRXR, DMA_MODE_READ);
231 if (unlikely(ret)) 232 if (unlikely(ret))
232 dev_err(pcdev->icd->dev.parent, "Failed to setup DMA sg list\n"); 233 dev_err(dev, "Failed to setup DMA sg list\n");
233 234
234 return ret; 235 return ret;
235} 236}
@@ -243,7 +244,7 @@ static void mx1_videobuf_queue(struct videobuf_queue *vq,
243 struct mx1_camera_dev *pcdev = ici->priv; 244 struct mx1_camera_dev *pcdev = ici->priv;
244 struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); 245 struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb);
245 246
246 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, 247 dev_dbg(icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
247 vb, vb->baddr, vb->bsize); 248 vb, vb->baddr, vb->bsize);
248 249
249 list_add_tail(&vb->queue, &pcdev->capture); 250 list_add_tail(&vb->queue, &pcdev->capture);
@@ -270,22 +271,23 @@ static void mx1_videobuf_release(struct videobuf_queue *vq,
270 struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb); 271 struct mx1_buffer *buf = container_of(vb, struct mx1_buffer, vb);
271#ifdef DEBUG 272#ifdef DEBUG
272 struct soc_camera_device *icd = vq->priv_data; 273 struct soc_camera_device *icd = vq->priv_data;
274 struct device *dev = icd->dev.parent;
273 275
274 dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__, 276 dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
275 vb, vb->baddr, vb->bsize); 277 vb, vb->baddr, vb->bsize);
276 278
277 switch (vb->state) { 279 switch (vb->state) {
278 case VIDEOBUF_ACTIVE: 280 case VIDEOBUF_ACTIVE:
279 dev_dbg(&icd->dev, "%s (active)\n", __func__); 281 dev_dbg(dev, "%s (active)\n", __func__);
280 break; 282 break;
281 case VIDEOBUF_QUEUED: 283 case VIDEOBUF_QUEUED:
282 dev_dbg(&icd->dev, "%s (queued)\n", __func__); 284 dev_dbg(dev, "%s (queued)\n", __func__);
283 break; 285 break;
284 case VIDEOBUF_PREPARED: 286 case VIDEOBUF_PREPARED:
285 dev_dbg(&icd->dev, "%s (prepared)\n", __func__); 287 dev_dbg(dev, "%s (prepared)\n", __func__);
286 break; 288 break;
287 default: 289 default:
288 dev_dbg(&icd->dev, "%s (unknown)\n", __func__); 290 dev_dbg(dev, "%s (unknown)\n", __func__);
289 break; 291 break;
290 } 292 }
291#endif 293#endif
@@ -325,6 +327,7 @@ static void mx1_camera_wakeup(struct mx1_camera_dev *pcdev,
325static void mx1_camera_dma_irq(int channel, void *data) 327static void mx1_camera_dma_irq(int channel, void *data)
326{ 328{
327 struct mx1_camera_dev *pcdev = data; 329 struct mx1_camera_dev *pcdev = data;
330 struct device *dev = pcdev->icd->dev.parent;
328 struct mx1_buffer *buf; 331 struct mx1_buffer *buf;
329 struct videobuf_buffer *vb; 332 struct videobuf_buffer *vb;
330 unsigned long flags; 333 unsigned long flags;
@@ -334,14 +337,14 @@ static void mx1_camera_dma_irq(int channel, void *data)
334 imx_dma_disable(channel); 337 imx_dma_disable(channel);
335 338
336 if (unlikely(!pcdev->active)) { 339 if (unlikely(!pcdev->active)) {
337 dev_err(pcdev->icd->dev.parent, "DMA End IRQ with no active buffer\n"); 340 dev_err(dev, "DMA End IRQ with no active buffer\n");
338 goto out; 341 goto out;
339 } 342 }
340 343
341 vb = &pcdev->active->vb; 344 vb = &pcdev->active->vb;
342 buf = container_of(vb, struct mx1_buffer, vb); 345 buf = container_of(vb, struct mx1_buffer, vb);
343 WARN_ON(buf->inwork || list_empty(&vb->queue)); 346 WARN_ON(buf->inwork || list_empty(&vb->queue));
344 dev_dbg(pcdev->icd->dev.parent, "%s (vb=0x%p) 0x%08lx %d\n", __func__, 347 dev_dbg(dev, "%s (vb=0x%p) 0x%08lx %d\n", __func__,
345 vb, vb->baddr, vb->bsize); 348 vb, vb->baddr, vb->bsize);
346 349
347 mx1_camera_wakeup(pcdev, vb, buf); 350 mx1_camera_wakeup(pcdev, vb, buf);
@@ -381,8 +384,9 @@ static int mclk_get_divisor(struct mx1_camera_dev *pcdev)
381 * they get a nice Oops */ 384 * they get a nice Oops */
382 div = (lcdclk + 2 * mclk - 1) / (2 * mclk) - 1; 385 div = (lcdclk + 2 * mclk - 1) / (2 * mclk) - 1;
383 386
384 dev_dbg(pcdev->icd->dev.parent, "System clock %lukHz, target freq %dkHz, " 387 dev_dbg(pcdev->icd->dev.parent,
385 "divisor %lu\n", lcdclk / 1000, mclk / 1000, div); 388 "System clock %lukHz, target freq %dkHz, divisor %lu\n",
389 lcdclk / 1000, mclk / 1000, div);
386 390
387 return div; 391 return div;
388} 392}
@@ -428,7 +432,7 @@ static int mx1_camera_add_device(struct soc_camera_device *icd)
428 goto ebusy; 432 goto ebusy;
429 } 433 }
430 434
431 dev_info(&icd->dev, "MX1 Camera driver attached to camera %d\n", 435 dev_info(icd->dev.parent, "MX1 Camera driver attached to camera %d\n",
432 icd->devnum); 436 icd->devnum);
433 437
434 mx1_camera_activate(pcdev); 438 mx1_camera_activate(pcdev);
@@ -454,7 +458,7 @@ static void mx1_camera_remove_device(struct soc_camera_device *icd)
454 /* Stop DMA engine */ 458 /* Stop DMA engine */
455 imx_dma_disable(pcdev->dma_chan); 459 imx_dma_disable(pcdev->dma_chan);
456 460
457 dev_info(&icd->dev, "MX1 Camera driver detached from camera %d\n", 461 dev_info(icd->dev.parent, "MX1 Camera driver detached from camera %d\n",
458 icd->devnum); 462 icd->devnum);
459 463
460 mx1_camera_deactivate(pcdev); 464 mx1_camera_deactivate(pcdev);