diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2013-02-01 13:00:40 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-02-05 14:55:58 -0500 |
commit | 56bc911ac3b94c731db3a6de20258827f1a61c20 (patch) | |
tree | a5fc7486fa4d94364fa43db503b98eb5de84bcb8 | |
parent | b84ef24e1e421da266fe9c0a3ee82a49db517ddf (diff) |
[media] s5p-fimc: Redefine platform data structure for fimc-is
Newer Exynos4 SoC are equipped with a local camera ISP that
controls external raw image sensor directly. Such sensors
can be connected through FIMC-LITEn (and MIPI-CSISn) IPs to
the ISP, which then feeds image data to the FIMCn IP. Thus
there can be two busses associated with an image source
(sensor). Rename struct s5p_fimc_isp_info describing external
image sensor (video decoder) to struct fimc_source_info to
avoid confusion. bus_type is split into fimc_bus_type and
sensor_bus_type. The bus type enumeration is extended to
include both FIMC Writeback input types.
The bus_type enumeration and the data structure name in the
board files are modified according to the above changes.
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | arch/arm/mach-exynos/mach-nuri.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-exynos/mach-universal_c210.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/mach-goni.c | 6 | ||||
-rw-r--r-- | drivers/media/platform/s5p-fimc/fimc-lite-reg.c | 8 | ||||
-rw-r--r-- | drivers/media/platform/s5p-fimc/fimc-lite-reg.h | 4 | ||||
-rw-r--r-- | drivers/media/platform/s5p-fimc/fimc-mdevice.c | 16 | ||||
-rw-r--r-- | drivers/media/platform/s5p-fimc/fimc-mdevice.h | 2 | ||||
-rw-r--r-- | drivers/media/platform/s5p-fimc/fimc-reg.c | 34 | ||||
-rw-r--r-- | drivers/media/platform/s5p-fimc/fimc-reg.h | 6 | ||||
-rw-r--r-- | include/media/s5p_fimc.h | 49 |
10 files changed, 79 insertions, 62 deletions
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c index 27d4ed8b116e..7c2600e09a91 100644 --- a/arch/arm/mach-exynos/mach-nuri.c +++ b/arch/arm/mach-exynos/mach-nuri.c | |||
@@ -1209,25 +1209,25 @@ static struct i2c_board_info m5mols_board_info = { | |||
1209 | .platform_data = &m5mols_platdata, | 1209 | .platform_data = &m5mols_platdata, |
1210 | }; | 1210 | }; |
1211 | 1211 | ||
1212 | static struct s5p_fimc_isp_info nuri_camera_sensors[] = { | 1212 | static struct fimc_source_info nuri_camera_sensors[] = { |
1213 | { | 1213 | { |
1214 | .flags = V4L2_MBUS_PCLK_SAMPLE_RISING | | 1214 | .flags = V4L2_MBUS_PCLK_SAMPLE_RISING | |
1215 | V4L2_MBUS_VSYNC_ACTIVE_LOW, | 1215 | V4L2_MBUS_VSYNC_ACTIVE_LOW, |
1216 | .bus_type = FIMC_ITU_601, | 1216 | .fimc_bus_type = FIMC_BUS_TYPE_ITU_601, |
1217 | .board_info = &s5k6aa_board_info, | 1217 | .board_info = &s5k6aa_board_info, |
1218 | .clk_frequency = 24000000UL, | 1218 | .clk_frequency = 24000000UL, |
1219 | .i2c_bus_num = 6, | 1219 | .i2c_bus_num = 6, |
1220 | }, { | 1220 | }, { |
1221 | .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | | 1221 | .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | |
1222 | V4L2_MBUS_VSYNC_ACTIVE_LOW, | 1222 | V4L2_MBUS_VSYNC_ACTIVE_LOW, |
1223 | .bus_type = FIMC_MIPI_CSI2, | 1223 | .fimc_bus_type = FIMC_BUS_TYPE_MIPI_CSI2, |
1224 | .board_info = &m5mols_board_info, | 1224 | .board_info = &m5mols_board_info, |
1225 | .clk_frequency = 24000000UL, | 1225 | .clk_frequency = 24000000UL, |
1226 | }, | 1226 | }, |
1227 | }; | 1227 | }; |
1228 | 1228 | ||
1229 | static struct s5p_platform_fimc fimc_md_platdata = { | 1229 | static struct s5p_platform_fimc fimc_md_platdata = { |
1230 | .isp_info = nuri_camera_sensors, | 1230 | .source_info = nuri_camera_sensors, |
1231 | .num_clients = ARRAY_SIZE(nuri_camera_sensors), | 1231 | .num_clients = ARRAY_SIZE(nuri_camera_sensors), |
1232 | }; | 1232 | }; |
1233 | 1233 | ||
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c index 9e3340f18950..c09290a8fa2e 100644 --- a/arch/arm/mach-exynos/mach-universal_c210.c +++ b/arch/arm/mach-exynos/mach-universal_c210.c | |||
@@ -988,12 +988,12 @@ static struct i2c_board_info m5mols_board_info = { | |||
988 | .platform_data = &m5mols_platdata, | 988 | .platform_data = &m5mols_platdata, |
989 | }; | 989 | }; |
990 | 990 | ||
991 | static struct s5p_fimc_isp_info universal_camera_sensors[] = { | 991 | static struct fimc_source_info universal_camera_sensors[] = { |
992 | { | 992 | { |
993 | .mux_id = 0, | 993 | .mux_id = 0, |
994 | .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | | 994 | .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | |
995 | V4L2_MBUS_VSYNC_ACTIVE_LOW, | 995 | V4L2_MBUS_VSYNC_ACTIVE_LOW, |
996 | .bus_type = FIMC_ITU_601, | 996 | .fimc_bus_type = FIMC_BUS_TYPE_ITU_601, |
997 | .board_info = &s5k6aa_board_info, | 997 | .board_info = &s5k6aa_board_info, |
998 | .i2c_bus_num = 0, | 998 | .i2c_bus_num = 0, |
999 | .clk_frequency = 24000000UL, | 999 | .clk_frequency = 24000000UL, |
@@ -1001,7 +1001,7 @@ static struct s5p_fimc_isp_info universal_camera_sensors[] = { | |||
1001 | .mux_id = 0, | 1001 | .mux_id = 0, |
1002 | .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | | 1002 | .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | |
1003 | V4L2_MBUS_VSYNC_ACTIVE_LOW, | 1003 | V4L2_MBUS_VSYNC_ACTIVE_LOW, |
1004 | .bus_type = FIMC_MIPI_CSI2, | 1004 | .fimc_bus_type = FIMC_BUS_TYPE_MIPI_CSI2, |
1005 | .board_info = &m5mols_board_info, | 1005 | .board_info = &m5mols_board_info, |
1006 | .i2c_bus_num = 0, | 1006 | .i2c_bus_num = 0, |
1007 | .clk_frequency = 24000000UL, | 1007 | .clk_frequency = 24000000UL, |
@@ -1009,7 +1009,7 @@ static struct s5p_fimc_isp_info universal_camera_sensors[] = { | |||
1009 | }; | 1009 | }; |
1010 | 1010 | ||
1011 | static struct s5p_platform_fimc fimc_md_platdata = { | 1011 | static struct s5p_platform_fimc fimc_md_platdata = { |
1012 | .isp_info = universal_camera_sensors, | 1012 | .source_info = universal_camera_sensors, |
1013 | .num_clients = ARRAY_SIZE(universal_camera_sensors), | 1013 | .num_clients = ARRAY_SIZE(universal_camera_sensors), |
1014 | }; | 1014 | }; |
1015 | 1015 | ||
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c index c72b31078c99..423f6b6e8dbe 100644 --- a/arch/arm/mach-s5pv210/mach-goni.c +++ b/arch/arm/mach-s5pv210/mach-goni.c | |||
@@ -841,12 +841,12 @@ static struct i2c_board_info noon010pc30_board_info = { | |||
841 | .platform_data = &noon010pc30_pldata, | 841 | .platform_data = &noon010pc30_pldata, |
842 | }; | 842 | }; |
843 | 843 | ||
844 | static struct s5p_fimc_isp_info goni_camera_sensors[] = { | 844 | static struct fimc_source_info goni_camera_sensors[] = { |
845 | { | 845 | { |
846 | .mux_id = 0, | 846 | .mux_id = 0, |
847 | .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | | 847 | .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | |
848 | V4L2_MBUS_VSYNC_ACTIVE_LOW, | 848 | V4L2_MBUS_VSYNC_ACTIVE_LOW, |
849 | .bus_type = FIMC_ITU_601, | 849 | .bus_type = FIMC_BUS_TYPE_ITU_601, |
850 | .board_info = &noon010pc30_board_info, | 850 | .board_info = &noon010pc30_board_info, |
851 | .i2c_bus_num = 0, | 851 | .i2c_bus_num = 0, |
852 | .clk_frequency = 16000000UL, | 852 | .clk_frequency = 16000000UL, |
@@ -854,7 +854,7 @@ static struct s5p_fimc_isp_info goni_camera_sensors[] = { | |||
854 | }; | 854 | }; |
855 | 855 | ||
856 | static struct s5p_platform_fimc goni_fimc_md_platdata __initdata = { | 856 | static struct s5p_platform_fimc goni_fimc_md_platdata __initdata = { |
857 | .isp_info = goni_camera_sensors, | 857 | .source_info = goni_camera_sensors, |
858 | .num_clients = ARRAY_SIZE(goni_camera_sensors), | 858 | .num_clients = ARRAY_SIZE(goni_camera_sensors), |
859 | }; | 859 | }; |
860 | 860 | ||
diff --git a/drivers/media/platform/s5p-fimc/fimc-lite-reg.c b/drivers/media/platform/s5p-fimc/fimc-lite-reg.c index 962652da3b43..f0af0754a7b4 100644 --- a/drivers/media/platform/s5p-fimc/fimc-lite-reg.c +++ b/drivers/media/platform/s5p-fimc/fimc-lite-reg.c | |||
@@ -187,12 +187,12 @@ static void flite_hw_set_camera_port(struct fimc_lite *dev, int id) | |||
187 | 187 | ||
188 | /* Select serial or parallel bus, camera port (A,B) and set signals polarity */ | 188 | /* Select serial or parallel bus, camera port (A,B) and set signals polarity */ |
189 | void flite_hw_set_camera_bus(struct fimc_lite *dev, | 189 | void flite_hw_set_camera_bus(struct fimc_lite *dev, |
190 | struct s5p_fimc_isp_info *s_info) | 190 | struct fimc_source_info *si) |
191 | { | 191 | { |
192 | u32 cfg = readl(dev->regs + FLITE_REG_CIGCTRL); | 192 | u32 cfg = readl(dev->regs + FLITE_REG_CIGCTRL); |
193 | unsigned int flags = s_info->flags; | 193 | unsigned int flags = si->flags; |
194 | 194 | ||
195 | if (s_info->bus_type != FIMC_MIPI_CSI2) { | 195 | if (si->sensor_bus_type != FIMC_BUS_TYPE_MIPI_CSI2) { |
196 | cfg &= ~(FLITE_REG_CIGCTRL_SELCAM_MIPI | | 196 | cfg &= ~(FLITE_REG_CIGCTRL_SELCAM_MIPI | |
197 | FLITE_REG_CIGCTRL_INVPOLPCLK | | 197 | FLITE_REG_CIGCTRL_INVPOLPCLK | |
198 | FLITE_REG_CIGCTRL_INVPOLVSYNC | | 198 | FLITE_REG_CIGCTRL_INVPOLVSYNC | |
@@ -212,7 +212,7 @@ void flite_hw_set_camera_bus(struct fimc_lite *dev, | |||
212 | 212 | ||
213 | writel(cfg, dev->regs + FLITE_REG_CIGCTRL); | 213 | writel(cfg, dev->regs + FLITE_REG_CIGCTRL); |
214 | 214 | ||
215 | flite_hw_set_camera_port(dev, s_info->mux_id); | 215 | flite_hw_set_camera_port(dev, si->mux_id); |
216 | } | 216 | } |
217 | 217 | ||
218 | static void flite_hw_set_out_order(struct fimc_lite *dev, struct flite_frame *f) | 218 | static void flite_hw_set_out_order(struct fimc_lite *dev, struct flite_frame *f) |
diff --git a/drivers/media/platform/s5p-fimc/fimc-lite-reg.h b/drivers/media/platform/s5p-fimc/fimc-lite-reg.h index adb9e9e6f3c2..0e345844c13a 100644 --- a/drivers/media/platform/s5p-fimc/fimc-lite-reg.h +++ b/drivers/media/platform/s5p-fimc/fimc-lite-reg.h | |||
@@ -131,9 +131,9 @@ void flite_hw_set_interrupt_mask(struct fimc_lite *dev); | |||
131 | void flite_hw_capture_start(struct fimc_lite *dev); | 131 | void flite_hw_capture_start(struct fimc_lite *dev); |
132 | void flite_hw_capture_stop(struct fimc_lite *dev); | 132 | void flite_hw_capture_stop(struct fimc_lite *dev); |
133 | void flite_hw_set_camera_bus(struct fimc_lite *dev, | 133 | void flite_hw_set_camera_bus(struct fimc_lite *dev, |
134 | struct s5p_fimc_isp_info *s_info); | 134 | struct fimc_source_info *s_info); |
135 | void flite_hw_set_camera_polarity(struct fimc_lite *dev, | 135 | void flite_hw_set_camera_polarity(struct fimc_lite *dev, |
136 | struct s5p_fimc_isp_info *cam); | 136 | struct fimc_source_info *cam); |
137 | void flite_hw_set_window_offset(struct fimc_lite *dev, struct flite_frame *f); | 137 | void flite_hw_set_window_offset(struct fimc_lite *dev, struct flite_frame *f); |
138 | void flite_hw_set_source_format(struct fimc_lite *dev, struct flite_frame *f); | 138 | void flite_hw_set_source_format(struct fimc_lite *dev, struct flite_frame *f); |
139 | 139 | ||
diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c index d940454a0297..f49f6f17a3f7 100644 --- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c +++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c | |||
@@ -290,7 +290,7 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd) | |||
290 | for (i = 0; i < num_clients; i++) { | 290 | for (i = 0; i < num_clients; i++) { |
291 | struct v4l2_subdev *sd; | 291 | struct v4l2_subdev *sd; |
292 | 292 | ||
293 | fmd->sensor[i].pdata = pdata->isp_info[i]; | 293 | fmd->sensor[i].pdata = pdata->source_info[i]; |
294 | ret = __fimc_md_set_camclk(fmd, &fmd->sensor[i], true); | 294 | ret = __fimc_md_set_camclk(fmd, &fmd->sensor[i], true); |
295 | if (ret) | 295 | if (ret) |
296 | break; | 296 | break; |
@@ -504,7 +504,7 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, | |||
504 | struct v4l2_subdev *sensor, | 504 | struct v4l2_subdev *sensor, |
505 | int pad, int link_mask) | 505 | int pad, int link_mask) |
506 | { | 506 | { |
507 | struct fimc_sensor_info *s_info; | 507 | struct fimc_sensor_info *s_info = NULL; |
508 | struct media_entity *sink; | 508 | struct media_entity *sink; |
509 | unsigned int flags = 0; | 509 | unsigned int flags = 0; |
510 | int ret, i; | 510 | int ret, i; |
@@ -614,7 +614,7 @@ static int fimc_md_create_links(struct fimc_md *fmd) | |||
614 | { | 614 | { |
615 | struct v4l2_subdev *csi_sensors[CSIS_MAX_ENTITIES] = { NULL }; | 615 | struct v4l2_subdev *csi_sensors[CSIS_MAX_ENTITIES] = { NULL }; |
616 | struct v4l2_subdev *sensor, *csis; | 616 | struct v4l2_subdev *sensor, *csis; |
617 | struct s5p_fimc_isp_info *pdata; | 617 | struct fimc_source_info *pdata; |
618 | struct fimc_sensor_info *s_info; | 618 | struct fimc_sensor_info *s_info; |
619 | struct media_entity *source, *sink; | 619 | struct media_entity *source, *sink; |
620 | int i, pad, fimc_id = 0, ret = 0; | 620 | int i, pad, fimc_id = 0, ret = 0; |
@@ -632,8 +632,8 @@ static int fimc_md_create_links(struct fimc_md *fmd) | |||
632 | source = NULL; | 632 | source = NULL; |
633 | pdata = &s_info->pdata; | 633 | pdata = &s_info->pdata; |
634 | 634 | ||
635 | switch (pdata->bus_type) { | 635 | switch (pdata->sensor_bus_type) { |
636 | case FIMC_MIPI_CSI2: | 636 | case FIMC_BUS_TYPE_MIPI_CSI2: |
637 | if (WARN(pdata->mux_id >= CSIS_MAX_ENTITIES, | 637 | if (WARN(pdata->mux_id >= CSIS_MAX_ENTITIES, |
638 | "Wrong CSI channel id: %d\n", pdata->mux_id)) | 638 | "Wrong CSI channel id: %d\n", pdata->mux_id)) |
639 | return -EINVAL; | 639 | return -EINVAL; |
@@ -659,14 +659,14 @@ static int fimc_md_create_links(struct fimc_md *fmd) | |||
659 | csi_sensors[pdata->mux_id] = sensor; | 659 | csi_sensors[pdata->mux_id] = sensor; |
660 | break; | 660 | break; |
661 | 661 | ||
662 | case FIMC_ITU_601...FIMC_ITU_656: | 662 | case FIMC_BUS_TYPE_ITU_601...FIMC_BUS_TYPE_ITU_656: |
663 | source = &sensor->entity; | 663 | source = &sensor->entity; |
664 | pad = 0; | 664 | pad = 0; |
665 | break; | 665 | break; |
666 | 666 | ||
667 | default: | 667 | default: |
668 | v4l2_err(&fmd->v4l2_dev, "Wrong bus_type: %x\n", | 668 | v4l2_err(&fmd->v4l2_dev, "Wrong bus_type: %x\n", |
669 | pdata->bus_type); | 669 | pdata->sensor_bus_type); |
670 | return -EINVAL; | 670 | return -EINVAL; |
671 | } | 671 | } |
672 | if (source == NULL) | 672 | if (source == NULL) |
@@ -762,7 +762,7 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, | |||
762 | struct fimc_sensor_info *s_info, | 762 | struct fimc_sensor_info *s_info, |
763 | bool on) | 763 | bool on) |
764 | { | 764 | { |
765 | struct s5p_fimc_isp_info *pdata = &s_info->pdata; | 765 | struct fimc_source_info *pdata = &s_info->pdata; |
766 | struct fimc_camclk_info *camclk; | 766 | struct fimc_camclk_info *camclk; |
767 | int ret = 0; | 767 | int ret = 0; |
768 | 768 | ||
diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.h b/drivers/media/platform/s5p-fimc/fimc-mdevice.h index da7d9922cf58..06b0d8276fd2 100644 --- a/drivers/media/platform/s5p-fimc/fimc-mdevice.h +++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.h | |||
@@ -53,7 +53,7 @@ struct fimc_camclk_info { | |||
53 | * This data structure applies to image sensor and the writeback subdevs. | 53 | * This data structure applies to image sensor and the writeback subdevs. |
54 | */ | 54 | */ |
55 | struct fimc_sensor_info { | 55 | struct fimc_sensor_info { |
56 | struct s5p_fimc_isp_info pdata; | 56 | struct fimc_source_info pdata; |
57 | struct v4l2_subdev *subdev; | 57 | struct v4l2_subdev *subdev; |
58 | struct fimc_dev *host; | 58 | struct fimc_dev *host; |
59 | }; | 59 | }; |
diff --git a/drivers/media/platform/s5p-fimc/fimc-reg.c b/drivers/media/platform/s5p-fimc/fimc-reg.c index c05d0444192f..50b97c75b956 100644 --- a/drivers/media/platform/s5p-fimc/fimc-reg.c +++ b/drivers/media/platform/s5p-fimc/fimc-reg.c | |||
@@ -554,7 +554,7 @@ void fimc_hw_set_output_addr(struct fimc_dev *dev, | |||
554 | } | 554 | } |
555 | 555 | ||
556 | int fimc_hw_set_camera_polarity(struct fimc_dev *fimc, | 556 | int fimc_hw_set_camera_polarity(struct fimc_dev *fimc, |
557 | struct s5p_fimc_isp_info *cam) | 557 | struct fimc_source_info *cam) |
558 | { | 558 | { |
559 | u32 cfg = readl(fimc->regs + FIMC_REG_CIGCTRL); | 559 | u32 cfg = readl(fimc->regs + FIMC_REG_CIGCTRL); |
560 | 560 | ||
@@ -596,14 +596,15 @@ static const struct mbus_pixfmt_desc pix_desc[] = { | |||
596 | }; | 596 | }; |
597 | 597 | ||
598 | int fimc_hw_set_camera_source(struct fimc_dev *fimc, | 598 | int fimc_hw_set_camera_source(struct fimc_dev *fimc, |
599 | struct s5p_fimc_isp_info *cam) | 599 | struct fimc_source_info *source) |
600 | { | 600 | { |
601 | struct fimc_frame *f = &fimc->vid_cap.ctx->s_frame; | 601 | struct fimc_frame *f = &fimc->vid_cap.ctx->s_frame; |
602 | u32 cfg = 0; | 602 | u32 bus_width, cfg = 0; |
603 | u32 bus_width; | ||
604 | int i; | 603 | int i; |
605 | 604 | ||
606 | if (cam->bus_type == FIMC_ITU_601 || cam->bus_type == FIMC_ITU_656) { | 605 | switch (source->fimc_bus_type) { |
606 | case FIMC_BUS_TYPE_ITU_601: | ||
607 | case FIMC_BUS_TYPE_ITU_656: | ||
607 | for (i = 0; i < ARRAY_SIZE(pix_desc); i++) { | 608 | for (i = 0; i < ARRAY_SIZE(pix_desc); i++) { |
608 | if (fimc->vid_cap.mf.code == pix_desc[i].pixelcode) { | 609 | if (fimc->vid_cap.mf.code == pix_desc[i].pixelcode) { |
609 | cfg = pix_desc[i].cisrcfmt; | 610 | cfg = pix_desc[i].cisrcfmt; |
@@ -619,15 +620,17 @@ int fimc_hw_set_camera_source(struct fimc_dev *fimc, | |||
619 | return -EINVAL; | 620 | return -EINVAL; |
620 | } | 621 | } |
621 | 622 | ||
622 | if (cam->bus_type == FIMC_ITU_601) { | 623 | if (source->fimc_bus_type == FIMC_BUS_TYPE_ITU_601) { |
623 | if (bus_width == 8) | 624 | if (bus_width == 8) |
624 | cfg |= FIMC_REG_CISRCFMT_ITU601_8BIT; | 625 | cfg |= FIMC_REG_CISRCFMT_ITU601_8BIT; |
625 | else if (bus_width == 16) | 626 | else if (bus_width == 16) |
626 | cfg |= FIMC_REG_CISRCFMT_ITU601_16BIT; | 627 | cfg |= FIMC_REG_CISRCFMT_ITU601_16BIT; |
627 | } /* else defaults to ITU-R BT.656 8-bit */ | 628 | } /* else defaults to ITU-R BT.656 8-bit */ |
628 | } else if (cam->bus_type == FIMC_MIPI_CSI2) { | 629 | break; |
630 | case FIMC_BUS_TYPE_MIPI_CSI2: | ||
629 | if (fimc_fmt_is_user_defined(f->fmt->color)) | 631 | if (fimc_fmt_is_user_defined(f->fmt->color)) |
630 | cfg |= FIMC_REG_CISRCFMT_ITU601_8BIT; | 632 | cfg |= FIMC_REG_CISRCFMT_ITU601_8BIT; |
633 | break; | ||
631 | } | 634 | } |
632 | 635 | ||
633 | cfg |= (f->o_width << 16) | f->o_height; | 636 | cfg |= (f->o_width << 16) | f->o_height; |
@@ -655,7 +658,7 @@ void fimc_hw_set_camera_offset(struct fimc_dev *fimc, struct fimc_frame *f) | |||
655 | } | 658 | } |
656 | 659 | ||
657 | int fimc_hw_set_camera_type(struct fimc_dev *fimc, | 660 | int fimc_hw_set_camera_type(struct fimc_dev *fimc, |
658 | struct s5p_fimc_isp_info *cam) | 661 | struct fimc_source_info *source) |
659 | { | 662 | { |
660 | u32 cfg, tmp; | 663 | u32 cfg, tmp; |
661 | struct fimc_vid_cap *vid_cap = &fimc->vid_cap; | 664 | struct fimc_vid_cap *vid_cap = &fimc->vid_cap; |
@@ -668,11 +671,11 @@ int fimc_hw_set_camera_type(struct fimc_dev *fimc, | |||
668 | FIMC_REG_CIGCTRL_SELCAM_MIPI | FIMC_REG_CIGCTRL_CAMIF_SELWB | | 671 | FIMC_REG_CIGCTRL_SELCAM_MIPI | FIMC_REG_CIGCTRL_CAMIF_SELWB | |
669 | FIMC_REG_CIGCTRL_SELCAM_MIPI_A | FIMC_REG_CIGCTRL_CAM_JPEG); | 672 | FIMC_REG_CIGCTRL_SELCAM_MIPI_A | FIMC_REG_CIGCTRL_CAM_JPEG); |
670 | 673 | ||
671 | switch (cam->bus_type) { | 674 | switch (source->fimc_bus_type) { |
672 | case FIMC_MIPI_CSI2: | 675 | case FIMC_BUS_TYPE_MIPI_CSI2: |
673 | cfg |= FIMC_REG_CIGCTRL_SELCAM_MIPI; | 676 | cfg |= FIMC_REG_CIGCTRL_SELCAM_MIPI; |
674 | 677 | ||
675 | if (cam->mux_id == 0) | 678 | if (source->mux_id == 0) |
676 | cfg |= FIMC_REG_CIGCTRL_SELCAM_MIPI_A; | 679 | cfg |= FIMC_REG_CIGCTRL_SELCAM_MIPI_A; |
677 | 680 | ||
678 | /* TODO: add remaining supported formats. */ | 681 | /* TODO: add remaining supported formats. */ |
@@ -695,15 +698,16 @@ int fimc_hw_set_camera_type(struct fimc_dev *fimc, | |||
695 | 698 | ||
696 | writel(tmp, fimc->regs + FIMC_REG_CSIIMGFMT); | 699 | writel(tmp, fimc->regs + FIMC_REG_CSIIMGFMT); |
697 | break; | 700 | break; |
698 | case FIMC_ITU_601...FIMC_ITU_656: | 701 | case FIMC_BUS_TYPE_ITU_601...FIMC_BUS_TYPE_ITU_656: |
699 | if (cam->mux_id == 0) /* ITU-A, ITU-B: 0, 1 */ | 702 | if (source->mux_id == 0) /* ITU-A, ITU-B: 0, 1 */ |
700 | cfg |= FIMC_REG_CIGCTRL_SELCAM_ITU_A; | 703 | cfg |= FIMC_REG_CIGCTRL_SELCAM_ITU_A; |
701 | break; | 704 | break; |
702 | case FIMC_LCD_WB: | 705 | case FIMC_BUS_TYPE_LCD_WRITEBACK_A: |
703 | cfg |= FIMC_REG_CIGCTRL_CAMIF_SELWB; | 706 | cfg |= FIMC_REG_CIGCTRL_CAMIF_SELWB; |
704 | break; | 707 | break; |
705 | default: | 708 | default: |
706 | v4l2_err(&vid_cap->vfd, "Invalid camera bus type selected\n"); | 709 | v4l2_err(&vid_cap->vfd, "Invalid FIMC bus type selected: %d\n", |
710 | source->fimc_bus_type); | ||
707 | return -EINVAL; | 711 | return -EINVAL; |
708 | } | 712 | } |
709 | writel(cfg, fimc->regs + FIMC_REG_CIGCTRL); | 713 | writel(cfg, fimc->regs + FIMC_REG_CIGCTRL); |
diff --git a/drivers/media/platform/s5p-fimc/fimc-reg.h b/drivers/media/platform/s5p-fimc/fimc-reg.h index f3e0b78a3736..1a40df6d1a80 100644 --- a/drivers/media/platform/s5p-fimc/fimc-reg.h +++ b/drivers/media/platform/s5p-fimc/fimc-reg.h | |||
@@ -297,12 +297,12 @@ void fimc_hw_set_input_addr(struct fimc_dev *fimc, struct fimc_addr *paddr); | |||
297 | void fimc_hw_set_output_addr(struct fimc_dev *fimc, struct fimc_addr *paddr, | 297 | void fimc_hw_set_output_addr(struct fimc_dev *fimc, struct fimc_addr *paddr, |
298 | int index); | 298 | int index); |
299 | int fimc_hw_set_camera_source(struct fimc_dev *fimc, | 299 | int fimc_hw_set_camera_source(struct fimc_dev *fimc, |
300 | struct s5p_fimc_isp_info *cam); | 300 | struct fimc_source_info *cam); |
301 | void fimc_hw_set_camera_offset(struct fimc_dev *fimc, struct fimc_frame *f); | 301 | void fimc_hw_set_camera_offset(struct fimc_dev *fimc, struct fimc_frame *f); |
302 | int fimc_hw_set_camera_polarity(struct fimc_dev *fimc, | 302 | int fimc_hw_set_camera_polarity(struct fimc_dev *fimc, |
303 | struct s5p_fimc_isp_info *cam); | 303 | struct fimc_source_info *cam); |
304 | int fimc_hw_set_camera_type(struct fimc_dev *fimc, | 304 | int fimc_hw_set_camera_type(struct fimc_dev *fimc, |
305 | struct s5p_fimc_isp_info *cam); | 305 | struct fimc_source_info *cam); |
306 | void fimc_hw_clear_irq(struct fimc_dev *dev); | 306 | void fimc_hw_clear_irq(struct fimc_dev *dev); |
307 | void fimc_hw_enable_scaler(struct fimc_dev *dev, bool on); | 307 | void fimc_hw_enable_scaler(struct fimc_dev *dev, bool on); |
308 | void fimc_hw_activate_input_dma(struct fimc_dev *dev, bool on); | 308 | void fimc_hw_activate_input_dma(struct fimc_dev *dev, bool on); |
diff --git a/include/media/s5p_fimc.h b/include/media/s5p_fimc.h index eaea62a382f8..28f3590aa031 100644 --- a/include/media/s5p_fimc.h +++ b/include/media/s5p_fimc.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Samsung S5P SoC camera interface driver header | 2 | * Samsung S5P/Exynos4 SoC series camera interface driver header |
3 | * | 3 | * |
4 | * Copyright (c) 2010 Samsung Electronics Co., Ltd | 4 | * Copyright (C) 2010 - 2013 Samsung Electronics Co., Ltd. |
5 | * Author: Sylwester Nawrocki, <s.nawrocki@samsung.com> | 5 | * Sylwester Nawrocki <s.nawrocki@samsung.com> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License version 2 as | 8 | * it under the terms of the GNU General Public License version 2 as |
@@ -14,45 +14,58 @@ | |||
14 | 14 | ||
15 | #include <media/media-entity.h> | 15 | #include <media/media-entity.h> |
16 | 16 | ||
17 | enum cam_bus_type { | 17 | /* |
18 | FIMC_ITU_601 = 1, | 18 | * Enumeration of the FIMC data bus types. |
19 | FIMC_ITU_656, | 19 | */ |
20 | FIMC_MIPI_CSI2, | 20 | enum fimc_bus_type { |
21 | FIMC_LCD_WB, /* FIFO link from LCD mixer */ | 21 | /* Camera parallel bus */ |
22 | FIMC_BUS_TYPE_ITU_601 = 1, | ||
23 | /* Camera parallel bus with embedded synchronization */ | ||
24 | FIMC_BUS_TYPE_ITU_656, | ||
25 | /* Camera MIPI-CSI2 serial bus */ | ||
26 | FIMC_BUS_TYPE_MIPI_CSI2, | ||
27 | /* FIFO link from LCD controller (WriteBack A) */ | ||
28 | FIMC_BUS_TYPE_LCD_WRITEBACK_A, | ||
29 | /* FIFO link from LCD controller (WriteBack B) */ | ||
30 | FIMC_BUS_TYPE_LCD_WRITEBACK_B, | ||
31 | /* FIFO link from FIMC-IS */ | ||
32 | FIMC_BUS_TYPE_ISP_WRITEBACK = FIMC_BUS_TYPE_LCD_WRITEBACK_B, | ||
22 | }; | 33 | }; |
23 | 34 | ||
24 | struct i2c_board_info; | 35 | struct i2c_board_info; |
25 | 36 | ||
26 | /** | 37 | /** |
27 | * struct s5p_fimc_isp_info - image sensor information required for host | 38 | * struct fimc_source_info - video source description required for the host |
28 | * interace configuration. | 39 | * interface configuration |
29 | * | 40 | * |
30 | * @board_info: pointer to I2C subdevice's board info | 41 | * @board_info: pointer to I2C subdevice's board info |
31 | * @clk_frequency: frequency of the clock the host interface provides to sensor | 42 | * @clk_frequency: frequency of the clock the host interface provides to sensor |
32 | * @bus_type: determines bus type, MIPI, ITU-R BT.601 etc. | 43 | * @fimc_bus_type: FIMC camera input type |
44 | * @sensor_bus_type: image sensor bus type, MIPI, ITU-R BT.601 etc. | ||
45 | * @flags: the parallel sensor bus flags defining signals polarity (V4L2_MBUS_*) | ||
33 | * @i2c_bus_num: i2c control bus id the sensor is attached to | 46 | * @i2c_bus_num: i2c control bus id the sensor is attached to |
34 | * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU) | 47 | * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU) |
35 | * @clk_id: index of the SoC peripheral clock for sensors | 48 | * @clk_id: index of the SoC peripheral clock for sensors |
36 | * @flags: the parallel bus flags defining signals polarity (V4L2_MBUS_*) | ||
37 | */ | 49 | */ |
38 | struct s5p_fimc_isp_info { | 50 | struct fimc_source_info { |
39 | struct i2c_board_info *board_info; | 51 | struct i2c_board_info *board_info; |
40 | unsigned long clk_frequency; | 52 | unsigned long clk_frequency; |
41 | enum cam_bus_type bus_type; | 53 | enum fimc_bus_type fimc_bus_type; |
54 | enum fimc_bus_type sensor_bus_type; | ||
55 | u16 flags; | ||
42 | u16 i2c_bus_num; | 56 | u16 i2c_bus_num; |
43 | u16 mux_id; | 57 | u16 mux_id; |
44 | u16 flags; | ||
45 | u8 clk_id; | 58 | u8 clk_id; |
46 | }; | 59 | }; |
47 | 60 | ||
48 | /** | 61 | /** |
49 | * struct s5p_platform_fimc - camera host interface platform data | 62 | * struct s5p_platform_fimc - camera host interface platform data |
50 | * | 63 | * |
51 | * @isp_info: properties of camera sensor required for host interface setup | 64 | * @source_info: properties of an image source for the host interface setup |
52 | * @num_clients: the number of attached image sensors | 65 | * @num_clients: the number of attached image sources |
53 | */ | 66 | */ |
54 | struct s5p_platform_fimc { | 67 | struct s5p_platform_fimc { |
55 | struct s5p_fimc_isp_info *isp_info; | 68 | struct fimc_source_info *source_info; |
56 | int num_clients; | 69 | int num_clients; |
57 | }; | 70 | }; |
58 | 71 | ||