From bf00d30ce512dcf14c9b435e263e0af52f632448 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Sat, 16 Nov 2024 01:28:28 +0000 Subject: [PATCH 01/16] media: platform: exynos4-is: Remove unused fimc_is_param_strerr fimc_is_param_strerr() was added in 2013 by commit 9a761e436843 ("[media] exynos4-is: Add Exynos4x12 FIMC-IS driver") but has never been called. Remove it. (The other possibility might be to add a call maybe in fimc-is-param ?) Signed-off-by: Dr. David Alan Gilbert Signed-off-by: Hans Verkuil --- .../samsung/exynos4-is/fimc-is-errno.c | 131 ------------------ .../samsung/exynos4-is/fimc-is-errno.h | 1 - 2 files changed, 132 deletions(-) diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-is-errno.c b/drivers/media/platform/samsung/exynos4-is/fimc-is-errno.c index 7a48fad1df16..ac67a04e5eeb 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-is-errno.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-is-errno.c @@ -12,137 +12,6 @@ #include "fimc-is-errno.h" -const char *fimc_is_param_strerr(unsigned int error) -{ - switch (error) { - case ERROR_COMMON_CMD: - return "ERROR_COMMON_CMD: Invalid Command"; - case ERROR_COMMON_PARAMETER: - return "ERROR_COMMON_PARAMETER: Invalid Parameter"; - case ERROR_COMMON_SETFILE_LOAD: - return "ERROR_COMMON_SETFILE_LOAD: Illegal Setfile Loading"; - case ERROR_COMMON_SETFILE_ADJUST: - return "ERROR_COMMON_SETFILE_ADJUST: Setfile isn't adjusted"; - case ERROR_COMMON_SETFILE_INDEX: - return "ERROR_COMMON_SETFILE_INDEX: Invalid setfile index"; - case ERROR_COMMON_INPUT_PATH: - return "ERROR_COMMON_INPUT_PATH: Input path can be changed in ready state"; - case ERROR_COMMON_INPUT_INIT: - return "ERROR_COMMON_INPUT_INIT: IP can not start if input path is not set"; - case ERROR_COMMON_OUTPUT_PATH: - return "ERROR_COMMON_OUTPUT_PATH: Output path can be changed in ready state (stop)"; - case ERROR_COMMON_OUTPUT_INIT: - return "ERROR_COMMON_OUTPUT_INIT: IP can not start if output path is not set"; - case ERROR_CONTROL_BYPASS: - return "ERROR_CONTROL_BYPASS"; - case ERROR_OTF_INPUT_FORMAT: - return "ERROR_OTF_INPUT_FORMAT: Invalid format (DRC: YUV444, FD: YUV444, 422, 420)"; - case ERROR_OTF_INPUT_WIDTH: - return "ERROR_OTF_INPUT_WIDTH: Invalid width (DRC: 128~8192, FD: 32~8190)"; - case ERROR_OTF_INPUT_HEIGHT: - return "ERROR_OTF_INPUT_HEIGHT: Invalid bit-width (DRC: 8~12bits, FD: 8bit)"; - case ERROR_OTF_INPUT_BIT_WIDTH: - return "ERROR_OTF_INPUT_BIT_WIDTH: Invalid bit-width (DRC: 8~12bits, FD: 8bit)"; - case ERROR_DMA_INPUT_WIDTH: - return "ERROR_DMA_INPUT_WIDTH: Invalid width (DRC: 128~8192, FD: 32~8190)"; - case ERROR_DMA_INPUT_HEIGHT: - return "ERROR_DMA_INPUT_HEIGHT: Invalid height (DRC: 64~8192, FD: 16~8190)"; - case ERROR_DMA_INPUT_FORMAT: - return "ERROR_DMA_INPUT_FORMAT: Invalid format (DRC: YUV444 or YUV422, FD: YUV444,422,420)"; - case ERROR_DMA_INPUT_BIT_WIDTH: - return "ERROR_DMA_INPUT_BIT_WIDTH: Invalid bit-width (DRC: 8~12bits, FD: 8bit)"; - case ERROR_DMA_INPUT_ORDER: - return "ERROR_DMA_INPUT_ORDER: Invalid order(DRC: YYCbCr,YCbYCr,FD:NO,YYCbCr,YCbYCr,CbCr,CrCb)"; - case ERROR_DMA_INPUT_PLANE: - return "ERROR_DMA_INPUT_PLANE: Invalid plane (DRC: 3, FD: 1, 2, 3)"; - case ERROR_OTF_OUTPUT_WIDTH: - return "ERROR_OTF_OUTPUT_WIDTH: Invalid width (DRC: 128~8192)"; - case ERROR_OTF_OUTPUT_HEIGHT: - return "ERROR_OTF_OUTPUT_HEIGHT: Invalid height (DRC: 64~8192)"; - case ERROR_OTF_OUTPUT_FORMAT: - return "ERROR_OTF_OUTPUT_FORMAT: Invalid format (DRC: YUV444)"; - case ERROR_OTF_OUTPUT_BIT_WIDTH: - return "ERROR_OTF_OUTPUT_BIT_WIDTH: Invalid bit-width (DRC: 8~12bits, FD: 8bit)"; - case ERROR_DMA_OUTPUT_WIDTH: - return "ERROR_DMA_OUTPUT_WIDTH"; - case ERROR_DMA_OUTPUT_HEIGHT: - return "ERROR_DMA_OUTPUT_HEIGHT"; - case ERROR_DMA_OUTPUT_FORMAT: - return "ERROR_DMA_OUTPUT_FORMAT"; - case ERROR_DMA_OUTPUT_BIT_WIDTH: - return "ERROR_DMA_OUTPUT_BIT_WIDTH"; - case ERROR_DMA_OUTPUT_PLANE: - return "ERROR_DMA_OUTPUT_PLANE"; - case ERROR_DMA_OUTPUT_ORDER: - return "ERROR_DMA_OUTPUT_ORDER"; - - /* Sensor Error(100~199) */ - case ERROR_SENSOR_I2C_FAIL: - return "ERROR_SENSOR_I2C_FAIL"; - case ERROR_SENSOR_INVALID_FRAMERATE: - return "ERROR_SENSOR_INVALID_FRAMERATE"; - case ERROR_SENSOR_INVALID_EXPOSURETIME: - return "ERROR_SENSOR_INVALID_EXPOSURETIME"; - case ERROR_SENSOR_INVALID_SIZE: - return "ERROR_SENSOR_INVALID_SIZE"; - case ERROR_SENSOR_INVALID_SETTING: - return "ERROR_SENSOR_INVALID_SETTING"; - case ERROR_SENSOR_ACTUATOR_INIT_FAIL: - return "ERROR_SENSOR_ACTUATOR_INIT_FAIL"; - case ERROR_SENSOR_INVALID_AF_POS: - return "ERROR_SENSOR_INVALID_AF_POS"; - case ERROR_SENSOR_UNSUPPORT_FUNC: - return "ERROR_SENSOR_UNSUPPORT_FUNC"; - case ERROR_SENSOR_UNSUPPORT_PERI: - return "ERROR_SENSOR_UNSUPPORT_PERI"; - case ERROR_SENSOR_UNSUPPORT_AF: - return "ERROR_SENSOR_UNSUPPORT_AF"; - - /* ISP Error (200~299) */ - case ERROR_ISP_AF_BUSY: - return "ERROR_ISP_AF_BUSY"; - case ERROR_ISP_AF_INVALID_COMMAND: - return "ERROR_ISP_AF_INVALID_COMMAND"; - case ERROR_ISP_AF_INVALID_MODE: - return "ERROR_ISP_AF_INVALID_MODE"; - - /* DRC Error (300~399) */ - /* FD Error (400~499) */ - case ERROR_FD_CONFIG_MAX_NUMBER_STATE: - return "ERROR_FD_CONFIG_MAX_NUMBER_STATE"; - case ERROR_FD_CONFIG_MAX_NUMBER_INVALID: - return "ERROR_FD_CONFIG_MAX_NUMBER_INVALID"; - case ERROR_FD_CONFIG_YAW_ANGLE_STATE: - return "ERROR_FD_CONFIG_YAW_ANGLE_STATE"; - case ERROR_FD_CONFIG_YAW_ANGLE_INVALID: - return "ERROR_FD_CONFIG_YAW_ANGLE_INVALID\n"; - case ERROR_FD_CONFIG_ROLL_ANGLE_STATE: - return "ERROR_FD_CONFIG_ROLL_ANGLE_STATE"; - case ERROR_FD_CONFIG_ROLL_ANGLE_INVALID: - return "ERROR_FD_CONFIG_ROLL_ANGLE_INVALID"; - case ERROR_FD_CONFIG_SMILE_MODE_INVALID: - return "ERROR_FD_CONFIG_SMILE_MODE_INVALID"; - case ERROR_FD_CONFIG_BLINK_MODE_INVALID: - return "ERROR_FD_CONFIG_BLINK_MODE_INVALID"; - case ERROR_FD_CONFIG_EYES_DETECT_INVALID: - return "ERROR_FD_CONFIG_EYES_DETECT_INVALID"; - case ERROR_FD_CONFIG_MOUTH_DETECT_INVALID: - return "ERROR_FD_CONFIG_MOUTH_DETECT_INVALID"; - case ERROR_FD_CONFIG_ORIENTATION_STATE: - return "ERROR_FD_CONFIG_ORIENTATION_STATE"; - case ERROR_FD_CONFIG_ORIENTATION_INVALID: - return "ERROR_FD_CONFIG_ORIENTATION_INVALID"; - case ERROR_FD_CONFIG_ORIENTATION_VALUE_INVALID: - return "ERROR_FD_CONFIG_ORIENTATION_VALUE_INVALID"; - case ERROR_FD_RESULT: - return "ERROR_FD_RESULT"; - case ERROR_FD_MODE: - return "ERROR_FD_MODE"; - default: - return "Unknown"; - } -} - const char *fimc_is_strerr(unsigned int error) { error &= ~IS_ERROR_TIME_OUT_FLAG; diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-is-errno.h b/drivers/media/platform/samsung/exynos4-is/fimc-is-errno.h index 809e117331c0..fa8204ffec7b 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-is-errno.h +++ b/drivers/media/platform/samsung/exynos4-is/fimc-is-errno.h @@ -240,6 +240,5 @@ enum fimc_is_error { }; const char *fimc_is_strerr(unsigned int error); -const char *fimc_is_param_strerr(unsigned int error); #endif /* FIMC_IS_ERR_H_ */ -- 2.51.0 From 5c546082840f8f91631623706f39bf5daa77d16c Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Sat, 16 Nov 2024 15:16:31 +0000 Subject: [PATCH 02/16] media: tuners: fc0013 Remove unused functions fc0013_rc_cal_add() and fc0013_rc_cal_reset() were added in 2012's commit e889adc91187 ("[media] fc001x: tuner driver for FC0013") but haven't been used. Remove them. Signed-off-by: Dr. David Alan Gilbert Signed-off-by: Hans Verkuil --- drivers/media/tuners/fc0013.c | 64 ----------------------------------- drivers/media/tuners/fc0013.h | 11 ------ 2 files changed, 75 deletions(-) diff --git a/drivers/media/tuners/fc0013.c b/drivers/media/tuners/fc0013.c index 1006a2798eef..90d2ef067594 100644 --- a/drivers/media/tuners/fc0013.c +++ b/drivers/media/tuners/fc0013.c @@ -112,70 +112,6 @@ static int fc0013_sleep(struct dvb_frontend *fe) return 0; } -int fc0013_rc_cal_add(struct dvb_frontend *fe, int rc_val) -{ - struct fc0013_priv *priv = fe->tuner_priv; - int ret; - u8 rc_cal; - int val; - - if (fe->ops.i2c_gate_ctrl) - fe->ops.i2c_gate_ctrl(fe, 1); /* open I2C-gate */ - - /* push rc_cal value, get rc_cal value */ - ret = fc0013_writereg(priv, 0x10, 0x00); - if (ret) - goto error_out; - - /* get rc_cal value */ - ret = fc0013_readreg(priv, 0x10, &rc_cal); - if (ret) - goto error_out; - - rc_cal &= 0x0f; - - val = (int)rc_cal + rc_val; - - /* forcing rc_cal */ - ret = fc0013_writereg(priv, 0x0d, 0x11); - if (ret) - goto error_out; - - /* modify rc_cal value */ - if (val > 15) - ret = fc0013_writereg(priv, 0x10, 0x0f); - else if (val < 0) - ret = fc0013_writereg(priv, 0x10, 0x00); - else - ret = fc0013_writereg(priv, 0x10, (u8)val); - -error_out: - if (fe->ops.i2c_gate_ctrl) - fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */ - - return ret; -} -EXPORT_SYMBOL(fc0013_rc_cal_add); - -int fc0013_rc_cal_reset(struct dvb_frontend *fe) -{ - struct fc0013_priv *priv = fe->tuner_priv; - int ret; - - if (fe->ops.i2c_gate_ctrl) - fe->ops.i2c_gate_ctrl(fe, 1); /* open I2C-gate */ - - ret = fc0013_writereg(priv, 0x0d, 0x01); - if (!ret) - ret = fc0013_writereg(priv, 0x10, 0x00); - - if (fe->ops.i2c_gate_ctrl) - fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */ - - return ret; -} -EXPORT_SYMBOL(fc0013_rc_cal_reset); - static int fc0013_set_vhf_track(struct fc0013_priv *priv, u32 freq) { int ret; diff --git a/drivers/media/tuners/fc0013.h b/drivers/media/tuners/fc0013.h index 74ce5903f199..47ab36342ee8 100644 --- a/drivers/media/tuners/fc0013.h +++ b/drivers/media/tuners/fc0013.h @@ -16,8 +16,6 @@ extern struct dvb_frontend *fc0013_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_address, int dual_master, enum fc001x_xtal_freq xtal_freq); -extern int fc0013_rc_cal_add(struct dvb_frontend *fe, int rc_val); -extern int fc0013_rc_cal_reset(struct dvb_frontend *fe); #else static inline struct dvb_frontend *fc0013_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, @@ -28,15 +26,6 @@ static inline struct dvb_frontend *fc0013_attach(struct dvb_frontend *fe, return NULL; } -static inline int fc0013_rc_cal_add(struct dvb_frontend *fe, int rc_val) -{ - return 0; -} - -static inline int fc0013_rc_cal_reset(struct dvb_frontend *fe) -{ - return 0; -} #endif #endif -- 2.51.0 From fddffe84b1af672da933ab236f8e7f25c8619dd1 Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Tue, 19 Nov 2024 21:42:28 +0100 Subject: [PATCH 03/16] media: s5p-mfc: Fix an error handling path s5p_mfc_open() A mfc_debug_enter() is not balanced by a corresponding mfc_debug_leave(). Add the missing call. Signed-off-by: Christophe JAILLET Signed-off-by: Hans Verkuil --- drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c index 2fe3c9228ac5..5f80931f056d 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c @@ -774,8 +774,10 @@ static int s5p_mfc_open(struct file *file) int ret = 0; mfc_debug_enter(); - if (mutex_lock_interruptible(&dev->mfc_mutex)) - return -ERESTARTSYS; + if (mutex_lock_interruptible(&dev->mfc_mutex)) { + ret = -ERESTARTSYS; + goto err_enter; + } dev->num_inst++; /* It is guarded by mfc_mutex in vfd */ /* Allocate memory for context */ ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); @@ -946,6 +948,7 @@ err_no_ctx: err_alloc: dev->num_inst--; mutex_unlock(&dev->mfc_mutex); +err_enter: mfc_debug_leave(); return ret; } -- 2.51.0 From 8f242f84669b992004bd561aff566740e900cf38 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20T=C5=AFma?= Date: Wed, 20 Nov 2024 15:48:44 +0100 Subject: [PATCH 04/16] media: mgb4: Unify the outputs padding logic with the inputs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Write the padding to the HW registers at the same place as the input logic does. Signed-off-by: Martin Tůma Signed-off-by: Hans Verkuil --- drivers/media/pci/mgb4/mgb4_vout.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/mgb4/mgb4_vout.c b/drivers/media/pci/mgb4/mgb4_vout.c index 6b2791e29de1..600f858918e7 100644 --- a/drivers/media/pci/mgb4/mgb4_vout.c +++ b/drivers/media/pci/mgb4/mgb4_vout.c @@ -180,7 +180,10 @@ static void stop_streaming(struct vb2_queue *vq) xdma_disable_user_irq(mgbdev->xdev, irq); cancel_work_sync(&voutdev->dma_work); + mgb4_mask_reg(&mgbdev->video, voutdev->config->regs.config, 0x2, 0x0); + mgb4_write_reg(&mgbdev->video, voutdev->config->regs.padding, 0); + return_all_buffers(voutdev, VB2_BUF_STATE_ERROR); } @@ -196,6 +199,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) int rv; u32 addr; + mgb4_write_reg(video, config->regs.padding, voutdev->padding); mgb4_mask_reg(video, config->regs.config, 0x2, 0x2); addr = mgb4_read_reg(video, config->regs.address); @@ -359,7 +363,6 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) voutdev->padding = (f->fmt.pix.bytesperline - (f->fmt.pix.width * pixelsize)) / pixelsize; - mgb4_write_reg(video, voutdev->config->regs.padding, voutdev->padding); return 0; } -- 2.51.0 From 771c4770723c1961d118740eb6991e64a43ddcf0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20T=C5=AFma?= Date: Wed, 20 Nov 2024 15:48:45 +0100 Subject: [PATCH 05/16] media: mgb4: Unify register names in inputs/outputs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Unify the names of HW hsync/vsync registers between the inputs and outputs. Signed-off-by: Martin Tůma Signed-off-by: Hans Verkuil --- drivers/media/pci/mgb4/mgb4_sysfs_in.c | 12 ++++++------ drivers/media/pci/mgb4/mgb4_vin.c | 20 ++++++++++---------- drivers/media/pci/mgb4/mgb4_vin.h | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/media/pci/mgb4/mgb4_sysfs_in.c b/drivers/media/pci/mgb4/mgb4_sysfs_in.c index 0ba66a2cf145..9626fa59e3d3 100644 --- a/drivers/media/pci/mgb4/mgb4_sysfs_in.c +++ b/drivers/media/pci/mgb4/mgb4_sysfs_in.c @@ -333,7 +333,7 @@ static ssize_t hsync_width_show(struct device *dev, struct video_device *vdev = to_video_device(dev); struct mgb4_vin_dev *vindev = video_get_drvdata(vdev); u32 sig = mgb4_read_reg(&vindev->mgbdev->video, - vindev->config->regs.signal); + vindev->config->regs.hsync); return sprintf(buf, "%u\n", (sig & 0x00FF0000) >> 16); } @@ -344,7 +344,7 @@ static ssize_t vsync_width_show(struct device *dev, struct video_device *vdev = to_video_device(dev); struct mgb4_vin_dev *vindev = video_get_drvdata(vdev); u32 sig = mgb4_read_reg(&vindev->mgbdev->video, - vindev->config->regs.signal2); + vindev->config->regs.vsync); return sprintf(buf, "%u\n", (sig & 0x00FF0000) >> 16); } @@ -355,7 +355,7 @@ static ssize_t hback_porch_show(struct device *dev, struct video_device *vdev = to_video_device(dev); struct mgb4_vin_dev *vindev = video_get_drvdata(vdev); u32 sig = mgb4_read_reg(&vindev->mgbdev->video, - vindev->config->regs.signal); + vindev->config->regs.hsync); return sprintf(buf, "%u\n", (sig & 0x0000FF00) >> 8); } @@ -366,7 +366,7 @@ static ssize_t hfront_porch_show(struct device *dev, struct video_device *vdev = to_video_device(dev); struct mgb4_vin_dev *vindev = video_get_drvdata(vdev); u32 sig = mgb4_read_reg(&vindev->mgbdev->video, - vindev->config->regs.signal); + vindev->config->regs.hsync); return sprintf(buf, "%u\n", (sig & 0x000000FF)); } @@ -377,7 +377,7 @@ static ssize_t vback_porch_show(struct device *dev, struct video_device *vdev = to_video_device(dev); struct mgb4_vin_dev *vindev = video_get_drvdata(vdev); u32 sig = mgb4_read_reg(&vindev->mgbdev->video, - vindev->config->regs.signal2); + vindev->config->regs.vsync); return sprintf(buf, "%u\n", (sig & 0x0000FF00) >> 8); } @@ -388,7 +388,7 @@ static ssize_t vfront_porch_show(struct device *dev, struct video_device *vdev = to_video_device(dev); struct mgb4_vin_dev *vindev = video_get_drvdata(vdev); u32 sig = mgb4_read_reg(&vindev->mgbdev->video, - vindev->config->regs.signal2); + vindev->config->regs.vsync); return sprintf(buf, "%u\n", (sig & 0x000000FF)); } diff --git a/drivers/media/pci/mgb4/mgb4_vin.c b/drivers/media/pci/mgb4/mgb4_vin.c index 3f171c624b40..434eaf0440e2 100644 --- a/drivers/media/pci/mgb4/mgb4_vin.c +++ b/drivers/media/pci/mgb4/mgb4_vin.c @@ -143,8 +143,8 @@ static int get_timings(struct mgb4_vin_dev *vindev, u32 status = mgb4_read_reg(video, regs->status); u32 pclk = mgb4_read_reg(video, regs->pclk); - u32 signal = mgb4_read_reg(video, regs->signal); - u32 signal2 = mgb4_read_reg(video, regs->signal2); + u32 hsync = mgb4_read_reg(video, regs->hsync); + u32 vsync = mgb4_read_reg(video, regs->vsync); u32 resolution = mgb4_read_reg(video, regs->resolution); if (!(status & (1U << 2))) @@ -161,12 +161,12 @@ static int get_timings(struct mgb4_vin_dev *vindev, if (status & (1U << 13)) timings->bt.polarities |= V4L2_DV_VSYNC_POS_POL; timings->bt.pixelclock = pclk * 1000; - timings->bt.hsync = (signal & 0x00FF0000) >> 16; - timings->bt.vsync = (signal2 & 0x00FF0000) >> 16; - timings->bt.hbackporch = (signal & 0x0000FF00) >> 8; - timings->bt.hfrontporch = signal & 0x000000FF; - timings->bt.vbackporch = (signal2 & 0x0000FF00) >> 8; - timings->bt.vfrontporch = signal2 & 0x000000FF; + timings->bt.hsync = (hsync & 0x00FF0000) >> 16; + timings->bt.vsync = (vsync & 0x00FF0000) >> 16; + timings->bt.hbackporch = (hsync & 0x0000FF00) >> 8; + timings->bt.hfrontporch = hsync & 0x000000FF; + timings->bt.vbackporch = (vsync & 0x0000FF00) >> 8; + timings->bt.vfrontporch = vsync & 0x000000FF; return 0; } @@ -864,9 +864,9 @@ static void create_debugfs(struct mgb4_vin_dev *vindev) vindev->regs[5].name = "PCLK_FREQUENCY"; vindev->regs[5].offset = vindev->config->regs.pclk; vindev->regs[6].name = "VIDEO_PARAMS_1"; - vindev->regs[6].offset = vindev->config->regs.signal; + vindev->regs[6].offset = vindev->config->regs.hsync; vindev->regs[7].name = "VIDEO_PARAMS_2"; - vindev->regs[7].offset = vindev->config->regs.signal2; + vindev->regs[7].offset = vindev->config->regs.vsync; vindev->regs[8].name = "PADDING_PIXELS"; vindev->regs[8].offset = vindev->config->regs.padding; if (has_timeperframe(video)) { diff --git a/drivers/media/pci/mgb4/mgb4_vin.h b/drivers/media/pci/mgb4/mgb4_vin.h index 8fd10c0a5554..2a2c829914ce 100644 --- a/drivers/media/pci/mgb4/mgb4_vin.h +++ b/drivers/media/pci/mgb4/mgb4_vin.h @@ -22,8 +22,8 @@ struct mgb4_vin_regs { u32 frame_period; u32 sync; u32 pclk; - u32 signal; - u32 signal2; + u32 hsync; + u32 vsync; u32 padding; u32 timer; }; -- 2.51.0 From 7801f16792001bd7684f7991121c74e088c30146 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20T=C5=AFma?= Date: Wed, 20 Nov 2024 15:48:46 +0100 Subject: [PATCH 06/16] media: mgb4: Defines cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Do not define stuff used in a single source file in a global header. Do not mix defines with "bare" values in the initialization. Signed-off-by: Martin Tůma Signed-off-by: Hans Verkuil --- drivers/media/pci/mgb4/mgb4_core.c | 4 +++- drivers/media/pci/mgb4/mgb4_core.h | 3 --- drivers/media/pci/mgb4/mgb4_vout.c | 9 ++------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/media/pci/mgb4/mgb4_core.c b/drivers/media/pci/mgb4/mgb4_core.c index bc63dc81bcae..8ceaed5c1453 100644 --- a/drivers/media/pci/mgb4/mgb4_core.c +++ b/drivers/media/pci/mgb4/mgb4_core.c @@ -40,7 +40,9 @@ #include "mgb4_trigger.h" #include "mgb4_core.h" -#define MGB4_USER_IRQS 16 +#define MGB4_USER_IRQS 16 +#define MGB4_MGB4_BAR_ID 0 +#define MGB4_XDMA_BAR_ID 1 #define DIGITEQ_VID 0x1ed8 #define T100_DID 0x0101 diff --git a/drivers/media/pci/mgb4/mgb4_core.h b/drivers/media/pci/mgb4/mgb4_core.h index 9aec62514c0b..e86742d7b6c4 100644 --- a/drivers/media/pci/mgb4/mgb4_core.h +++ b/drivers/media/pci/mgb4/mgb4_core.h @@ -18,9 +18,6 @@ #define MGB4_VIN_DEVICES 2 #define MGB4_VOUT_DEVICES 2 -#define MGB4_MGB4_BAR_ID 0 -#define MGB4_XDMA_BAR_ID 1 - #define MGB4_IS_GMSL(mgbdev) \ ((mgbdev)->module_version >> 4 == 2) #define MGB4_IS_FPDL3(mgbdev) \ diff --git a/drivers/media/pci/mgb4/mgb4_vout.c b/drivers/media/pci/mgb4/mgb4_vout.c index 600f858918e7..14c5725bd4d8 100644 --- a/drivers/media/pci/mgb4/mgb4_vout.c +++ b/drivers/media/pci/mgb4/mgb4_vout.c @@ -24,10 +24,6 @@ #include "mgb4_cmt.h" #include "mgb4_vout.h" -#define DEFAULT_WIDTH 1280 -#define DEFAULT_HEIGHT 640 -#define DEFAULT_PERIOD (MGB4_HW_FREQ / 60) - ATTRIBUTE_GROUPS(mgb4_fpdl3_out); ATTRIBUTE_GROUPS(mgb4_gmsl_out); @@ -664,11 +660,10 @@ static void fpga_init(struct mgb4_vout_dev *voutdev) const struct mgb4_vout_regs *regs = &voutdev->config->regs; mgb4_write_reg(video, regs->config, 0x00000011); - mgb4_write_reg(video, regs->resolution, - (DEFAULT_WIDTH << 16) | DEFAULT_HEIGHT); + mgb4_write_reg(video, regs->resolution, (1280 << 16) | 640); mgb4_write_reg(video, regs->hsync, 0x00283232); mgb4_write_reg(video, regs->vsync, 0x40141F1E); - mgb4_write_reg(video, regs->frame_limit, DEFAULT_PERIOD); + mgb4_write_reg(video, regs->frame_limit, MGB4_HW_FREQ / 60); mgb4_write_reg(video, regs->padding, 0x00000000); voutdev->freq = mgb4_cmt_set_vout_freq(voutdev, 61150 >> 1) << 1; -- 2.51.0 From c10597366f60ff6bceba5386e9694634fb90c4ec Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Sat, 30 Nov 2024 12:36:32 +0100 Subject: [PATCH 07/16] MAINTAINERS: Update own email address from Bootlin to sys-base Update my email address as I am no longer working at Bootlin and have started my own consulting company: sys-base. Signed-off-by: Paul Kocialkowski Signed-off-by: Hans Verkuil --- MAINTAINERS | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 1e930c7a58b1..1ec1aa2684e5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -816,7 +816,7 @@ F: drivers/media/platform/sunxi/sun4i-csi/ ALLWINNER A31 CSI DRIVER M: Yong Deng -M: Paul Kocialkowski +M: Paul Kocialkowski L: linux-media@vger.kernel.org S: Maintained T: git git://linuxtv.org/media.git @@ -824,7 +824,7 @@ F: Documentation/devicetree/bindings/media/allwinner,sun6i-a31-csi.yaml F: drivers/media/platform/sunxi/sun6i-csi/ ALLWINNER A31 ISP DRIVER -M: Paul Kocialkowski +M: Paul Kocialkowski L: linux-media@vger.kernel.org S: Maintained T: git git://linuxtv.org/media.git @@ -833,7 +833,7 @@ F: drivers/staging/media/sunxi/sun6i-isp/ F: drivers/staging/media/sunxi/sun6i-isp/uapi/sun6i-isp-config.h ALLWINNER A31 MIPI CSI-2 BRIDGE DRIVER -M: Paul Kocialkowski +M: Paul Kocialkowski L: linux-media@vger.kernel.org S: Maintained T: git git://linuxtv.org/media.git @@ -876,7 +876,7 @@ F: drivers/thermal/sun8i_thermal.c ALLWINNER VPU DRIVER M: Maxime Ripard -M: Paul Kocialkowski +M: Paul Kocialkowski L: linux-media@vger.kernel.org S: Maintained F: drivers/staging/media/sunxi/cedrus/ @@ -7234,7 +7234,7 @@ F: Documentation/devicetree/bindings/display/panel/lg,sw43408.yaml F: drivers/gpu/drm/panel/panel-lg-sw43408.c DRM DRIVER FOR LOGICVC DISPLAY CONTROLLER -M: Paul Kocialkowski +M: Paul Kocialkowski S: Supported T: git https://gitlab.freedesktop.org/drm/misc/kernel.git F: drivers/gpu/drm/logicvc/ -- 2.51.0 From 53b01a5fdb41762db79a3f3192b209f6ccff805b Mon Sep 17 00:00:00 2001 From: Vikram Sharma Date: Tue, 26 Nov 2024 15:31:25 +0530 Subject: [PATCH 08/16] media: qcom: camss: reducing the repitious error message string Introducing a new function camss_link_err to avoid repition of same error message, improving code maintainability. Signed-off-by: Vikram Sharma Reviewed-by: Bryan O'Donoghue Signed-off-by: Hans Verkuil --- drivers/media/platform/qcom/camss/camss.c | 58 ++++++++++++++--------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index 9fb31f4c18ad..6824ffbdf4a8 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -1993,6 +1993,24 @@ static int camss_init_subdevices(struct camss *camss) return 0; } +/* + * camss_link_entities - Register subdev nodes and create links + * camss_link_err - print error in case link creation fails + * @src_name: name for source of the link + * @sink_name: name for sink of the link + */ +inline void camss_link_err(struct camss *camss, + const char *src_name, + const char *sink_name, + int ret) +{ + dev_err(camss->dev, + "Failed to link %s->%s entities: %d\n", + src_name, + sink_name, + ret); +} + /* * camss_link_entities - Register subdev nodes and create links * @camss: CAMSS device @@ -2012,11 +2030,10 @@ static int camss_link_entities(struct camss *camss) MSM_CSID_PAD_SINK, 0); if (ret < 0) { - dev_err(camss->dev, - "Failed to link %s->%s entities: %d\n", - camss->csiphy[i].subdev.entity.name, - camss->csid[j].subdev.entity.name, - ret); + camss_link_err(camss, + camss->csiphy[i].subdev.entity.name, + camss->csid[j].subdev.entity.name, + ret); return ret; } } @@ -2031,11 +2048,10 @@ static int camss_link_entities(struct camss *camss) MSM_ISPIF_PAD_SINK, 0); if (ret < 0) { - dev_err(camss->dev, - "Failed to link %s->%s entities: %d\n", - camss->csid[i].subdev.entity.name, - camss->ispif->line[j].subdev.entity.name, - ret); + camss_link_err(camss, + camss->csid[i].subdev.entity.name, + camss->ispif->line[j].subdev.entity.name, + ret); return ret; } } @@ -2053,11 +2069,9 @@ static int camss_link_entities(struct camss *camss) MSM_VFE_PAD_SINK, 0); if (ret < 0) { - dev_err(camss->dev, - "Failed to link %s->%s entities: %d\n", - ispif->entity.name, - vfe->entity.name, - ret); + camss_link_err(camss, ispif->entity.name, + vfe->entity.name, + ret); return ret; } } @@ -2074,11 +2088,9 @@ static int camss_link_entities(struct camss *camss) MSM_VFE_PAD_SINK, 0); if (ret < 0) { - dev_err(camss->dev, - "Failed to link %s->%s entities: %d\n", - csid->entity.name, - vfe->entity.name, - ret); + camss_link_err(camss, csid->entity.name, + vfe->entity.name, + ret); return ret; } } @@ -2227,9 +2239,9 @@ static int camss_subdev_notifier_complete(struct v4l2_async_notifier *async) input, MSM_CSIPHY_PAD_SINK, MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED); if (ret < 0) { - dev_err(camss->dev, - "Failed to link %s->%s entities: %d\n", - sensor->name, input->name, ret); + camss_link_err(camss, sensor->name, + input->name, + ret); return ret; } } -- 2.51.0 From cc1ecabe67d92a2da0b0402f715598e8dbdc3b9e Mon Sep 17 00:00:00 2001 From: Vikram Sharma Date: Tue, 26 Nov 2024 15:31:26 +0530 Subject: [PATCH 09/16] media: qcom: camss: Restructure camss_link_entities Refactor the camss_link_entities function by breaking it down into three distinct functions. Each function will handle the linking of a specific entity separately. SC7280 and later targets mandates for 1:1 linking for csid -> vfe. i.e. csid0 can be mapped to vfe0 only. Signed-off-by: Suresh Vankadara Signed-off-by: Trishansh Bhardwaj Signed-off-by: Vikram Sharma Reviewed-by: Bryan O'Donoghue Signed-off-by: Hans Verkuil --- drivers/media/platform/qcom/camss/camss.c | 155 ++++++++++++++-------- 1 file changed, 103 insertions(+), 52 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index 6824ffbdf4a8..67fb11cbe865 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -1994,7 +1994,6 @@ static int camss_init_subdevices(struct camss *camss) } /* - * camss_link_entities - Register subdev nodes and create links * camss_link_err - print error in case link creation fails * @src_name: name for source of the link * @sink_name: name for sink of the link @@ -2012,14 +2011,64 @@ inline void camss_link_err(struct camss *camss, } /* - * camss_link_entities - Register subdev nodes and create links + * camss_link_entities_csid - Register subdev nodes and create links * @camss: CAMSS device * * Return 0 on success or a negative error code on failure */ -static int camss_link_entities(struct camss *camss) +static int camss_link_entities_csid(struct camss *camss) { - int i, j, k; + struct media_entity *src_entity; + struct media_entity *sink_entity; + int ret, line_num; + u16 sink_pad; + u16 src_pad; + int i, j; + + for (i = 0; i < camss->res->csid_num; i++) { + if (camss->ispif) + line_num = camss->ispif->line_num; + else + line_num = camss->vfe[i].res->line_num; + + src_entity = &camss->csid[i].subdev.entity; + for (j = 0; j < line_num; j++) { + if (camss->ispif) { + sink_entity = &camss->ispif->line[j].subdev.entity; + src_pad = MSM_CSID_PAD_SRC; + sink_pad = MSM_ISPIF_PAD_SINK; + } else { + sink_entity = &camss->vfe[i].line[j].subdev.entity; + src_pad = MSM_CSID_PAD_FIRST_SRC + j; + sink_pad = MSM_VFE_PAD_SINK; + } + + ret = media_create_pad_link(src_entity, + src_pad, + sink_entity, + sink_pad, + 0); + if (ret < 0) { + camss_link_err(camss, src_entity->name, + sink_entity->name, + ret); + return ret; + } + } + } + + return 0; +} + +/* + * camss_link_entities_csiphy - Register subdev nodes and create links + * @camss: CAMSS device + * + * Return 0 on success or a negative error code on failure + */ +static int camss_link_entities_csiphy(struct camss *camss) +{ + int i, j; int ret; for (i = 0; i < camss->res->csiphy_num; i++) { @@ -2039,66 +2088,68 @@ static int camss_link_entities(struct camss *camss) } } - if (camss->ispif) { - for (i = 0; i < camss->res->csid_num; i++) { - for (j = 0; j < camss->ispif->line_num; j++) { - ret = media_create_pad_link(&camss->csid[i].subdev.entity, - MSM_CSID_PAD_SRC, - &camss->ispif->line[j].subdev.entity, - MSM_ISPIF_PAD_SINK, + return 0; +} + +/* + * camss_link_entities_ispif - Register subdev nodes and create links + * @camss: CAMSS device + * + * Return 0 on success or a negative error code on failure + */ +static int camss_link_entities_ispif(struct camss *camss) +{ + int i, j, k; + int ret; + + for (i = 0; i < camss->ispif->line_num; i++) { + for (k = 0; k < camss->res->vfe_num; k++) { + for (j = 0; j < camss->vfe[k].res->line_num; j++) { + struct v4l2_subdev *ispif = &camss->ispif->line[i].subdev; + struct v4l2_subdev *vfe = &camss->vfe[k].line[j].subdev; + + ret = media_create_pad_link(&ispif->entity, + MSM_ISPIF_PAD_SRC, + &vfe->entity, + MSM_VFE_PAD_SINK, 0); if (ret < 0) { - camss_link_err(camss, - camss->csid[i].subdev.entity.name, - camss->ispif->line[j].subdev.entity.name, + camss_link_err(camss, ispif->entity.name, + vfe->entity.name, ret); return ret; } } } - - for (i = 0; i < camss->ispif->line_num; i++) - for (k = 0; k < camss->res->vfe_num; k++) - for (j = 0; j < camss->vfe[k].res->line_num; j++) { - struct v4l2_subdev *ispif = &camss->ispif->line[i].subdev; - struct v4l2_subdev *vfe = &camss->vfe[k].line[j].subdev; - - ret = media_create_pad_link(&ispif->entity, - MSM_ISPIF_PAD_SRC, - &vfe->entity, - MSM_VFE_PAD_SINK, - 0); - if (ret < 0) { - camss_link_err(camss, ispif->entity.name, - vfe->entity.name, - ret); - return ret; - } - } - } else { - for (i = 0; i < camss->res->csid_num; i++) - for (k = 0; k < camss->res->vfe_num; k++) - for (j = 0; j < camss->vfe[k].res->line_num; j++) { - struct v4l2_subdev *csid = &camss->csid[i].subdev; - struct v4l2_subdev *vfe = &camss->vfe[k].line[j].subdev; - - ret = media_create_pad_link(&csid->entity, - MSM_CSID_PAD_FIRST_SRC + j, - &vfe->entity, - MSM_VFE_PAD_SINK, - 0); - if (ret < 0) { - camss_link_err(camss, csid->entity.name, - vfe->entity.name, - ret); - return ret; - } - } } return 0; } +/* + * camss_link_entities - Register subdev nodes and create links + * @camss: CAMSS device + * + * Return 0 on success or a negative error code on failure + */ +static int camss_link_entities(struct camss *camss) +{ + int ret; + + ret = camss_link_entities_csiphy(camss); + if (ret < 0) + return ret; + + ret = camss_link_entities_csid(camss); + if (ret < 0) + return ret; + + if (camss->ispif) + ret = camss_link_entities_ispif(camss); + + return ret; +} + /* * camss_register_entities - Register subdev nodes and create links * @camss: CAMSS device -- 2.51.0 From b3347d7d618dbe94c73b4091781cb99023f295b6 Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Thu, 28 Nov 2024 15:01:36 -0500 Subject: [PATCH 10/16] media: qcom: camss: document csiphy_lanes_cfg structure Add documentation for struct csiphy_lanes_cfg. Signed-off-by: Caleb Connolly Signed-off-by: David Heidelberg Acked-by: Bryan O'Donoghue Signed-off-by: Hans Verkuil [hverkuil: added missing commit description] --- drivers/media/platform/qcom/camss/camss-csiphy.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.h b/drivers/media/platform/qcom/camss/camss-csiphy.h index eebc1ff1cfab..e3b9e8f12806 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.h +++ b/drivers/media/platform/qcom/camss/camss-csiphy.h @@ -26,6 +26,12 @@ struct csiphy_lane { u8 pol; }; +/** + * struct csiphy_lanes_cfg - CSIPHY lanes configuration + * @num_data: number of data lanes + * @data: data lanes configuration + * @clk: clock lane configuration (only for D-PHY) + */ struct csiphy_lanes_cfg { int num_data; struct csiphy_lane *data; -- 2.51.0 From c04e4bae9097a1ac62c6e8b1e0c485274f56a720 Mon Sep 17 00:00:00 2001 From: Vladimir Zapolskiy Date: Wed, 27 Nov 2024 14:29:45 +0200 Subject: [PATCH 11/16] dt-bindings: media: qcom,sc8280xp-camss: Fix interrupt types Qualcomm IP catalog says that all CAMSS interrupts are edge rising, fix it in the documented example from CAMSS device tree bindings for sc8280xp SoC. Fixes: bc5191e5799e ("media: dt-bindings: media: camss: Add qcom,sc8280xp-camss binding") Signed-off-by: Vladimir Zapolskiy Acked-by: Krzysztof Kozlowski Reviewed-by: Bryan O'Donoghue Signed-off-by: Hans Verkuil --- .../bindings/media/qcom,sc8280xp-camss.yaml | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Documentation/devicetree/bindings/media/qcom,sc8280xp-camss.yaml b/Documentation/devicetree/bindings/media/qcom,sc8280xp-camss.yaml index c0bc31709873..9936f0132417 100644 --- a/Documentation/devicetree/bindings/media/qcom,sc8280xp-camss.yaml +++ b/Documentation/devicetree/bindings/media/qcom,sc8280xp-camss.yaml @@ -328,26 +328,26 @@ examples: vdda-phy-supply = <&vreg_l6d>; vdda-pll-supply = <&vreg_l4d>; - interrupts = , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - ; + interrupts = , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + ; interrupt-names = "csid1_lite", "vfe_lite1", -- 2.51.0 From 349396bb55c4dfaa3b8cb0415c782af555e21c8a Mon Sep 17 00:00:00 2001 From: Vladimir Zapolskiy Date: Wed, 27 Nov 2024 14:29:46 +0200 Subject: [PATCH 12/16] dt-bindings: media: qcom,sdm845-camss: Fix interrupt types Qualcomm IP catalog says that all CAMSS interrupts are edge rising, fix it in the documented example from CAMSS device tree bindings for sdm845 SoC. Fixes: d1d5ce260165 ("media: dt-bindings: media: camss: Add qcom,sdm845-camss binding") Signed-off-by: Vladimir Zapolskiy Acked-by: Krzysztof Kozlowski Reviewed-by: Bryan O'Donoghue Signed-off-by: Hans Verkuil --- .../bindings/media/qcom,sdm845-camss.yaml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Documentation/devicetree/bindings/media/qcom,sdm845-camss.yaml b/Documentation/devicetree/bindings/media/qcom,sdm845-camss.yaml index ec4380a0a03f..d32daaef1b50 100644 --- a/Documentation/devicetree/bindings/media/qcom,sdm845-camss.yaml +++ b/Documentation/devicetree/bindings/media/qcom,sdm845-camss.yaml @@ -296,16 +296,16 @@ examples: "vfe_lite_cphy_rx", "vfe_lite_src"; - interrupts = , - , - , - , - , - , - , - , - , - ; + interrupts = , + , + , + , + , + , + , + , + , + ; interrupt-names = "csid0", "csid1", -- 2.51.0 From d1028b5748164e3ddd6d2bb0bbceee846ed2fc71 Mon Sep 17 00:00:00 2001 From: Vladimir Zapolskiy Date: Wed, 27 Nov 2024 14:29:47 +0200 Subject: [PATCH 13/16] dt-bindings: media: qcom,sm8250-camss: Fix interrupt types Qualcomm IP catalog says that all CAMSS interrupts are edge rising, fix it in the documented example from CAMSS device tree bindings for SM8250 SoC. Fixes: 46f8ac8497c5 ("media: dt-bindings: media: camss: Add qcom,sm8250-camss binding") Signed-off-by: Vladimir Zapolskiy Acked-by: Krzysztof Kozlowski Reviewed-by: Bryan O'Donoghue Signed-off-by: Hans Verkuil --- .../bindings/media/qcom,sm8250-camss.yaml | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Documentation/devicetree/bindings/media/qcom,sm8250-camss.yaml b/Documentation/devicetree/bindings/media/qcom,sm8250-camss.yaml index fa5073c0fd1e..06db2c1e6079 100644 --- a/Documentation/devicetree/bindings/media/qcom,sm8250-camss.yaml +++ b/Documentation/devicetree/bindings/media/qcom,sm8250-camss.yaml @@ -329,20 +329,20 @@ examples: vdda-phy-supply = <&vreg_l5a_0p88>; vdda-pll-supply = <&vreg_l9a_1p2>; - interrupts = , - , - , - , - , - , - , - , - , - , - , - , - , - ; + interrupts = , + , + , + , + , + , + , + , + , + , + , + , + , + ; interrupt-names = "csiphy0", "csiphy1", "csiphy2", -- 2.51.0 From 86e5e8efb82cbee416e726e141decdc9e1a2d5f3 Mon Sep 17 00:00:00 2001 From: Dheeraj Reddy Jonnalagadda Date: Tue, 19 Nov 2024 12:56:53 +0530 Subject: [PATCH 14/16] media: rkisp1: Fix unused value issue This commit fixes an unused value issue detected by Coverity (CID 1519008). The error condition for the invalid MIPI CSI-2 is not properly handled as the break statement would only exit the switch block and not the entire loop. Fix this by breaking from the look immediately after the switch block when an error occurs. Signed-off-by: Dheeraj Reddy Jonnalagadda Fixes: 7d4f126fde89 ("media: rkisp1: Make the internal CSI-2 receiver optional") Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Link: https://lore.kernel.org/r/20241119072653.72260-1-dheeraj.linuxdev@gmail.com Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c index 0100b9c3edbe..dc65a7924f8a 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c @@ -228,6 +228,9 @@ static int rkisp1_subdev_notifier_register(struct rkisp1_device *rkisp1) break; } + if (ret) + break; + /* Parse the endpoint and validate the bus type. */ ret = v4l2_fwnode_endpoint_parse(ep, &vep); if (ret) { -- 2.51.0 From 6c10d1adae82e1c8da16e7ebd2320e69f20b9d6f Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Mon, 7 Oct 2024 14:42:24 +0200 Subject: [PATCH 15/16] media: rkisp1: Reduce min_queued_buffers to 1 There apparently is no reason to require 3 queued buffers to call streamon() for the RkISP1 as the driver operates with a scratch buffer where frames can be directed to if there's no available buffer provided by userspace. Reduce the number of required buffers to 1 to allow applications to operate with a single queued buffer. Tested with libcamera, by operating with a single capture request. The same request (and associated capture buffer) gets recycled once completed. This of course causes a frame rate drop but doesn't hinder operations. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Link: https://lore.kernel.org/r/20241007124225.63463-1-jacopo.mondi@ideasonboard.com Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c index 02339cd94486..6dcefd144d5a 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c @@ -35,8 +35,6 @@ #define RKISP1_SP_DEV_NAME RKISP1_DRIVER_NAME "_selfpath" #define RKISP1_MP_DEV_NAME RKISP1_DRIVER_NAME "_mainpath" -#define RKISP1_MIN_BUFFERS_NEEDED 3 - enum rkisp1_plane { RKISP1_PLANE_Y = 0, RKISP1_PLANE_CB = 1, @@ -1561,7 +1559,7 @@ static int rkisp1_register_capture(struct rkisp1_capture *cap) q->ops = &rkisp1_vb2_ops; q->mem_ops = &vb2_dma_contig_memops; q->buf_struct_size = sizeof(struct rkisp1_buffer); - q->min_queued_buffers = RKISP1_MIN_BUFFERS_NEEDED; + q->min_queued_buffers = 1; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->lock = &node->vlock; q->dev = cap->rkisp1->dev; -- 2.51.0 From 11c7fd6e0f62b24b3e6b0558bcbd0c3bbf541718 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Sun, 13 Oct 2024 00:39:32 +0100 Subject: [PATCH 16/16] media: cx18: Remove unused cx18_reset_ir_gpio cx18_reset_ir_gpio() has been unused in tree since 2009 commit eefe1010a465 ("V4L/DVB (10759): cx18: Convert GPIO connected functions to act as v4l2_subdevices") It has a comment saying it's exported for use by 'lirc_pvr150' but I don't see any sign of it in the lirc git, and I see it removed support for lirc_i2c.c 'Flavors of the Hauppage PVR-150...' in 2014. Remove it. Signed-off-by: Dr. David Alan Gilbert Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx18/cx18-gpio.c | 15 --------------- drivers/media/pci/cx18/cx18-gpio.h | 1 - 2 files changed, 16 deletions(-) diff --git a/drivers/media/pci/cx18/cx18-gpio.c b/drivers/media/pci/cx18/cx18-gpio.c index c85eb8d25837..485a6cbeb15a 100644 --- a/drivers/media/pci/cx18/cx18-gpio.c +++ b/drivers/media/pci/cx18/cx18-gpio.c @@ -305,21 +305,6 @@ int cx18_gpio_register(struct cx18 *cx, u32 hw) return v4l2_device_register_subdev(&cx->v4l2_dev, sd); } -void cx18_reset_ir_gpio(void *data) -{ - struct cx18 *cx = to_cx18(data); - - if (cx->card->gpio_i2c_slave_reset.ir_reset_mask == 0) - return; - - CX18_DEBUG_INFO("Resetting IR microcontroller\n"); - - v4l2_subdev_call(&cx->sd_resetctrl, - core, reset, CX18_GPIO_RESET_Z8F0811); -} -EXPORT_SYMBOL(cx18_reset_ir_gpio); -/* This symbol is exported for use by lirc_pvr150 for the IR-blaster */ - /* Xceive tuner reset function */ int cx18_reset_tuner_gpio(void *dev, int component, int cmd, int value) { diff --git a/drivers/media/pci/cx18/cx18-gpio.h b/drivers/media/pci/cx18/cx18-gpio.h index 0fa4c7ad2286..8d5797dea7f5 100644 --- a/drivers/media/pci/cx18/cx18-gpio.h +++ b/drivers/media/pci/cx18/cx18-gpio.h @@ -17,5 +17,4 @@ enum cx18_gpio_reset_type { CX18_GPIO_RESET_XC2028 = 2, }; -void cx18_reset_ir_gpio(void *data); int cx18_reset_tuner_gpio(void *dev, int component, int cmd, int value); -- 2.51.0