aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2011-02-28 11:12:19 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-22 04:54:16 -0300
commit117182d18399a956719be94d3e6e17aad9210cda (patch)
treed888d420f2354af873d2db7acd997e371bf0ef45 /drivers
parent4ecbf5d1d2bb7d1e3882de79e512c1a0a2816581 (diff)
downloadkernel_samsung_aries-117182d18399a956719be94d3e6e17aad9210cda.zip
kernel_samsung_aries-117182d18399a956719be94d3e6e17aad9210cda.tar.gz
kernel_samsung_aries-117182d18399a956719be94d3e6e17aad9210cda.tar.bz2
[media] s5p-fimc: Allow defining number of sensors at runtime
Add num_clients field to struct s5p_fimc_isp_info to define exactly size of clients array which simplifies a bit the sensors management. 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')
-rw-r--r--drivers/media/video/s5p-fimc/fimc-capture.c23
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.c22
2 files changed, 18 insertions, 27 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c
index 8312ce4..95f8b4e1 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -91,10 +91,10 @@ static int fimc_subdev_attach(struct fimc_dev *fimc, int index)
struct v4l2_subdev *sd;
int i;
- for (i = 0; i < FIMC_MAX_CAMIF_CLIENTS; ++i) {
- isp_info = pdata->isp_info[i];
+ for (i = 0; i < pdata->num_clients; ++i) {
+ isp_info = &pdata->isp_info[i];
- if (!isp_info || (index >= 0 && i != index))
+ if (index >= 0 && i != index)
continue;
sd = fimc_subdev_register(fimc, isp_info);
@@ -116,14 +116,13 @@ static int fimc_subdev_attach(struct fimc_dev *fimc, int index)
static int fimc_isp_subdev_init(struct fimc_dev *fimc, unsigned int index)
{
struct s5p_fimc_isp_info *isp_info;
+ struct s5p_platform_fimc *pdata = fimc->pdata;
int ret;
- if (index >= FIMC_MAX_CAMIF_CLIENTS)
+ if (index >= pdata->num_clients)
return -EINVAL;
- isp_info = fimc->pdata->isp_info[index];
- if (!isp_info)
- return -EINVAL;
+ isp_info = &pdata->isp_info[index];
if (isp_info->clk_frequency)
clk_set_rate(fimc->clock[CLK_CAM], isp_info->clk_frequency);
@@ -215,7 +214,7 @@ static int start_streaming(struct vb2_queue *q)
if (ret)
return ret;
- isp_info = fimc->pdata->isp_info[fimc->vid_cap.input_index];
+ isp_info = &fimc->pdata->isp_info[fimc->vid_cap.input_index];
fimc_hw_set_camera_type(fimc, isp_info);
fimc_hw_set_camera_source(fimc, isp_info);
fimc_hw_set_camera_offset(fimc, &ctx->s_frame);
@@ -567,12 +566,10 @@ static int fimc_cap_enum_input(struct file *file, void *priv,
struct s5p_platform_fimc *pldata = ctx->fimc_dev->pdata;
struct s5p_fimc_isp_info *isp_info;
- if (i->index >= FIMC_MAX_CAMIF_CLIENTS)
+ if (i->index >= pldata->num_clients)
return -EINVAL;
- isp_info = pldata->isp_info[i->index];
- if (isp_info == NULL)
- return -EINVAL;
+ isp_info = &pldata->isp_info[i->index];
i->type = V4L2_INPUT_TYPE_CAMERA;
strncpy(i->name, isp_info->board_info->type, 32);
@@ -589,7 +586,7 @@ static int fimc_cap_s_input(struct file *file, void *priv,
if (fimc_capture_active(ctx->fimc_dev))
return -EBUSY;
- if (i >= FIMC_MAX_CAMIF_CLIENTS || !pdata->isp_info[i])
+ if (i >= pdata->num_clients)
return -EINVAL;
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c
index f506197..b29937e 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -1577,6 +1577,7 @@ static int fimc_probe(struct platform_device *pdev)
struct fimc_dev *fimc;
struct resource *res;
struct samsung_fimc_driverdata *drv_data;
+ struct s5p_platform_fimc *pdata;
int ret = 0;
int cap_input_index = -1;
@@ -1598,7 +1599,8 @@ static int fimc_probe(struct platform_device *pdev)
fimc->id = pdev->id;
fimc->variant = drv_data->variant[fimc->id];
fimc->pdev = pdev;
- fimc->pdata = pdev->dev.platform_data;
+ pdata = pdev->dev.platform_data;
+ fimc->pdata = pdata;
fimc->state = ST_IDLE;
init_waitqueue_head(&fimc->irq_queue);
@@ -1629,19 +1631,11 @@ static int fimc_probe(struct platform_device *pdev)
}
fimc->num_clocks = MAX_FIMC_CLOCKS - 1;
- /*
- * Check if vide capture node needs to be registered for this device
- * instance.
- */
- if (fimc->pdata) {
- int i;
- for (i = 0; i < FIMC_MAX_CAMIF_CLIENTS; ++i)
- if (fimc->pdata->isp_info[i])
- break;
- if (i < FIMC_MAX_CAMIF_CLIENTS) {
- cap_input_index = i;
- fimc->num_clocks++;
- }
+
+ /* Check if a video capture node needs to be registered. */
+ if (pdata && pdata->num_clients > 0) {
+ cap_input_index = 0;
+ fimc->num_clocks++;
}
ret = fimc_clk_get(fimc);