aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2013-04-04 11:06:32 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-06-21 14:45:20 -0400
commitd71042c1fa1c3b32bfd55151eef6b2e104301a11 (patch)
tree0a9e3ba173a78d4c2ac3d11577fdbabe7e28d3b4 /drivers/media
parent6b417c897000515e308ff45687319f8ede1ccdd2 (diff)
[media] mx1-camera: move interface activation and deactivation to clock callbacks
When adding and removing a client, the mx1-camera driver only activates and deactivates its camera interface respectively, which doesn't include any client-specific actions. Move this functionality into .clock_start() and .clock_stop() callbacks. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/soc_camera/mx1_camera.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/drivers/media/platform/soc_camera/mx1_camera.c b/drivers/media/platform/soc_camera/mx1_camera.c
index 5f9ec8efd978..fea3e61476ae 100644
--- a/drivers/media/platform/soc_camera/mx1_camera.c
+++ b/drivers/media/platform/soc_camera/mx1_camera.c
@@ -399,7 +399,7 @@ static void mx1_camera_activate(struct mx1_camera_dev *pcdev)
399{ 399{
400 unsigned int csicr1 = CSICR1_EN; 400 unsigned int csicr1 = CSICR1_EN;
401 401
402 dev_dbg(pcdev->soc_host.icd->parent, "Activate device\n"); 402 dev_dbg(pcdev->soc_host.v4l2_dev.dev, "Activate device\n");
403 403
404 clk_prepare_enable(pcdev->clk); 404 clk_prepare_enable(pcdev->clk);
405 405
@@ -415,7 +415,7 @@ static void mx1_camera_activate(struct mx1_camera_dev *pcdev)
415 415
416static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev) 416static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev)
417{ 417{
418 dev_dbg(pcdev->soc_host.icd->parent, "Deactivate device\n"); 418 dev_dbg(pcdev->soc_host.v4l2_dev.dev, "Deactivate device\n");
419 419
420 /* Disable all CSI interface */ 420 /* Disable all CSI interface */
421 __raw_writel(0x00, pcdev->base + CSICR1); 421 __raw_writel(0x00, pcdev->base + CSICR1);
@@ -423,26 +423,35 @@ static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev)
423 clk_disable_unprepare(pcdev->clk); 423 clk_disable_unprepare(pcdev->clk);
424} 424}
425 425
426static int mx1_camera_add_device(struct soc_camera_device *icd)
427{
428 dev_info(icd->parent, "MX1 Camera driver attached to camera %d\n",
429 icd->devnum);
430
431 return 0;
432}
433
434static void mx1_camera_remove_device(struct soc_camera_device *icd)
435{
436 dev_info(icd->parent, "MX1 Camera driver detached from camera %d\n",
437 icd->devnum);
438}
439
426/* 440/*
427 * The following two functions absolutely depend on the fact, that 441 * The following two functions absolutely depend on the fact, that
428 * there can be only one camera on i.MX1/i.MXL camera sensor interface 442 * there can be only one camera on i.MX1/i.MXL camera sensor interface
429 */ 443 */
430static int mx1_camera_add_device(struct soc_camera_device *icd) 444static int mx1_camera_clock_start(struct soc_camera_host *ici)
431{ 445{
432 struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
433 struct mx1_camera_dev *pcdev = ici->priv; 446 struct mx1_camera_dev *pcdev = ici->priv;
434 447
435 dev_info(icd->parent, "MX1 Camera driver attached to camera %d\n",
436 icd->devnum);
437
438 mx1_camera_activate(pcdev); 448 mx1_camera_activate(pcdev);
439 449
440 return 0; 450 return 0;
441} 451}
442 452
443static void mx1_camera_remove_device(struct soc_camera_device *icd) 453static void mx1_camera_clock_stop(struct soc_camera_host *ici)
444{ 454{
445 struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
446 struct mx1_camera_dev *pcdev = ici->priv; 455 struct mx1_camera_dev *pcdev = ici->priv;
447 unsigned int csicr1; 456 unsigned int csicr1;
448 457
@@ -453,9 +462,6 @@ static void mx1_camera_remove_device(struct soc_camera_device *icd)
453 /* Stop DMA engine */ 462 /* Stop DMA engine */
454 imx_dma_disable(pcdev->dma_chan); 463 imx_dma_disable(pcdev->dma_chan);
455 464
456 dev_info(icd->parent, "MX1 Camera driver detached from camera %d\n",
457 icd->devnum);
458
459 mx1_camera_deactivate(pcdev); 465 mx1_camera_deactivate(pcdev);
460} 466}
461 467
@@ -669,6 +675,8 @@ static struct soc_camera_host_ops mx1_soc_camera_host_ops = {
669 .owner = THIS_MODULE, 675 .owner = THIS_MODULE,
670 .add = mx1_camera_add_device, 676 .add = mx1_camera_add_device,
671 .remove = mx1_camera_remove_device, 677 .remove = mx1_camera_remove_device,
678 .clock_start = mx1_camera_clock_start,
679 .clock_stop = mx1_camera_clock_stop,
672 .set_bus_param = mx1_camera_set_bus_param, 680 .set_bus_param = mx1_camera_set_bus_param,
673 .set_fmt = mx1_camera_set_fmt, 681 .set_fmt = mx1_camera_set_fmt,
674 .try_fmt = mx1_camera_try_fmt, 682 .try_fmt = mx1_camera_try_fmt,