Skip to content

Commit 34947b8

Browse files
Sylwester Nawrockimchehab
authored andcommitted
[media] exynos4-is: Add the FIMC-IS ISP capture DMA driver
Add a video capture node for the FIMC-IS ISP IP block. The Exynos4x12 FIMC-IS ISP IP block has 2 DMA interfaces that allow to capture raw Bayer and YUV data to memory. Currently only the DMA2 output is and raw Bayer data capture is supported. Signed-off-by: Sylwester Nawrocki <[email protected]> Acked-by: Kyungmin Park <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent fa91f10 commit 34947b8

File tree

13 files changed

+817
-9
lines changed

13 files changed

+817
-9
lines changed

drivers/media/platform/exynos4-is/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,13 @@ config VIDEO_EXYNOS4_FIMC_IS
6464
To compile this driver as a module, choose M here: the
6565
module will be called exynos4-fimc-is.
6666

67+
config VIDEO_EXYNOS4_ISP_DMA_CAPTURE
68+
bool "EXYNOS4x12 FIMC-IS ISP Direct DMA capture support"
69+
depends on VIDEO_EXYNOS4_FIMC_IS
70+
select VIDEO_EXYNOS4_IS_COMMON
71+
default y
72+
help
73+
This option enables an additional video device node exposing a V4L2
74+
video capture interface for the FIMC-IS ISP raw (Bayer) capture DMA.
75+
6776
endif # VIDEO_SAMSUNG_EXYNOS4_IS

drivers/media/platform/exynos4-is/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ exynos4-is-common-objs := common.o
66
exynos-fimc-is-objs := fimc-is.o fimc-isp.o fimc-is-sensor.o fimc-is-regs.o
77
exynos-fimc-is-objs += fimc-is-param.o fimc-is-errno.o fimc-is-i2c.o
88

9+
ifeq ($(CONFIG_VIDEO_EXYNOS4_ISP_DMA_CAPTURE),y)
10+
exynos-fimc-is-objs += fimc-isp-video.o
11+
endif
12+
913
obj-$(CONFIG_VIDEO_S5P_MIPI_CSIS) += s5p-csis.o
1014
obj-$(CONFIG_VIDEO_EXYNOS_FIMC_LITE) += exynos-fimc-lite.o
1115
obj-$(CONFIG_VIDEO_EXYNOS4_FIMC_IS) += exynos-fimc-is.o

drivers/media/platform/exynos4-is/fimc-is-param.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static void __fimc_is_hw_update_param_sensor_framerate(struct fimc_is *is)
5656
__hw_param_copy(dst, src);
5757
}
5858

59-
static int __fimc_is_hw_update_param(struct fimc_is *is, u32 offset)
59+
int __fimc_is_hw_update_param(struct fimc_is *is, u32 offset)
6060
{
6161
struct is_param_region *par = &is->is_p_region->parameter;
6262
struct chain_config *cfg = &is->config[is->config_index];

drivers/media/platform/exynos4-is/fimc-is-param.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,10 @@ struct is_region {
911911
u32 shared[MAX_SHARED_COUNT];
912912
} __packed;
913913

914+
/* Offset to the ISP DMA2 output buffer address array. */
915+
#define DMA2_OUTPUT_ADDR_ARRAY_OFFS \
916+
(offsetof(struct is_region, shared) + 32 * sizeof(u32))
917+
914918
struct is_debug_frame_descriptor {
915919
u32 sensor_frame_time;
916920
u32 sensor_exposure_time;
@@ -988,6 +992,7 @@ struct sensor_open_extended {
988992
struct fimc_is;
989993

990994
int fimc_is_hw_get_sensor_max_framerate(struct fimc_is *is);
995+
int __fimc_is_hw_update_param(struct fimc_is *is, u32 offset);
991996
void fimc_is_set_initial_params(struct fimc_is *is);
992997
unsigned int __get_pending_param_count(struct fimc_is *is);
993998

drivers/media/platform/exynos4-is/fimc-is-regs.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,20 @@ int fimc_is_hw_get_params(struct fimc_is *is, unsigned int num_args)
105105
return 0;
106106
}
107107

108+
void fimc_is_hw_set_isp_buf_mask(struct fimc_is *is, unsigned int mask)
109+
{
110+
if (hweight32(mask) == 1) {
111+
dev_err(&is->pdev->dev, "%s(): not enough buffers (mask %#x)\n",
112+
__func__, mask);
113+
return;
114+
}
115+
116+
if (mcuctl_read(is, MCUCTL_REG_ISSR(23)) != 0)
117+
dev_dbg(&is->pdev->dev, "non-zero DMA buffer mask\n");
118+
119+
mcuctl_write(mask, is, MCUCTL_REG_ISSR(23));
120+
}
121+
108122
void fimc_is_hw_set_sensor_num(struct fimc_is *is)
109123
{
110124
pr_debug("setting sensor index to: %d\n", is->sensor_index);

drivers/media/platform/exynos4-is/fimc-is-regs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ int fimc_is_hw_get_params(struct fimc_is *is, unsigned int num);
147147
void fimc_is_hw_set_intgr0_gd0(struct fimc_is *is);
148148
int fimc_is_hw_wait_intmsr0_intmsd0(struct fimc_is *is);
149149
void fimc_is_hw_set_sensor_num(struct fimc_is *is);
150+
void fimc_is_hw_set_isp_buf_mask(struct fimc_is *is, unsigned int mask);
150151
void fimc_is_hw_stream_on(struct fimc_is *is);
151152
void fimc_is_hw_stream_off(struct fimc_is *is);
152153
int fimc_is_hw_set_param(struct fimc_is *is);

drivers/media/platform/exynos4-is/fimc-is.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ static int fimc_is_register_subdevs(struct fimc_is *is)
204204
if (ret < 0)
205205
return ret;
206206

207+
/* Initialize memory allocator context for the ISP DMA. */
208+
is->isp.alloc_ctx = is->alloc_ctx;
209+
207210
for_each_compatible_node(i2c_bus, NULL, FIMC_IS_I2C_COMPATIBLE) {
208211
for_each_available_child_of_node(i2c_bus, child) {
209212
ret = fimc_is_parse_sensor_config(is, index, child);

drivers/media/platform/exynos4-is/fimc-is.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ static inline struct fimc_is *fimc_isp_to_is(struct fimc_isp *isp)
292292
return container_of(isp, struct fimc_is, isp);
293293
}
294294

295+
static inline struct chain_config *__get_curr_is_config(struct fimc_is *is)
296+
{
297+
return &is->config[is->config_index];
298+
}
299+
295300
static inline void fimc_is_mem_barrier(void)
296301
{
297302
mb();

0 commit comments

Comments
 (0)