diff mbox series

[16/21] media: ov5640: Disable s_frame_interval in MIPI mode

Message ID 20220131144444.129036-5-jacopo@jmondi.org (mailing list archive)
State New, archived
Headers show
Series media: ov5640: Rework the clock tree programming for MIPI | expand

Commit Message

Jacopo Mondi Jan. 31, 2022, 2:44 p.m. UTC
When the sensor is operated in MIPI mode, the frame rate configuration
is performed by tuning the frame blanking times and not by the
s_frame_interval subdev operation.

Disallow enum/s/g_frame_interval if the chip is used in MIPI mode.

While at it re-indent one function which whose parameters were wrongly
aligned.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 drivers/media/i2c/ov5640.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Comments

Laurent Pinchart Feb. 2, 2022, 10:40 p.m. UTC | #1
Hi Jacopo,

Thank you for the patch.

On Mon, Jan 31, 2022 at 03:44:44PM +0100, Jacopo Mondi wrote:
> When the sensor is operated in MIPI mode, the frame rate configuration
> is performed by tuning the frame blanking times and not by the
> s_frame_interval subdev operation.
> 
> Disallow enum/s/g_frame_interval if the chip is used in MIPI mode.
> 
> While at it re-indent one function which whose parameters were wrongly
> aligned.

I would squash this with 15/21.

> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  drivers/media/i2c/ov5640.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
> index ec46e16223af..28da0ddd2a06 100644
> --- a/drivers/media/i2c/ov5640.c
> +++ b/drivers/media/i2c/ov5640.c
> @@ -3275,15 +3275,17 @@ static int ov5640_enum_frame_size(struct v4l2_subdev *sd,
>  	return 0;
>  }
>  
> -static int ov5640_enum_frame_interval(
> -	struct v4l2_subdev *sd,
> -	struct v4l2_subdev_state *sd_state,
> -	struct v4l2_subdev_frame_interval_enum *fie)
> +static int ov5640_enum_frame_interval(struct v4l2_subdev *sd,
> +				      struct v4l2_subdev_state *sd_state,
> +				      struct v4l2_subdev_frame_interval_enum *fie)
>  {
>  	struct ov5640_dev *sensor = to_ov5640_dev(sd);
>  	struct v4l2_fract tpf;
>  	int ret;
>  
> +	if (ov5640_is_mipi(sensor))
> +		return -EINVAL;

Should we return -ENOIOCTLCMD instead of -EINVAL, to indicate the
operation isn't implemented in CSI-2 mode ? Same below.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +
>  	if (fie->pad != 0)
>  		return -EINVAL;
>  	if (fie->index >= OV5640_NUM_FRAMERATES)
> @@ -3306,6 +3308,9 @@ static int ov5640_g_frame_interval(struct v4l2_subdev *sd,
>  {
>  	struct ov5640_dev *sensor = to_ov5640_dev(sd);
>  
> +	if (ov5640_is_mipi(sensor))
> +		return -EINVAL;
> +
>  	mutex_lock(&sensor->lock);
>  	fi->interval = sensor->frame_interval;
>  	mutex_unlock(&sensor->lock);
> @@ -3320,6 +3325,9 @@ static int ov5640_s_frame_interval(struct v4l2_subdev *sd,
>  	const struct ov5640_mode_info *mode;
>  	int frame_rate, ret = 0;
>  
> +	if (ov5640_is_mipi(sensor))
> +		return -EINVAL;
> +
>  	if (fi->pad != 0)
>  		return -EINVAL;
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index ec46e16223af..28da0ddd2a06 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -3275,15 +3275,17 @@  static int ov5640_enum_frame_size(struct v4l2_subdev *sd,
 	return 0;
 }
 
-static int ov5640_enum_frame_interval(
-	struct v4l2_subdev *sd,
-	struct v4l2_subdev_state *sd_state,
-	struct v4l2_subdev_frame_interval_enum *fie)
+static int ov5640_enum_frame_interval(struct v4l2_subdev *sd,
+				      struct v4l2_subdev_state *sd_state,
+				      struct v4l2_subdev_frame_interval_enum *fie)
 {
 	struct ov5640_dev *sensor = to_ov5640_dev(sd);
 	struct v4l2_fract tpf;
 	int ret;
 
+	if (ov5640_is_mipi(sensor))
+		return -EINVAL;
+
 	if (fie->pad != 0)
 		return -EINVAL;
 	if (fie->index >= OV5640_NUM_FRAMERATES)
@@ -3306,6 +3308,9 @@  static int ov5640_g_frame_interval(struct v4l2_subdev *sd,
 {
 	struct ov5640_dev *sensor = to_ov5640_dev(sd);
 
+	if (ov5640_is_mipi(sensor))
+		return -EINVAL;
+
 	mutex_lock(&sensor->lock);
 	fi->interval = sensor->frame_interval;
 	mutex_unlock(&sensor->lock);
@@ -3320,6 +3325,9 @@  static int ov5640_s_frame_interval(struct v4l2_subdev *sd,
 	const struct ov5640_mode_info *mode;
 	int frame_rate, ret = 0;
 
+	if (ov5640_is_mipi(sensor))
+		return -EINVAL;
+
 	if (fi->pad != 0)
 		return -EINVAL;