diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2013-04-04 07:51:36 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-06-21 14:35:51 -0400 |
commit | eb569cf9db804e6ba34b3a1812415e59d5e43d1a (patch) | |
tree | 119054daf7f86e7b76fb64d6c8406cf76f66893d | |
parent | f7f6ce2d09c86bd80ee11bd654a1ac1e8f5dfe13 (diff) |
[media] soc-camera: add host clock callbacks to start and stop the master clock
Currently soc-camera uses a single camera host callback to activate the
interface master clock and to configure the interface for a specific
client. However, during probing we might not have the information about
a client, we just need to activate the clock. Add new camera host driver
callbacks to only start and stop the clock without and client-specific
configuration.
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/soc_camera.c | 19 | ||||
-rw-r--r-- | include/media/soc_camera.h | 2 |
2 files changed, 19 insertions, 2 deletions
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index 1e831009f914..3cc086036070 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c | |||
@@ -512,10 +512,23 @@ static int soc_camera_add_device(struct soc_camera_device *icd) | |||
512 | if (ici->icd) | 512 | if (ici->icd) |
513 | return -EBUSY; | 513 | return -EBUSY; |
514 | 514 | ||
515 | if (ici->ops->clock_start) { | ||
516 | ret = ici->ops->clock_start(ici); | ||
517 | if (ret < 0) | ||
518 | return ret; | ||
519 | } | ||
520 | |||
515 | ret = ici->ops->add(icd); | 521 | ret = ici->ops->add(icd); |
516 | if (!ret) | 522 | if (ret < 0) |
517 | ici->icd = icd; | 523 | goto eadd; |
524 | |||
525 | ici->icd = icd; | ||
518 | 526 | ||
527 | return 0; | ||
528 | |||
529 | eadd: | ||
530 | if (ici->ops->clock_stop) | ||
531 | ici->ops->clock_stop(ici); | ||
519 | return ret; | 532 | return ret; |
520 | } | 533 | } |
521 | 534 | ||
@@ -527,6 +540,8 @@ static void soc_camera_remove_device(struct soc_camera_device *icd) | |||
527 | return; | 540 | return; |
528 | 541 | ||
529 | ici->ops->remove(icd); | 542 | ici->ops->remove(icd); |
543 | if (ici->ops->clock_stop) | ||
544 | ici->ops->clock_stop(ici); | ||
530 | ici->icd = NULL; | 545 | ici->icd = NULL; |
531 | } | 546 | } |
532 | 547 | ||
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index db23a8f0c26b..dfa24df960df 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h | |||
@@ -74,6 +74,8 @@ struct soc_camera_host_ops { | |||
74 | struct module *owner; | 74 | struct module *owner; |
75 | int (*add)(struct soc_camera_device *); | 75 | int (*add)(struct soc_camera_device *); |
76 | void (*remove)(struct soc_camera_device *); | 76 | void (*remove)(struct soc_camera_device *); |
77 | int (*clock_start)(struct soc_camera_host *); | ||
78 | void (*clock_stop)(struct soc_camera_host *); | ||
77 | /* | 79 | /* |
78 | * .get_formats() is called for each client device format, but | 80 | * .get_formats() is called for each client device format, but |
79 | * .put_formats() is only called once. Further, if any of the calls to | 81 | * .put_formats() is only called once. Further, if any of the calls to |