From dd8245f445f5e751b38126140b6ba1723f06c60b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 18 May 2017 05:40:18 -0300 Subject: [media] atomisp: don't treat warnings as errors Several atomisp files use: ccflags-y += -Werror As, on media, our usual procedure is to use W=1, and atomisp has *a lot* of warnings with such flag enabled,like: ./drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/system_local.h:62:26: warning: 'DDR_BASE' defined but not used [-Wunused-const-variable=] At the end, it causes our build to fail, impacting our workflow. So, remove this crap. If one wants to force -Werror, he can still build with it enabled by passing a parameter to make. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/i2c/Makefile | 2 -- drivers/staging/media/atomisp/i2c/imx/Makefile | 2 -- drivers/staging/media/atomisp/i2c/ov5693/Makefile | 2 -- drivers/staging/media/atomisp/pci/atomisp2/Makefile | 2 +- 4 files changed, 1 insertion(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/i2c/Makefile b/drivers/staging/media/atomisp/i2c/Makefile index 8ea01904c0ea..466517c7c8e6 100644 --- a/drivers/staging/media/atomisp/i2c/Makefile +++ b/drivers/staging/media/atomisp/i2c/Makefile @@ -19,5 +19,3 @@ obj-$(CONFIG_VIDEO_AP1302) += ap1302.o obj-$(CONFIG_VIDEO_LM3554) += lm3554.o -ccflags-y += -Werror - diff --git a/drivers/staging/media/atomisp/i2c/imx/Makefile b/drivers/staging/media/atomisp/i2c/imx/Makefile index 1d7f7ab94cac..6b13a3a66e49 100644 --- a/drivers/staging/media/atomisp/i2c/imx/Makefile +++ b/drivers/staging/media/atomisp/i2c/imx/Makefile @@ -4,5 +4,3 @@ imx1x5-objs := imx.o drv201.o ad5816g.o dw9714.o dw9719.o dw9718.o vcm.o otp.o o ov8858_driver-objs := ../ov8858.o dw9718.o vcm.o obj-$(CONFIG_VIDEO_OV8858) += ov8858_driver.o - -ccflags-y += -Werror diff --git a/drivers/staging/media/atomisp/i2c/ov5693/Makefile b/drivers/staging/media/atomisp/i2c/ov5693/Makefile index fceb9e9b881b..c9c0e1245858 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/Makefile +++ b/drivers/staging/media/atomisp/i2c/ov5693/Makefile @@ -1,3 +1 @@ obj-$(CONFIG_VIDEO_OV5693) += ov5693.o - -ccflags-y += -Werror diff --git a/drivers/staging/media/atomisp/pci/atomisp2/Makefile b/drivers/staging/media/atomisp/pci/atomisp2/Makefile index 3fa7c1c1479f..f126a89a08e9 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/Makefile +++ b/drivers/staging/media/atomisp/pci/atomisp2/Makefile @@ -351,5 +351,5 @@ DEFINES := -DHRT_HW -DHRT_ISP_CSS_CUSTOM_HOST -DHRT_USE_VIR_ADDRS -D__HOST__ DEFINES += -DATOMISP_POSTFIX=\"css2400b0_v21\" -DISP2400B0 DEFINES += -DSYSTEM_hive_isp_css_2400_system -DISP2400 -ccflags-y += $(INCLUDES) $(DEFINES) -fno-common -Werror +ccflags-y += $(INCLUDES) $(DEFINES) -fno-common -- cgit v1.2.3-55-g7522 From 158aeefcb82f875ac603d66596e33dbdfcf8a400 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Thu, 18 May 2017 10:50:10 -0300 Subject: [media] atomisp: Add __printf validation and fix fallout __printf validation adds format and argument validation. Fix the various broken format/argument mismatches. Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman Signed-off-by: Mauro Carvalho Chehab --- .../isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c | 6 +++--- .../isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c | 2 +- .../css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c | 2 +- .../css2400/runtime/debug/interface/ia_css_debug.h | 1 + .../atomisp2/css2400/runtime/debug/src/ia_css_debug.c | 6 +++--- .../media/atomisp/pci/atomisp2/css2400/sh_css.c | 19 ++++++++++--------- .../media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c | 2 +- .../atomisp/pci/atomisp2/css2400/sh_css_params.c | 10 +++++----- 8 files changed, 25 insertions(+), 23 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c index 0daab1176865..9478c12abe89 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c @@ -265,9 +265,9 @@ ia_css_translate_dvs_statistics( assert(isp_stats->hor_proj != NULL); assert(isp_stats->ver_proj != NULL); - IA_CSS_ENTER("hproj=%p, vproj=%p, haddr=%x, vaddr=%x", - host_stats->hor_proj, host_stats->ver_proj, - isp_stats->hor_proj, isp_stats->ver_proj); + IA_CSS_ENTER("hproj=%p, vproj=%p, haddr=%p, vaddr=%p", + host_stats->hor_proj, host_stats->ver_proj, + isp_stats->hor_proj, isp_stats->ver_proj); hor_num_isp = host_stats->grid.aligned_height; ver_num_isp = host_stats->grid.aligned_width; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c index 5a0c103e9eb7..9bccb6473154 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c @@ -213,7 +213,7 @@ ia_css_translate_dvs2_statistics( "hor_coefs.even_real=%p, hor_coefs.even_imag=%p, " "ver_coefs.odd_real=%p, ver_coefs.odd_imag=%p, " "ver_coefs.even_real=%p, ver_coefs.even_imag=%p, " - "haddr=%x, vaddr=%x", + "haddr=%p, vaddr=%p", host_stats->hor_prod.odd_real, host_stats->hor_prod.odd_imag, host_stats->hor_prod.even_real, host_stats->hor_prod.even_imag, host_stats->ver_prod.odd_real, host_stats->ver_prod.odd_imag, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c index 804c19ab4485..222a7bd7f176 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c @@ -55,7 +55,7 @@ ia_css_tnr_dump( "tnr_coef", tnr->coef); ia_css_debug_dtrace(level, "\t%-32s = %d\n", "tnr_threshold_Y", tnr->threshold_Y); - ia_css_debug_dtrace(level, "\t%-32s = %d\n" + ia_css_debug_dtrace(level, "\t%-32s = %d\n", "tnr_threshold_C", tnr->threshold_C); } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug.h index be7df3a30c21..91c105cc6204 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug.h @@ -137,6 +137,7 @@ ia_css_debug_vdtrace(unsigned int level, const char *fmt, va_list args) sh_css_vprint(fmt, args); } +__printf(2, 3) extern void ia_css_debug_dtrace(unsigned int level, const char *fmt, ...); /*! @brief Dump sp thread's stack contents diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c index 030810bd0878..bcc0d464084f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c @@ -3148,8 +3148,8 @@ ia_css_debug_dump_pipe_config( ia_css_debug_dump_frame_info(&config->vf_output_info[i], "vf_output_info"); } - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "acc_extension: 0x%x\n", - config->acc_extension); + ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "acc_extension: %p\n", + config->acc_extension); ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "num_acc_stages: %d\n", config->num_acc_stages); ia_css_debug_dump_capture_config(&config->default_capture_config); @@ -3179,7 +3179,7 @@ ia_css_debug_dump_stream_config_source( ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "timeout: %d\n", config->source.port.timeout); ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "compression: %d\n", - config->source.port.compression); + config->source.port.compression.type); break; case IA_CSS_INPUT_MODE_TPG: ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "source.tpg\n"); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index 73c76583610a..81a21a0c1391 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -2003,7 +2003,7 @@ ia_css_enable_isys_event_queue(bool enable) void *sh_css_malloc(size_t size) { - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "sh_css_malloc() enter: size=%d\n",size); + ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "sh_css_malloc() enter: size=%zu\n",size); /* FIXME: This first test can probably go away */ if (size == 0) return NULL; @@ -2016,7 +2016,7 @@ void *sh_css_calloc(size_t N, size_t size) { void *p; - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "sh_css_calloc() enter: N=%d, size=%d\n",N,size); + ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "sh_css_calloc() enter: N=%zu, size=%zu\n",N,size); /* FIXME: this test can probably go away */ if (size > 0) { @@ -2059,7 +2059,8 @@ map_sp_threads(struct ia_css_stream *stream, bool map) enum ia_css_pipe_id pipe_id; assert(stream != NULL); - IA_CSS_ENTER_PRIVATE("stream = %p, map = %p", stream, map); + IA_CSS_ENTER_PRIVATE("stream = %p, map = %s", + stream, map ? "true" : "false"); if (stream == NULL) { IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_INVALID_ARGUMENTS); @@ -2766,7 +2767,7 @@ enum ia_css_err ia_css_irq_translate( *irq_infos = infos; ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_irq_translate() " - "leave: irq_infos=%p\n", infos); + "leave: irq_infos=%u\n", infos); return IA_CSS_SUCCESS; } @@ -4514,7 +4515,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe, #else if (hmm_buffer_record) { #endif - IA_CSS_LOG("send vbuf=0x%x", h_vbuf); + IA_CSS_LOG("send vbuf=%p", h_vbuf); } else { return_err = IA_CSS_ERR_INTERNAL_ERROR; IA_CSS_ERROR("hmm_buffer_record[]: no available slots\n"); @@ -4624,7 +4625,7 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, ia_css_rmgr_rel_vbuf(hmm_buffer_pool, &hmm_buffer_record->h_vbuf); sh_css_hmm_buffer_record_reset(hmm_buffer_record); } else { - IA_CSS_ERROR("hmm_buffer_record not found (0x%p) buf_type(%d)", + IA_CSS_ERROR("hmm_buffer_record not found (0x%u) buf_type(%d)", ddr_buffer_addr, buf_type); IA_CSS_LEAVE_ERR(IA_CSS_ERR_INTERNAL_ERROR); return IA_CSS_ERR_INTERNAL_ERROR; @@ -4640,8 +4641,8 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, if ((ddr_buffer.kernel_ptr == 0) || (kernel_ptr != HOST_ADDRESS(ddr_buffer.kernel_ptr))) { IA_CSS_ERROR("kernel_ptr invalid"); - IA_CSS_ERROR("expected: (0x%p)", kernel_ptr); - IA_CSS_ERROR("actual: (0x%p)", HOST_ADDRESS(ddr_buffer.kernel_ptr)); + IA_CSS_ERROR("expected: (0x%llx)", (u64)kernel_ptr); + IA_CSS_ERROR("actual: (0x%llx)", (u64)HOST_ADDRESS(ddr_buffer.kernel_ptr)); IA_CSS_ERROR("buf_type: %d\n", buf_type); IA_CSS_LEAVE_ERR(IA_CSS_ERR_INTERNAL_ERROR); return IA_CSS_ERR_INTERNAL_ERROR; @@ -6621,7 +6622,7 @@ allocate_delay_frames(struct ia_css_pipe *pipe) IA_CSS_ENTER_PRIVATE(""); if (pipe == NULL) { - IA_CSS_ERROR("Invalid args - pipe %x", pipe); + IA_CSS_ERROR("Invalid args - pipe %p", pipe); return IA_CSS_ERR_INVALID_ARGUMENTS; } diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c index 7e3893c6c08a..36aaa3019a15 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c @@ -681,7 +681,7 @@ send_mipi_frames(struct ia_css_pipe *pipe) unsigned int port = 0; #endif - IA_CSS_ENTER_PRIVATE("pipe=%d", pipe); + IA_CSS_ENTER_PRIVATE("pipe=%p", pipe); assert(pipe != NULL); assert(pipe->stream != NULL); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c index 561f4a7236f7..d8c22e8cd3af 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c @@ -3375,7 +3375,7 @@ enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe, #endif if (pipe->scaler_pp_lut == mmgr_NULL) { #ifndef ISP2401 - IA_CSS_LEAVE("lut(%p) err=%d", pipe->scaler_pp_lut, err); + IA_CSS_LEAVE("lut(%u) err=%d", pipe->scaler_pp_lut, err); return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; #else ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR, @@ -3397,7 +3397,7 @@ enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe, #endif } - IA_CSS_LEAVE("lut(%p) err=%d", pipe->scaler_pp_lut, err); + IA_CSS_LEAVE("lut(%u) err=%d", pipe->scaler_pp_lut, err); return err; } @@ -3437,7 +3437,7 @@ enum ia_css_err sh_css_params_map_and_store_default_gdc_lut(void) mmgr_store(default_gdc_lut, (int *)interleaved_lut_temp, sizeof(zoom_table)); - IA_CSS_LEAVE_PRIVATE("lut(%p) err=%d", default_gdc_lut, err); + IA_CSS_LEAVE_PRIVATE("lut(%u) err=%d", default_gdc_lut, err); return err; } @@ -3859,7 +3859,7 @@ sh_css_param_update_isp_params(struct ia_css_pipe *curr_pipe, /* When API change is implemented making good distinction between * stream config and pipe config this skipping code can be moved out of the #ifdef */ if (pipe_in && (pipe != pipe_in)) { - IA_CSS_LOG("skipping pipe %x", pipe); + IA_CSS_LOG("skipping pipe %p", pipe); continue; } @@ -4590,7 +4590,7 @@ free_ia_css_isp_parameter_set_info( unsigned int i; hrt_vaddress *addrs = (hrt_vaddress *)&isp_params_info.mem_map; - IA_CSS_ENTER_PRIVATE("ptr = %p", ptr); + IA_CSS_ENTER_PRIVATE("ptr = %u", ptr); /* sanity check - ptr must be valid */ if (!ia_css_refcount_is_valid(ptr)) { -- cgit v1.2.3-55-g7522 From 86675eccd1a531003c270a6f05954d49757c6bb5 Mon Sep 17 00:00:00 2001 From: Guru Das Srinagesh Date: Thu, 18 May 2017 10:50:11 -0300 Subject: [media] atomisp: use logical AND, not bitwise Fixes sparse warning "dubious: x & !y" in logical expression. Signed-off-by: Guru Das Srinagesh Signed-off-by: Greg Kroah-Hartman Signed-off-by: Mauro Carvalho Chehab --- .../media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c index a8b93a756e41..ae0b229c9fb8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c @@ -1658,7 +1658,7 @@ ia_css_binary_find(struct ia_css_binary_descr *descr, candidate->internal.max_height); continue; } - if (!candidate->enable.ds && need_ds & !(xcandidate->num_output_pins > 1)) { + if (!candidate->enable.ds && need_ds && !(xcandidate->num_output_pins > 1)) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_binary_find() [%d] continue: !%d && %d\n", __LINE__, candidate->enable.ds, (int)need_ds); -- cgit v1.2.3-55-g7522 From cc6a612ab8ee00f80f3f0ca44caa37659565f0e8 Mon Sep 17 00:00:00 2001 From: Fabrizio Perria Date: Thu, 18 May 2017 10:50:12 -0300 Subject: [media] atomisp: Fix unnecessary initialization of static Fix checkpatch warning: removed unnecessary initialization of static variable "skip_fwload" to 0 in source atomisp_v4l2.c Signed-off-by: Fabrizio Perria Signed-off-by: Greg Kroah-Hartman Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c index e3fdbdba0b34..a0478077a012 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c @@ -51,7 +51,7 @@ /* G-Min addition: pull this in from intel_mid_pm.h */ #define CSTATE_EXIT_LATENCY_C1 1 -static uint skip_fwload = 0; +static uint skip_fwload; module_param(skip_fwload, uint, 0644); MODULE_PARM_DESC(skip_fwload, "Skip atomisp firmware load"); -- cgit v1.2.3-55-g7522 From c6cfe6edd67e9f0ab9f2307a27c93f15ea3844f6 Mon Sep 17 00:00:00 2001 From: Avraham Shukron Date: Fri, 19 May 2017 06:25:46 -0300 Subject: [media] atomisp: fixed sparse warnings Added "static" storage class to 4 not-declared functions Signed-off-by: Avraham Shukron Signed-off-by: Greg Kroah-Hartman --- .../media/atomisp/platform/intel-mid/atomisp_gmin_platform.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c index 5b4506a71126..15409e96449d 100644 --- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c @@ -436,7 +436,7 @@ static int gmin_gpio1_ctrl(struct v4l2_subdev *subdev, int on) return -EINVAL; } -int gmin_v1p2_ctrl(struct v4l2_subdev *subdev, int on) +static int gmin_v1p2_ctrl(struct v4l2_subdev *subdev, int on) { struct gmin_subdev *gs = find_gmin_subdev(subdev); @@ -455,7 +455,8 @@ int gmin_v1p2_ctrl(struct v4l2_subdev *subdev, int on) return -EINVAL; } -int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on) + +static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on) { struct gmin_subdev *gs = find_gmin_subdev(subdev); int ret; @@ -491,7 +492,7 @@ int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on) return -EINVAL; } -int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on) +static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on) { struct gmin_subdev *gs = find_gmin_subdev(subdev); int ret; @@ -527,7 +528,7 @@ int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on) return -EINVAL; } -int gmin_flisclk_ctrl(struct v4l2_subdev *subdev, int on) +static int gmin_flisclk_ctrl(struct v4l2_subdev *subdev, int on) { int ret = 0; struct gmin_subdev *gs = find_gmin_subdev(subdev); -- cgit v1.2.3-55-g7522 From 76d041f276abd29bb7b29b1d847acec36249c9ab Mon Sep 17 00:00:00 2001 From: Valentin Vidic Date: Thu, 18 May 2017 10:50:14 -0300 Subject: [media] atomisp: drop unused qos variable Fixes a sparse warning: drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c:35:5: warning: symbol 'qos' was not declared. Should it be static? Signed-off-by: Valentin Vidic Signed-off-by: Greg Kroah-Hartman Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c index a6c0f5f8c3f8..b01463361943 100644 --- a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c +++ b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c @@ -32,7 +32,6 @@ static DEFINE_SPINLOCK(msgbus_lock); static struct pci_dev *pci_root; static struct pm_qos_request pm_qos; -int qos; #define DW_I2C_NEED_QOS (platform_is(INTEL_ATOM_BYT)) -- cgit v1.2.3-55-g7522 From b739d0247a3213520a07e8dedaa191ef10880a15 Mon Sep 17 00:00:00 2001 From: Avraham Shukron Date: Thu, 18 May 2017 10:50:15 -0300 Subject: [media] atomisp: fixed coding style errors Fix for error (not warnings) reported by checkpatch.pl Specifically: - missing whitespace around "=" and after "," - indentation with spaces instead of tabs - lines starting with a whitespace This patch does not affect the compiled code in any way. Signed-off-by: Avraham Shukron Signed-off-by: Greg Kroah-Hartman Signed-off-by: Mauro Carvalho Chehab --- .../platform/intel-mid/atomisp_gmin_platform.c | 156 ++++++++++----------- .../platform/intel-mid/intel_mid_pcihelpers.c | 2 +- 2 files changed, 79 insertions(+), 79 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c index 15409e96449d..2a819ac6f9e2 100644 --- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c @@ -51,7 +51,7 @@ struct gmin_subdev { static struct gmin_subdev gmin_subdevs[MAX_SUBDEVS]; -static enum { PMIC_UNSET = 0, PMIC_REGULATOR, PMIC_AXP, PMIC_TI , +static enum { PMIC_UNSET = 0, PMIC_REGULATOR, PMIC_AXP, PMIC_TI, PMIC_CRYSTALCOVE } pmic_id; /* The atomisp uses type==0 for the end-of-list marker, so leave space. */ @@ -152,13 +152,13 @@ const struct camera_af_platform_data *camera_get_af_platform_data(void) EXPORT_SYMBOL_GPL(camera_get_af_platform_data); int atomisp_register_i2c_module(struct v4l2_subdev *subdev, - struct camera_sensor_platform_data *plat_data, - enum intel_v4l2_subdev_type type) + struct camera_sensor_platform_data *plat_data, + enum intel_v4l2_subdev_type type) { int i; struct i2c_board_info *bi; struct gmin_subdev *gs; - struct i2c_client *client = v4l2_get_subdevdata(subdev); + struct i2c_client *client = v4l2_get_subdevdata(subdev); struct acpi_device *adev; dev_info(&client->dev, "register atomisp i2c module type %d\n", type); @@ -172,7 +172,7 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev, if (adev) adev->power.flags.power_resources = 0; - for (i=0; i < MAX_SUBDEVS; i++) + for (i = 0; i < MAX_SUBDEVS; i++) if (!pdata.subdevs[i].type) break; @@ -206,7 +206,7 @@ struct v4l2_subdev *atomisp_gmin_find_subdev(struct i2c_adapter *adapter, struct i2c_board_info *board_info) { int i; - for (i=0; i < MAX_SUBDEVS && pdata.subdevs[i].type; i++) { + for (i = 0; i < MAX_SUBDEVS && pdata.subdevs[i].type; i++) { struct intel_v4l2_subdev_table *sd = &pdata.subdevs[i]; if (sd->v4l2_subdev.i2c_adapter_id == adapter->nr && sd->v4l2_subdev.board_info.addr == board_info->addr) @@ -270,45 +270,45 @@ static const struct gmin_cfg_var t100_vars[] = { }; static const struct gmin_cfg_var mrd7_vars[] = { - {"INT33F8:00_CamType", "1"}, - {"INT33F8:00_CsiPort", "1"}, - {"INT33F8:00_CsiLanes","2"}, - {"INT33F8:00_CsiFmt","13"}, - {"INT33F8:00_CsiBayer", "0"}, - {"INT33F8:00_CamClk", "0"}, - {"INT33F9:00_CamType", "1"}, - {"INT33F9:00_CsiPort", "0"}, - {"INT33F9:00_CsiLanes","1"}, - {"INT33F9:00_CsiFmt","13"}, - {"INT33F9:00_CsiBayer", "0"}, - {"INT33F9:00_CamClk", "1"}, - {}, + {"INT33F8:00_CamType", "1"}, + {"INT33F8:00_CsiPort", "1"}, + {"INT33F8:00_CsiLanes", "2"}, + {"INT33F8:00_CsiFmt", "13"}, + {"INT33F8:00_CsiBayer", "0"}, + {"INT33F8:00_CamClk", "0"}, + {"INT33F9:00_CamType", "1"}, + {"INT33F9:00_CsiPort", "0"}, + {"INT33F9:00_CsiLanes", "1"}, + {"INT33F9:00_CsiFmt", "13"}, + {"INT33F9:00_CsiBayer", "0"}, + {"INT33F9:00_CamClk", "1"}, + {}, }; static const struct gmin_cfg_var ecs7_vars[] = { - {"INT33BE:00_CsiPort", "1"}, - {"INT33BE:00_CsiLanes","2"}, - {"INT33BE:00_CsiFmt","13"}, - {"INT33BE:00_CsiBayer", "2"}, - {"INT33BE:00_CamClk", "0"}, - {"INT33F0:00_CsiPort", "0"}, - {"INT33F0:00_CsiLanes","1"}, - {"INT33F0:00_CsiFmt","13"}, - {"INT33F0:00_CsiBayer", "0"}, - {"INT33F0:00_CamClk", "1"}, - {"gmin_V2P8GPIO","402"}, - {}, + {"INT33BE:00_CsiPort", "1"}, + {"INT33BE:00_CsiLanes", "2"}, + {"INT33BE:00_CsiFmt", "13"}, + {"INT33BE:00_CsiBayer", "2"}, + {"INT33BE:00_CamClk", "0"}, + {"INT33F0:00_CsiPort", "0"}, + {"INT33F0:00_CsiLanes", "1"}, + {"INT33F0:00_CsiFmt", "13"}, + {"INT33F0:00_CsiBayer", "0"}, + {"INT33F0:00_CamClk", "1"}, + {"gmin_V2P8GPIO", "402"}, + {}, }; static const struct gmin_cfg_var i8880_vars[] = { - {"XXOV2680:00_CsiPort", "1"}, - {"XXOV2680:00_CsiLanes","1"}, - {"XXOV2680:00_CamClk","0"}, - {"XXGC0310:00_CsiPort", "0"}, - {"XXGC0310:00_CsiLanes", "1"}, - {"XXGC0310:00_CamClk", "1"}, - {}, + {"XXOV2680:00_CsiPort", "1"}, + {"XXOV2680:00_CsiLanes", "1"}, + {"XXOV2680:00_CamClk", "0"}, + {"XXGC0310:00_CsiPort", "0"}, + {"XXGC0310:00_CsiLanes", "1"}, + {"XXGC0310:00_CamClk", "1"}, + {}, }; static const struct { @@ -317,9 +317,9 @@ static const struct { } hard_vars[] = { { "BYT-T FFD8", ffrd8_vars }, { "T100TA", t100_vars }, - { "MRD7", mrd7_vars }, - { "ST70408", ecs7_vars }, - { "VTA0803", i8880_vars }, + { "MRD7", mrd7_vars }, + { "ST70408", ecs7_vars }, + { "VTA0803", i8880_vars }, }; @@ -343,7 +343,7 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev) { int i, ret; struct device *dev; - struct i2c_client *client = v4l2_get_subdevdata(subdev); + struct i2c_client *client = v4l2_get_subdevdata(subdev); if (!pmic_id) { @@ -355,7 +355,7 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev) dev = &client->dev; - for (i=0; i < MAX_SUBDEVS && gmin_subdevs[i].subdev; i++) + for (i = 0; i < MAX_SUBDEVS && gmin_subdevs[i].subdev; i++) ; if (i >= MAX_SUBDEVS) return NULL; @@ -410,7 +410,7 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev) static struct gmin_subdev *find_gmin_subdev(struct v4l2_subdev *subdev) { int i; - for (i=0; i < MAX_SUBDEVS; i++) + for (i = 0; i < MAX_SUBDEVS; i++) if (gmin_subdevs[i].subdev == subdev) return &gmin_subdevs[i]; return gmin_subdev_add(subdev); @@ -482,7 +482,7 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on) gpio_set_value(v1p8_gpio, on); if (gs->v1p8_reg) { - regulator_set_voltage(gs->v1p8_reg, 1800000, 1800000); + regulator_set_voltage(gs->v1p8_reg, 1800000, 1800000); if (on) return regulator_enable(gs->v1p8_reg); else @@ -518,7 +518,7 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on) gpio_set_value(v2p8_gpio, on); if (gs->v2p8_reg) { - regulator_set_voltage(gs->v2p8_reg, 2900000, 2900000); + regulator_set_voltage(gs->v2p8_reg, 2900000, 2900000); if (on) return regulator_enable(gs->v2p8_reg); else @@ -628,13 +628,13 @@ int gmin_get_config_var(struct device *dev, const char *var, char *out, size_t * int i, j, ret; unsigned long efilen; - if (dev && ACPI_COMPANION(dev)) - dev = &ACPI_COMPANION(dev)->dev; + if (dev && ACPI_COMPANION(dev)) + dev = &ACPI_COMPANION(dev)->dev; - if (dev) - ret = snprintf(var8, sizeof(var8), "%s_%s", dev_name(dev), var); - else - ret = snprintf(var8, sizeof(var8), "gmin_%s", var); + if (dev) + ret = snprintf(var8, sizeof(var8), "%s_%s", dev_name(dev), var); + else + ret = snprintf(var8, sizeof(var8), "gmin_%s", var); if (ret < 0 || ret >= sizeof(var8) - 1) return -EINVAL; @@ -693,7 +693,7 @@ int gmin_get_config_var(struct device *dev, const char *var, char *out, size_t * *out_len = efilen; if (ret) - dev_warn(dev, "Failed to find gmin variable %s\n", var8); + dev_warn(dev, "Failed to find gmin variable %s\n", var8); return ret; } @@ -719,31 +719,31 @@ EXPORT_SYMBOL_GPL(gmin_get_var_int); int camera_sensor_csi(struct v4l2_subdev *sd, u32 port, u32 lanes, u32 format, u32 bayer_order, int flag) { - struct i2c_client *client = v4l2_get_subdevdata(sd); - struct camera_mipi_info *csi = NULL; - - if (flag) { - csi = kzalloc(sizeof(*csi), GFP_KERNEL); - if (!csi) { - dev_err(&client->dev, "out of memory\n"); - return -ENOMEM; - } - csi->port = port; - csi->num_lanes = lanes; - csi->input_format = format; - csi->raw_bayer_order = bayer_order; - v4l2_set_subdev_hostdata(sd, (void *)csi); - csi->metadata_format = ATOMISP_INPUT_FORMAT_EMBEDDED; - csi->metadata_effective_width = NULL; - dev_info(&client->dev, - "camera pdata: port: %d lanes: %d order: %8.8x\n", - port, lanes, bayer_order); - } else { - csi = v4l2_get_subdev_hostdata(sd); - kfree(csi); - } - - return 0; + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct camera_mipi_info *csi = NULL; + + if (flag) { + csi = kzalloc(sizeof(*csi), GFP_KERNEL); + if (!csi) { + dev_err(&client->dev, "out of memory\n"); + return -ENOMEM; + } + csi->port = port; + csi->num_lanes = lanes; + csi->input_format = format; + csi->raw_bayer_order = bayer_order; + v4l2_set_subdev_hostdata(sd, (void *)csi); + csi->metadata_format = ATOMISP_INPUT_FORMAT_EMBEDDED; + csi->metadata_effective_width = NULL; + dev_info(&client->dev, + "camera pdata: port: %d lanes: %d order: %8.8x\n", + port, lanes, bayer_order); + } else { + csi = v4l2_get_subdev_hostdata(sd); + kfree(csi); + } + + return 0; } EXPORT_SYMBOL_GPL(camera_sensor_csi); diff --git a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c index b01463361943..c9eea71ece2c 100644 --- a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c +++ b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c @@ -22,7 +22,7 @@ #endif static inline int platform_is(u8 model) { - return (boot_cpu_data.x86_model == model); + return (boot_cpu_data.x86_model == model); } #include "../../include/asm/intel_mid_pcihelpers.h" -- cgit v1.2.3-55-g7522 From 8c7e9a738155b8c6c0bc3662d8f5a264106c712c Mon Sep 17 00:00:00 2001 From: Avraham Shukron Date: Thu, 18 May 2017 10:50:16 -0300 Subject: [media] atomisp: fix coding style warnings Fix for warnings reported by checkpatch.pl: - Multiline comment style - Bare "unsigned" - Missing blank line after declarations - Un-needed braces around single-statement branch Signed-off-by: Avraham Shukron Signed-off-by: Greg Kroah-Hartman Signed-off-by: Mauro Carvalho Chehab --- .../platform/intel-mid/atomisp_gmin_platform.c | 45 ++++++++++++++-------- .../platform/intel-mid/intel_mid_pcihelpers.c | 9 +++-- 2 files changed, 35 insertions(+), 19 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c index 2a819ac6f9e2..d68e9cf33aa7 100644 --- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c @@ -119,7 +119,7 @@ static int af_power_ctrl(struct v4l2_subdev *subdev, int flag) /* * The power here is used for dw9817, * regulator is from rear sensor - */ + */ if (gs->v2p8_vcm_reg) { if (flag) return regulator_enable(gs->v2p8_vcm_reg); @@ -167,7 +167,8 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev, * uses ACPI runtime power management for camera devices, but * we don't. Disable it, or else the rails will be needlessly * tickled during suspend/resume. This has caused power and - * performance issues on multiple devices. */ + * performance issues on multiple devices. + */ adev = ACPI_COMPANION(&client->dev); if (adev) adev->power.flags.power_resources = 0; @@ -182,7 +183,8 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev, /* Note subtlety of initialization order: at the point where * this registration API gets called, the platform data * callbacks have probably already been invoked, so the - * gmin_subdev struct is already initialized for us. */ + * gmin_subdev struct is already initialized for us. + */ gs = find_gmin_subdev(subdev); pdata.subdevs[i].type = type; @@ -206,8 +208,10 @@ struct v4l2_subdev *atomisp_gmin_find_subdev(struct i2c_adapter *adapter, struct i2c_board_info *board_info) { int i; + for (i = 0; i < MAX_SUBDEVS && pdata.subdevs[i].type; i++) { struct intel_v4l2_subdev_table *sd = &pdata.subdevs[i]; + if (sd->v4l2_subdev.i2c_adapter_id == adapter->nr && sd->v4l2_subdev.board_info.addr == board_info->addr) return sd->subdev; @@ -261,7 +265,8 @@ static const struct gmin_cfg_var ffrd8_vars[] = { }; /* Cribbed from MCG defaults in the mt9m114 driver, not actually verified - * vs. T100 hardware */ + * vs. T100 hardware + */ static const struct gmin_cfg_var t100_vars[] = { { "INT33F0:00_CsiPort", "0" }, { "INT33F0:00_CsiLanes", "1" }, @@ -345,10 +350,8 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev) struct device *dev; struct i2c_client *client = v4l2_get_subdevdata(subdev); - if (!pmic_id) { - - pmic_id = PMIC_REGULATOR; - } + if (!pmic_id) + pmic_id = PMIC_REGULATOR; if (!client) return NULL; @@ -401,7 +404,8 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev) * API is broken with the current drivers, returning * "1" for a regulator that will then emit a * "unbalanced disable" WARNing if we try to disable - * it. */ + * it. + */ } return &gmin_subdevs[i]; @@ -410,6 +414,7 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev) static struct gmin_subdev *find_gmin_subdev(struct v4l2_subdev *subdev) { int i; + for (i = 0; i < MAX_SUBDEVS; i++) if (gmin_subdevs[i].subdev == subdev) return &gmin_subdevs[i]; @@ -419,6 +424,7 @@ static struct gmin_subdev *find_gmin_subdev(struct v4l2_subdev *subdev) static int gmin_gpio0_ctrl(struct v4l2_subdev *subdev, int on) { struct gmin_subdev *gs = find_gmin_subdev(subdev); + if (gs && gs->gpio0) { gpiod_set_value(gs->gpio0, on); return 0; @@ -429,6 +435,7 @@ static int gmin_gpio0_ctrl(struct v4l2_subdev *subdev, int on) static int gmin_gpio1_ctrl(struct v4l2_subdev *subdev, int on) { struct gmin_subdev *gs = find_gmin_subdev(subdev); + if (gs && gs->gpio1) { gpiod_set_value(gs->gpio1, on); return 0; @@ -532,6 +539,7 @@ static int gmin_flisclk_ctrl(struct v4l2_subdev *subdev, int on) { int ret = 0; struct gmin_subdev *gs = find_gmin_subdev(subdev); + if (on) ret = vlv2_plat_set_clock_freq(gs->clock_num, gs->clock_src); if (ret) @@ -596,6 +604,7 @@ struct camera_sensor_platform_data *gmin_camera_platform_data( enum atomisp_bayer_order csi_bayer) { struct gmin_subdev *gs = find_gmin_subdev(subdev); + gs->csi_fmt = csi_format; gs->csi_bayer = csi_bayer; @@ -618,8 +627,10 @@ EXPORT_SYMBOL_GPL(atomisp_gmin_register_vcm_control); /* Retrieves a device-specific configuration variable. The dev * argument should be a device with an ACPI companion, as all - * configuration is based on firmware ID. */ -int gmin_get_config_var(struct device *dev, const char *var, char *out, size_t *out_len) + * configuration is based on firmware ID. + */ +int gmin_get_config_var(struct device *dev, const char *var, char *out, + size_t *out_len) { char var8[CFG_VAR_NAME_MAX]; efi_char16_t var16[CFG_VAR_NAME_MAX]; @@ -641,7 +652,8 @@ int gmin_get_config_var(struct device *dev, const char *var, char *out, size_t * /* First check a hard-coded list of board-specific variables. * Some device firmwares lack the ability to set EFI variables at - * runtime. */ + * runtime. + */ for (i = 0; i < ARRAY_SIZE(hard_vars); i++) { if (dmi_match(DMI_BOARD_NAME, hard_vars[i].dmi_board_name)) { for (j = 0; hard_vars[i].vars[j].name; j++) { @@ -666,7 +678,8 @@ int gmin_get_config_var(struct device *dev, const char *var, char *out, size_t * } /* Our variable names are ASCII by construction, but EFI names - * are wide chars. Convert and zero-pad. */ + * are wide chars. Convert and zero-pad. + */ memset(var16, 0, sizeof(var16)); for (i = 0; i < sizeof(var8) && var8[i]; i++) var16[i] = var8[i]; @@ -679,7 +692,8 @@ int gmin_get_config_var(struct device *dev, const char *var, char *out, size_t * * implementation simply uses VariableName and VendorGuid from * the struct and ignores the rest, but it seems like there * ought to be an "official" efivar_entry registered - * somewhere? */ + * somewhere? + */ ev = kzalloc(sizeof(*ev), GFP_KERNEL); if (!ev) return -ENOMEM; @@ -750,7 +764,8 @@ EXPORT_SYMBOL_GPL(camera_sensor_csi); /* PCI quirk: The BYT ISP advertises PCI runtime PM but it doesn't * work. Disable so the kernel framework doesn't hang the device * trying. The driver itself does direct calls to the PUNIT to manage - * ISP power. */ + * ISP power. + */ static void isp_pm_cap_fixup(struct pci_dev *dev) { dev_info(&dev->dev, "Disabling PCI power management on camera ISP\n"); diff --git a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c index c9eea71ece2c..cd452cc20fea 100644 --- a/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c +++ b/drivers/staging/media/atomisp/platform/intel-mid/intel_mid_pcihelpers.c @@ -5,7 +5,8 @@ /* G-Min addition: "platform_is()" lives in intel_mid_pm.h in the MCG * tree, but it's just platform ID info and we don't want to pull in - * the whole SFI-based PM architecture. */ + * the whole SFI-based PM architecture. + */ #define INTEL_ATOM_MRST 0x26 #define INTEL_ATOM_MFLD 0x27 #define INTEL_ATOM_CLV 0x35 @@ -135,8 +136,8 @@ u32 intel_mid_msgbus_read32(u8 port, u32 addr) return data; } - EXPORT_SYMBOL(intel_mid_msgbus_read32); + void intel_mid_msgbus_write32(u8 port, u32 addr, u32 data) { unsigned long irq_flags; @@ -170,8 +171,8 @@ EXPORT_SYMBOL(intel_mid_soc_stepping); static bool is_south_complex_device(struct pci_dev *dev) { - unsigned base_class = dev->class >> 16; - unsigned sub_class = (dev->class & SUB_CLASS_MASK) >> 8; + unsigned int base_class = dev->class >> 16; + unsigned int sub_class = (dev->class & SUB_CLASS_MASK) >> 8; /* other than camera, pci bridges and display, * everything else are south complex devices. -- cgit v1.2.3-55-g7522 From c2c611b7b4f6cccbaea47e6b4a6853a129ddd1f8 Mon Sep 17 00:00:00 2001 From: Guru Das Srinagesh Date: Thu, 18 May 2017 10:50:17 -0300 Subject: [media] atomisp: Make undeclared symbols static Fix sparse warnings: "symbol not declared; should it be static?" Signed-off-by: Guru Das Srinagesh Signed-off-by: Greg Kroah-Hartman Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c index 7ce8803cf6f9..c151c848cf8f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c @@ -130,9 +130,9 @@ static int atomisp_q_one_metadata_buffer(struct atomisp_sub_device *asd, return 0; } -int atomisp_q_one_s3a_buffer(struct atomisp_sub_device *asd, - enum atomisp_input_stream_id stream_id, - enum atomisp_css_pipe_id css_pipe_id) +static int atomisp_q_one_s3a_buffer(struct atomisp_sub_device *asd, + enum atomisp_input_stream_id stream_id, + enum atomisp_css_pipe_id css_pipe_id) { struct atomisp_s3a_buf *s3a_buf; struct list_head *s3a_list; @@ -172,9 +172,9 @@ int atomisp_q_one_s3a_buffer(struct atomisp_sub_device *asd, return 0; } -int atomisp_q_one_dis_buffer(struct atomisp_sub_device *asd, - enum atomisp_input_stream_id stream_id, - enum atomisp_css_pipe_id css_pipe_id) +static int atomisp_q_one_dis_buffer(struct atomisp_sub_device *asd, + enum atomisp_input_stream_id stream_id, + enum atomisp_css_pipe_id css_pipe_id) { struct atomisp_dis_buf *dis_buf; unsigned long irqflags; @@ -744,7 +744,7 @@ static void atomisp_subdev_init_struct(struct atomisp_sub_device *asd) /* * file operation functions */ -unsigned int atomisp_subdev_users(struct atomisp_sub_device *asd) +static unsigned int atomisp_subdev_users(struct atomisp_sub_device *asd) { return asd->video_out_preview.users + asd->video_out_vf.users + -- cgit v1.2.3-55-g7522 From 02d978318b0983e7af6bbc9c1f9861b0d6983e37 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 18 May 2017 10:50:18 -0300 Subject: [media] atomisp: Fix -Werror=int-in-bool-context compile errors With gcc-7.1.1 I was getting the following compile error: error: ‘*’ in boolean context, suggest ‘&&’ instead The problem is the definition of CEIL_DIV: #define CEIL_DIV(a, b) ((b) ? ((a) + (b) - 1) / (b) : 0) Which when called as: CEIL_DIV(x, y * z) triggers this error, note we cannot do as the error suggests since b is evaluated multiple times. This commit fixes these compile errors. Signed-off-by: Hans de Goede Signed-off-by: Greg Kroah-Hartman Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c | 1 - .../pci/atomisp2/css2400/hive_isp_css_include/math_support.h | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c index b830b241e2e6..ad2c610d2ce3 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c @@ -2506,7 +2506,6 @@ static void __configure_capture_pp_input(struct atomisp_sub_device *asd, struct ia_css_pipe_extra_config *pipe_extra_configs = &stream_env->pipe_extra_configs[pipe_id]; unsigned int hor_ds_factor = 0, ver_ds_factor = 0; -#define CEIL_DIV(a, b) ((b) ? ((a) + (b) - 1) / (b) : 0) if (width == 0 && height == 0) return; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/math_support.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/math_support.h index 48d84bc0ad9e..f74b405b0f39 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/math_support.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/math_support.h @@ -62,15 +62,15 @@ #define MAX(a, b) (((a) > (b)) ? (a) : (b)) #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #ifdef ISP2401 -#define ROUND_DIV(a, b) ((b) ? ((a) + ((b) >> 1)) / (b) : 0) +#define ROUND_DIV(a, b) (((b) != 0) ? ((a) + ((b) >> 1)) / (b) : 0) #endif -#define CEIL_DIV(a, b) ((b) ? ((a) + (b) - 1) / (b) : 0) +#define CEIL_DIV(a, b) (((b) != 0) ? ((a) + (b) - 1) / (b) : 0) #define CEIL_MUL(a, b) (CEIL_DIV(a, b) * (b)) #define CEIL_MUL2(a, b) (((a) + (b) - 1) & ~((b) - 1)) #define CEIL_SHIFT(a, b) (((a) + (1 << (b)) - 1)>>(b)) #define CEIL_SHIFT_MUL(a, b) (CEIL_SHIFT(a, b) << (b)) #ifdef ISP2401 -#define ROUND_HALF_DOWN_DIV(a, b) ((b) ? ((a) + (b / 2) - 1) / (b) : 0) +#define ROUND_HALF_DOWN_DIV(a, b) (((b) != 0) ? ((a) + (b / 2) - 1) / (b) : 0) #define ROUND_HALF_DOWN_MUL(a, b) (ROUND_HALF_DOWN_DIV(a, b) * (b)) #endif -- cgit v1.2.3-55-g7522 From d1fec5bdeb18ff98fbe317a9454bcd1fe8da1bee Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 18 May 2017 10:50:19 -0300 Subject: [media] atomisp: one char read beyond end of string We should verify that "ix < max_len" before we test whether we have reached the NUL terminator. Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2") Reported-by: David Binderman Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman Signed-off-by: Mauro Carvalho Chehab --- .../pci/atomisp2/css2400/hive_isp_css_include/string_support.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h index 568631698a3d..74b5a1c7ac9a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h @@ -72,9 +72,8 @@ static size_t strnlen_s( return 0; } - for (ix=0; - ((src_str[ix] != '\0') && (ix< max_len)); - ++ix) /*Nothing else to do*/; + for (ix = 0; ix < max_len && src_str[ix] != '\0'; ix++) + ; /* On Error, it will return src_size == max_len*/ return ix; -- cgit v1.2.3-55-g7522 From c32e3d1b490e89c592d0c59f10fd267c4847cbaf Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 18 May 2017 10:50:20 -0300 Subject: [media] atomisp: putting NULs in the wrong place We're putting the NUL terminators one space beyond where they belong. This doesn't show up in testing because all but the callers put a NUL in the correct place themselves. LOL. It causes a static checker warning about buffer overflows. Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2") Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman Signed-off-by: Mauro Carvalho Chehab --- .../pci/atomisp2/css2400/hive_isp_css_include/string_support.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h index 74b5a1c7ac9a..c53241a7a281 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h @@ -117,7 +117,7 @@ STORAGE_CLASS_INLINE int strncpy_s( /* dest_str is big enough for the len */ strncpy(dest_str, src_str, len); - dest_str[len+1] = '\0'; + dest_str[len] = '\0'; return 0; } @@ -157,7 +157,7 @@ STORAGE_CLASS_INLINE int strcpy_s( /* dest_str is big enough for the len */ strncpy(dest_str, src_str, len); - dest_str[len+1] = '\0'; + dest_str[len] = '\0'; return 0; } -- cgit v1.2.3-55-g7522 From 54221e7248a66e1748f4bc93790042294bb6914b Mon Sep 17 00:00:00 2001 From: Manny Vindiola Date: Thu, 18 May 2017 10:50:21 -0300 Subject: [media] atomisp: fix missing blank line coding style issue in atomisp_tpg.c This is a patch to the atomisp_tpg.c file that fixes up a missing blank line warning found by the checkpatch.pl tool Signed-off-by: Manny Vindiola Signed-off-by: Greg Kroah-Hartman Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.c index 996d1bdebad4..48b96048cab4 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.c @@ -56,6 +56,7 @@ static int tpg_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_format *format) { struct v4l2_mbus_framefmt *fmt = &format->format; + if (format->pad) return -EINVAL; /* only raw8 grbg is supported by TPG */ -- cgit v1.2.3-55-g7522 From 4c9ef4f150589478ac0b26bc7db1216c0af207fb Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 May 2017 07:34:04 -0300 Subject: [media] atomisp: disable several warnings when W=1 The atomisp currently produce hundreds of warnings when W=1. It is a known fact that this driver is currently in bad shape, and there are lot of things to be done here. We don't want to be bothered by those "minor" stuff for now, while the driver doesn't receive a major cleanup. So, disable those warnings. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/i2c/Makefile | 4 ++++ drivers/staging/media/atomisp/i2c/imx/Makefile | 5 +++++ drivers/staging/media/atomisp/i2c/ov5693/Makefile | 5 +++++ drivers/staging/media/atomisp/pci/atomisp2/Makefile | 6 ++++++ 4 files changed, 20 insertions(+) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/i2c/Makefile b/drivers/staging/media/atomisp/i2c/Makefile index 466517c7c8e6..a1afca6ec31f 100644 --- a/drivers/staging/media/atomisp/i2c/Makefile +++ b/drivers/staging/media/atomisp/i2c/Makefile @@ -19,3 +19,7 @@ obj-$(CONFIG_VIDEO_AP1302) += ap1302.o obj-$(CONFIG_VIDEO_LM3554) += lm3554.o +# HACK! While this driver is in bad shape, don't enable several warnings +# that would be otherwise enabled with W=1 +ccflags-y += -Wno-unused-but-set-variable -Wno-missing-prototypes \ + -Wno-unused-const-variable -Wno-missing-declarations diff --git a/drivers/staging/media/atomisp/i2c/imx/Makefile b/drivers/staging/media/atomisp/i2c/imx/Makefile index 6b13a3a66e49..0eceb7374bec 100644 --- a/drivers/staging/media/atomisp/i2c/imx/Makefile +++ b/drivers/staging/media/atomisp/i2c/imx/Makefile @@ -4,3 +4,8 @@ imx1x5-objs := imx.o drv201.o ad5816g.o dw9714.o dw9719.o dw9718.o vcm.o otp.o o ov8858_driver-objs := ../ov8858.o dw9718.o vcm.o obj-$(CONFIG_VIDEO_OV8858) += ov8858_driver.o + +# HACK! While this driver is in bad shape, don't enable several warnings +# that would be otherwise enabled with W=1 +ccflags-y += -Wno-unused-but-set-variable -Wno-missing-prototypes \ + -Wno-unused-const-variable -Wno-missing-declarations diff --git a/drivers/staging/media/atomisp/i2c/ov5693/Makefile b/drivers/staging/media/atomisp/i2c/ov5693/Makefile index c9c0e1245858..fd2ef2e3c31e 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/Makefile +++ b/drivers/staging/media/atomisp/i2c/ov5693/Makefile @@ -1 +1,6 @@ obj-$(CONFIG_VIDEO_OV5693) += ov5693.o + +# HACK! While this driver is in bad shape, don't enable several warnings +# that would be otherwise enabled with W=1 +ccflags-y += -Wno-unused-but-set-variable -Wno-missing-prototypes \ + -Wno-unused-const-variable -Wno-missing-declarations diff --git a/drivers/staging/media/atomisp/pci/atomisp2/Makefile b/drivers/staging/media/atomisp/pci/atomisp2/Makefile index f126a89a08e9..68a9ab1c3b61 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/Makefile +++ b/drivers/staging/media/atomisp/pci/atomisp2/Makefile @@ -353,3 +353,9 @@ DEFINES += -DSYSTEM_hive_isp_css_2400_system -DISP2400 ccflags-y += $(INCLUDES) $(DEFINES) -fno-common +# HACK! While this driver is in bad shape, don't enable several warnings +# that would be otherwise enabled with W=1 +ccflags-y += -Wno-unused-const-variable -Wno-missing-prototypes \ + -Wno-unused-but-set-variable -Wno-missing-declarations \ + -Wno-suggest-attribute=format -Wno-missing-prototypes \ + -Wno-implicit-fallthrough -- cgit v1.2.3-55-g7522 From 52e809f9fe3e4922e1cb539079ad1b262e163a3b Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Mon, 1 May 2017 13:03:41 -0300 Subject: [media] lirc_dev: remove pointless functions drv->set_use_inc and drv->set_use_dec are already optional so we can remove all dummy functions. Signed-off-by: David Härdeman Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/ir-lirc-codec.c | 14 ++------------ drivers/staging/media/lirc/lirc_zilog.c | 11 ----------- 2 files changed, 2 insertions(+), 23 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index 8f0669c9894c..fc58745b26b8 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c @@ -327,16 +327,6 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, return ret; } -static int ir_lirc_open(void *data) -{ - return 0; -} - -static void ir_lirc_close(void *data) -{ - return; -} - static const struct file_operations lirc_fops = { .owner = THIS_MODULE, .write = ir_lirc_transmit_ir, @@ -396,8 +386,8 @@ static int ir_lirc_register(struct rc_dev *dev) drv->features = features; drv->data = &dev->raw->lirc; drv->rbuf = NULL; - drv->set_use_inc = &ir_lirc_open; - drv->set_use_dec = &ir_lirc_close; + drv->set_use_inc = NULL; + drv->set_use_dec = NULL; drv->code_length = sizeof(struct ir_raw_event) * 8; drv->chunk_size = sizeof(int); drv->buffer_size = LIRCBUF_SIZE; diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index 8ce1db04414a..123933f1b9b0 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -497,15 +497,6 @@ static int lirc_thread(void *arg) return 0; } -static int set_use_inc(void *data) -{ - return 0; -} - -static void set_use_dec(void *data) -{ -} - /* safe read of a uint32 (always network byte order) */ static int read_uint32(unsigned char **data, unsigned char *endp, unsigned int *val) @@ -1396,8 +1387,6 @@ static struct lirc_driver lirc_template = { .buffer_size = BUFLEN / 2, .sample_rate = 0, /* tell lirc_dev to not start its own kthread */ .chunk_size = 2, - .set_use_inc = set_use_inc, - .set_use_dec = set_use_dec, .fops = &lirc_fops, .owner = THIS_MODULE, }; -- cgit v1.2.3-55-g7522 From c3104e1b42744156c414003043587d128de2b91f Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Mon, 1 May 2017 13:03:56 -0300 Subject: [media] lirc_dev: remove sampling kthread There are no drivers which use this functionality. Signed-off-by: David Härdeman Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/lirc_dev.c | 94 +-------------------------------- drivers/staging/media/lirc/lirc_zilog.c | 1 - include/media/lirc_dev.h | 16 ------ 3 files changed, 2 insertions(+), 109 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index 05f600bd6c67..a613970ce159 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -57,9 +56,6 @@ struct irctl { struct device dev; struct cdev cdev; - - struct task_struct *task; - long jiffies_to_wait; }; static DEFINE_MUTEX(lirc_dev_lock); @@ -95,59 +91,6 @@ static void lirc_release(struct device *ld) kfree(ir); } -/* helper function - * reads key codes from driver and puts them into buffer - * returns 0 on success - */ -static int lirc_add_to_buf(struct irctl *ir) -{ - int res; - int got_data = -1; - - if (!ir->d.add_to_buf) - return 0; - - /* - * service the device as long as it is returning - * data and we have space - */ - do { - got_data++; - res = ir->d.add_to_buf(ir->d.data, ir->buf); - } while (!res); - - if (res == -ENODEV) - kthread_stop(ir->task); - - return got_data ? 0 : res; -} - -/* main function of the polling thread - */ -static int lirc_thread(void *irctl) -{ - struct irctl *ir = irctl; - - do { - if (ir->open) { - if (ir->jiffies_to_wait) { - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(ir->jiffies_to_wait); - } - if (kthread_should_stop()) - break; - if (!lirc_add_to_buf(ir)) - wake_up_interruptible(&ir->buf->wait_poll); - } else { - set_current_state(TASK_INTERRUPTIBLE); - schedule(); - } - } while (!kthread_should_stop()); - - return 0; -} - - static const struct file_operations lirc_dev_fops = { .owner = THIS_MODULE, .read = lirc_dev_fop_read, @@ -252,18 +195,8 @@ static int lirc_allocate_driver(struct lirc_driver *d) return -EBADRQC; } - if (d->sample_rate) { - if (2 > d->sample_rate || HZ < d->sample_rate) { - dev_err(d->dev, "invalid %d sample rate\n", - d->sample_rate); - return -EBADRQC; - } - if (!d->add_to_buf) { - dev_err(d->dev, "add_to_buf not set\n"); - return -EBADRQC; - } - } else if (!d->rbuf && !(d->fops && d->fops->read && - d->fops->poll && d->fops->unlocked_ioctl)) { + if (!d->rbuf && !(d->fops && d->fops->read && + d->fops->poll && d->fops->unlocked_ioctl)) { dev_err(d->dev, "undefined read, poll, ioctl\n"); return -EBADRQC; } @@ -312,22 +245,6 @@ static int lirc_allocate_driver(struct lirc_driver *d) dev_set_name(&ir->dev, "lirc%d", ir->d.minor); device_initialize(&ir->dev); - if (d->sample_rate) { - ir->jiffies_to_wait = HZ / d->sample_rate; - - /* try to fire up polling thread */ - ir->task = kthread_run(lirc_thread, (void *)ir, "lirc_dev"); - if (IS_ERR(ir->task)) { - dev_err(d->dev, "cannot run thread for minor = %d\n", - d->minor); - err = -ECHILD; - goto out_sysfs; - } - } else { - /* it means - wait for external event in task queue */ - ir->jiffies_to_wait = 0; - } - err = lirc_cdev_add(ir); if (err) goto out_sysfs; @@ -404,10 +321,6 @@ int lirc_unregister_driver(int minor) return -ENOENT; } - /* end up polling thread */ - if (ir->task) - kthread_stop(ir->task); - dev_dbg(ir->d.dev, "lirc_dev: driver %s unregistered from minor = %d\n", ir->d.name, ir->d.minor); @@ -470,9 +383,6 @@ int lirc_dev_fop_open(struct inode *inode, struct file *file) if (ir->buf) lirc_buffer_clear(ir->buf); - if (ir->task) - wake_up_process(ir->task); - ir->open++; error: diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index 123933f1b9b0..59f657daf31b 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -1385,7 +1385,6 @@ static struct lirc_driver lirc_template = { .minor = -1, .code_length = 13, .buffer_size = BUFLEN / 2, - .sample_rate = 0, /* tell lirc_dev to not start its own kthread */ .chunk_size = 2, .fops = &lirc_fops, .owner = THIS_MODULE, diff --git a/include/media/lirc_dev.h b/include/media/lirc_dev.h index 71c1c11950fe..01649b009922 100644 --- a/include/media/lirc_dev.h +++ b/include/media/lirc_dev.h @@ -133,12 +133,6 @@ static inline unsigned int lirc_buffer_write(struct lirc_buffer *buf, * @buffer_size: Number of FIFO buffers with @chunk_size size. If zero, * creates a buffer with BUFLEN size (16 bytes). * - * @sample_rate: if zero, the device will wait for an event with a new - * code to be parsed. Otherwise, specifies the sample - * rate for polling. Value should be between 0 - * and HZ. If equal to HZ, it would mean one polling per - * second. - * * @features: lirc compatible hardware features, like LIRC_MODE_RAW, * LIRC_CAN\_\*, as defined at include/media/lirc.h. * @@ -153,14 +147,6 @@ static inline unsigned int lirc_buffer_write(struct lirc_buffer *buf, * @max_timeout: Maximum timeout for record. Valid only if * LIRC_CAN_SET_REC_TIMEOUT is defined. * - * @add_to_buf: add_to_buf will be called after specified period of the - * time or triggered by the external event, this behavior - * depends on value of the sample_rate this function will - * be called in user context. This routine should return - * 0 if data was added to the buffer and -ENODATA if none - * was available. This should add some number of bits - * evenly divisible by code_length to the buffer. - * * @rbuf: if not NULL, it will be used as a read buffer, you will * have to write to the buffer by other means, like irq's * (see also lirc_serial.c). @@ -184,7 +170,6 @@ struct lirc_driver { int minor; __u32 code_length; unsigned int buffer_size; /* in chunks holding one code each */ - int sample_rate; __u32 features; unsigned int chunk_size; @@ -192,7 +177,6 @@ struct lirc_driver { void *data; int min_timeout; int max_timeout; - int (*add_to_buf)(void *data, struct lirc_buffer *buf); struct lirc_buffer *rbuf; struct rc_dev *rdev; const struct file_operations *fops; -- cgit v1.2.3-55-g7522 From bd16168da80dde6cfc6b7f89959206b74409cb86 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Mon, 1 May 2017 13:04:16 -0300 Subject: [media] lirc_zilog: remove module parameter minor Always let the kernel decide what minor the lirc chardev gets. Signed-off-by: David Härdeman Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/lirc/lirc_zilog.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index 59f657daf31b..df371e07e6c1 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -156,7 +156,6 @@ static struct mutex tx_data_lock; /* module parameters */ static bool debug; /* debug output */ static bool tx_only; /* only handle the IR Tx function */ -static int minor = -1; /* minor number */ /* struct IR reference counting */ @@ -184,10 +183,11 @@ static void release_ir_device(struct kref *ref) * ir->open_count == 0 - happens on final close() * ir_lock, tx_ref_lock, rx_ref_lock, all released */ - if (ir->l.minor >= 0 && ir->l.minor < MAX_IRCTL_DEVICES) { + if (ir->l.minor >= 0) { lirc_unregister_driver(ir->l.minor); - ir->l.minor = MAX_IRCTL_DEVICES; + ir->l.minor = -1; } + if (kfifo_initialized(&ir->rbuf.fifo)) lirc_buffer_free(&ir->rbuf); list_del(&ir->list); @@ -1597,12 +1597,11 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) } /* register with lirc */ - ir->l.minor = minor; /* module option: user requested minor number */ ir->l.minor = lirc_register_driver(&ir->l); - if (ir->l.minor < 0 || ir->l.minor >= MAX_IRCTL_DEVICES) { + if (ir->l.minor < 0) { dev_err(tx->ir->l.dev, - "%s: \"minor\" must be between 0 and %d (%d)!\n", - __func__, MAX_IRCTL_DEVICES-1, ir->l.minor); + "%s: lirc_register_driver() failed: %i\n", + __func__, ir->l.minor); ret = -EBADRQC; goto out_put_xx; } @@ -1674,9 +1673,6 @@ MODULE_LICENSE("GPL"); /* for compat with old name, which isn't all that accurate anymore */ MODULE_ALIAS("lirc_pvr150"); -module_param(minor, int, 0444); -MODULE_PARM_DESC(minor, "Preferred minor device number"); - module_param(debug, bool, 0644); MODULE_PARM_DESC(debug, "Enable debugging messages"); -- cgit v1.2.3-55-g7522 From 32ddcbb5b8dc10bf922ff3a6666cb3748efca388 Mon Sep 17 00:00:00 2001 From: Ricardo Silva Date: Mon, 15 May 2017 16:40:12 -0300 Subject: [media] lirc_zilog: Fix whitespace style checks Fix style issues reported by checkpatch, affecting whitespace only: * CHECK: "Please don't use multiple blank lines". Two of these still triggering and left untouched because used for separating logical blocks (vars from functions, etc.). * CHECK: "spaces preferred around that ''". All fixed. * CHECK: "Alignment should match open parenthesis". All fixed except one on line 1161, left untouched for readability. Move towards recommended coding style without compromising readability. Signed-off-by: Ricardo Silva Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/lirc/lirc_zilog.c | 35 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index df371e07e6c1..a8cfbee9c32e 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -472,7 +472,7 @@ static int lirc_thread(void *arg) /* if device not opened, we can sleep half a second */ if (atomic_read(&ir->open_count) == 0) { - schedule_timeout(HZ/2); + schedule_timeout(HZ / 2); continue; } @@ -499,7 +499,7 @@ static int lirc_thread(void *arg) /* safe read of a uint32 (always network byte order) */ static int read_uint32(unsigned char **data, - unsigned char *endp, unsigned int *val) + unsigned char *endp, unsigned int *val) { if (*data + 4 > endp) return 0; @@ -511,7 +511,7 @@ static int read_uint32(unsigned char **data, /* safe read of a uint8 */ static int read_uint8(unsigned char **data, - unsigned char *endp, unsigned char *val) + unsigned char *endp, unsigned char *val) { if (*data + 1 > endp) return 0; @@ -521,7 +521,7 @@ static int read_uint8(unsigned char **data, /* safe skipping of N bytes */ static int skip(unsigned char **data, - unsigned char *endp, unsigned int distance) + unsigned char *endp, unsigned int distance) { if (*data + distance > endp) return 0; @@ -531,7 +531,7 @@ static int skip(unsigned char **data, /* decompress key data into the given buffer */ static int get_key_data(unsigned char *buf, - unsigned int codeset, unsigned int key) + unsigned int codeset, unsigned int key) { unsigned char *data, *endp, *diffs, *key_block; unsigned char keys, ndiffs, id; @@ -801,7 +801,7 @@ static int fw_load(struct IR_tx *tx) goto corrupt; if (!read_uint32(&data, tx_data->endp, - &tx_data->num_code_sets)) + &tx_data->num_code_sets)) goto corrupt; dev_dbg(tx->ir->l.dev, "%u IR blaster codesets loaded\n", @@ -857,12 +857,12 @@ static int fw_load(struct IR_tx *tx) * global fixed */ if (!skip(&data, tx_data->endp, - 1 + TX_BLOCK_SIZE - num_global_fixed)) + 1 + TX_BLOCK_SIZE - num_global_fixed)) goto corrupt; /* Then we have keys-1 blocks of key id+diffs */ if (!skip(&data, tx_data->endp, - (ndiffs + 1) * (keys - 1))) + (ndiffs + 1) * (keys - 1))) goto corrupt; } ret = 0; @@ -1056,7 +1056,7 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) break; dev_dbg(tx->ir->l.dev, "NAK expected: i2c_master_send failed with %d (try %d)\n", - ret, i+1); + ret, i + 1); } if (ret != 1) { dev_err(tx->ir->l.dev, @@ -1222,7 +1222,7 @@ static unsigned int poll(struct file *filep, poll_table *wait) poll_wait(filep, &rbuf->wait_poll, wait); /* Indicate what ops could happen immediately without blocking */ - ret = lirc_buffer_empty(rbuf) ? 0 : (POLLIN|POLLRDNORM); + ret = lirc_buffer_empty(rbuf) ? 0 : (POLLIN | POLLRDNORM); dev_dbg(ir->l.dev, "poll result = %s\n", ret ? "POLLIN|POLLRDNORM" : "none"); @@ -1246,15 +1246,15 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg) result = put_user(features, uptr); break; case LIRC_GET_REC_MODE: - if (!(features&LIRC_CAN_REC_MASK)) + if (!(features & LIRC_CAN_REC_MASK)) return -ENOSYS; result = put_user(LIRC_REC2MODE - (features&LIRC_CAN_REC_MASK), + (features & LIRC_CAN_REC_MASK), uptr); break; case LIRC_SET_REC_MODE: - if (!(features&LIRC_CAN_REC_MASK)) + if (!(features & LIRC_CAN_REC_MASK)) return -ENOSYS; result = get_user(mode, uptr); @@ -1262,13 +1262,13 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg) result = -EINVAL; break; case LIRC_GET_SEND_MODE: - if (!(features&LIRC_CAN_SEND_MASK)) + if (!(features & LIRC_CAN_SEND_MASK)) return -ENOSYS; result = put_user(LIRC_MODE_PULSE, uptr); break; case LIRC_SET_SEND_MODE: - if (!(features&LIRC_CAN_SEND_MASK)) + if (!(features & LIRC_CAN_SEND_MASK)) return -ENOSYS; result = get_user(mode, uptr); @@ -1414,7 +1414,6 @@ static int ir_remove(struct i2c_client *client) return 0; } - /* ir_devices_lock must be held */ static struct IR *get_ir_device_by_adapter(struct i2c_adapter *adapter) { @@ -1455,7 +1454,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) return -ENXIO; pr_info("probing IR %s on %s (i2c-%d)\n", - tx_probe ? "Tx" : "Rx", adap->name, adap->nr); + tx_probe ? "Tx" : "Rx", adap->name, adap->nr); mutex_lock(&ir_devices_lock); @@ -1591,7 +1590,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) /* Proceed only if the Tx client is also ready */ if (tx == NULL) { pr_info("probe of IR Rx on %s (i2c-%d) done. Waiting on IR Tx.\n", - adap->name, adap->nr); + adap->name, adap->nr); goto out_ok; } } -- cgit v1.2.3-55-g7522 From 28b671b4bac52b4ad8e1a9e8aa7514da7efe924d Mon Sep 17 00:00:00 2001 From: Ricardo Silva Date: Mon, 15 May 2017 16:40:13 -0300 Subject: [media] lirc_zilog: Fix NULL comparisons style Fix all checkpatch reported issues for "CHECK: Comparison to NULL could be written...". Do these comparisons using the recommended coding style and consistent with other similar cases in the file, which already used the recommended way. Signed-off-by: Ricardo Silva Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/lirc/lirc_zilog.c | 48 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index a8cfbee9c32e..b9761a8b0bc2 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -215,7 +215,7 @@ static struct IR_rx *get_ir_rx(struct IR *ir) spin_lock(&ir->rx_ref_lock); rx = ir->rx; - if (rx != NULL) + if (rx) kref_get(&rx->ref); spin_unlock(&ir->rx_ref_lock); return rx; @@ -277,7 +277,7 @@ static struct IR_tx *get_ir_tx(struct IR *ir) spin_lock(&ir->tx_ref_lock); tx = ir->tx; - if (tx != NULL) + if (tx) kref_get(&tx->ref); spin_unlock(&ir->tx_ref_lock); return tx; @@ -327,12 +327,12 @@ static int add_to_buf(struct IR *ir) } rx = get_ir_rx(ir); - if (rx == NULL) + if (!rx) return -ENXIO; /* Ensure our rx->c i2c_client remains valid for the duration */ mutex_lock(&rx->client_lock); - if (rx->c == NULL) { + if (!rx->c) { mutex_unlock(&rx->client_lock); put_ir_rx(rx, false); return -ENXIO; @@ -388,7 +388,7 @@ static int add_to_buf(struct IR *ir) break; } schedule_timeout((100 * HZ + 999) / 1000); - if (tx != NULL) + if (tx) tx->need_boot = 1; ++failures; @@ -444,7 +444,7 @@ static int add_to_buf(struct IR *ir) } while (!lirc_buffer_full(rbuf)); mutex_unlock(&rx->client_lock); - if (tx != NULL) + if (tx) put_ir_tx(tx, false); put_ir_rx(rx, false); return ret; @@ -763,7 +763,7 @@ static int fw_load(struct IR_tx *tx) /* Parse the file */ tx_data = vmalloc(sizeof(*tx_data)); - if (tx_data == NULL) { + if (!tx_data) { release_firmware(fw_entry); ret = -ENOMEM; goto out; @@ -772,7 +772,7 @@ static int fw_load(struct IR_tx *tx) /* Copy the data so hotplug doesn't get confused and timeout */ tx_data->datap = vmalloc(fw_entry->size); - if (tx_data->datap == NULL) { + if (!tx_data->datap) { release_firmware(fw_entry); vfree(tx_data); ret = -ENOMEM; @@ -809,7 +809,7 @@ static int fw_load(struct IR_tx *tx) tx_data->code_sets = vmalloc( tx_data->num_code_sets * sizeof(char *)); - if (tx_data->code_sets == NULL) { + if (!tx_data->code_sets) { fw_unload_locked(); ret = -ENOMEM; goto out; @@ -896,7 +896,7 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n, } rx = get_ir_rx(ir); - if (rx == NULL) + if (!rx) return -ENXIO; /* @@ -1102,12 +1102,12 @@ static ssize_t write(struct file *filep, const char __user *buf, size_t n, /* Get a struct IR_tx reference */ tx = get_ir_tx(ir); - if (tx == NULL) + if (!tx) return -ENXIO; /* Ensure our tx->c i2c_client remains valid for the duration */ mutex_lock(&tx->client_lock); - if (tx->c == NULL) { + if (!tx->c) { mutex_unlock(&tx->client_lock); put_ir_tx(tx, false); return -ENXIO; @@ -1206,7 +1206,7 @@ static unsigned int poll(struct file *filep, poll_table *wait) dev_dbg(ir->l.dev, "poll called\n"); rx = get_ir_rx(ir); - if (rx == NULL) { + if (!rx) { /* * Revisit this, if our poll function ever reports writeable * status for Tx @@ -1313,7 +1313,7 @@ static int open(struct inode *node, struct file *filep) /* find our IR struct */ ir = get_ir_device_by_minor(minor); - if (ir == NULL) + if (!ir) return -ENODEV; atomic_inc(&ir->open_count); @@ -1331,7 +1331,7 @@ static int close(struct inode *node, struct file *filep) /* find our IR struct */ struct IR *ir = filep->private_data; - if (ir == NULL) { + if (!ir) { pr_err("ir: close: no private_data attached to the file!\n"); return -ENODEV; } @@ -1395,7 +1395,7 @@ static int ir_remove(struct i2c_client *client) if (strncmp("ir_tx_z8", client->name, 8) == 0) { struct IR_tx *tx = i2c_get_clientdata(client); - if (tx != NULL) { + if (tx) { mutex_lock(&tx->client_lock); tx->c = NULL; mutex_unlock(&tx->client_lock); @@ -1404,7 +1404,7 @@ static int ir_remove(struct i2c_client *client) } else if (strncmp("ir_rx_z8", client->name, 8) == 0) { struct IR_rx *rx = i2c_get_clientdata(client); - if (rx != NULL) { + if (rx) { mutex_lock(&rx->client_lock); rx->c = NULL; mutex_unlock(&rx->client_lock); @@ -1460,7 +1460,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) /* Use a single struct IR instance for both the Rx and Tx functions */ ir = get_ir_device_by_adapter(adap); - if (ir == NULL) { + if (!ir) { ir = kzalloc(sizeof(struct IR), GFP_KERNEL); if (!ir) { ret = -ENOMEM; @@ -1534,7 +1534,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) fw_load(tx); /* Proceed only if the Rx client is also ready or not needed */ - if (rx == NULL && !tx_only) { + if (!rx && !tx_only) { dev_info(tx->ir->l.dev, "probe of IR Tx on %s (i2c-%d) done. Waiting on IR Rx.\n", adap->name, adap->nr); @@ -1588,7 +1588,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) } /* Proceed only if the Tx client is also ready */ - if (tx == NULL) { + if (!tx) { pr_info("probe of IR Rx on %s (i2c-%d) done. Waiting on IR Tx.\n", adap->name, adap->nr); goto out_ok; @@ -1609,9 +1609,9 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) adap->name, adap->nr, ir->l.minor); out_ok: - if (rx != NULL) + if (rx) put_ir_rx(rx, true); - if (tx != NULL) + if (tx) put_ir_tx(tx, true); put_ir_device(ir, true); dev_info(ir->l.dev, @@ -1621,10 +1621,10 @@ out_ok: return 0; out_put_xx: - if (rx != NULL) + if (rx) put_ir_rx(rx, true); out_put_tx: - if (tx != NULL) + if (tx) put_ir_tx(tx, true); out_put_ir: put_ir_device(ir, true); -- cgit v1.2.3-55-g7522 From 41a603f8d94c6e7627ddd4e13763b4523aa473ac Mon Sep 17 00:00:00 2001 From: Ricardo Silva Date: Mon, 15 May 2017 16:40:14 -0300 Subject: [media] lirc_zilog: Use __func__ for logging function name Fix all checkpatch reported issues for "CHECK: Prefer using '"%s...", __func__' to using '', ..." Use recommended style. Additionally, __func__ was already used in similar cases throughout the code, so make it all consistent. Signed-off-by: Ricardo Silva Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/lirc/lirc_zilog.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index b9761a8b0bc2..4af0068ab0c5 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -1203,7 +1203,7 @@ static unsigned int poll(struct file *filep, poll_table *wait) struct lirc_buffer *rbuf = ir->l.rbuf; unsigned int ret; - dev_dbg(ir->l.dev, "poll called\n"); + dev_dbg(ir->l.dev, "%s called\n", __func__); rx = get_ir_rx(ir); if (!rx) { @@ -1211,7 +1211,7 @@ static unsigned int poll(struct file *filep, poll_table *wait) * Revisit this, if our poll function ever reports writeable * status for Tx */ - dev_dbg(ir->l.dev, "poll result = POLLERR\n"); + dev_dbg(ir->l.dev, "%s result = POLLERR\n", __func__); return POLLERR; } @@ -1224,7 +1224,7 @@ static unsigned int poll(struct file *filep, poll_table *wait) /* Indicate what ops could happen immediately without blocking */ ret = lirc_buffer_empty(rbuf) ? 0 : (POLLIN | POLLRDNORM); - dev_dbg(ir->l.dev, "poll result = %s\n", + dev_dbg(ir->l.dev, "%s result = %s\n", __func__, ret ? "POLLIN|POLLRDNORM" : "none"); return ret; } @@ -1332,7 +1332,8 @@ static int close(struct inode *node, struct file *filep) struct IR *ir = filep->private_data; if (!ir) { - pr_err("ir: close: no private_data attached to the file!\n"); + pr_err("ir: %s: no private_data attached to the file!\n", + __func__); return -ENODEV; } -- cgit v1.2.3-55-g7522 From d44e07c752ecfed1fb131cd0c5f103e299c22ab4 Mon Sep 17 00:00:00 2001 From: Ricardo Silva Date: Mon, 15 May 2017 16:40:15 -0300 Subject: [media] lirc_zilog: Use sizeof(*p) instead of sizeof(struct P) Fix all checkpatch reported issues for "CHECK: Prefer kzalloc(sizeof(*

)...) over kzalloc(sizeof(struct

)...)". Other similar case in the code already using recommended style, so make it all consistent with the recommended practice. Signed-off-by: Ricardo Silva Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/lirc/lirc_zilog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index 4af0068ab0c5..48628bab62fc 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -1462,7 +1462,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) /* Use a single struct IR instance for both the Rx and Tx functions */ ir = get_ir_device_by_adapter(adap); if (!ir) { - ir = kzalloc(sizeof(struct IR), GFP_KERNEL); + ir = kzalloc(sizeof(*ir), GFP_KERNEL); if (!ir) { ret = -ENOMEM; goto out_no_ir; @@ -1502,7 +1502,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) rx = get_ir_rx(ir); /* Set up a struct IR_tx instance */ - tx = kzalloc(sizeof(struct IR_tx), GFP_KERNEL); + tx = kzalloc(sizeof(*tx), GFP_KERNEL); if (!tx) { ret = -ENOMEM; goto out_put_xx; @@ -1546,7 +1546,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) tx = get_ir_tx(ir); /* Set up a struct IR_rx instance */ - rx = kzalloc(sizeof(struct IR_rx), GFP_KERNEL); + rx = kzalloc(sizeof(*rx), GFP_KERNEL); if (!rx) { ret = -ENOMEM; goto out_put_xx; -- cgit v1.2.3-55-g7522 From da731edb5b7667d0752eeaf473896fc123b8e95f Mon Sep 17 00:00:00 2001 From: Ricardo Silva Date: Mon, 15 May 2017 16:40:16 -0300 Subject: [media] lirc_zilog: Fix unbalanced braces around if/else Fix all checkpatch reported issues for: * CHECK: "braces {} should be used on all arms of this statement". * CHECK: "Unbalanced braces around else statement". Make sure all if/else statements are balanced in terms of braces. Most cases in code are, but a few were left unbalanced, so put them all consistent with the recommended style. Signed-off-by: Ricardo Silva Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/lirc/lirc_zilog.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index 48628bab62fc..015e41bd036e 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -545,9 +545,9 @@ static int get_key_data(unsigned char *buf, if (!read_uint32(&data, tx_data->endp, &i)) goto corrupt; - if (i == codeset) + if (i == codeset) { break; - else if (codeset > i) { + } else if (codeset > i) { base = pos + 1; --lim; } @@ -981,8 +981,9 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) "failed to get data for code %u, key %u -- check lircd.conf entries\n", code, key); return ret; - } else if (ret != 0) + } else if (ret != 0) { return ret; + } /* Send the data block */ ret = send_data_block(tx, data_block); @@ -1179,8 +1180,9 @@ static ssize_t write(struct file *filep, const char __user *buf, size_t n, schedule_timeout((100 * HZ + 999) / 1000); tx->need_boot = 1; ++failures; - } else + } else { i += sizeof(int); + } } /* Release i2c bus */ -- cgit v1.2.3-55-g7522 From 614d651e1abda005ec9df5accef4b02aafcdf1ed Mon Sep 17 00:00:00 2001 From: Sean Young Date: Wed, 17 May 2017 14:32:54 -0300 Subject: [media] staging: remove todo and replace with lirc_zilog todo The lirc_zilog driver is the last remaining lirc driver, so the existing todo is no longer relevant. Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/lirc/TODO | 47 ++++++++++++++++++++++-------- drivers/staging/media/lirc/TODO.lirc_zilog | 36 ----------------------- 2 files changed, 35 insertions(+), 48 deletions(-) delete mode 100644 drivers/staging/media/lirc/TODO.lirc_zilog (limited to 'drivers/staging') diff --git a/drivers/staging/media/lirc/TODO b/drivers/staging/media/lirc/TODO index cbea5d84fed3..a97800a8e127 100644 --- a/drivers/staging/media/lirc/TODO +++ b/drivers/staging/media/lirc/TODO @@ -1,13 +1,36 @@ -- All drivers should either be ported to ir-core, or dropped entirely - (see drivers/media/IR/mceusb.c vs. lirc_mceusb.c in lirc cvs for an - example of a previously completed port). - -- lirc_bt829 uses registers on a Mach64 VT, which has a separate kernel - framebuffer driver (atyfb) and userland X driver (mach64). It can't - simply be converted to a normal PCI driver, but ideally it should be - coordinated with the other drivers. - -Please send patches to: -Jarod Wilson -Greg Kroah-Hartman +1. Both ir-kbd-i2c and lirc_zilog provide support for RX events for +the chips supported by lirc_zilog. Before moving lirc_zilog out of staging: + +a. ir-kbd-i2c needs a module parameter added to allow the user to tell + ir-kbd-i2c to ignore Z8 IR units. + +b. lirc_zilog should provide Rx key presses to the rc core like ir-kbd-i2c + does. + + +2. lirc_zilog module ref-counting need examination. It has not been +verified that cdev and lirc_dev will take the proper module references on +lirc_zilog to prevent removal of lirc_zilog when the /dev/lircN device node +is open. + +(The good news is ref-counting of lirc_zilog internal structures appears to be +complete. Testing has shown the cx18 module can be unloaded out from under +irw + lircd + lirc_dev, with the /dev/lirc0 device node open, with no adverse +effects. The cx18 module could then be reloaded and irw properly began +receiving button presses again and ir_send worked without error.) + + +3. Bridge drivers, if able, should provide a chip reset() callback +to lirc_zilog via struct IR_i2c_init_data. cx18 and ivtv already have routines +to perform Z8 chip resets via GPIO manipulations. This would allow lirc_zilog +to bring the chip back to normal when it hangs, in the same places the +original lirc_pvr150 driver code does. This is not strictly needed, so it +is not required to move lirc_zilog out of staging. + +Note: Both lirc_zilog and ir-kbd-i2c support the Zilog Z8 for IR, as programmed +and installed on Hauppauge products. When working on either module, developers +must consider at least the following bridge drivers which mention an IR Rx unit +at address 0x71 (indicative of a Z8): + + ivtv cx18 hdpvr pvrusb2 bt8xx cx88 saa7134 diff --git a/drivers/staging/media/lirc/TODO.lirc_zilog b/drivers/staging/media/lirc/TODO.lirc_zilog deleted file mode 100644 index a97800a8e127..000000000000 --- a/drivers/staging/media/lirc/TODO.lirc_zilog +++ /dev/null @@ -1,36 +0,0 @@ -1. Both ir-kbd-i2c and lirc_zilog provide support for RX events for -the chips supported by lirc_zilog. Before moving lirc_zilog out of staging: - -a. ir-kbd-i2c needs a module parameter added to allow the user to tell - ir-kbd-i2c to ignore Z8 IR units. - -b. lirc_zilog should provide Rx key presses to the rc core like ir-kbd-i2c - does. - - -2. lirc_zilog module ref-counting need examination. It has not been -verified that cdev and lirc_dev will take the proper module references on -lirc_zilog to prevent removal of lirc_zilog when the /dev/lircN device node -is open. - -(The good news is ref-counting of lirc_zilog internal structures appears to be -complete. Testing has shown the cx18 module can be unloaded out from under -irw + lircd + lirc_dev, with the /dev/lirc0 device node open, with no adverse -effects. The cx18 module could then be reloaded and irw properly began -receiving button presses again and ir_send worked without error.) - - -3. Bridge drivers, if able, should provide a chip reset() callback -to lirc_zilog via struct IR_i2c_init_data. cx18 and ivtv already have routines -to perform Z8 chip resets via GPIO manipulations. This would allow lirc_zilog -to bring the chip back to normal when it hangs, in the same places the -original lirc_pvr150 driver code does. This is not strictly needed, so it -is not required to move lirc_zilog out of staging. - -Note: Both lirc_zilog and ir-kbd-i2c support the Zilog Z8 for IR, as programmed -and installed on Hauppauge products. When working on either module, developers -must consider at least the following bridge drivers which mention an IR Rx unit -at address 0x71 (indicative of a Z8): - - ivtv cx18 hdpvr pvrusb2 bt8xx cx88 saa7134 - -- cgit v1.2.3-55-g7522 From 74058c596b5007e2186258fccf20e1103cd88f39 Mon Sep 17 00:00:00 2001 From: Christoph Fanelsa Date: Tue, 16 May 2017 17:07:40 -0300 Subject: [media] staging: media: cxd2099: Fix checkpatch issues Fix checkpatch warnings of prefered using '%s..", __func__' as function name in a string Signed-off-by: Christoph Fanelsa Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/cxd2099/cxd2099.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/cxd2099/cxd2099.c b/drivers/staging/media/cxd2099/cxd2099.c index 18186d0fa1a6..370ecb959543 100644 --- a/drivers/staging/media/cxd2099/cxd2099.c +++ b/drivers/staging/media/cxd2099/cxd2099.c @@ -473,7 +473,7 @@ static int slot_shutdown(struct dvb_ca_en50221 *ca, int slot) { struct cxd *ci = ca->data; - dev_info(&ci->i2c->dev, "slot_shutdown\n"); + dev_info(&ci->i2c->dev, "%s\n", __func__); mutex_lock(&ci->lock); write_regm(ci, 0x09, 0x08, 0x08); write_regm(ci, 0x20, 0x80, 0x80); /* Reset CAM Mode */ @@ -564,7 +564,7 @@ static int read_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount) campoll(ci); mutex_unlock(&ci->lock); - dev_info(&ci->i2c->dev, "read_data\n"); + dev_info(&ci->i2c->dev, "%s\n", __func__); if (!ci->dr) return 0; @@ -584,7 +584,7 @@ static int write_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount) struct cxd *ci = ca->data; mutex_lock(&ci->lock); - dev_info(&ci->i2c->dev, "write_data %d\n", ecount); + dev_info(&ci->i2c->dev, "%s %d\n", __func__, ecount); write_reg(ci, 0x0d, ecount >> 8); write_reg(ci, 0x0e, ecount & 0xff); write_block(ci, 0x11, ebuf, ecount); -- cgit v1.2.3-55-g7522 From e1b28f132675963e06b54ba8e1acf13399325a8d Mon Sep 17 00:00:00 2001 From: Paolo Cretaro Date: Mon, 22 May 2017 18:04:46 -0300 Subject: [media] atomisp: use NULL instead of 0 for pointers Fix warning issued by sparse: Using plain integer as NULL pointer Signed-off-by: Paolo Cretaro Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/i2c/ov5693/ov5693.c | 2 +- .../media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c | 2 +- .../media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c | 2 +- drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c | 2 +- drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c index 5e9dafe7cc32..d6447398f5ef 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c +++ b/drivers/staging/media/atomisp/i2c/ov5693/ov5693.c @@ -706,7 +706,7 @@ static int ov5693_read_otp_reg_array(struct i2c_client *client, u16 size, { u16 index; int ret; - u16 *pVal = 0; + u16 *pVal = NULL; for (index = 0; index <= size; index++) { pVal = (u16 *) (buf + index); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c index ed33d4c4c84a..5d40afd482f5 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c @@ -239,7 +239,7 @@ static ia_css_queue_t *bufq_get_qhandle( enum sh_css_queue_id id, int thread) { - ia_css_queue_t *q = 0; + ia_css_queue_t *q = NULL; switch (type) { case sh_css_host2sp_buffer_queue: diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c index b36d7b00ebe8..18966d89602a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c @@ -57,7 +57,7 @@ enum ia_css_err ia_css_spctrl_load_fw(sp_ID_t sp_id, hrt_vaddress code_addr = mmgr_NULL; struct ia_css_sp_init_dmem_cfg *init_dmem_cfg; - if ((sp_id >= N_SP_ID) || (spctrl_cfg == 0)) + if ((sp_id >= N_SP_ID) || (spctrl_cfg == NULL)) return IA_CSS_ERR_INVALID_ARGUMENTS; spctrl_cofig_info[sp_id].code_addr = mmgr_NULL; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c index 57295397da3e..5e63073f3581 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c @@ -193,7 +193,7 @@ int hmm_init(void) * at the beginning, to avoid hmm_alloc return 0 in the * further allocation. */ - dummy_ptr = hmm_alloc(1, HMM_BO_PRIVATE, 0, 0, HMM_UNCACHED); + dummy_ptr = hmm_alloc(1, HMM_BO_PRIVATE, 0, NULL, HMM_UNCACHED); if (!ret) { ret = sysfs_create_group(&atomisp_dev->kobj, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.c b/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.c index 7dff22f59e29..2e78976bb2ac 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.c @@ -55,7 +55,7 @@ static ia_css_ptr __hrt_isp_css_mm_alloc(size_t bytes, void *userptr, if (type == HRT_USR_PTR) { if (userptr == NULL) return hmm_alloc(bytes, HMM_BO_PRIVATE, 0, - 0, cached); + NULL, cached); else { if (num_pages < ((__page_align(bytes)) >> PAGE_SHIFT)) dev_err(atomisp_dev, @@ -94,7 +94,7 @@ ia_css_ptr hrt_isp_css_mm_alloc_user_ptr(size_t bytes, void *userptr, ia_css_ptr hrt_isp_css_mm_alloc_cached(size_t bytes) { if (my_userptr == NULL) - return hmm_alloc(bytes, HMM_BO_PRIVATE, 0, 0, + return hmm_alloc(bytes, HMM_BO_PRIVATE, 0, NULL, HMM_CACHED); else { if (my_num_pages < ((__page_align(bytes)) >> PAGE_SHIFT)) -- cgit v1.2.3-55-g7522 From 4518c3fe7ca7288e6ca8d0cbb977e4c725d0398a Mon Sep 17 00:00:00 2001 From: Juan Antonio Pedreira Martos Date: Tue, 23 May 2017 21:27:11 -0300 Subject: [media] staging: media: atomisp: fix non static symbol warnings Fix a couple of sparse warnings: drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c:59:14: warning: symbol 'repool_pgnr' was not declared. Should it be static? drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c:387:6: warning: symbol 'punit_ddr_dvfs_enable' was not declared. Should it be static? Mark these symbols as static, so they are no longer incorrectly exported. Signed-off-by: Juan Antonio Pedreira Martos Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c index a0478077a012..a543def739fc 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c @@ -56,7 +56,7 @@ module_param(skip_fwload, uint, 0644); MODULE_PARM_DESC(skip_fwload, "Skip atomisp firmware load"); /* set reserved memory pool size in page */ -unsigned int repool_pgnr; +static unsigned int repool_pgnr; module_param(repool_pgnr, uint, 0644); MODULE_PARM_DESC(repool_pgnr, "Set the reserved memory pool size in page (default:0)"); @@ -384,7 +384,7 @@ done: * WA for DDR DVFS enable/disable * By default, ISP will force DDR DVFS 1600MHz before disable DVFS */ -void punit_ddr_dvfs_enable(bool enable) +static void punit_ddr_dvfs_enable(bool enable) { int reg = intel_mid_msgbus_read32(PUNIT_PORT, MRFLD_ISPSSDVFS); int door_bell = 1 << 8; -- cgit v1.2.3-55-g7522 From 5c9f9d602e54433483355b474353ba2e2de8caa3 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 26 May 2017 12:27:18 -0300 Subject: [media] atompisp: HAS_BL is never defined so lose it Kill off the HAS_BL define and the code and includes it brackets. We never define HAS_BL or use that functionality. Signed-off-by: Alan Cox Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/atomisp/pci/atomisp2/css2400/sh_css.c | 101 --------------------- .../atomisp/pci/atomisp2/css2400/sh_css_firmware.c | 19 +--- .../atomisp/pci/atomisp2/css2400/sh_css_internal.h | 7 -- 3 files changed, 1 insertion(+), 126 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index 81a21a0c1391..19dc843ad19e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -98,18 +98,12 @@ static int thread_alive; #include "isp/modes/interface/input_buf.isp.h" -#if defined(HAS_BL) -#include "support/bootloader/interface/ia_css_blctrl.h" -#endif #if defined(HAS_RES_MGR) #include "components/acc_cluster/gen/host/acc_cluster.host.h" #endif /* Name of the sp program: should not be built-in */ #define SP_PROG_NAME "sp" -#if defined(HAS_BL) -#define BL_PROG_NAME "bootloader" -#endif /* Size of Refcount List */ #define REFCOUNT_SIZE 1000 @@ -1571,34 +1565,7 @@ enable_interrupts(enum ia_css_irq_type irq_type) } #endif -#if defined(HAS_BL) -static bool sh_css_setup_blctrl_config(const struct ia_css_fw_info *fw, - const char *program, - ia_css_blctrl_cfg *blctrl_cfg) -{ - if((fw == NULL)||(blctrl_cfg == NULL)) - return false; - blctrl_cfg->bl_entry = 0; - blctrl_cfg->program_name = (char *)(program); - -#if !defined(HRT_UNSCHED) - blctrl_cfg->ddr_data_offset = fw->blob.data_source; - blctrl_cfg->dmem_data_addr = fw->blob.data_target; - blctrl_cfg->dmem_bss_addr = fw->blob.bss_target; - blctrl_cfg->data_size = fw->blob.data_size ; - blctrl_cfg->bss_size = fw->blob.bss_size; - - blctrl_cfg->blctrl_state_dmem_addr = fw->info.bl.sw_state; - blctrl_cfg->blctrl_dma_cmd_list = fw->info.bl.dma_cmd_list; - blctrl_cfg->blctrl_nr_of_dma_cmds = fw->info.bl.num_dma_cmds; - blctrl_cfg->code_size = fw->blob.size; - blctrl_cfg->code = fw->blob.code; - blctrl_cfg->bl_entry = fw->info.bl.bl_entry; /* entry function ptr on Bootloader */ -#endif - return true; -} -#endif static bool sh_css_setup_spctrl_config(const struct ia_css_fw_info *fw, const char * program, ia_css_spctrl_cfg *spctrl_cfg) @@ -1708,9 +1675,6 @@ ia_css_init(const struct ia_css_env *env, { enum ia_css_err err; ia_css_spctrl_cfg spctrl_cfg; -#if defined(HAS_BL) - ia_css_blctrl_cfg blctrl_cfg; -#endif void (*flush_func)(struct ia_css_acc_fw *fw); hrt_data select, enable; @@ -1863,26 +1827,6 @@ ia_css_init(const struct ia_css_env *env, return err; } -#if defined(HAS_BL) - if (!sh_css_setup_blctrl_config(&sh_css_bl_fw, BL_PROG_NAME, &blctrl_cfg)) - return IA_CSS_ERR_INTERNAL_ERROR; - err = ia_css_blctrl_load_fw(&blctrl_cfg); - if (err != IA_CSS_SUCCESS) { - IA_CSS_LEAVE_ERR(err); - return err; - } - -#ifdef ISP2401 - err = ia_css_blctrl_add_target_fw_info(&sh_css_sp_fw, IA_CSS_SP0, - get_sp_code_addr(SP0_ID)); - -#endif - if (err != IA_CSS_SUCCESS) { - IA_CSS_LEAVE_ERR(err); - return err; - } -#endif /* HAS_BL */ - #if WITH_PC_MONITORING if (!thread_alive) { thread_alive++; @@ -2667,9 +2611,6 @@ ia_css_uninit(void) } ia_css_spctrl_unload_fw(SP0_ID); sh_css_sp_set_sp_running(false); -#if defined(HAS_BL) - ia_css_blctrl_unload_fw(); -#endif #if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) /* check and free any remaining mipi frames */ free_mipi_frames(NULL); @@ -10588,39 +10529,6 @@ ia_css_pipe_get_isp_pipe_version(const struct ia_css_pipe *pipe) return (unsigned int)pipe->config.isp_pipe_version; } -#if defined(HAS_BL) -#define BL_START_TIMEOUT_US 30000000 -static enum ia_css_err -ia_css_start_bl(void) -{ - enum ia_css_err err = IA_CSS_SUCCESS; - unsigned long timeout; - - IA_CSS_ENTER(""); - sh_css_start_bl(); - /* waiting for the Bootloader to complete execution */ - timeout = BL_START_TIMEOUT_US; - while((ia_css_blctrl_get_state() == BOOTLOADER_BUSY) && timeout) { - timeout--; - hrt_sleep(); - } - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, - "Bootloader state %d\n", ia_css_blctrl_get_state()); - if (timeout == 0) { - ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR, - "Bootloader Execution Timeout\n"); - err = IA_CSS_ERR_INTERNAL_ERROR; - } - if (ia_css_blctrl_get_state() != BOOTLOADER_OK) { - ia_css_debug_dtrace(IA_CSS_DEBUG_ERROR, - "Bootloader Execution Failed\n"); - err = IA_CSS_ERR_INTERNAL_ERROR; - } - IA_CSS_LEAVE_ERR(err); - return err; -} -#endif - #define SP_START_TIMEOUT_US 30000000 enum ia_css_err @@ -10630,15 +10538,6 @@ ia_css_start_sp(void) enum ia_css_err err = IA_CSS_SUCCESS; IA_CSS_ENTER(""); -#if defined(HAS_BL) - /* Starting bootloader before Sp0 and Sp1 - * and not exposing CSS API */ - err = ia_css_start_bl(); - if (err != IA_CSS_SUCCESS) { - IA_CSS_LEAVE("Bootloader fails"); - return err; - } -#endif sh_css_sp_start_isp(); /* waiting for the SP is completely started */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c index 34cc56f0b471..57b4fe5e603f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c @@ -63,9 +63,6 @@ static const char *release_version = STR(irci_ecr-master_20150911_0724); static char FW_rel_ver_name[MAX_FW_REL_VER_NAME] = "---"; struct ia_css_fw_info sh_css_sp_fw; -#if defined(HAS_BL) -struct ia_css_fw_info sh_css_bl_fw; -#endif /* HAS_BL */ struct ia_css_blob_descr *sh_css_blob_info; /* Only ISP blob info (no SP) */ unsigned sh_css_num_binaries; /* This includes 1 SP binary */ @@ -137,12 +134,7 @@ sh_css_load_blob_info(const char *fw, const struct ia_css_fw_info *bi, struct ia bd->blob = blob; bd->header = *bi; - if ((bi->type == ia_css_isp_firmware) || (bi->type == ia_css_sp_firmware) -#if defined(HAS_BL) - || (bi->type == ia_css_bootloader_firmware) -#endif /* HAS_BL */ - ) - { + if (bi->type == ia_css_isp_firmware || bi->type == ia_css_sp_firmware) { char *namebuffer; int namelength = (int)strlen(name); @@ -279,15 +271,6 @@ sh_css_load_firmware(const char *fw_data, err = setup_binary(bi, fw_data, &sh_css_sp_fw, i); if (err != IA_CSS_SUCCESS) return err; -#if defined(HAS_BL) - } else if (bi->type == ia_css_bootloader_firmware) { - if (i != BOOTLOADER_FIRMWARE) - return IA_CSS_ERR_INTERNAL_ERROR; - err = setup_binary(bi, fw_data, &sh_css_bl_fw, i); - if (err != IA_CSS_SUCCESS) - return err; - IA_CSS_LOG("Bootloader binary recognized\n"); -#endif } else { /* All subsequent binaries (including bootloaders) (i>NUM_OF_SPS+NUM_OF_BLS) are ISP firmware */ if (i < (NUM_OF_SPS + NUM_OF_BLS)) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_internal.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_internal.h index e2b6f06ed099..5b2b78f96dc5 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_internal.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_internal.h @@ -154,18 +154,11 @@ /* Number of SP's */ #define NUM_OF_SPS 1 -#if defined(HAS_BL) -#define NUM_OF_BLS 1 -#else #define NUM_OF_BLS 0 -#endif /* Enum for order of Binaries */ enum sh_css_order_binaries { SP_FIRMWARE = 0, -#if defined(HAS_BL) - BOOTLOADER_FIRMWARE, -#endif ISP_FIRMWARE }; -- cgit v1.2.3-55-g7522 From 2310ae5c12ce5768cc8c14601fec8b256dd01e4e Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 26 May 2017 12:27:29 -0300 Subject: [media] atomisp: remove NUM_OF_BLS With the removal of the HAS_BL bootloader code the value of NUM_OF_BLS is an invariant zero. So let's get rid of it. Signed-off-by: Alan Cox Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c index 57b4fe5e603f..a179de5212d9 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c @@ -234,9 +234,9 @@ sh_css_load_firmware(const char *fw_data, sh_css_num_binaries = file_header->binary_nr; /* Only allocate memory for ISP blob info */ - if (sh_css_num_binaries > (NUM_OF_SPS + NUM_OF_BLS)) { + if (sh_css_num_binaries > NUM_OF_SPS) { sh_css_blob_info = kmalloc( - (sh_css_num_binaries - (NUM_OF_SPS + NUM_OF_BLS)) * + (sh_css_num_binaries - NUM_OF_SPS) * sizeof(*sh_css_blob_info), GFP_KERNEL); if (sh_css_blob_info == NULL) return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; @@ -272,15 +272,15 @@ sh_css_load_firmware(const char *fw_data, if (err != IA_CSS_SUCCESS) return err; } else { - /* All subsequent binaries (including bootloaders) (i>NUM_OF_SPS+NUM_OF_BLS) are ISP firmware */ - if (i < (NUM_OF_SPS + NUM_OF_BLS)) + /* All subsequent binaries (including bootloaders) (i>NUM_OF_SPS) are ISP firmware */ + if (i < NUM_OF_SPS) return IA_CSS_ERR_INTERNAL_ERROR; if (bi->type != ia_css_isp_firmware) return IA_CSS_ERR_INTERNAL_ERROR; if (sh_css_blob_info == NULL) /* cannot happen but KW does not see this */ return IA_CSS_ERR_INTERNAL_ERROR; - sh_css_blob_info[i-(NUM_OF_SPS + NUM_OF_BLS)] = bd; + sh_css_blob_info[i - NUM_OF_SPS] = bd; } } -- cgit v1.2.3-55-g7522 From f16595ae2048e201365425a337ed5281ce60caf2 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 26 May 2017 12:27:40 -0300 Subject: [media] atomisp2: remove HRT_UNSCHED HRT_UNSCHED is never defined or set in the driver, so this is dead code that can be retired, simplifying the code a bit further. Signed-off-by: Alan Cox Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c | 7 ------- .../atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c | 8 +------- drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c | 10 ++-------- .../media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c | 5 ----- 4 files changed, 3 insertions(+), 27 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c index bcc0d464084f..0fa7cb2423d8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c @@ -176,7 +176,6 @@ void ia_css_debug_dtrace(unsigned int level, const char *fmt, ...) va_end(ap); } -#if !defined(HRT_UNSCHED) static void debug_dump_long_array_formatted( const sp_ID_t sp_id, hrt_address stack_sp_addr, @@ -249,12 +248,6 @@ void ia_css_debug_dump_sp_stack_info(void) { debug_dump_sp_stack_info(SP0_ID); } -#else -/* Empty def for crun */ -void ia_css_debug_dump_sp_stack_info(void) -{ -} -#endif /* #if !HRT_UNSCHED */ void ia_css_debug_set_dtrace_level(const unsigned int trace_level) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c index 18966d89602a..d9178e80dab2 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c @@ -62,12 +62,6 @@ enum ia_css_err ia_css_spctrl_load_fw(sp_ID_t sp_id, spctrl_cofig_info[sp_id].code_addr = mmgr_NULL; -#if defined(HRT_UNSCHED) - (void)init_dmem_cfg; - code_addr = mmgr_malloc(1); - if (code_addr == mmgr_NULL) - return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; -#else init_dmem_cfg = &spctrl_cofig_info[sp_id].dmem_config; init_dmem_cfg->dmem_data_addr = spctrl_cfg->dmem_data_addr; init_dmem_cfg->dmem_bss_addr = spctrl_cfg->dmem_bss_addr; @@ -104,7 +98,7 @@ enum ia_css_err ia_css_spctrl_load_fw(sp_ID_t sp_id, code_addr = mmgr_NULL; return IA_CSS_ERR_INTERNAL_ERROR; } -#endif + spctrl_cofig_info[sp_id].sp_entry = spctrl_cfg->sp_entry; spctrl_cofig_info[sp_id].code_addr = code_addr; spctrl_cofig_info[sp_id].program_name = spctrl_cfg->program_name; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index 19dc843ad19e..231c3f8b535e 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -1575,7 +1575,6 @@ static bool sh_css_setup_spctrl_config(const struct ia_css_fw_info *fw, spctrl_cfg->sp_entry = 0; spctrl_cfg->program_name = (char *)(program); -#if !defined(HRT_UNSCHED) spctrl_cfg->ddr_data_offset = fw->blob.data_source; spctrl_cfg->dmem_data_addr = fw->blob.data_target; spctrl_cfg->dmem_bss_addr = fw->blob.bss_target; @@ -1588,7 +1587,7 @@ static bool sh_css_setup_spctrl_config(const struct ia_css_fw_info *fw, spctrl_cfg->code_size = fw->blob.size; spctrl_cfg->code = fw->blob.code; spctrl_cfg->sp_entry = fw->info.sp.sp_entry; /* entry function ptr on SP */ -#endif + return true; } void @@ -8570,9 +8569,7 @@ remove_firmware(struct ia_css_fw_info **l, struct ia_css_fw_info *firmware) return; /* removing single and multiple firmware is handled in acc_unload_extension() */ } -#if !defined(HRT_UNSCHED) -static enum ia_css_err -upload_isp_code(struct ia_css_fw_info *firmware) +static enum ia_css_err upload_isp_code(struct ia_css_fw_info *firmware) { hrt_vaddress binary; @@ -8600,12 +8597,10 @@ upload_isp_code(struct ia_css_fw_info *firmware) return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; return IA_CSS_SUCCESS; } -#endif static enum ia_css_err acc_load_extension(struct ia_css_fw_info *firmware) { -#if !defined(HRT_UNSCHED) enum ia_css_err err; struct ia_css_fw_info *hd = firmware; while (hd){ @@ -8614,7 +8609,6 @@ acc_load_extension(struct ia_css_fw_info *firmware) return err; hd = hd->next; } -#endif if (firmware == NULL) return IA_CSS_ERR_INVALID_ARGUMENTS; diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c index a179de5212d9..eecd8cf71951 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c @@ -92,12 +92,7 @@ setup_binary(struct ia_css_fw_info *fw, const char *fw_data, struct ia_css_fw_in *sh_css_fw = *fw; -#if defined(HRT_UNSCHED) - sh_css_fw->blob.code = vmalloc(1); -#else sh_css_fw->blob.code = vmalloc(fw->blob.size); -#endif - if (sh_css_fw->blob.code == NULL) return IA_CSS_ERR_CANNOT_ALLOCATE_MEMORY; -- cgit v1.2.3-55-g7522 From 94e23b61486c979e92357f9c3a97a277209720ea Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 26 May 2017 12:27:54 -0300 Subject: [media] atomisp2: tidy up confused ifdefs The two drivers were machine merged and in this case the machine output was to say the least not optimal. Signed-off-by: Alan Cox Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/atomisp/pci/atomisp2/css2400/sh_css.c | 26 +++++----------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index 231c3f8b535e..8d44608b39a0 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -1469,30 +1469,17 @@ static void start_pipe( copy_ovrd, input_mode, &me->stream->config.metadata_config, -#ifndef ISP2401 &me->stream->info.metadata_info -#else - &me->stream->info.metadata_info, -#endif #if !defined(HAS_NO_INPUT_SYSTEM) -#ifndef ISP2401 - , (input_mode==IA_CSS_INPUT_MODE_MEMORY)? -#else - (input_mode == IA_CSS_INPUT_MODE_MEMORY) ? -#endif + ,(input_mode==IA_CSS_INPUT_MODE_MEMORY) ? (mipi_port_ID_t)0 : -#ifndef ISP2401 me->stream->config.source.port.port -#else - me->stream->config.source.port.port, #endif +#ifdef ISP2401 + ,&me->config.internal_frame_origin_bqs_on_sctbl, + me->stream->isp_params_configs #endif -#ifndef ISP2401 - ); -#else - &me->config.internal_frame_origin_bqs_on_sctbl, - me->stream->isp_params_configs); -#endif + ); if (me->config.mode != IA_CSS_PIPE_MODE_COPY) { struct ia_css_pipeline_stage *stage; @@ -9815,9 +9802,6 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, /* take over effective info */ effective_res = curr_pipe->config.input_effective_res; -#endif - -#ifndef ISP2401 err = ia_css_util_check_res( effective_res.width, effective_res.height); -- cgit v1.2.3-55-g7522 From 9dff81436d4d8aa252233bd146d882aaa04094e3 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 26 May 2017 12:28:05 -0300 Subject: [media] atomisp2: off by one in atomisp_s_input() The isp->inputs[] array has isp->input_cnt elements which have been initialized so this > should be >=. This bug is harmless. The check against ATOM_ISP_MAX_INPUTS prevents us from reading beyond the end of the array. The uninitialized elements are zeroed out so we will end up returning -EINVAL a few lines later because the .camera pointer is NULL. Signed-off-by: Dan Carpenter Signed-off-by: Alan Cox Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c index 6064bb823a47..aa0526ebaff1 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c @@ -683,7 +683,7 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input) int ret; rt_mutex_lock(&isp->mutex); - if (input >= ATOM_ISP_MAX_INPUTS || input > isp->input_cnt) { + if (input >= ATOM_ISP_MAX_INPUTS || input >= isp->input_cnt) { dev_dbg(isp->dev, "input_cnt: %d\n", isp->input_cnt); ret = -EINVAL; goto error; -- cgit v1.2.3-55-g7522 From 4a2fcc0c91b3d8b12322f7568eb62ce9f97e7bcf Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 26 May 2017 12:28:41 -0300 Subject: [media] atomisp: eliminate dead code under HAS_RES_MGR This define is never set and these code paths are never used so they can go away. Signed-off-by: Alan Cox Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../css2400/isp/modes/interface/isp_const.h | 16 ---------- .../css2400/isp/modes/interface/isp_exprs.h | 23 --------------- .../atomisp2/css2400/runtime/binary/src/binary.c | 34 ---------------------- .../media/atomisp/pci/atomisp2/css2400/sh_css.c | 30 ------------------- 4 files changed, 103 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/isp_const.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/isp_const.h index 005eaaa9eb6c..2f215dc2ac32 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/isp_const.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/isp_const.h @@ -398,17 +398,6 @@ more details. * so the calc for the output buffer vmem size is: * ((width[vectors]/num_of_stripes) + 2[vectors]) */ -#if defined(HAS_RES_MGR) -#define MAX_VECTORS_PER_OUTPUT_LINE \ - (CEIL_DIV(CEIL_DIV(ISP_MAX_OUTPUT_WIDTH, ISP_NUM_STRIPES) + ISP_LEFT_PADDING, ISP_VEC_NELEMS) + \ - ITERATOR_VECTOR_INCREMENT) - -#define MAX_VECTORS_PER_INPUT_LINE CEIL_DIV(ISP_MAX_INPUT_WIDTH, ISP_VEC_NELEMS) -#define MAX_VECTORS_PER_INPUT_STRIPE (CEIL_ROUND_DIV_STRIPE(CEIL_DIV(ISP_MAX_INPUT_WIDTH, ISP_VEC_NELEMS) , \ - ISP_NUM_STRIPES, \ - ISP_LEFT_PADDING_VECS) + \ - ITERATOR_VECTOR_INCREMENT) -#else /* !defined(HAS_RES_MGR)*/ #define MAX_VECTORS_PER_OUTPUT_LINE \ CEIL_DIV(CEIL_DIV(ISP_MAX_OUTPUT_WIDTH, ISP_NUM_STRIPES) + ISP_LEFT_PADDING, ISP_VEC_NELEMS) @@ -417,7 +406,6 @@ more details. #define MAX_VECTORS_PER_INPUT_STRIPE CEIL_ROUND_DIV_STRIPE(MAX_VECTORS_PER_INPUT_LINE, \ ISP_NUM_STRIPES, \ ISP_LEFT_PADDING_VECS) -#endif /* HAS_RES_MGR */ /* Add 2 for left croppping */ @@ -470,15 +458,11 @@ more details. #define RAW_BUF_LINES ((ENABLE_RAW_BINNING || ENABLE_FIXED_BAYER_DS) ? 4 : 2) -#if defined(HAS_RES_MGR) -#define RAW_BUF_STRIDE (MAX_VECTORS_PER_INPUT_STRIPE) -#else /* !defined(HAS_RES_MGR) */ #define RAW_BUF_STRIDE \ (BINARY_ID == SH_CSS_BINARY_ID_POST_ISP ? MAX_VECTORS_PER_INPUT_CHUNK : \ ISP_NUM_STRIPES > 1 ? MAX_VECTORS_PER_INPUT_STRIPE+_ISP_EXTRA_PADDING_VECS : \ !ENABLE_CONTINUOUS ? MAX_VECTORS_PER_INPUT_LINE : \ MAX_VECTORS_PER_INPUT_CHUNK) -#endif /* HAS_RES_MGR */ /* [isp vmem] table size[vectors] per line per color (GR,R,B,GB), multiples of NWAY */ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/isp_exprs.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/isp_exprs.h index 8b59a8caec52..e625ba62cc15 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/isp_exprs.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/isp_exprs.h @@ -214,24 +214,6 @@ more details. /******* STRIPING-RELATED MACROS *******/ #define NO_STRIPING (ISP_NUM_STRIPES == 1) -#if defined(HAS_RES_MGR) - -#define ISP_OUTPUT_CHUNK_VECS ISP_INTERNAL_WIDTH_VECS - -#if defined(__ISP) -#define VECTORS_PER_LINE ISP_INTERNAL_WIDTH_VECS -#else -#define VECTORS_PER_LINE \ - (NO_STRIPING ? ISP_INTERNAL_WIDTH_VECS \ - : ISP_IO_STRIPE_WIDTH_VECS(ISP_INTERNAL_WIDTH_VECS, ISP_LEFT_PADDING_VECS, ISP_NUM_STRIPES, ISP_MIN_STRIPE_WIDTH) ) -#endif - -#define VECTORS_PER_INPUT_LINE \ - (NO_STRIPING ? ISP_INPUT_WIDTH_VECS \ - : ISP_IO_STRIPE_WIDTH_VECS(ISP_INPUT_WIDTH_VECS, ISP_LEFT_PADDING_VECS, ISP_NUM_STRIPES, ISP_MIN_STRIPE_WIDTH) ) - -#else - #define ISP_OUTPUT_CHUNK_VECS \ (NO_STRIPING ? CEIL_DIV_CHUNKS(ISP_OUTPUT_VECS_EXTRA_CROP, OUTPUT_NUM_CHUNKS) \ : ISP_IO_STRIPE_WIDTH_VECS(ISP_OUTPUT_VECS_EXTRA_CROP, ISP_LEFT_PADDING_VECS, ISP_NUM_STRIPES, ISP_MIN_STRIPE_WIDTH) ) @@ -244,7 +226,6 @@ more details. (NO_STRIPING ? ISP_INPUT_WIDTH_VECS \ : ISP_IO_STRIPE_WIDTH_VECS(ISP_INPUT_WIDTH_VECS, ISP_LEFT_PADDING_VECS, ISP_NUM_STRIPES, ISP_MIN_STRIPE_WIDTH)+_ISP_EXTRA_PADDING_VECS) -#endif #define ISP_MAX_VF_OUTPUT_STRIPE_VECS \ (NO_STRIPING ? ISP_MAX_VF_OUTPUT_VECS \ @@ -282,11 +263,7 @@ more details. #define OUTPUT_VECTORS_PER_CHUNK CEIL_DIV_CHUNKS(VECTORS_PER_LINE,OUTPUT_NUM_CHUNKS) /* should be even?? */ -#if !defined(HAS_RES_MGR) #define OUTPUT_C_VECTORS_PER_CHUNK CEIL_DIV(OUTPUT_VECTORS_PER_CHUNK, 2) -#else -#define OUTPUT_C_VECTORS_PER_CHUNK CEIL_DIV(MAX_VECTORS_PER_CHUNK, 2) -#endif #ifndef ISP2401 /**** SCTBL defs *******/ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c index ae0b229c9fb8..9f8a125f0d74 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c @@ -36,10 +36,6 @@ #endif #include "camera/pipe/interface/ia_css_pipe_binarydesc.h" -#if defined(HAS_RES_MGR) -#include -#include -#endif #include "memory_access.h" @@ -110,10 +106,6 @@ ia_css_binary_internal_res(const struct ia_css_frame_info *in_info, internal_res->height = __ISP_INTERNAL_HEIGHT(isp_tmp_internal_height, info->pipeline.top_cropping, binary_dvs_env.height); -#if defined(HAS_RES_MGR) - internal_res->height = (bds_out_info == NULL) ? internal_res->height : bds_out_info->res.height; - internal_res->width = (bds_out_info == NULL) ? internal_res->width: bds_out_info->res.width; -#endif } #ifndef ISP2401 @@ -787,25 +779,6 @@ ia_css_binary_dvs_stat_grid_info( struct ia_css_grid_info *info, struct ia_css_pipe *pipe) { -#if defined(HAS_RES_MGR) - struct ia_css_dvs_stat_grid_info *dvs_stat_info; - unsigned int i; - - assert(binary != NULL); - assert(info != NULL); - dvs_stat_info = &info->dvs_grid.dvs_stat_grid_info; - - if (binary->info->sp.enable.dvs_stats) { - for (i = 0; i < IA_CSS_SKC_DVS_STAT_NUM_OF_LEVELS; i++) { - dvs_stat_info->grd_cfg[i].grd_start.enable = 1; - } - ia_css_dvs_stat_grid_calculate(pipe, dvs_stat_info); - } - else { - memset(dvs_stat_info, 0, sizeof(struct ia_css_dvs_stat_grid_info)); - } - -#endif (void)pipe; sh_css_binary_common_grid_info(binary, info); return; @@ -1087,9 +1060,6 @@ binary_in_frame_padded_width(int in_frame_width, #else /* in other cases, the left padding pixels are always 128 */ nr_of_left_paddings = 2*ISP_VEC_NELEMS; -#endif -#if defined(HAS_RES_MGR) - (void)dvs_env_width; #endif if (need_scaling) { /* In SDV use-case, we need to match left-padding of @@ -1101,9 +1071,7 @@ binary_in_frame_padded_width(int in_frame_width, 2*ISP_VEC_NELEMS); } else { /* Different than before, we do left&right padding. */ -#if !defined(HAS_RES_MGR) /* dvs env is included already */ in_frame_width += dvs_env_width; -#endif rval = CEIL_MUL(in_frame_width + (left_cropping ? nr_of_left_paddings : 0), @@ -1214,10 +1182,8 @@ ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo, binary->in_frame_info.res.width = in_info->res.width + info->pipeline.left_cropping; binary->in_frame_info.res.height = in_info->res.height + info->pipeline.top_cropping; -#if !defined(HAS_RES_MGR) /* dvs env is included already */ binary->in_frame_info.res.width += dvs_env_width; binary->in_frame_info.res.height += dvs_env_height; -#endif binary->in_frame_info.padded_width = binary_in_frame_padded_width(in_info->res.width, diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index 8d44608b39a0..4f3a2ea725ac 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -98,10 +98,6 @@ static int thread_alive; #include "isp/modes/interface/input_buf.isp.h" -#if defined(HAS_RES_MGR) -#include "components/acc_cluster/gen/host/acc_cluster.host.h" -#endif - /* Name of the sp program: should not be built-in */ #define SP_PROG_NAME "sp" /* Size of Refcount List */ @@ -6243,9 +6239,6 @@ static enum ia_css_err load_primary_binaries( capt_ldc_out_info; #else *pipe_vf_out_info; -#endif -#if defined(HAS_RES_MGR) - struct ia_css_frame_info bds_out_info; #endif enum ia_css_err err = IA_CSS_SUCCESS; struct ia_css_capture_settings *mycs; @@ -6368,10 +6361,6 @@ static enum ia_css_err load_primary_binaries( &cas_scaler_descr.out_info[i], &cas_scaler_descr.internal_out_info[i], &cas_scaler_descr.vf_info[i]); -#if defined(HAS_RES_MGR) - bds_out_info.res = pipe->config.bayer_ds_out_res; - yuv_scaler_descr.bds_out_info = &bds_out_info; -#endif err = ia_css_binary_find(&yuv_scaler_descr, &mycs->yuv_scaler_binary[i]); if (err != IA_CSS_SUCCESS) { @@ -6422,10 +6411,6 @@ static enum ia_css_err load_primary_binaries( &capture_pp_descr, &prim_out_info, #endif &capt_pp_out_info, &vf_info); -#if defined(HAS_RES_MGR) - bds_out_info.res = pipe->config.bayer_ds_out_res; - capture_pp_descr.bds_out_info = &bds_out_info; -#endif err = ia_css_binary_find(&capture_pp_descr, &mycs->capture_pp_binary); if (err != IA_CSS_SUCCESS) { @@ -6461,10 +6446,6 @@ static enum ia_css_err load_primary_binaries( if (pipe->enable_viewfinder[IA_CSS_PIPE_OUTPUT_STAGE_0] && (i == mycs->num_primary_stage - 1)) local_vf_info = &vf_info; ia_css_pipe_get_primary_binarydesc(pipe, &prim_descr[i], &prim_in_info, &prim_out_info, local_vf_info, i); -#if defined(HAS_RES_MGR) - bds_out_info.res = pipe->config.bayer_ds_out_res; - prim_descr[i].bds_out_info = &bds_out_info; -#endif err = ia_css_binary_find(&prim_descr[i], &mycs->primary_binary[i]); if (err != IA_CSS_SUCCESS) { IA_CSS_LEAVE_ERR_PRIVATE(err); @@ -6498,10 +6479,6 @@ static enum ia_css_err load_primary_binaries( ia_css_pipe_get_vfpp_binarydesc(pipe, &vf_pp_descr, vf_pp_in_info, pipe_vf_out_info); -#if defined(HAS_RES_MGR) - bds_out_info.res = pipe->config.bayer_ds_out_res; - vf_pp_descr.bds_out_info = &bds_out_info; -#endif err = ia_css_binary_find(&vf_pp_descr, &mycs->vf_pp_binary); if (err != IA_CSS_SUCCESS) { IA_CSS_LEAVE_ERR_PRIVATE(err); @@ -9822,13 +9799,6 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, if (err != IA_CSS_SUCCESS) goto ERR; -#if defined(HAS_RES_MGR) - /* update acc configuration - striping info is ready */ - err = ia_css_update_cfg_stripe_info(curr_pipe); - if (err != IA_CSS_SUCCESS) - goto ERR; -#endif - /* handle each pipe */ pipe_info = &curr_pipe->info; for (j = 0; j < IA_CSS_PIPE_MAX_OUTPUT_STAGE; j++) { -- cgit v1.2.3-55-g7522 From 0ef9e6e5559306079200742ee40f5754672dd498 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 26 May 2017 12:28:55 -0300 Subject: [media] atomisp: unify sh_css_hmm_buffer_record_acquire The ISP2401 version of this function returns a pointer to the buffer, whilst the ISP2400 version returns a boolean if a slot is found. We can trivially unify the code to use the ISP2401 version. Signed-off-by: Alan Cox Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/atomisp/pci/atomisp2/css2400/sh_css.c | 40 ++-------------------- 1 file changed, 3 insertions(+), 37 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index 4f3a2ea725ac..8e1cd1258f08 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -375,13 +375,8 @@ sh_css_hmm_buffer_record_uninit(void); static void sh_css_hmm_buffer_record_reset(struct sh_css_hmm_buffer_record *buffer_record); -#ifndef ISP2401 -static bool -sh_css_hmm_buffer_record_acquire(struct ia_css_rmgr_vbuf_handle *h_vbuf, -#else static struct sh_css_hmm_buffer_record *sh_css_hmm_buffer_record_acquire(struct ia_css_rmgr_vbuf_handle *h_vbuf, -#endif enum ia_css_buffer_type type, hrt_address kernel_ptr); @@ -4423,21 +4418,9 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe, } if (return_err == IA_CSS_SUCCESS) { -#ifndef ISP2401 - bool found_record = false; - found_record = sh_css_hmm_buffer_record_acquire( -#else - struct sh_css_hmm_buffer_record *hmm_buffer_record = NULL; - - hmm_buffer_record = sh_css_hmm_buffer_record_acquire( -#endif - h_vbuf, buf_type, - HOST_ADDRESS(ddr_buffer.kernel_ptr)); -#ifndef ISP2401 - if (found_record == true) { -#else - if (hmm_buffer_record) { -#endif + if (sh_css_hmm_buffer_record_acquire( + h_vbuf, buf_type, + HOST_ADDRESS(ddr_buffer.kernel_ptr))) { IA_CSS_LOG("send vbuf=%p", h_vbuf); } else { return_err = IA_CSS_ERR_INTERNAL_ERROR; @@ -11139,23 +11122,14 @@ sh_css_hmm_buffer_record_reset(struct sh_css_hmm_buffer_record *buffer_record) buffer_record->kernel_ptr = 0; } -#ifndef ISP2401 -static bool -sh_css_hmm_buffer_record_acquire(struct ia_css_rmgr_vbuf_handle *h_vbuf, -#else static struct sh_css_hmm_buffer_record *sh_css_hmm_buffer_record_acquire(struct ia_css_rmgr_vbuf_handle *h_vbuf, -#endif enum ia_css_buffer_type type, hrt_address kernel_ptr) { int i; struct sh_css_hmm_buffer_record *buffer_record = NULL; -#ifndef ISP2401 - bool found_record = false; -#else struct sh_css_hmm_buffer_record *out_buffer_record = NULL; -#endif assert(h_vbuf != NULL); assert((type > IA_CSS_BUFFER_TYPE_INVALID) && (type < IA_CSS_NUM_DYNAMIC_BUFFER_TYPE)); @@ -11168,21 +11142,13 @@ static struct sh_css_hmm_buffer_record buffer_record->type = type; buffer_record->h_vbuf = h_vbuf; buffer_record->kernel_ptr = kernel_ptr; -#ifndef ISP2401 - found_record = true; -#else out_buffer_record = buffer_record; -#endif break; } buffer_record++; } -#ifndef ISP2401 - return found_record; -#else return out_buffer_record; -#endif } static struct sh_css_hmm_buffer_record -- cgit v1.2.3-55-g7522 From b1c056e05b25ba7bf58c9c4f82a767dcfa052f43 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 26 May 2017 12:29:15 -0300 Subject: [media] atomisp: Unify load_preview_binaries for the most part ISP2401 introduced a rather sensible change to cut through the structure spaghetti. Adopt that for the ISP2400 as well. It makes no difference to the actual code other than readability. Signed-off-by: Alan Cox Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/atomisp/pci/atomisp2/css2400/sh_css.c | 40 +--------------------- 1 file changed, 1 insertion(+), 39 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index 8e1cd1258f08..55d2a69f4e92 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -2923,11 +2923,8 @@ load_preview_binaries(struct ia_css_pipe *pipe) #endif /* preview only have 1 output pin now */ struct ia_css_frame_info *pipe_out_info = &pipe->output_info[0]; -#ifdef ISP2401 struct ia_css_preview_settings *mycs = &pipe->pipe_settings.preview; -#endif - IA_CSS_ENTER_PRIVATE(""); assert(pipe != NULL); assert(pipe->stream != NULL); @@ -2939,11 +2936,7 @@ load_preview_binaries(struct ia_css_pipe *pipe) sensor = pipe->stream->config.mode == IA_CSS_INPUT_MODE_SENSOR; #endif -#ifndef ISP2401 - if (pipe->pipe_settings.preview.preview_binary.info) -#else if (mycs->preview_binary.info) -#endif return IA_CSS_SUCCESS; err = ia_css_util_check_input(&pipe->stream->config, false, false); @@ -2996,12 +2989,7 @@ load_preview_binaries(struct ia_css_pipe *pipe) &prev_vf_info); if (err != IA_CSS_SUCCESS) return err; - err = ia_css_binary_find(&preview_descr, -#ifndef ISP2401 - &pipe->pipe_settings.preview.preview_binary); -#else - &mycs->preview_binary); -#endif + err = ia_css_binary_find(&preview_descr, &mycs->preview_binary); if (err != IA_CSS_SUCCESS) return err; @@ -3017,24 +3005,15 @@ load_preview_binaries(struct ia_css_pipe *pipe) #endif /* The vf_pp binary is needed when (further) YUV downscaling is required */ -#ifndef ISP2401 - need_vf_pp |= pipe->pipe_settings.preview.preview_binary.out_frame_info[0].res.width != pipe_out_info->res.width; - need_vf_pp |= pipe->pipe_settings.preview.preview_binary.out_frame_info[0].res.height != pipe_out_info->res.height; -#else need_vf_pp |= mycs->preview_binary.out_frame_info[0].res.width != pipe_out_info->res.width; need_vf_pp |= mycs->preview_binary.out_frame_info[0].res.height != pipe_out_info->res.height; -#endif /* When vf_pp is needed, then the output format of the selected * preview binary must be yuv_line. If this is not the case, * then the preview binary selection is done again. */ if (need_vf_pp && -#ifndef ISP2401 - (pipe->pipe_settings.preview.preview_binary.out_frame_info[0].format != IA_CSS_FRAME_FORMAT_YUV_LINE)) { -#else (mycs->preview_binary.out_frame_info[0].format != IA_CSS_FRAME_FORMAT_YUV_LINE)) { -#endif /* Preview step 2 */ if (pipe->vf_yuv_ds_input_info.res.width) @@ -3055,11 +3034,7 @@ load_preview_binaries(struct ia_css_pipe *pipe) if (err != IA_CSS_SUCCESS) return err; err = ia_css_binary_find(&preview_descr, -#ifndef ISP2401 - &pipe->pipe_settings.preview.preview_binary); -#else &mycs->preview_binary); -#endif if (err != IA_CSS_SUCCESS) return err; } @@ -3069,18 +3044,10 @@ load_preview_binaries(struct ia_css_pipe *pipe) /* Viewfinder post-processing */ ia_css_pipe_get_vfpp_binarydesc(pipe, &vf_pp_descr, -#ifndef ISP2401 - &pipe->pipe_settings.preview.preview_binary.out_frame_info[0], -#else &mycs->preview_binary.out_frame_info[0], -#endif pipe_out_info); err = ia_css_binary_find(&vf_pp_descr, -#ifndef ISP2401 - &pipe->pipe_settings.preview.vf_pp_binary); -#else &mycs->vf_pp_binary); -#endif if (err != IA_CSS_SUCCESS) return err; } @@ -3106,13 +3073,8 @@ load_preview_binaries(struct ia_css_pipe *pipe) /* Copy */ if (need_isp_copy_binary) { err = load_copy_binary(pipe, -#ifndef ISP2401 - &pipe->pipe_settings.preview.copy_binary, - &pipe->pipe_settings.preview.preview_binary); -#else &mycs->copy_binary, &mycs->preview_binary); -#endif if (err != IA_CSS_SUCCESS) return err; } -- cgit v1.2.3-55-g7522 From 29a323ea90c900aaa9794e567b8d616580ac82ec Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 26 May 2017 12:29:25 -0300 Subject: [media] atomisp: Unify lut free logic ISP2401 introduced a helper for this which we can use just as well on the ISP2400 and remove some more noise differences. Signed-off-by: Alan Cox Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../staging/media/atomisp/pci/atomisp2/css2400/sh_css.c | 7 ------- .../media/atomisp/pci/atomisp2/css2400/sh_css_params.c | 14 -------------- 2 files changed, 21 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index 55d2a69f4e92..dfef219c4bef 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -2533,15 +2533,8 @@ ia_css_pipe_destroy(struct ia_css_pipe *pipe) break; } -#ifndef ISP2401 - if (pipe->scaler_pp_lut != mmgr_NULL) { - hmm_free(pipe->scaler_pp_lut); - pipe->scaler_pp_lut = mmgr_NULL; - } -#else sh_css_params_free_gdc_lut(pipe->scaler_pp_lut); pipe->scaler_pp_lut = mmgr_NULL; -#endif my_css.active_pipes[ia_css_pipe_get_pipe_num(pipe)] = NULL; sh_css_pipe_free_shading_table(pipe); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c index d8c22e8cd3af..48224370b8bf 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c @@ -3356,15 +3356,8 @@ enum ia_css_err ia_css_pipe_set_bci_scaler_lut(struct ia_css_pipe *pipe, } /* Free any existing tables. */ -#ifndef ISP2401 - if (pipe->scaler_pp_lut != mmgr_NULL) { - hmm_free(pipe->scaler_pp_lut); - pipe->scaler_pp_lut = mmgr_NULL; - } -#else sh_css_params_free_gdc_lut(pipe->scaler_pp_lut); pipe->scaler_pp_lut = mmgr_NULL; -#endif #ifndef ISP2401 if (store) { @@ -3445,15 +3438,8 @@ void sh_css_params_free_default_gdc_lut(void) { IA_CSS_ENTER_PRIVATE("void"); -#ifndef ISP2401 - if (default_gdc_lut != mmgr_NULL) { - hmm_free(default_gdc_lut); - default_gdc_lut = mmgr_NULL; - } -#else sh_css_params_free_gdc_lut(default_gdc_lut); default_gdc_lut = mmgr_NULL; -#endif IA_CSS_LEAVE_PRIVATE("void"); -- cgit v1.2.3-55-g7522 From 4950cfecd109735390c058e18adc5bd5bc38847e Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 26 May 2017 12:29:36 -0300 Subject: [media] atomisp: remove sh_css_irq - it contains nothing We won't be adding abstractions or moving them here so kill it. Signed-off-by: Alan Cox Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp2/Makefile | 1 - .../media/atomisp/pci/atomisp2/css2400/sh_css_irq.c | 16 ---------------- 2 files changed, 17 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_irq.c (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/Makefile b/drivers/staging/media/atomisp/pci/atomisp2/Makefile index 68a9ab1c3b61..726eaa293c55 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/Makefile +++ b/drivers/staging/media/atomisp/pci/atomisp2/Makefile @@ -108,7 +108,6 @@ atomisp-objs += \ css2400/sh_css_metadata.o \ css2400/base/refcount/src/refcount.o \ css2400/base/circbuf/src/circbuf.o \ - css2400/sh_css_irq.o \ css2400/camera/pipe/src/pipe_binarydesc.o \ css2400/camera/pipe/src/pipe_util.o \ css2400/camera/pipe/src/pipe_stagedesc.o \ diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_irq.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_irq.c deleted file mode 100644 index 37e954aea36f..000000000000 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_irq.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - -/* This file will contain the code to implement the functions declared in ia_css_irq.h - and associated helper functions */ -- cgit v1.2.3-55-g7522 From fc993494134bfa76084529dda99ea8fcf23bec73 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 26 May 2017 12:29:48 -0300 Subject: [media] atomisp: de-duplicate sh_css_mmu_set_page_table_base_index Between the ISP2400 and ISP2401 code base this function moved file. The merge of the drivers left us with two version in ifdefs. Resolve this down to a single copy. Signed-off-by: Alan Cox Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../pci/atomisp2/css2400/ia_css_mmu_private.h | 2 -- .../media/atomisp/pci/atomisp2/css2400/sh_css.c | 24 +--------------------- .../atomisp/pci/atomisp2/css2400/sh_css_mmu.c | 6 ------ 3 files changed, 1 insertion(+), 31 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mmu_private.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mmu_private.h index 7c8500903b5c..1021e4f380a5 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mmu_private.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mmu_private.h @@ -1,4 +1,3 @@ -#ifdef ISP2401 /* * Support for Intel Camera Imaging ISP subsystem. * Copyright (c) 2015, Intel Corporation. @@ -28,4 +27,3 @@ void sh_css_mmu_set_page_table_base_index(hrt_data base_index); #endif /* __IA_CSS_MMU_PRIVATE_H */ -#endif diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c index dfef219c4bef..471f2be974e2 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c @@ -64,7 +64,7 @@ #include "input_system.h" #endif #include "mmu_device.h" /* mmu_set_page_table_base_index(), ... */ -//#include "ia_css_mmu_private.h" /* sh_css_mmu_set_page_table_base_index() */ +#include "ia_css_mmu_private.h" /* sh_css_mmu_set_page_table_base_index() */ #include "gdc_device.h" /* HRT_GDC_N */ #include "dma.h" /* dma_set_max_burst_size() */ #include "irq.h" /* virq */ @@ -242,11 +242,6 @@ ia_css_reset_defaults(struct sh_css* css); static void sh_css_init_host_sp_control_vars(void); -#ifndef ISP2401 -static void -sh_css_mmu_set_page_table_base_index(hrt_data base_index); - -#endif static enum ia_css_err set_num_primary_stages(unsigned int *num, enum ia_css_pipe_version version); static bool @@ -2595,23 +2590,6 @@ ia_css_uninit(void) ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_uninit() leave: return_void\n"); } -#ifndef ISP2401 -/* Deprecated, this is an HRT backend function (memory_access.h) */ -static void -sh_css_mmu_set_page_table_base_index(hrt_data base_index) -{ - int i; - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "sh_css_mmu_set_page_table_base_index() enter: base_index=0x%08x\n",base_index); - my_css.page_table_base_index = base_index; - for (i = 0; i < (int)N_MMU_ID; i++) { - mmu_ID_t mmu_id = (mmu_ID_t)i; - mmu_set_page_table_base_index(mmu_id, base_index); - mmu_invalidate_cache(mmu_id); - } - ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "sh_css_mmu_set_page_table_base_index() leave: return_void\n"); -} - -#endif #if defined(HAS_IRQ_MAP_VERSION_2) enum ia_css_err ia_css_irq_translate( unsigned int *irq_infos) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mmu.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mmu.c index 6de8472f1b07..237e38b2f0c1 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mmu.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mmu.c @@ -13,16 +13,12 @@ */ #include "ia_css_mmu.h" -#ifdef ISP2401 #include "ia_css_mmu_private.h" -#endif #include #include "sh_css_sp.h" #include "sh_css_firmware.h" #include "sp.h" -#ifdef ISP2401 #include "mmu_device.h" -#endif void ia_css_mmu_invalidate_cache(void) @@ -44,7 +40,6 @@ ia_css_mmu_invalidate_cache(void) } ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_mmu_invalidate_cache() leave\n"); } -#ifdef ISP2401 /* Deprecated, this is an HRT backend function (memory_access.h) */ void @@ -59,4 +54,3 @@ sh_css_mmu_set_page_table_base_index(hrt_data base_index) } IA_CSS_LEAVE_PRIVATE(""); } -#endif -- cgit v1.2.3-55-g7522 From 008d8e10054b3548cf9781083c26809486d7c07c Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 28 May 2017 09:31:47 -0300 Subject: [media] staging: atomisp: Fix calling efivar_entry_get() with unaligned arguments efivar_entry_get has certain alignment requirements and the atomisp platform code was not honoring these, causing an oops by triggering the WARN_ON in arch/x86/platform/efi/efi_64.c: virt_to_phys_or_null_size(). This commit fixes this by using the members of the efivar struct embedded in the efivar_entry struct we kzalloc as arguments to efivar_entry_get(), which is how all the other callers of efivar_entry_get() do this. Signed-off-by: Hans de Goede Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../atomisp/platform/intel-mid/atomisp_gmin_platform.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c index d68e9cf33aa7..fe996d0cb71c 100644 --- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c @@ -635,9 +635,7 @@ int gmin_get_config_var(struct device *dev, const char *var, char *out, char var8[CFG_VAR_NAME_MAX]; efi_char16_t var16[CFG_VAR_NAME_MAX]; struct efivar_entry *ev; - u32 efiattr_dummy; int i, j, ret; - unsigned long efilen; if (dev && ACPI_COMPANION(dev)) dev = &ACPI_COMPANION(dev)->dev; @@ -699,15 +697,18 @@ int gmin_get_config_var(struct device *dev, const char *var, char *out, return -ENOMEM; memcpy(&ev->var.VariableName, var16, sizeof(var16)); ev->var.VendorGuid = GMIN_CFG_VAR_EFI_GUID; + ev->var.DataSize = *out_len; - efilen = *out_len; - ret = efivar_entry_get(ev, &efiattr_dummy, &efilen, out); + ret = efivar_entry_get(ev, &ev->var.Attributes, + &ev->var.DataSize, ev->var.Data); + if (ret == 0) { + memcpy(out, ev->var.Data, ev->var.DataSize); + *out_len = ev->var.DataSize; + } else { + dev_warn(dev, "Failed to find gmin variable %s\n", var8); + } kfree(ev); - *out_len = efilen; - - if (ret) - dev_warn(dev, "Failed to find gmin variable %s\n", var8); return ret; } -- cgit v1.2.3-55-g7522 From 797f91e6417abcc9a07f9c99dd9128ae7622ee81 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 28 May 2017 09:31:48 -0300 Subject: [media] staging: atomisp: Do not call dev_warn with a NULL device Do not call dev_warn with a NULL device, this silence the following 2 warnings: [ 14.392194] (NULL device *): Failed to find gmin variable gmin_V2P8GPIO [ 14.392257] (NULL device *): Failed to find gmin variable gmin_V1P8GPIO We could switch to using pr_warn for dev == NULL instead, but as comments in the source indicate, the check for these 2 special gmin variables with a NULL device is a workaround for 2 specific evaluation boards, so completely silencing the missing warning for these actually is a good thing. Signed-off-by: Hans de Goede Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c index fe996d0cb71c..edaae93af8f9 100644 --- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c @@ -704,7 +704,7 @@ int gmin_get_config_var(struct device *dev, const char *var, char *out, if (ret == 0) { memcpy(out, ev->var.Data, ev->var.DataSize); *out_len = ev->var.DataSize; - } else { + } else if (dev) { dev_warn(dev, "Failed to find gmin variable %s\n", var8); } -- cgit v1.2.3-55-g7522 From 42c6d864acaede779a4e44f8ce8d23c1012a1e64 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 28 May 2017 09:31:49 -0300 Subject: [media] staging: atomisp: Set step to 0 for mt9m114 menu control menu controls are not allowed to have a step size, set step to 0 to fix an oops from the WARN_ON in v4l2_ctrl_new_custom() triggering because of this. Signed-off-by: Hans de Goede Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/i2c/mt9m114.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/i2c/mt9m114.c b/drivers/staging/media/atomisp/i2c/mt9m114.c index ced175c268d1..3fa915313e53 100644 --- a/drivers/staging/media/atomisp/i2c/mt9m114.c +++ b/drivers/staging/media/atomisp/i2c/mt9m114.c @@ -1499,7 +1499,7 @@ static struct v4l2_ctrl_config mt9m114_controls[] = { .type = V4L2_CTRL_TYPE_MENU, .min = 0, .max = 3, - .step = 1, + .step = 0, .def = 1, .flags = 0, }, -- cgit v1.2.3-55-g7522 From 6706e9008dc6df4093deff12f93a1072708e0aef Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 28 May 2017 09:31:50 -0300 Subject: [media] staging: atomisp: Add INT0310 ACPI id to gc0310 driver Add INT0310 ACPI id to gc0310 driver Signed-off-by: Hans de Goede Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/i2c/gc0310.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/i2c/gc0310.c b/drivers/staging/media/atomisp/i2c/gc0310.c index 1ec616a15086..350fd7fd5b86 100644 --- a/drivers/staging/media/atomisp/i2c/gc0310.c +++ b/drivers/staging/media/atomisp/i2c/gc0310.c @@ -1455,6 +1455,7 @@ out_free: static struct acpi_device_id gc0310_acpi_match[] = { {"XXGC0310"}, + {"INT0310"}, {}, }; -- cgit v1.2.3-55-g7522 From 22b2807dae2c79eb9f75a5c0e4cdfd418fd14fcf Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 28 May 2017 09:31:51 -0300 Subject: [media] staging: atomisp: Add OVTI2680 ACPI id to ov2680 driver Add OVTI2680 ACPI id to ov2680 driver Signed-off-by: Hans de Goede Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/i2c/ov2680.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/i2c/ov2680.c b/drivers/staging/media/atomisp/i2c/ov2680.c index 566091035c64..449aa2aa276f 100644 --- a/drivers/staging/media/atomisp/i2c/ov2680.c +++ b/drivers/staging/media/atomisp/i2c/ov2680.c @@ -1521,6 +1521,7 @@ out_free: static struct acpi_device_id ov2680_acpi_match[] = { {"XXOV2680"}, + {"OVTI2680"}, {}, }; MODULE_DEVICE_TABLE(acpi, ov2680_acpi_match); -- cgit v1.2.3-55-g7522 From da3e18059be96c67365e63e4d1e3f301d802c3c8 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 28 May 2017 09:31:52 -0300 Subject: [media] staging: atomisp: Ignore errors from second gpio in ov2680 driver As the existing comment in the driver indicates the sensor has only 1 pin, but some boards may have 2 gpios defined and we toggle both as we we don't know which one is the right one. However if the ACPI resources table defines only 1 gpio (as expected) the gpio1_ctrl call will always fail, causing the probing of the driver to file. This commit ignore the return value of the gpio1_ctrl call, fixing this. Signed-off-by: Hans de Goede Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/i2c/ov2680.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/i2c/ov2680.c b/drivers/staging/media/atomisp/i2c/ov2680.c index 449aa2aa276f..6dd466558701 100644 --- a/drivers/staging/media/atomisp/i2c/ov2680.c +++ b/drivers/staging/media/atomisp/i2c/ov2680.c @@ -885,11 +885,12 @@ static int gpio_ctrl(struct v4l2_subdev *sd, bool flag) if (flag) { ret = dev->platform_data->gpio0_ctrl(sd, 1); usleep_range(10000, 15000); - ret |= dev->platform_data->gpio1_ctrl(sd, 1); + /* Ignore return from second gpio, it may not be there */ + dev->platform_data->gpio1_ctrl(sd, 1); usleep_range(10000, 15000); } else { - ret = dev->platform_data->gpio1_ctrl(sd, 0); - ret |= dev->platform_data->gpio0_ctrl(sd, 0); + dev->platform_data->gpio1_ctrl(sd, 0); + ret = dev->platform_data->gpio0_ctrl(sd, 0); } return ret; } -- cgit v1.2.3-55-g7522 From ef14aa3bc1564f714b4e30bea78762b29516cc48 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 28 May 2017 09:31:53 -0300 Subject: [media] staging: atomisp: Make ov2680 driver less chatty There is no reason for all this printk spamming and certainly not at an error log level. Signed-off-by: Hans de Goede Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/i2c/ov2680.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/i2c/ov2680.c b/drivers/staging/media/atomisp/i2c/ov2680.c index 6dd466558701..3cabfe54c669 100644 --- a/drivers/staging/media/atomisp/i2c/ov2680.c +++ b/drivers/staging/media/atomisp/i2c/ov2680.c @@ -1191,9 +1191,8 @@ static int ov2680_detect(struct i2c_client *client) OV2680_SC_CMMN_SUB_ID, &high); revision = (u8) high & 0x0f; - dev_err(&client->dev, "sensor_revision id = 0x%x\n", id); - dev_err(&client->dev, "detect ov2680 success\n"); - dev_err(&client->dev, "################5##########\n"); + dev_info(&client->dev, "sensor_revision id = 0x%x\n", id); + return 0; } @@ -1448,8 +1447,6 @@ static int ov2680_probe(struct i2c_client *client, void *pdata; unsigned int i; - printk("++++ov2680_probe++++\n"); - dev_info(&client->dev, "++++ov2680_probe++++\n"); dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) { dev_err(&client->dev, "out of memory\n"); -- cgit v1.2.3-55-g7522 From f1e627a41db14a4bb7bb5ee39486528121ed11c2 Mon Sep 17 00:00:00 2001 From: Chen Guanqiao Date: Sun, 28 May 2017 15:06:41 -0300 Subject: [media] staging: atomisp: lm3554: fix sparse warnings(was not declared. Should it be static?) Fix "symbol 'xxxxxxx' was not declared. Should it be static?" sparse warnings. Signed-off-by: Chen Guanqiao Reviewed-by: Alan Cox Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/i2c/lm3554.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/i2c/lm3554.c b/drivers/staging/media/atomisp/i2c/lm3554.c index dd9c9c3ffff7..2b170c07aaba 100644 --- a/drivers/staging/media/atomisp/i2c/lm3554.c +++ b/drivers/staging/media/atomisp/i2c/lm3554.c @@ -497,7 +497,7 @@ static const struct v4l2_ctrl_ops ctrl_ops = { .g_volatile_ctrl = lm3554_g_volatile_ctrl }; -struct v4l2_ctrl_config lm3554_controls[] = { +static const struct v4l2_ctrl_config lm3554_controls[] = { { .ops = &ctrl_ops, .id = V4L2_CID_FLASH_TIMEOUT, @@ -825,7 +825,7 @@ static int lm3554_gpio_uninit(struct i2c_client *client) return 0; } -void *lm3554_platform_data_func(struct i2c_client *client) +static void *lm3554_platform_data_func(struct i2c_client *client) { static struct lm3554_platform_data platform_data; -- cgit v1.2.3-55-g7522 From af822177d614f985cb89dcf6e505e2d76a3f3683 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 2 Jun 2017 17:04:23 -0300 Subject: [media] staging: atomisp: Fix endless recursion in hmm_init hmm_init calls hmm_alloc to set dummy_ptr, hmm_alloc calls hmm_init when dummy_ptr is not yet set, which is the case in the call from hmm_init, so it calls hmm_init again, this continues until we have a stack overflow due to the recursion. This commit fixes this by adding a separate flag for tracking if hmm_init has been called. Not pretty, but it gets the job done, eventually we should be able to remove the hmm_init call from hmm_alloc. Signed-off-by: Hans de Goede Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c index 5e63073f3581..05eeff58a229 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c @@ -43,6 +43,7 @@ struct hmm_bo_device bo_device; struct hmm_pool dynamic_pool; struct hmm_pool reserved_pool; static ia_css_ptr dummy_ptr; +static bool hmm_initialized; struct _hmm_mem_stat hmm_mem_stat; /* p: private @@ -186,6 +187,8 @@ int hmm_init(void) if (ret) dev_err(atomisp_dev, "hmm_bo_device_init failed.\n"); + hmm_initialized = true; + /* * As hmm use NULL to indicate invalid ISP virtual address, * and ISP_VM_START is defined to 0 too, so we allocate @@ -217,6 +220,7 @@ void hmm_cleanup(void) dummy_ptr = 0; hmm_bo_device_exit(&bo_device); + hmm_initialized = false; } ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type, @@ -229,7 +233,7 @@ ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type, /* Check if we are initialized. In the ideal world we wouldn't need this but we can tackle it once the driver is a lot cleaner */ - if (!dummy_ptr) + if (!hmm_initialized) hmm_init(); /*Get page number from size*/ pgnr = size_to_pgnr_ceil(bytes); -- cgit v1.2.3-55-g7522 From 703ecba4dbfb8de9cad7420021dfcbd11007de3b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Jun 2017 12:34:44 -0300 Subject: [media] staging: css2400/Makefile: don't include non-existing files The atomisp css2400/Makefile includes a Makefile.common: include $(srctree)/$(src)/../Makefile.common Well, this file doesn't exist at the Kernel tree :-) So, don't include it. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp2/css2400/Makefile | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/Makefile b/drivers/staging/media/atomisp/pci/atomisp2/css2400/Makefile index 04defaafa02c..ee5631b0e635 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/Makefile +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/Makefile @@ -1,4 +1,2 @@ ccflags-y += -DISP2400B0 ISP2400B0 := y - -include $(srctree)/$(src)/../Makefile.common -- cgit v1.2.3-55-g7522 From acc490bbb7f9958530506f10adce75c8818b6a96 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Jun 2017 13:29:21 -0300 Subject: [media] atomisp: use correct dialect to disable warnings There's a Macro that checks if gcc supports a warning before disabling it. Use it, in order to avoid warnings when building with older gcc versions. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/i2c/Makefile | 6 ++++-- drivers/staging/media/atomisp/i2c/imx/Makefile | 6 ++++-- drivers/staging/media/atomisp/i2c/ov5693/Makefile | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/i2c/Makefile b/drivers/staging/media/atomisp/i2c/Makefile index a1afca6ec31f..be13fab92175 100644 --- a/drivers/staging/media/atomisp/i2c/Makefile +++ b/drivers/staging/media/atomisp/i2c/Makefile @@ -21,5 +21,7 @@ obj-$(CONFIG_VIDEO_LM3554) += lm3554.o # HACK! While this driver is in bad shape, don't enable several warnings # that would be otherwise enabled with W=1 -ccflags-y += -Wno-unused-but-set-variable -Wno-missing-prototypes \ - -Wno-unused-const-variable -Wno-missing-declarations +ccflags-y += $(call cc-disable-warning, unused-but-set-variable) +ccflags-y += $(call cc-disable-warning, unused-const-variable) +ccflags-y += $(call cc-disable-warning, missing-prototypes) +ccflags-y += $(call cc-disable-warning, missing-declarations) diff --git a/drivers/staging/media/atomisp/i2c/imx/Makefile b/drivers/staging/media/atomisp/i2c/imx/Makefile index 0eceb7374bec..b6578f09546e 100644 --- a/drivers/staging/media/atomisp/i2c/imx/Makefile +++ b/drivers/staging/media/atomisp/i2c/imx/Makefile @@ -7,5 +7,7 @@ obj-$(CONFIG_VIDEO_OV8858) += ov8858_driver.o # HACK! While this driver is in bad shape, don't enable several warnings # that would be otherwise enabled with W=1 -ccflags-y += -Wno-unused-but-set-variable -Wno-missing-prototypes \ - -Wno-unused-const-variable -Wno-missing-declarations +ccflags-y += $(call cc-disable-warning, unused-but-set-variable) +ccflags-y += $(call cc-disable-warning, unused-const-variable) +ccflags-y += $(call cc-disable-warning, missing-prototypes) +ccflags-y += $(call cc-disable-warning, missing-declarations) diff --git a/drivers/staging/media/atomisp/i2c/ov5693/Makefile b/drivers/staging/media/atomisp/i2c/ov5693/Makefile index fd2ef2e3c31e..4e3833aaec05 100644 --- a/drivers/staging/media/atomisp/i2c/ov5693/Makefile +++ b/drivers/staging/media/atomisp/i2c/ov5693/Makefile @@ -2,5 +2,7 @@ obj-$(CONFIG_VIDEO_OV5693) += ov5693.o # HACK! While this driver is in bad shape, don't enable several warnings # that would be otherwise enabled with W=1 -ccflags-y += -Wno-unused-but-set-variable -Wno-missing-prototypes \ - -Wno-unused-const-variable -Wno-missing-declarations +ccflags-y += $(call cc-disable-warning, unused-but-set-variable) +ccflags-y += $(call cc-disable-warning, unused-const-variable) +ccflags-y += $(call cc-disable-warning, missing-prototypes) +ccflags-y += $(call cc-disable-warning, missing-declarations) -- cgit v1.2.3-55-g7522 From e130291212df5ce8160cd2e35387c96439863ad3 Mon Sep 17 00:00:00 2001 From: Steve Longerbeam Date: Sat, 10 Jun 2017 16:00:29 -0300 Subject: [media] media: Add i.MX media core driver Add the core media driver for i.MX SOC. Switch from the v4l2_of_ APIs to the v4l2_fwnode_ APIs. Add the bayer formats to imx-media's list of supported pixel and bus formats. Signed-off-by: Steve Longerbeam Signed-off-by: Philipp Zabel Signed-off-by: Russell King Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/media/v4l-drivers/imx.rst | 614 ++++++++++++++++ drivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile | 1 + drivers/staging/media/imx/Kconfig | 7 + drivers/staging/media/imx/Makefile | 5 + drivers/staging/media/imx/imx-media-dev.c | 667 +++++++++++++++++ drivers/staging/media/imx/imx-media-fim.c | 494 +++++++++++++ drivers/staging/media/imx/imx-media-internal-sd.c | 349 +++++++++ drivers/staging/media/imx/imx-media-of.c | 270 +++++++ drivers/staging/media/imx/imx-media-utils.c | 834 ++++++++++++++++++++++ drivers/staging/media/imx/imx-media.h | 323 +++++++++ include/media/imx.h | 15 + include/uapi/linux/v4l2-controls.h | 4 + 13 files changed, 3585 insertions(+) create mode 100644 Documentation/media/v4l-drivers/imx.rst create mode 100644 drivers/staging/media/imx/Kconfig create mode 100644 drivers/staging/media/imx/Makefile create mode 100644 drivers/staging/media/imx/imx-media-dev.c create mode 100644 drivers/staging/media/imx/imx-media-fim.c create mode 100644 drivers/staging/media/imx/imx-media-internal-sd.c create mode 100644 drivers/staging/media/imx/imx-media-of.c create mode 100644 drivers/staging/media/imx/imx-media-utils.c create mode 100644 drivers/staging/media/imx/imx-media.h create mode 100644 include/media/imx.h (limited to 'drivers/staging') diff --git a/Documentation/media/v4l-drivers/imx.rst b/Documentation/media/v4l-drivers/imx.rst new file mode 100644 index 000000000000..e0ee0f1aeb05 --- /dev/null +++ b/Documentation/media/v4l-drivers/imx.rst @@ -0,0 +1,614 @@ +i.MX Video Capture Driver +========================= + +Introduction +------------ + +The Freescale i.MX5/6 contains an Image Processing Unit (IPU), which +handles the flow of image frames to and from capture devices and +display devices. + +For image capture, the IPU contains the following internal subunits: + +- Image DMA Controller (IDMAC) +- Camera Serial Interface (CSI) +- Image Converter (IC) +- Sensor Multi-FIFO Controller (SMFC) +- Image Rotator (IRT) +- Video De-Interlacing or Combining Block (VDIC) + +The IDMAC is the DMA controller for transfer of image frames to and from +memory. Various dedicated DMA channels exist for both video capture and +display paths. During transfer, the IDMAC is also capable of vertical +image flip, 8x8 block transfer (see IRT description), pixel component +re-ordering (for example UYVY to YUYV) within the same colorspace, and +even packed <--> planar conversion. It can also perform a simple +de-interlacing by interleaving even and odd lines during transfer +(without motion compensation which requires the VDIC). + +The CSI is the backend capture unit that interfaces directly with +camera sensors over Parallel, BT.656/1120, and MIPI CSI-2 busses. + +The IC handles color-space conversion, resizing (downscaling and +upscaling), horizontal flip, and 90/270 degree rotation operations. + +There are three independent "tasks" within the IC that can carry out +conversions concurrently: pre-process encoding, pre-process viewfinder, +and post-processing. Within each task, conversions are split into three +sections: downsizing section, main section (upsizing, flip, colorspace +conversion, and graphics plane combining), and rotation section. + +The IPU time-shares the IC task operations. The time-slice granularity +is one burst of eight pixels in the downsizing section, one image line +in the main processing section, one image frame in the rotation section. + +The SMFC is composed of four independent FIFOs that each can transfer +captured frames from sensors directly to memory concurrently via four +IDMAC channels. + +The IRT carries out 90 and 270 degree image rotation operations. The +rotation operation is carried out on 8x8 pixel blocks at a time. This +operation is supported by the IDMAC which handles the 8x8 block transfer +along with block reordering, in coordination with vertical flip. + +The VDIC handles the conversion of interlaced video to progressive, with +support for different motion compensation modes (low, medium, and high +motion). The deinterlaced output frames from the VDIC can be sent to the +IC pre-process viewfinder task for further conversions. The VDIC also +contains a Combiner that combines two image planes, with alpha blending +and color keying. + +In addition to the IPU internal subunits, there are also two units +outside the IPU that are also involved in video capture on i.MX: + +- MIPI CSI-2 Receiver for camera sensors with the MIPI CSI-2 bus + interface. This is a Synopsys DesignWare core. +- Two video multiplexers for selecting among multiple sensor inputs + to send to a CSI. + +For more info, refer to the latest versions of the i.MX5/6 reference +manuals [#f1]_ and [#f2]_. + + +Features +-------- + +Some of the features of this driver include: + +- Many different pipelines can be configured via media controller API, + that correspond to the hardware video capture pipelines supported in + the i.MX. + +- Supports parallel, BT.565, and MIPI CSI-2 interfaces. + +- Concurrent independent streams, by configuring pipelines to multiple + video capture interfaces using independent entities. + +- Scaling, color-space conversion, horizontal and vertical flip, and + image rotation via IC task subdevs. + +- Many pixel formats supported (RGB, packed and planar YUV, partial + planar YUV). + +- The VDIC subdev supports motion compensated de-interlacing, with three + motion compensation modes: low, medium, and high motion. Pipelines are + defined that allow sending frames to the VDIC subdev directly from the + CSI. There is also support in the future for sending frames to the + VDIC from memory buffers via a output/mem2mem devices. + +- Includes a Frame Interval Monitor (FIM) that can correct vertical sync + problems with the ADV718x video decoders. + + +Entities +-------- + +imx6-mipi-csi2 +-------------- + +This is the MIPI CSI-2 receiver entity. It has one sink pad to receive +the MIPI CSI-2 stream (usually from a MIPI CSI-2 camera sensor). It has +four source pads, corresponding to the four MIPI CSI-2 demuxed virtual +channel outputs. Multpiple source pads can be enabled to independently +stream from multiple virtual channels. + +This entity actually consists of two sub-blocks. One is the MIPI CSI-2 +core. This is a Synopsys Designware MIPI CSI-2 core. The other sub-block +is a "CSI-2 to IPU gasket". The gasket acts as a demultiplexer of the +four virtual channels streams, providing four separate parallel buses +containing each virtual channel that are routed to CSIs or video +multiplexers as described below. + +On i.MX6 solo/dual-lite, all four virtual channel buses are routed to +two video multiplexers. Both CSI0 and CSI1 can receive any virtual +channel, as selected by the video multiplexers. + +On i.MX6 Quad, virtual channel 0 is routed to IPU1-CSI0 (after selected +by a video mux), virtual channels 1 and 2 are hard-wired to IPU1-CSI1 +and IPU2-CSI0, respectively, and virtual channel 3 is routed to +IPU2-CSI1 (again selected by a video mux). + +ipuX_csiY_mux +------------- + +These are the video multiplexers. They have two or more sink pads to +select from either camera sensors with a parallel interface, or from +MIPI CSI-2 virtual channels from imx6-mipi-csi2 entity. They have a +single source pad that routes to a CSI (ipuX_csiY entities). + +On i.MX6 solo/dual-lite, there are two video mux entities. One sits +in front of IPU1-CSI0 to select between a parallel sensor and any of +the four MIPI CSI-2 virtual channels (a total of five sink pads). The +other mux sits in front of IPU1-CSI1, and again has five sink pads to +select between a parallel sensor and any of the four MIPI CSI-2 virtual +channels. + +On i.MX6 Quad, there are two video mux entities. One sits in front of +IPU1-CSI0 to select between a parallel sensor and MIPI CSI-2 virtual +channel 0 (two sink pads). The other mux sits in front of IPU2-CSI1 to +select between a parallel sensor and MIPI CSI-2 virtual channel 3 (two +sink pads). + +ipuX_csiY +--------- + +These are the CSI entities. They have a single sink pad receiving from +either a video mux or from a MIPI CSI-2 virtual channel as described +above. + +This entity has two source pads. The first source pad can link directly +to the ipuX_vdic entity or the ipuX_ic_prp entity, using hardware links +that require no IDMAC memory buffer transfer. + +When the direct source pad is routed to the ipuX_ic_prp entity, frames +from the CSI can be processed by one or both of the IC pre-processing +tasks. + +When the direct source pad is routed to the ipuX_vdic entity, the VDIC +will carry out motion-compensated de-interlace using "high motion" mode +(see description of ipuX_vdic entity). + +The second source pad sends video frames directly to memory buffers +via the SMFC and an IDMAC channel, bypassing IC pre-processing. This +source pad is routed to a capture device node, with a node name of the +format "ipuX_csiY capture". + +Note that since the IDMAC source pad makes use of an IDMAC channel, it +can do pixel reordering within the same colorspace. For example, the +sink pad can take UYVY2X8, but the IDMAC source pad can output YUYV2X8. +If the sink pad is receiving YUV, the output at the capture device can +also be converted to a planar YUV format such as YUV420. + +It will also perform simple de-interlace without motion compensation, +which is activated if the sink pad's field type is an interlaced type, +and the IDMAC source pad field type is set to none. + +This subdev can generate the following event when enabling the second +IDMAC source pad: + +- V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR + +The user application can subscribe to this event from the ipuX_csiY +subdev node. This event is generated by the Frame Interval Monitor +(see below for more on the FIM). + +Cropping in ipuX_csiY +--------------------- + +The CSI supports cropping the incoming raw sensor frames. This is +implemented in the ipuX_csiY entities at the sink pad, using the +crop selection subdev API. + +The CSI also supports fixed divide-by-two downscaling indepently in +width and height. This is implemented in the ipuX_csiY entities at +the sink pad, using the compose selection subdev API. + +The output rectangle at the ipuX_csiY source pad is the same as +the compose rectangle at the sink pad. So the source pad rectangle +cannot be negotiated, it must be set using the compose selection +API at sink pad (if /2 downscale is desired, otherwise source pad +rectangle is equal to incoming rectangle). + +To give an example of crop and /2 downscale, this will crop a +1280x960 input frame to 640x480, and then /2 downscale in both +dimensions to 320x240 (assumes ipu1_csi0 is linked to ipu1_csi0_mux): + +media-ctl -V "'ipu1_csi0_mux':2[fmt:UYVY2X8/1280x960]" +media-ctl -V "'ipu1_csi0':0[crop:(0,0)/640x480]" +media-ctl -V "'ipu1_csi0':0[compose:(0,0)/320x240]" + +Frame Skipping in ipuX_csiY +--------------------------- + +The CSI supports frame rate decimation, via frame skipping. Frame +rate decimation is specified by setting the frame intervals at +sink and source pads. The ipuX_csiY entity then applies the best +frame skip setting to the CSI to achieve the desired frame rate +at the source pad. + +The following example reduces an assumed incoming 60 Hz frame +rate by half at the IDMAC output source pad: + +media-ctl -V "'ipu1_csi0':0[fmt:UYVY2X8/640x480@1/60]" +media-ctl -V "'ipu1_csi0':2[fmt:UYVY2X8/640x480@1/30]" + +Frame Interval Monitor in ipuX_csiY +----------------------------------- + +The adv718x decoders can occasionally send corrupt fields during +NTSC/PAL signal re-sync (too little or too many video lines). When +this happens, the IPU triggers a mechanism to re-establish vertical +sync by adding 1 dummy line every frame, which causes a rolling effect +from image to image, and can last a long time before a stable image is +recovered. Or sometimes the mechanism doesn't work at all, causing a +permanent split image (one frame contains lines from two consecutive +captured images). + +From experiment it was found that during image rolling, the frame +intervals (elapsed time between two EOF's) drop below the nominal +value for the current standard, by about one frame time (60 usec), +and remain at that value until rolling stops. + +While the reason for this observation isn't known (the IPU dummy +line mechanism should show an increase in the intervals by 1 line +time every frame, not a fixed value), we can use it to detect the +corrupt fields using a frame interval monitor. If the FIM detects a +bad frame interval, the ipuX_csiY subdev will send the event +V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR. Userland can register with +the FIM event notification on the ipuX_csiY subdev device node. +Userland can issue a streaming restart when this event is received +to correct the rolling/split image. + +The ipuX_csiY subdev includes custom controls to tweak some dials for +FIM. If one of these controls is changed during streaming, the FIM will +be reset and will continue at the new settings. + +- V4L2_CID_IMX_FIM_ENABLE + +Enable/disable the FIM. + +- V4L2_CID_IMX_FIM_NUM + +How many frame interval measurements to average before comparing against +the nominal frame interval reported by the sensor. This can reduce noise +caused by interrupt latency. + +- V4L2_CID_IMX_FIM_TOLERANCE_MIN + +If the averaged intervals fall outside nominal by this amount, in +microseconds, the V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR event is sent. + +- V4L2_CID_IMX_FIM_TOLERANCE_MAX + +If any intervals are higher than this value, those samples are +discarded and do not enter into the average. This can be used to +discard really high interval errors that might be due to interrupt +latency from high system load. + +- V4L2_CID_IMX_FIM_NUM_SKIP + +How many frames to skip after a FIM reset or stream restart before +FIM begins to average intervals. + +- V4L2_CID_IMX_FIM_ICAP_CHANNEL +- V4L2_CID_IMX_FIM_ICAP_EDGE + +These controls will configure an input capture channel as the method +for measuring frame intervals. This is superior to the default method +of measuring frame intervals via EOF interrupt, since it is not subject +to uncertainty errors introduced by interrupt latency. + +Input capture requires hardware support. A VSYNC signal must be routed +to one of the i.MX6 input capture channel pads. + +V4L2_CID_IMX_FIM_ICAP_CHANNEL configures which i.MX6 input capture +channel to use. This must be 0 or 1. + +V4L2_CID_IMX_FIM_ICAP_EDGE configures which signal edge will trigger +input capture events. By default the input capture method is disabled +with a value of IRQ_TYPE_NONE. Set this control to IRQ_TYPE_EDGE_RISING, +IRQ_TYPE_EDGE_FALLING, or IRQ_TYPE_EDGE_BOTH to enable input capture, +triggered on the given signal edge(s). + +When input capture is disabled, frame intervals will be measured via +EOF interrupt. + + +ipuX_vdic +--------- + +The VDIC carries out motion compensated de-interlacing, with three +motion compensation modes: low, medium, and high motion. The mode is +specified with the menu control V4L2_CID_DEINTERLACING_MODE. It has +two sink pads and a single source pad. + +The direct sink pad receives from an ipuX_csiY direct pad. With this +link the VDIC can only operate in high motion mode. + +When the IDMAC sink pad is activated, it receives from an output +or mem2mem device node. With this pipeline, it can also operate +in low and medium modes, because these modes require receiving +frames from memory buffers. Note that an output or mem2mem device +is not implemented yet, so this sink pad currently has no links. + +The source pad routes to the IC pre-processing entity ipuX_ic_prp. + +ipuX_ic_prp +----------- + +This is the IC pre-processing entity. It acts as a router, routing +data from its sink pad to one or both of its source pads. + +It has a single sink pad. The sink pad can receive from the ipuX_csiY +direct pad, or from ipuX_vdic. + +This entity has two source pads. One source pad routes to the +pre-process encode task entity (ipuX_ic_prpenc), the other to the +pre-process viewfinder task entity (ipuX_ic_prpvf). Both source pads +can be activated at the same time if the sink pad is receiving from +ipuX_csiY. Only the source pad to the pre-process viewfinder task entity +can be activated if the sink pad is receiving from ipuX_vdic (frames +from the VDIC can only be processed by the pre-process viewfinder task). + +ipuX_ic_prpenc +-------------- + +This is the IC pre-processing encode entity. It has a single sink +pad from ipuX_ic_prp, and a single source pad. The source pad is +routed to a capture device node, with a node name of the format +"ipuX_ic_prpenc capture". + +This entity performs the IC pre-process encode task operations: +color-space conversion, resizing (downscaling and upscaling), +horizontal and vertical flip, and 90/270 degree rotation. Flip +and rotation are provided via standard V4L2 controls. + +Like the ipuX_csiY IDMAC source, it can also perform simple de-interlace +without motion compensation, and pixel reordering. + +ipuX_ic_prpvf +------------- + +This is the IC pre-processing viewfinder entity. It has a single sink +pad from ipuX_ic_prp, and a single source pad. The source pad is routed +to a capture device node, with a node name of the format +"ipuX_ic_prpvf capture". + +It is identical in operation to ipuX_ic_prpenc, with the same resizing +and CSC operations and flip/rotation controls. It will receive and +process de-interlaced frames from the ipuX_vdic if ipuX_ic_prp is +receiving from ipuX_vdic. + +Like the ipuX_csiY IDMAC source, it can perform simple de-interlace +without motion compensation. However, note that if the ipuX_vdic is +included in the pipeline (ipuX_ic_prp is receiving from ipuX_vdic), +it's not possible to use simple de-interlace in ipuX_ic_prpvf, since +the ipuX_vdic has already carried out de-interlacing (with motion +compensation) and therefore the field type output from ipuX_ic_prp can +only be none. + +Capture Pipelines +----------------- + +The following describe the various use-cases supported by the pipelines. + +The links shown do not include the backend sensor, video mux, or mipi +csi-2 receiver links. This depends on the type of sensor interface +(parallel or mipi csi-2). So these pipelines begin with: + +sensor -> ipuX_csiY_mux -> ... + +for parallel sensors, or: + +sensor -> imx6-mipi-csi2 -> (ipuX_csiY_mux) -> ... + +for mipi csi-2 sensors. The imx6-mipi-csi2 receiver may need to route +to the video mux (ipuX_csiY_mux) before sending to the CSI, depending +on the mipi csi-2 virtual channel, hence ipuX_csiY_mux is shown in +parenthesis. + +Unprocessed Video Capture: +-------------------------- + +Send frames directly from sensor to camera device interface node, with +no conversions, via ipuX_csiY IDMAC source pad: + +-> ipuX_csiY:2 -> ipuX_csiY capture + +IC Direct Conversions: +---------------------- + +This pipeline uses the preprocess encode entity to route frames directly +from the CSI to the IC, to carry out scaling up to 1024x1024 resolution, +CSC, flipping, and image rotation: + +-> ipuX_csiY:1 -> 0:ipuX_ic_prp:1 -> 0:ipuX_ic_prpenc:1 -> + ipuX_ic_prpenc capture + +Motion Compensated De-interlace: +-------------------------------- + +This pipeline routes frames from the CSI direct pad to the VDIC entity to +support motion-compensated de-interlacing (high motion mode only), +scaling up to 1024x1024, CSC, flip, and rotation: + +-> ipuX_csiY:1 -> 0:ipuX_vdic:2 -> 0:ipuX_ic_prp:2 -> + 0:ipuX_ic_prpvf:1 -> ipuX_ic_prpvf capture + + +Usage Notes +----------- + +To aid in configuration and for backward compatibility with V4L2 +applications that access controls only from video device nodes, the +capture device interfaces inherit controls from the active entities +in the current pipeline, so controls can be accessed either directly +from the subdev or from the active capture device interface. For +example, the FIM controls are available either from the ipuX_csiY +subdevs or from the active capture device. + +The following are specific usage notes for the Sabre* reference +boards: + + +SabreLite with OV5642 and OV5640 +-------------------------------- + +This platform requires the OmniVision OV5642 module with a parallel +camera interface, and the OV5640 module with a MIPI CSI-2 +interface. Both modules are available from Boundary Devices: + +https://boundarydevices.com/product/nit6x_5mp +https://boundarydevices.com/product/nit6x_5mp_mipi + +Note that if only one camera module is available, the other sensor +node can be disabled in the device tree. + +The OV5642 module is connected to the parallel bus input on the i.MX +internal video mux to IPU1 CSI0. It's i2c bus connects to i2c bus 2. + +The MIPI CSI-2 OV5640 module is connected to the i.MX internal MIPI CSI-2 +receiver, and the four virtual channel outputs from the receiver are +routed as follows: vc0 to the IPU1 CSI0 mux, vc1 directly to IPU1 CSI1, +vc2 directly to IPU2 CSI0, and vc3 to the IPU2 CSI1 mux. The OV5640 is +also connected to i2c bus 2 on the SabreLite, therefore the OV5642 and +OV5640 must not share the same i2c slave address. + +The following basic example configures unprocessed video capture +pipelines for both sensors. The OV5642 is routed to ipu1_csi0, and +the OV5640, transmitting on MIPI CSI-2 virtual channel 1 (which is +imx6-mipi-csi2 pad 2), is routed to ipu1_csi1. Both sensors are +configured to output 640x480, and the OV5642 outputs YUYV2X8, the +OV5640 UYVY2X8: + +.. code-block:: none + + # Setup links for OV5642 + media-ctl -l "'ov5642 1-0042':0 -> 'ipu1_csi0_mux':1[1]" + media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]" + media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]" + # Setup links for OV5640 + media-ctl -l "'ov5640 1-0040':0 -> 'imx6-mipi-csi2':0[1]" + media-ctl -l "'imx6-mipi-csi2':2 -> 'ipu1_csi1':0[1]" + media-ctl -l "'ipu1_csi1':2 -> 'ipu1_csi1 capture':0[1]" + # Configure pads for OV5642 pipeline + media-ctl -V "'ov5642 1-0042':0 [fmt:YUYV2X8/640x480 field:none]" + media-ctl -V "'ipu1_csi0_mux':2 [fmt:YUYV2X8/640x480 field:none]" + media-ctl -V "'ipu1_csi0':2 [fmt:AYUV32/640x480 field:none]" + # Configure pads for OV5640 pipeline + media-ctl -V "'ov5640 1-0040':0 [fmt:UYVY2X8/640x480 field:none]" + media-ctl -V "'imx6-mipi-csi2':2 [fmt:UYVY2X8/640x480 field:none]" + media-ctl -V "'ipu1_csi1':2 [fmt:AYUV32/640x480 field:none]" + +Streaming can then begin independently on the capture device nodes +"ipu1_csi0 capture" and "ipu1_csi1 capture". The v4l2-ctl tool can +be used to select any supported YUV pixelformat on the capture device +nodes, including planar. + +SabreAuto with ADV7180 decoder +------------------------------ + +On the SabreAuto, an on-board ADV7180 SD decoder is connected to the +parallel bus input on the internal video mux to IPU1 CSI0. + +The following example configures a pipeline to capture from the ADV7180 +video decoder, assuming NTSC 720x480 input signals, with Motion +Compensated de-interlacing. Pad field types assume the adv7180 outputs +"interlaced". $outputfmt can be any format supported by the ipu1_ic_prpvf +entity at its output pad: + +.. code-block:: none + + # Setup links + media-ctl -l "'adv7180 3-0021':0 -> 'ipu1_csi0_mux':1[1]" + media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]" + media-ctl -l "'ipu1_csi0':1 -> 'ipu1_vdic':0[1]" + media-ctl -l "'ipu1_vdic':2 -> 'ipu1_ic_prp':0[1]" + media-ctl -l "'ipu1_ic_prp':2 -> 'ipu1_ic_prpvf':0[1]" + media-ctl -l "'ipu1_ic_prpvf':1 -> 'ipu1_ic_prpvf capture':0[1]" + # Configure pads + media-ctl -V "'adv7180 3-0021':0 [fmt:UYVY2X8/720x480]" + media-ctl -V "'ipu1_csi0_mux':2 [fmt:UYVY2X8/720x480 field:interlaced]" + media-ctl -V "'ipu1_csi0':1 [fmt:AYUV32/720x480 field:interlaced]" + media-ctl -V "'ipu1_vdic':2 [fmt:AYUV32/720x480 field:none]" + media-ctl -V "'ipu1_ic_prp':2 [fmt:AYUV32/720x480 field:none]" + media-ctl -V "'ipu1_ic_prpvf':1 [fmt:$outputfmt field:none]" + +Streaming can then begin on the capture device node at +"ipu1_ic_prpvf capture". The v4l2-ctl tool can be used to select any +supported YUV or RGB pixelformat on the capture device node. + +This platform accepts Composite Video analog inputs to the ADV7180 on +Ain1 (connector J42). + +SabreSD with MIPI CSI-2 OV5640 +------------------------------ + +Similarly to SabreLite, the SabreSD supports a parallel interface +OV5642 module on IPU1 CSI0, and a MIPI CSI-2 OV5640 module. The OV5642 +connects to i2c bus 1 and the OV5640 to i2c bus 2. + +The device tree for SabreSD includes OF graphs for both the parallel +OV5642 and the MIPI CSI-2 OV5640, but as of this writing only the MIPI +CSI-2 OV5640 has been tested, so the OV5642 node is currently disabled. +The OV5640 module connects to MIPI connector J5 (sorry I don't have the +compatible module part number or URL). + +The following example configures a direct conversion pipeline to capture +from the OV5640, transmitting on MIPI CSI-2 virtual channel 1. $sensorfmt +can be any format supported by the OV5640. $sensordim is the frame +dimension part of $sensorfmt (minus the mbus pixel code). $outputfmt can +be any format supported by the ipu1_ic_prpenc entity at its output pad: + +.. code-block:: none + + # Setup links + media-ctl -l "'ov5640 1-003c':0 -> 'imx6-mipi-csi2':0[1]" + media-ctl -l "'imx6-mipi-csi2':2 -> 'ipu1_csi1':0[1]" + media-ctl -l "'ipu1_csi1':1 -> 'ipu1_ic_prp':0[1]" + media-ctl -l "'ipu1_ic_prp':1 -> 'ipu1_ic_prpenc':0[1]" + media-ctl -l "'ipu1_ic_prpenc':1 -> 'ipu1_ic_prpenc capture':0[1]" + # Configure pads + media-ctl -V "'ov5640 1-003c':0 [fmt:$sensorfmt field:none]" + media-ctl -V "'imx6-mipi-csi2':2 [fmt:$sensorfmt field:none]" + media-ctl -V "'ipu1_csi1':1 [fmt:AYUV32/$sensordim field:none]" + media-ctl -V "'ipu1_ic_prp':1 [fmt:AYUV32/$sensordim field:none]" + media-ctl -V "'ipu1_ic_prpenc':1 [fmt:$outputfmt field:none]" + +Streaming can then begin on "ipu1_ic_prpenc capture" node. The v4l2-ctl +tool can be used to select any supported YUV or RGB pixelformat on the +capture device node. + + +Known Issues +------------ + +1. When using 90 or 270 degree rotation control at capture resolutions + near the IC resizer limit of 1024x1024, and combined with planar + pixel formats (YUV420, YUV422p), frame capture will often fail with + no end-of-frame interrupts from the IDMAC channel. To work around + this, use lower resolution and/or packed formats (YUYV, RGB3, etc.) + when 90 or 270 rotations are needed. + + +File list +--------- + +drivers/staging/media/imx/ +include/media/imx.h +include/linux/imx-media.h + +References +---------- + +.. [#f1] http://www.nxp.com/assets/documents/data/en/reference-manuals/IMX6DQRM.pdf +.. [#f2] http://www.nxp.com/assets/documents/data/en/reference-manuals/IMX6SDLRM.pdf + + +Authors +------- +Steve Longerbeam +Philipp Zabel +Russell King + +Copyright (C) 2012-2017 Mentor Graphics Inc. diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig index dbda4d9a08e7..f8c25ee082ef 100644 --- a/drivers/staging/media/Kconfig +++ b/drivers/staging/media/Kconfig @@ -27,6 +27,8 @@ source "drivers/staging/media/cxd2099/Kconfig" source "drivers/staging/media/davinci_vpfe/Kconfig" +source "drivers/staging/media/imx/Kconfig" + source "drivers/staging/media/omap4iss/Kconfig" # Keep LIRC at the end, as it has sub-menus diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile index c04600c81264..ac090c5fce30 100644 --- a/drivers/staging/media/Makefile +++ b/drivers/staging/media/Makefile @@ -1,5 +1,6 @@ obj-$(CONFIG_I2C_BCM2048) += bcm2048/ obj-$(CONFIG_DVB_CXD2099) += cxd2099/ +obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx/ obj-$(CONFIG_LIRC_STAGING) += lirc/ obj-$(CONFIG_VIDEO_DM365_VPFE) += davinci_vpfe/ obj-$(CONFIG_VIDEO_OMAP4) += omap4iss/ diff --git a/drivers/staging/media/imx/Kconfig b/drivers/staging/media/imx/Kconfig new file mode 100644 index 000000000000..5e79a36ce225 --- /dev/null +++ b/drivers/staging/media/imx/Kconfig @@ -0,0 +1,7 @@ +config VIDEO_IMX_MEDIA + tristate "i.MX5/6 V4L2 media core driver" + depends on MEDIA_CONTROLLER && VIDEO_V4L2 && ARCH_MXC && IMX_IPUV3_CORE + select V4L2_FWNODE + ---help--- + Say yes here to enable support for video4linux media controller + driver for the i.MX5/6 SOC. diff --git a/drivers/staging/media/imx/Makefile b/drivers/staging/media/imx/Makefile new file mode 100644 index 000000000000..ddd7d94dbac9 --- /dev/null +++ b/drivers/staging/media/imx/Makefile @@ -0,0 +1,5 @@ +imx-media-objs := imx-media-dev.o imx-media-internal-sd.o imx-media-of.o +imx-media-common-objs := imx-media-utils.o imx-media-fim.o + +obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o +obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o diff --git a/drivers/staging/media/imx/imx-media-dev.c b/drivers/staging/media/imx/imx-media-dev.c new file mode 100644 index 000000000000..48cbc7716758 --- /dev/null +++ b/drivers/staging/media/imx/imx-media-dev.c @@ -0,0 +1,667 @@ +/* + * V4L2 Media Controller Driver for Freescale i.MX5/6 SOC + * + * Copyright (c) 2016 Mentor Graphics Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include