diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2013-04-04 10:49:13 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-06-21 14:45:06 -0400 |
commit | 6b417c897000515e308ff45687319f8ede1ccdd2 (patch) | |
tree | 0bd4fa6913dbd78b8214ca35d68aff811887186f | |
parent | 663ccaf4cd61f510e8a8e9bb913d2ee9b1e94932 (diff) |
[media] mx2-camera: move interface activation and deactivation to clock callbacks
When adding and removing a client, the mx2-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>
-rw-r--r-- | drivers/media/platform/soc_camera/mx2_camera.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/media/platform/soc_camera/mx2_camera.c b/drivers/media/platform/soc_camera/mx2_camera.c index 772e0710f59b..45a0276be4e5 100644 --- a/drivers/media/platform/soc_camera/mx2_camera.c +++ b/drivers/media/platform/soc_camera/mx2_camera.c | |||
@@ -412,13 +412,26 @@ static void mx2_camera_deactivate(struct mx2_camera_dev *pcdev) | |||
412 | writel(0, pcdev->base_emma + PRP_CNTL); | 412 | writel(0, pcdev->base_emma + PRP_CNTL); |
413 | } | 413 | } |
414 | 414 | ||
415 | static int mx2_camera_add_device(struct soc_camera_device *icd) | ||
416 | { | ||
417 | dev_info(icd->parent, "Camera driver attached to camera %d\n", | ||
418 | icd->devnum); | ||
419 | |||
420 | return 0; | ||
421 | } | ||
422 | |||
423 | static void mx2_camera_remove_device(struct soc_camera_device *icd) | ||
424 | { | ||
425 | dev_info(icd->parent, "Camera driver detached from camera %d\n", | ||
426 | icd->devnum); | ||
427 | } | ||
428 | |||
415 | /* | 429 | /* |
416 | * The following two functions absolutely depend on the fact, that | 430 | * The following two functions absolutely depend on the fact, that |
417 | * there can be only one camera on mx2 camera sensor interface | 431 | * there can be only one camera on mx2 camera sensor interface |
418 | */ | 432 | */ |
419 | static int mx2_camera_add_device(struct soc_camera_device *icd) | 433 | static int mx2_camera_clock_start(struct soc_camera_host *ici) |
420 | { | 434 | { |
421 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | ||
422 | struct mx2_camera_dev *pcdev = ici->priv; | 435 | struct mx2_camera_dev *pcdev = ici->priv; |
423 | int ret; | 436 | int ret; |
424 | u32 csicr1; | 437 | u32 csicr1; |
@@ -439,9 +452,6 @@ static int mx2_camera_add_device(struct soc_camera_device *icd) | |||
439 | 452 | ||
440 | pcdev->frame_count = 0; | 453 | pcdev->frame_count = 0; |
441 | 454 | ||
442 | dev_info(icd->parent, "Camera driver attached to camera %d\n", | ||
443 | icd->devnum); | ||
444 | |||
445 | return 0; | 455 | return 0; |
446 | 456 | ||
447 | exit_csi_ahb: | 457 | exit_csi_ahb: |
@@ -450,14 +460,10 @@ exit_csi_ahb: | |||
450 | return ret; | 460 | return ret; |
451 | } | 461 | } |
452 | 462 | ||
453 | static void mx2_camera_remove_device(struct soc_camera_device *icd) | 463 | static void mx2_camera_clock_stop(struct soc_camera_host *ici) |
454 | { | 464 | { |
455 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | ||
456 | struct mx2_camera_dev *pcdev = ici->priv; | 465 | struct mx2_camera_dev *pcdev = ici->priv; |
457 | 466 | ||
458 | dev_info(icd->parent, "Camera driver detached from camera %d\n", | ||
459 | icd->devnum); | ||
460 | |||
461 | mx2_camera_deactivate(pcdev); | 467 | mx2_camera_deactivate(pcdev); |
462 | } | 468 | } |
463 | 469 | ||
@@ -1271,6 +1277,8 @@ static struct soc_camera_host_ops mx2_soc_camera_host_ops = { | |||
1271 | .owner = THIS_MODULE, | 1277 | .owner = THIS_MODULE, |
1272 | .add = mx2_camera_add_device, | 1278 | .add = mx2_camera_add_device, |
1273 | .remove = mx2_camera_remove_device, | 1279 | .remove = mx2_camera_remove_device, |
1280 | .clock_start = mx2_camera_clock_start, | ||
1281 | .clock_stop = mx2_camera_clock_stop, | ||
1274 | .set_fmt = mx2_camera_set_fmt, | 1282 | .set_fmt = mx2_camera_set_fmt, |
1275 | .set_crop = mx2_camera_set_crop, | 1283 | .set_crop = mx2_camera_set_crop, |
1276 | .get_formats = mx2_camera_get_formats, | 1284 | .get_formats = mx2_camera_get_formats, |