diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2012-08-14 10:46:58 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-10-01 20:25:32 -0300 |
commit | b9ee31e621128ef7ad112daaba215357223b8cdd (patch) | |
tree | 06e8817add0f8abdcf60a1ae50f1283f2aa102a1 /drivers/media/platform/s5p-fimc/fimc-mdevice.c | |
parent | b5146c96d1795ed75bb90dc4d3189b2c4206c56d (diff) |
[media] s5p-fimc: Add pipeline ops to separate FIMC-LITE module
In order to reuse the FIMC-LITE module on Exynos4 and Exynos5
SoC introduce a set of callbacks for the media pipeline control
from within FIMC/FIMC-LITE video node. It lets us avoid symbol
dependencies between FIMC-LITE and the whole media device driver,
which simplifies the initialization sequences and doesn't
introduce issues preventing common kernel image for exynos4 and
exynos5 SoCs.
This patch also corrects following build errors:
drivers/built-in.o: In function `buffer_queue':
drivers/media/video/s5p-fimc/fimc-lite.c:414: undefined reference
to `fimc_pipeline_s_stream'
drivers/built-in.o: In function `fimc_lite_resume':
drivers/media/video/s5p-fimc/fimc-lite.c:1518: undefined reference
to `fimc_pipeline_initialize'
drivers/built-in.o: In function `fimc_lite_suspend':
drivers/media/video/s5p-fimc/fimc-lite.c:1544: undefined reference
to `fimc_pipeline_shutdown'
when only CONFIG_VIDEO_EXYNOS_FIMC_LITE is selected, without
CONFIG_VIDEO_S5P_FIMC.
Reported-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/platform/s5p-fimc/fimc-mdevice.c')
-rw-r--r-- | drivers/media/platform/s5p-fimc/fimc-mdevice.c | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c index e2aa8d99d858..223fcfe2e1b3 100644 --- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c +++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c @@ -23,6 +23,7 @@ #include <linux/slab.h> #include <media/v4l2-ctrls.h> #include <media/media-device.h> +#include <media/s5p_fimc.h> #include "fimc-core.h" #include "fimc-lite.h" @@ -38,7 +39,8 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, * * Caller holds the graph mutex. */ -void fimc_pipeline_prepare(struct fimc_pipeline *p, struct media_entity *me) +static void fimc_pipeline_prepare(struct fimc_pipeline *p, + struct media_entity *me) { struct media_pad *pad = &me->pads[0]; struct v4l2_subdev *sd; @@ -114,7 +116,7 @@ static int __subdev_set_power(struct v4l2_subdev *sd, int on) * * Needs to be called with the graph mutex held. */ -int fimc_pipeline_s_power(struct fimc_pipeline *p, bool state) +static int fimc_pipeline_s_power(struct fimc_pipeline *p, bool state) { unsigned int i; int ret; @@ -134,15 +136,15 @@ int fimc_pipeline_s_power(struct fimc_pipeline *p, bool state) } /** - * __fimc_pipeline_initialize - update the pipeline information, enable power - * of all pipeline subdevs and the sensor clock + * __fimc_pipeline_open - update the pipeline information, enable power + * of all pipeline subdevs and the sensor clock * @me: media entity to start graph walk with * @prep: true to acquire sensor (and csis) subdevs * * This function must be called with the graph mutex held. */ -static int __fimc_pipeline_initialize(struct fimc_pipeline *p, - struct media_entity *me, bool prep) +static int __fimc_pipeline_open(struct fimc_pipeline *p, + struct media_entity *me, bool prep) { int ret; @@ -159,28 +161,27 @@ static int __fimc_pipeline_initialize(struct fimc_pipeline *p, return fimc_pipeline_s_power(p, 1); } -int fimc_pipeline_initialize(struct fimc_pipeline *p, struct media_entity *me, - bool prep) +static int fimc_pipeline_open(struct fimc_pipeline *p, + struct media_entity *me, bool prep) { int ret; mutex_lock(&me->parent->graph_mutex); - ret = __fimc_pipeline_initialize(p, me, prep); + ret = __fimc_pipeline_open(p, me, prep); mutex_unlock(&me->parent->graph_mutex); return ret; } -EXPORT_SYMBOL_GPL(fimc_pipeline_initialize); /** - * __fimc_pipeline_shutdown - disable the sensor clock and pipeline power + * __fimc_pipeline_close - disable the sensor clock and pipeline power * @fimc: fimc device terminating the pipeline * * Disable power of all subdevs in the pipeline and turn off the external * sensor clock. * Called with the graph mutex held. */ -static int __fimc_pipeline_shutdown(struct fimc_pipeline *p) +static int __fimc_pipeline_close(struct fimc_pipeline *p) { int ret = 0; @@ -191,7 +192,7 @@ static int __fimc_pipeline_shutdown(struct fimc_pipeline *p) return ret == -ENXIO ? 0 : ret; } -int fimc_pipeline_shutdown(struct fimc_pipeline *p) +static int fimc_pipeline_close(struct fimc_pipeline *p) { struct media_entity *me; int ret; @@ -201,12 +202,11 @@ int fimc_pipeline_shutdown(struct fimc_pipeline *p) me = &p->subdevs[IDX_SENSOR]->entity; mutex_lock(&me->parent->graph_mutex); - ret = __fimc_pipeline_shutdown(p); + ret = __fimc_pipeline_close(p); mutex_unlock(&me->parent->graph_mutex); return ret; } -EXPORT_SYMBOL_GPL(fimc_pipeline_shutdown); /** * fimc_pipeline_s_stream - invoke s_stream on pipeline subdevs @@ -232,7 +232,13 @@ int fimc_pipeline_s_stream(struct fimc_pipeline *p, bool on) return 0; } -EXPORT_SYMBOL_GPL(fimc_pipeline_s_stream); + +/* Media pipeline operations for the FIMC/FIMC-LITE video device driver */ +static const struct fimc_pipeline_ops fimc_pipeline_ops = { + .open = fimc_pipeline_open, + .close = fimc_pipeline_close, + .set_stream = fimc_pipeline_s_stream, +}; /* * Sensor subdevice helper functions @@ -347,6 +353,7 @@ static int fimc_register_callback(struct device *dev, void *p) if (fimc->pdev->id < 0 || fimc->pdev->id >= FIMC_MAX_DEVS) return 0; + fimc->pipeline_ops = &fimc_pipeline_ops; fmd->fimc[fimc->pdev->id] = fimc; sd->grp_id = FIMC_GROUP_ID; @@ -372,6 +379,7 @@ static int fimc_lite_register_callback(struct device *dev, void *p) if (fimc->index >= FIMC_LITE_MAX_DEVS) return 0; + fimc->pipeline_ops = &fimc_pipeline_ops; fmd->fimc_lite[fimc->index] = fimc; sd->grp_id = FLITE_GROUP_ID; @@ -473,12 +481,14 @@ static void fimc_md_unregister_entities(struct fimc_md *fmd) if (fmd->fimc[i] == NULL) continue; v4l2_device_unregister_subdev(&fmd->fimc[i]->vid_cap.subdev); + fmd->fimc[i]->pipeline_ops = NULL; fmd->fimc[i] = NULL; } for (i = 0; i < FIMC_LITE_MAX_DEVS; i++) { if (fmd->fimc_lite[i] == NULL) continue; v4l2_device_unregister_subdev(&fmd->fimc_lite[i]->subdev); + fmd->fimc[i]->pipeline_ops = NULL; fmd->fimc_lite[i] = NULL; } for (i = 0; i < CSIS_MAX_ENTITIES; i++) { @@ -832,7 +842,7 @@ static int fimc_md_link_notify(struct media_pad *source, } if (!(flags & MEDIA_LNK_FL_ENABLED)) { - ret = __fimc_pipeline_shutdown(pipeline); + ret = __fimc_pipeline_close(pipeline); pipeline->subdevs[IDX_SENSOR] = NULL; pipeline->subdevs[IDX_CSIS] = NULL; @@ -851,8 +861,8 @@ static int fimc_md_link_notify(struct media_pad *source, if (fimc) { mutex_lock(&fimc->lock); if (fimc->vid_cap.refcnt > 0) { - ret = __fimc_pipeline_initialize(pipeline, - source->entity, true); + ret = __fimc_pipeline_open(pipeline, + source->entity, true); if (!ret) ret = fimc_capture_ctrls_create(fimc); } @@ -860,8 +870,8 @@ static int fimc_md_link_notify(struct media_pad *source, } else { mutex_lock(&fimc_lite->lock); if (fimc_lite->ref_count > 0) { - ret = __fimc_pipeline_initialize(pipeline, - source->entity, true); + ret = __fimc_pipeline_open(pipeline, + source->entity, true); } mutex_unlock(&fimc_lite->lock); } |