public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org, hans@jjverkuil.nl,
	Prabhakar <prabhakar.csengg@gmail.com>,
	"Kate Hsuan" <hpa@redhat.com>,
	"Alexander Shiyan" <eagle.alexander923@gmail.com>,
	"Dave Stevenson" <dave.stevenson@raspberrypi.com>,
	"Tommaso Merciai" <tomm.merciai@gmail.com>,
	"Umang Jain" <umang.jain@ideasonboard.com>,
	"Benjamin Mugnier" <benjamin.mugnier@foss.st.com>,
	"Sylvain Petinot" <sylvain.petinot@foss.st.com>,
	"Christophe JAILLET" <christophe.jaillet@wanadoo.fr>,
	"Julien Massot" <julien.massot@collabora.com>,
	"Naushir Patuck" <naush@raspberrypi.com>,
	"Yan, Dongcheng" <dongcheng.yan@intel.com>,
	"Cao, Bingbu" <bingbu.cao@intel.com>,
	"Qiu, Tian Shu" <tian.shu.qiu@intel.com>,
	"Wang, Hongju" <hongju.wang@intel.com>,
	"Stefan Klug" <stefan.klug@ideasonboard.com>,
	"Mirela Rabulea" <mirela.rabulea@nxp.com>,
	"André Apitzsch" <git@apitzsch.eu>,
	"Heimir Thor Sverrisson" <heimir.sverrisson@gmail.com>,
	"Kieran Bingham" <kieran.bingham@ideasonboard.com>,
	"Stanislaw Gruszka" <stanislaw.gruszka@linux.intel.com>,
	"Mehdi Djait" <mehdi.djait@linux.intel.com>,
	"Ricardo Ribalda Delgado" <ribalda@kernel.org>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Jacopo Mondi" <jacopo.mondi@ideasonboard.com>,
	"Tomi Valkeinen" <tomi.valkeinen@ideasonboard.com>
Subject: Re: [PATCH v11 32/66] media: ccs: Rely on sub-device state locking
Date: Wed, 14 Jan 2026 14:13:28 +0200	[thread overview]
Message-ID: <aWeIaBZeTcIXW2cb@kekkonen.localdomain> (raw)
In-Reply-To: <20250903205644.GX3648@pendragon.ideasonboard.com>

Hi Laurent,

On Wed, Sep 03, 2025 at 10:56:44PM +0200, Laurent Pinchart wrote:
> Hi Sakari,
> 
> Thank you for the patch.
> 
> On Mon, Aug 25, 2025 at 12:50:33PM +0300, Sakari Ailus wrote:
> > Rely on sub-device state locking to serialise access to driver's data
> > structures. The driver-provided mutex is used as the state lock for all
> > driver sub-devices.
> > 
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > ---
> >  drivers/media/i2c/ccs/ccs-core.c | 187 +++++++++++++------------------
> >  drivers/media/i2c/ccs/ccs.h      |   1 -
> >  2 files changed, 79 insertions(+), 109 deletions(-)
> > 
> > diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c
> > index 0f0588e0c2da..2d2ae568739b 100644
> > --- a/drivers/media/i2c/ccs/ccs-core.c
> > +++ b/drivers/media/i2c/ccs/ccs-core.c
> > @@ -541,12 +541,13 @@ static int ccs_pll_update(struct ccs_sensor *sensor)
> >   *
> >   */
> >  
> > -static void __ccs_update_exposure_limits(struct ccs_sensor *sensor)
> > +static void __ccs_update_exposure_limits(struct ccs_sensor *sensor,
> > +					 struct v4l2_rect *pa_src)
> 
> This can be const.
> 
> >  {
> >  	struct v4l2_ctrl *ctrl = sensor->exposure;
> >  	int max;
> >  
> > -	max = sensor->pa_src.height + sensor->vblank->val -
> > +	max = pa_src->height + sensor->vblank->val -
> >  		CCS_LIM(sensor, COARSE_INTEGRATION_TIME_MAX_MARGIN);
> >  
> >  	__v4l2_ctrl_modify_range(ctrl, ctrl->minimum, max, ctrl->step, max);
> > @@ -649,12 +650,20 @@ static int ccs_set_ctrl(struct v4l2_ctrl *ctrl)
> >  		container_of(ctrl->handler, struct ccs_subdev, ctrl_handler)
> >  			->sensor;
> >  	struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
> > +	struct v4l2_subdev_state *state;
> > +	struct v4l2_rect *pa_src;
> >  	int pm_status;
> >  	u32 orient = 0;
> >  	unsigned int i;
> >  	int exposure;
> >  	int rval;
> >  
> > +	if (ctrl->id == V4L2_CID_VBLANK || ctrl->id == V4L2_CID_HBLANK) {
> > +		state = v4l2_subdev_get_locked_active_state(&sensor->pixel_array->sd);
> > +		pa_src = v4l2_subdev_state_get_crop(state, CCS_PA_PAD_SRC,
> > +						    CCS_STREAM_PIXEL);
> > +	}
> > +
> >  	switch (ctrl->id) {
> >  	case V4L2_CID_HFLIP:
> >  	case V4L2_CID_VFLIP:
> > @@ -673,7 +682,7 @@ static int ccs_set_ctrl(struct v4l2_ctrl *ctrl)
> >  	case V4L2_CID_VBLANK:
> >  		exposure = sensor->exposure->val;
> >  
> > -		__ccs_update_exposure_limits(sensor);
> > +		__ccs_update_exposure_limits(sensor, pa_src);
> >  
> >  		if (exposure > sensor->exposure->maximum) {
> >  			sensor->exposure->val =	sensor->exposure->maximum;
> > @@ -765,12 +774,12 @@ static int ccs_set_ctrl(struct v4l2_ctrl *ctrl)
> >  		break;
> >  	case V4L2_CID_VBLANK:
> >  		rval = ccs_write(sensor, FRAME_LENGTH_LINES,
> > -				 sensor->pa_src.height + ctrl->val);
> > +				 pa_src->height + ctrl->val);
> >  
> >  		break;
> >  	case V4L2_CID_HBLANK:
> >  		rval = ccs_write(sensor, LINE_LENGTH_PCK,
> > -				 sensor->pa_src.width + ctrl->val);
> > +				 pa_src->width + ctrl->val);
> >  
> >  		break;
> >  	case V4L2_CID_TEST_PATTERN:
> > @@ -1242,7 +1251,8 @@ static int ccs_get_mbus_formats(struct ccs_sensor *sensor)
> >  	return 0;
> >  }
> >  
> > -static void ccs_update_blanking(struct ccs_sensor *sensor)
> > +static void ccs_update_blanking(struct ccs_sensor *sensor,
> > +				struct v4l2_rect *pa_src)
> 
> Same here.
> 
> >  {
> >  	struct v4l2_ctrl *vblank = sensor->vblank;
> >  	struct v4l2_ctrl *hblank = sensor->hblank;
> > @@ -1265,21 +1275,26 @@ static void ccs_update_blanking(struct ccs_sensor *sensor)
> >  
> >  	min = max_t(int,
> >  		    CCS_LIM(sensor, MIN_FRAME_BLANKING_LINES),
> > -		    min_fll - sensor->pa_src.height);
> > -	max = max_fll -	sensor->pa_src.height;
> > +		    min_fll - pa_src->height);
> > +	max = max_fll -	pa_src->height;
> >  
> >  	__v4l2_ctrl_modify_range(vblank, min, max, vblank->step, min);
> >  
> > -	min = max_t(int, min_llp - sensor->pa_src.width, min_lbp);
> > -	max = max_llp - sensor->pa_src.width;
> > +	min = max_t(int, min_llp - pa_src->width, min_lbp);
> > +	max = max_llp - pa_src->width;
> >  
> >  	__v4l2_ctrl_modify_range(hblank, min, max, hblank->step, min);
> >  
> > -	__ccs_update_exposure_limits(sensor);
> > +	__ccs_update_exposure_limits(sensor, pa_src);
> >  }
> >  
> >  static int ccs_pll_blanking_update(struct ccs_sensor *sensor)
> >  {
> > +	struct v4l2_subdev_state *state =
> > +		v4l2_subdev_get_locked_active_state(&sensor->pixel_array->sd);
> 
> As one of the callers (ccs_set_compose()) already has a state pointer, I
> would pass it to this function.

One caller does but the other one does not. I'd thus keep it as-is.

> 
> > +	struct v4l2_rect *pa_src =
> 
> const
> 
> I now realize you seem to have missed my review of v9. Please take all
> the comments from there into account for v12.

Yes, it seems I had missed some comments on v9; I'll address these in v12.

> 
> > +		v4l2_subdev_state_get_crop(state, CCS_PA_PAD_SRC,
> > +					   CCS_STREAM_PIXEL);
> >  	struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
> >  	int rval;
> >  
> > @@ -1288,15 +1303,15 @@ static int ccs_pll_blanking_update(struct ccs_sensor *sensor)
> >  		return rval;
> >  
> >  	/* Output from pixel array, including blanking */
> > -	ccs_update_blanking(sensor);
> > +	ccs_update_blanking(sensor, pa_src);
> >  
> >  	dev_dbg(&client->dev, "vblank\t\t%d\n", sensor->vblank->val);
> >  	dev_dbg(&client->dev, "hblank\t\t%d\n", sensor->hblank->val);
> >  
> >  	dev_dbg(&client->dev, "real timeperframe\t100/%d\n",
> >  		sensor->pll.pixel_rate_pixel_array /
> > -		((sensor->pa_src.width + sensor->hblank->val) *
> > -		 (sensor->pa_src.height + sensor->vblank->val) / 100));
> > +		((pa_src->width + sensor->hblank->val) *
> > +		 (pa_src->height + sensor->vblank->val) / 100));
> >  
> >  	return 0;
> >  }
> > @@ -1801,6 +1816,16 @@ static int ccs_enable_streams(struct v4l2_subdev *subdev,
> >  			      u64 streams_mask)
> >  {
> >  	struct ccs_sensor *sensor = to_ccs_sensor(subdev);
> > +	struct v4l2_subdev_state *pa_state =
> > +		v4l2_subdev_get_locked_active_state(&sensor->pixel_array->sd);
> > +	struct v4l2_subdev_state *src_state =
> > +		v4l2_subdev_get_locked_active_state(&sensor->src->sd);
> > +	struct v4l2_rect *pa_src =
> > +		v4l2_subdev_state_get_crop(pa_state, CCS_PA_PAD_SRC,
> > +					   CCS_STREAM_PIXEL);
> > +	struct v4l2_rect *src_src =
> > +		v4l2_subdev_state_get_crop(src_state, CCS_PAD_SRC,
> > +					   CCS_STREAM_PIXEL);
> >  	struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
> >  	unsigned int binning_mode;
> >  	int rval;
> > @@ -1848,22 +1873,20 @@ static int ccs_enable_streams(struct v4l2_subdev *subdev,
> >  		goto err_pm_put;
> >  
> >  	/* Analog crop start coordinates */
> > -	rval = ccs_write(sensor, X_ADDR_START, sensor->pa_src.left);
> > +	rval = ccs_write(sensor, X_ADDR_START, pa_src->left);
> >  	if (rval < 0)
> >  		goto err_pm_put;
> >  
> > -	rval = ccs_write(sensor, Y_ADDR_START, sensor->pa_src.top);
> > +	rval = ccs_write(sensor, Y_ADDR_START, pa_src->top);
> >  	if (rval < 0)
> >  		goto err_pm_put;
> >  
> >  	/* Analog crop end coordinates */
> > -	rval = ccs_write(sensor, X_ADDR_END,
> > -			 sensor->pa_src.left + sensor->pa_src.width - 1);
> > +	rval = ccs_write(sensor, X_ADDR_END, pa_src->left + pa_src->width - 1);
> >  	if (rval < 0)
> >  		goto err_pm_put;
> >  
> > -	rval = ccs_write(sensor, Y_ADDR_END,
> > -			 sensor->pa_src.top + sensor->pa_src.height - 1);
> > +	rval = ccs_write(sensor, Y_ADDR_END, pa_src->top + pa_src->height - 1);
> >  	if (rval < 0)
> >  		goto err_pm_put;
> >  
> > @@ -1875,23 +1898,30 @@ static int ccs_enable_streams(struct v4l2_subdev *subdev,
> >  	/* Digital crop */
> >  	if (CCS_LIM(sensor, DIGITAL_CROP_CAPABILITY)
> >  	    == CCS_DIGITAL_CROP_CAPABILITY_INPUT_CROP) {
> > +		struct v4l2_subdev_state *scaler_state =
> > +			v4l2_subdev_get_locked_active_state(&sensor->scaler->sd);
> > +		struct v4l2_rect *scaler_sink =
> > +			v4l2_subdev_state_get_crop(scaler_state,
> > +						   sensor->scaler->sink_pad,
> > +						   CCS_STREAM_PIXEL);
> > +
> >  		rval = ccs_write(sensor, DIGITAL_CROP_X_OFFSET,
> > -				 sensor->scaler_sink.left);
> > +				 scaler_sink->left);
> >  		if (rval < 0)
> >  			goto err_pm_put;
> >  
> >  		rval = ccs_write(sensor, DIGITAL_CROP_Y_OFFSET,
> > -				 sensor->scaler_sink.top);
> > +				 scaler_sink->top);
> >  		if (rval < 0)
> >  			goto err_pm_put;
> >  
> >  		rval = ccs_write(sensor, DIGITAL_CROP_IMAGE_WIDTH,
> > -				 sensor->scaler_sink.width);
> > +				 scaler_sink->width);
> >  		if (rval < 0)
> >  			goto err_pm_put;
> >  
> >  		rval = ccs_write(sensor, DIGITAL_CROP_IMAGE_HEIGHT,
> > -				 sensor->scaler_sink.height);
> > +				 scaler_sink->height);
> >  		if (rval < 0)
> >  			goto err_pm_put;
> >  	}
> > @@ -1909,10 +1939,10 @@ static int ccs_enable_streams(struct v4l2_subdev *subdev,
> >  	}
> >  
> >  	/* Output size from sensor */
> > -	rval = ccs_write(sensor, X_OUTPUT_SIZE, sensor->src_src.width);
> > +	rval = ccs_write(sensor, X_OUTPUT_SIZE, src_src->width);
> >  	if (rval < 0)
> >  		goto err_pm_put;
> > -	rval = ccs_write(sensor, Y_OUTPUT_SIZE, sensor->src_src.height);
> > +	rval = ccs_write(sensor, Y_OUTPUT_SIZE, src_src->height);
> >  	if (rval < 0)
> >  		goto err_pm_put;
> >  
> > @@ -2101,9 +2131,6 @@ static int ccs_enum_mbus_code(struct v4l2_subdev *subdev,
> >  	struct ccs_sensor *sensor = to_ccs_sensor(subdev);
> >  	unsigned int i;
> >  	int idx = -1;
> > -	int rval = -EINVAL;
> > -
> > -	mutex_lock(&sensor->mutex);
> >  
> >  	dev_err(&client->dev, "subdev %s, pad %u, index %u\n",
> >  		subdev->name, code->pad, code->index);
> > @@ -2155,21 +2182,21 @@ static int ccs_enum_mbus_code(struct v4l2_subdev *subdev,
> >  			}
> >  
> >  			if (WARN_ON(i > ARRAY_SIZE(codes)) || code->index >= i)
> > -				goto out;
> > +				return -EINVAL;
> >  
> >  			code->code = codes[code->index];
> > -			rval = 0;
> > -			goto out;
> > +
> > +			return 0;
> >  		}
> >  	}
> >  
> >  	if (subdev != &sensor->src->sd || code->pad != CCS_PAD_SRC) {
> >  		if (code->index)
> > -			goto out;
> > +			return -EINVAL;
> >  
> >  		code->code = sensor->internal_csi_format->code;
> > -		rval = 0;
> > -		goto out;
> > +
> > +		return 0;
> >  	}
> >  
> >  	for (i = 0; i < ARRAY_SIZE(ccs_csi_data_formats); i++) {
> > @@ -2180,18 +2207,14 @@ static int ccs_enum_mbus_code(struct v4l2_subdev *subdev,
> >  			code->code = ccs_csi_data_formats[i].code;
> >  			dev_err(&client->dev, "found index %u, i %u, code %x\n",
> >  				code->index, i, code->code);
> > -			rval = 0;
> > -			break;
> > +			return 0;
> >  		}
> >  	}
> >  
> > -out:
> > -	mutex_unlock(&sensor->mutex);
> > -
> > -	return rval;
> > +	return -EINVAL;
> >  }
> >  
> > -static u32 __ccs_get_mbus_code(struct v4l2_subdev *subdev, unsigned int pad)
> > +static u32 ccs_get_mbus_code(struct v4l2_subdev *subdev, unsigned int pad)
> >  {
> >  	struct ccs_sensor *sensor = to_ccs_sensor(subdev);
> >  
> > @@ -2201,33 +2224,19 @@ static u32 __ccs_get_mbus_code(struct v4l2_subdev *subdev, unsigned int pad)
> >  		return sensor->internal_csi_format->code;
> >  }
> >  
> > -static int __ccs_get_format(struct v4l2_subdev *subdev,
> > -			    struct v4l2_subdev_state *sd_state,
> > -			    struct v4l2_subdev_format *fmt)
> > +static int ccs_get_format(struct v4l2_subdev *subdev,
> > +			  struct v4l2_subdev_state *sd_state,
> > +			  struct v4l2_subdev_format *fmt)
> >  {
> >  	fmt->format = *v4l2_subdev_state_get_format(sd_state, fmt->pad,
> >  						    fmt->stream);
> >  
> >  	if (fmt->pad != CCS_PAD_META && fmt->stream != CCS_STREAM_META)
> > -		fmt->format.code = __ccs_get_mbus_code(subdev, fmt->pad);
> > +		fmt->format.code = ccs_get_mbus_code(subdev, fmt->pad);
> >  
> >  	return 0;
> >  }
> >  
> > -static int ccs_get_format(struct v4l2_subdev *subdev,
> > -			  struct v4l2_subdev_state *sd_state,
> > -			  struct v4l2_subdev_format *fmt)
> > -{
> > -	struct ccs_sensor *sensor = to_ccs_sensor(subdev);
> > -	int rval;
> > -
> > -	mutex_lock(&sensor->mutex);
> > -	rval = __ccs_get_format(subdev, sd_state, fmt);
> > -	mutex_unlock(&sensor->mutex);
> > -
> > -	return rval;
> > -}
> > -
> >  /* Changes require propagation only on sink pad. */
> >  static void ccs_propagate(struct v4l2_subdev *subdev,
> >  			  struct v4l2_subdev_state *sd_state, int which,
> > @@ -2251,7 +2260,6 @@ static void ccs_propagate(struct v4l2_subdev *subdev,
> >  				sensor->scale_m = CCS_LIM(sensor, SCALER_N_MIN);
> >  				sensor->scaling_mode =
> >  					CCS_SCALING_MODE_NO_SCALING;
> > -				sensor->scaler_sink = *comp;
> >  			} else if (ssd == sensor->binner) {
> >  				sensor->binning_horizontal = 1;
> >  				sensor->binning_vertical = 1;
> > @@ -2266,8 +2274,6 @@ static void ccs_propagate(struct v4l2_subdev *subdev,
> >  						   CCS_STREAM_PIXEL);
> >  		fmt->width = comp->width;
> >  		fmt->height = comp->height;
> > -		if (which == V4L2_SUBDEV_FORMAT_ACTIVE && ssd == sensor->src)
> > -			sensor->src_src = *crop;
> >  		break;
> >  	default:
> >  		WARN_ON_ONCE(1);
> > @@ -2286,7 +2292,7 @@ static int ccs_set_format_source(struct v4l2_subdev *subdev,
> >  	unsigned int i;
> >  	int rval;
> >  
> > -	rval = __ccs_get_format(subdev, sd_state, fmt);
> > +	rval = ccs_get_format(subdev, sd_state, fmt);
> >  	if (rval)
> >  		return rval;
> >  
> > @@ -2421,13 +2427,9 @@ static int ccs_set_format(struct v4l2_subdev *subdev,
> >  	if (ssd == sensor->src && fmt->pad == CCS_PAD_META)
> >  		return ccs_get_format(subdev, sd_state, fmt);
> >  
> > -	mutex_lock(&sensor->mutex);
> > -
> >  	if (ssd == sensor->src && fmt->stream == CCS_STREAM_META) {
> >  		ccs_set_format_meta(subdev, sd_state, &fmt->format);
> >  
> > -		mutex_unlock(&sensor->mutex);
> > -
> >  		return 0;
> >  	}
> >  
> > @@ -2438,13 +2440,12 @@ static int ccs_set_format(struct v4l2_subdev *subdev,
> >  		if (ccs_embedded_data_lines(sensor) && ssd == sensor->src)
> >  			ccs_set_format_meta(subdev, sd_state, NULL);
> >  
> > -		mutex_unlock(&sensor->mutex);
> > -
> >  		return rval;
> >  	}
> >  
> >  	/* Sink pad. Width and height are changeable here. */
> > -	fmt->format.code = __ccs_get_mbus_code(subdev, fmt->pad);
> > +	fmt->format.code = ccs_get_mbus_code(subdev, fmt->pad);
> > +
> >  	fmt->format.width &= ~1;
> >  	fmt->format.height &= ~1;
> >  	fmt->format.field = V4L2_FIELD_NONE;
> > @@ -2467,8 +2468,6 @@ static int ccs_set_format(struct v4l2_subdev *subdev,
> >  	crop->height = fmt->format.height;
> >  	ccs_propagate(subdev, sd_state, fmt->which, V4L2_SEL_TGT_CROP);
> >  
> > -	mutex_unlock(&sensor->mutex);
> > -
> >  	return 0;
> >  }
> >  
> > @@ -2776,9 +2775,6 @@ static int ccs_set_crop(struct v4l2_subdev *subdev,
> >  
> >  	if (ssd != sensor->pixel_array && sel->pad == CCS_PAD_SINK)
> >  		ccs_propagate(subdev, sd_state, sel->which, V4L2_SEL_TGT_CROP);
> > -	else if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE &&
> > -		 ssd == sensor->pixel_array)
> > -		sensor->pa_src = sel->r;
> >  
> >  	return 0;
> >  }
> > @@ -2850,8 +2846,6 @@ static int ccs_set_selection(struct v4l2_subdev *subdev,
> >  	if (ret)
> >  		return ret;
> >  
> > -	mutex_lock(&sensor->mutex);
> > -
> >  	sel->r.left = max(0, sel->r.left & ~1);
> >  	sel->r.top = max(0, sel->r.top & ~1);
> >  	sel->r.width = CCS_ALIGN_DIM(sel->r.width, sel->flags);
> > @@ -2873,7 +2867,6 @@ static int ccs_set_selection(struct v4l2_subdev *subdev,
> >  		ret = -EINVAL;
> >  	}
> >  
> > -	mutex_unlock(&sensor->mutex);
> >  	return ret;
> >  }
> >  
> > @@ -3256,6 +3249,7 @@ static int ccs_init_subdev(struct ccs_sensor *sensor,
> >  
> >  	ssd->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> >  	ssd->sd.entity.function = function;
> > +	ssd->sd.state_lock = &sensor->mutex;
> >  	ssd->sensor = sensor;
> >  
> >  	ssd->npads = num_pads;
> > @@ -3295,8 +3289,8 @@ static int ccs_init_subdev(struct ccs_sensor *sensor,
> >  	return 0;
> >  }
> >  
> > -static int __ccs_init_state(struct v4l2_subdev *sd,
> > -			    struct v4l2_subdev_state *sd_state)
> > +static int ccs_init_state(struct v4l2_subdev *sd,
> > +			  struct v4l2_subdev_state *sd_state)
> >  {
> >  	struct ccs_subdev *ssd = to_ccs_subdev(sd);
> >  	struct ccs_sensor *sensor = ssd->sensor;
> > @@ -3315,12 +3309,8 @@ static int __ccs_init_state(struct v4l2_subdev *sd,
> >  	fmt->code = sensor->internal_csi_format->code;
> >  	fmt->field = V4L2_FIELD_NONE;
> >  
> > -	if (ssd == sensor->pixel_array) {
> > -		if (is_active)
> > -			sensor->pa_src = *crop;
> > -
> > +	if (ssd == sensor->pixel_array)
> >  		return 0;
> > -	}
> >  
> >  	fmt = v4l2_subdev_state_get_format(sd_state, CCS_PAD_SRC,
> >  					   CCS_STREAM_PIXEL);
> > @@ -3333,20 +3323,6 @@ static int __ccs_init_state(struct v4l2_subdev *sd,
> >  	return 0;
> >  }
> >  
> > -static int ccs_init_state(struct v4l2_subdev *sd,
> > -			  struct v4l2_subdev_state *sd_state)
> > -{
> > -	struct ccs_subdev *ssd = to_ccs_subdev(sd);
> > -	struct ccs_sensor *sensor = ssd->sensor;
> > -	int rval;
> > -
> > -	mutex_lock(&sensor->mutex);
> > -	rval = __ccs_init_state(sd, sd_state);
> > -	mutex_unlock(&sensor->mutex);
> > -
> > -	return rval;
> > -}
> > -
> >  static int ccs_src_init_state(struct v4l2_subdev *sd,
> >  			      struct v4l2_subdev_state *sd_state)
> >  {
> > @@ -3371,25 +3347,20 @@ static int ccs_src_init_state(struct v4l2_subdev *sd,
> >  	struct ccs_sensor *sensor = ssd->sensor;
> >  	int rval;
> >  
> > -	mutex_lock(&sensor->mutex);
> > -
> >  	if (ccs_embedded_data_lines(sensor))
> >  		routing.num_routes++;
> >  
> >  	rval = v4l2_subdev_set_routing(sd, sd_state, &routing);
> >  	if (rval)
> > -		goto out;
> > +		return 0;
> >  
> > -	rval = __ccs_init_state(sd, sd_state);
> > +	rval = ccs_init_state(sd, sd_state);
> >  	if (rval)
> > -		goto out;
> > +		return 0;
> >  
> >  	if (ccs_embedded_data_lines(sensor))
> >  		ccs_set_format_meta(sd, sd_state, NULL);
> >  
> > -out:
> > -	mutex_unlock(&sensor->mutex);
> > -
> >  	return rval;
> >  }
> >  
> > diff --git a/drivers/media/i2c/ccs/ccs.h b/drivers/media/i2c/ccs/ccs.h
> > index 1bc524de3aa2..338209950fcb 100644
> > --- a/drivers/media/i2c/ccs/ccs.h
> > +++ b/drivers/media/i2c/ccs/ccs.h
> > @@ -232,7 +232,6 @@ struct ccs_sensor {
> >  	u32 mbus_frame_fmts;
> >  	const struct ccs_csi_data_format *csi_format;
> >  	const struct ccs_csi_data_format *internal_csi_format;
> > -	struct v4l2_rect pa_src, scaler_sink, src_src;
> >  	u32 default_mbus_frame_fmts;
> >  	int default_pixel_order;
> >  	struct ccs_data_container sdata, mdata;
> 

-- 
Kind regards,

Sakari Ailus

  parent reply	other threads:[~2026-01-14 12:13 UTC|newest]

Thread overview: 189+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-25  9:50 [PATCH v11 00/66] Generic line based metadata support, internal pads Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 01/66] media: Documentation: Clean up figure titles Sakari Ailus
2025-09-01 11:11   ` Jacopo Mondi
2025-09-03 13:00   ` Laurent Pinchart
2025-08-25  9:50 ` [PATCH v11 02/66] media: Documentation: Fix routing documentation flag references Sakari Ailus
2025-09-01 11:14   ` Jacopo Mondi
2025-09-03 13:01   ` Laurent Pinchart
2025-08-25  9:50 ` [PATCH v11 03/66] media: Documentation: There are either immutable or mutable routes Sakari Ailus
2025-09-01 11:18   ` Jacopo Mondi
2025-09-02  9:38     ` Sakari Ailus
2025-09-03 13:22   ` Laurent Pinchart
2025-09-03 14:09     ` Sakari Ailus
2025-09-03 14:12     ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 04/66] media: Documentation: Document -ENXIO for VIDIOC_SUBDEV_S_ROUTING Sakari Ailus
2025-09-01 11:33   ` Jacopo Mondi
2025-09-02 10:00     ` Sakari Ailus
2025-09-03 13:47       ` Laurent Pinchart
2025-09-03 14:15         ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 05/66] media: v4l2-subdev: Extend VIDIOC_SUBDEV_S_ROUTING error codes Sakari Ailus
2025-09-01 11:35   ` Jacopo Mondi
2025-09-03 13:53   ` Laurent Pinchart
2025-08-25  9:50 ` [PATCH v11 06/66] media: ccs: No need to set streaming to false in power off Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 07/66] media: ccs: Move ccs_pm_get_init function up Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 08/66] media: ccs: Rename out label of ccs_start_streaming Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 09/66] media: ccs: Move ccs_validate_csi_data_format up Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 10/66] media: ccs: Use {enable,disable}_streams operations Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 11/66] media: ccs: Track streaming state Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 12/66] media: ccs: Support frame descriptors Sakari Ailus
2025-09-01 12:06   ` Jacopo Mondi
2025-09-02 12:26     ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 13/66] media: mc: Add INTERNAL pad flag Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 14/66] media: Documentation: Refer to internal pads in metadata documentation Sakari Ailus
2025-09-01 12:08   ` Jacopo Mondi
2025-09-02 12:58     ` Sakari Ailus
2025-09-03 14:01   ` Laurent Pinchart
2025-08-25  9:50 ` [PATCH v11 15/66] media: uapi: Add generic CSI-2 raw pixelformats Sakari Ailus
2025-09-01 13:25   ` Jacopo Mondi
2025-09-02 13:16     ` Sakari Ailus
2025-09-03 14:20       ` Laurent Pinchart
2025-09-03 14:30         ` Sakari Ailus
2025-09-02 13:16     ` Jacopo Mondi
2025-08-25  9:50 ` [PATCH v11 16/66] media: Documentation: Reference color pattern control in format docs Sakari Ailus
2025-09-01 13:51   ` Jacopo Mondi
2025-09-03 14:25     ` Laurent Pinchart
2025-08-25  9:50 ` [PATCH v11 17/66] media: uapi: Add new media bus codes for generic raw formats Sakari Ailus
2025-09-01 14:12   ` Jacopo Mondi
2025-09-03  9:27     ` Sakari Ailus
2025-09-03 14:32       ` Laurent Pinchart
2025-09-03 14:35         ` Sakari Ailus
2025-09-03 14:39           ` Laurent Pinchart
2025-09-03 14:38   ` Laurent Pinchart
2025-09-19 10:07     ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 18/66] media: uapi: Add V4L2_CID_CONFIG_MODEL control Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 19/66] media: uapi: Add V4L2_CID_COLOR_PATTERN for describing color patterns Sakari Ailus
2025-09-03 15:05   ` Laurent Pinchart
2025-09-19 21:35     ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 20/66] media: Documentation: Reference COLOR_PATTERN control in raw format docs Sakari Ailus
2025-09-01 14:21   ` Jacopo Mondi
2025-09-03 10:03     ` Sakari Ailus
2025-09-03 12:03       ` Jacopo Mondi
2025-09-03 15:10         ` Laurent Pinchart
2025-09-19 10:09           ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 21/66] media: v4l: uapi: Add a control for color pattern flipping effect Sakari Ailus
2025-09-01 14:34   ` Jacopo Mondi
2025-09-03 10:25     ` Sakari Ailus
2025-09-03 10:40       ` Sakari Ailus
2025-09-03 12:18         ` Jacopo Mondi
2025-09-03 12:38           ` Sakari Ailus
2025-09-03 12:37       ` Jacopo Mondi
2025-09-03 13:25         ` Sakari Ailus
2025-09-03 15:28           ` Laurent Pinchart
2025-08-25  9:50 ` [PATCH v11 22/66] media: Documentation: Reference flipping controls in raw format docs Sakari Ailus
2025-09-02 13:06   ` Jacopo Mondi
2025-09-03 15:31   ` Laurent Pinchart
2025-08-25  9:50 ` [PATCH v11 23/66] media: Documentation: Document raw mbus codes and CFA for cameras Sakari Ailus
2025-09-01 14:59   ` Jacopo Mondi
2025-09-03 11:00     ` Sakari Ailus
2025-09-03 15:35       ` Laurent Pinchart
2025-08-25  9:50 ` [PATCH v11 24/66] media: uapi: Add V4L2_CID_METADATA_LAYOUT control Sakari Ailus
2025-09-01 15:07   ` Jacopo Mondi
2025-09-03 11:13     ` Sakari Ailus
2025-09-03 19:52       ` Laurent Pinchart
2025-09-19 10:36         ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 25/66] media: Documentation: v4l: Document internal sink pads Sakari Ailus
2025-09-01 16:39   ` Jacopo Mondi
2025-09-03 12:17     ` Sakari Ailus
2025-09-03 12:29       ` Jacopo Mondi
2025-09-03 13:27         ` Sakari Ailus
2025-09-03 20:24         ` Laurent Pinchart
2025-09-19 11:26           ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 26/66] media: Documentation: Document embedded data guidelines for camera sensors Sakari Ailus
2025-09-01 16:42   ` Jacopo Mondi
2025-09-03 13:37     ` Sakari Ailus
2025-09-03 20:40       ` Laurent Pinchart
2025-09-19 11:46         ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 27/66] media: uapi: ccs: Add metadata layout for MIPI CCS embedded data Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 28/66] media: Documentation: Document non-CCS use of CCS embedded data layout Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 29/66] media: ccs: Add support for embedded data stream Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 30/66] media: Documentation: ccs: Document routing Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 31/66] media: ccs: Remove ccs_get_crop_compose helper Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 32/66] media: ccs: Rely on sub-device state locking Sakari Ailus
2025-09-03 20:56   ` Laurent Pinchart
2025-09-22  7:48     ` Sakari Ailus
2026-01-14 12:13     ` Sakari Ailus [this message]
2025-08-25  9:50 ` [PATCH v11 33/66] media: ccs: Compute binning configuration from sub-device state Sakari Ailus
2025-09-03 21:00   ` Laurent Pinchart
2025-08-25  9:50 ` [PATCH v11 34/66] media: ccs: Compute scaling " Sakari Ailus
2025-09-03 21:02   ` Laurent Pinchart
2026-01-14 11:16     ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 35/66] media: ccs: Remove which parameter from ccs_propagate Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 36/66] media: ccs: Detemine emb_data_ctrl register from sub-device state Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 37/66] media: uapi: Correct generic CSI-2 metadata format 4cc Sakari Ailus
2025-09-01 16:45   ` Jacopo Mondi
2025-09-03 21:35   ` Laurent Pinchart
2025-08-25  9:50 ` [PATCH v11 38/66] Revert "media: uapi: v4l: Don't expose generic metadata formats to userspace" Sakari Ailus
2025-09-01 16:46   ` Jacopo Mondi
2025-09-03 21:36   ` Laurent Pinchart
2025-08-25  9:50 ` [PATCH v11 39/66] media: Documentation: Add subdev configuration models, raw sensor model Sakari Ailus
2025-09-01 17:09   ` Jacopo Mondi
2025-09-19 12:17     ` Sakari Ailus
2025-09-25 10:31       ` Jacopo Mondi
2025-10-02  7:09         ` Sakari Ailus
2025-10-02  7:22           ` Jacopo Mondi
2025-10-02  7:54             ` Sakari Ailus
2025-10-03  7:10             ` Jacopo Mondi
2025-10-03 13:15               ` Sakari Ailus
2025-10-03 13:25                 ` Jacopo Mondi
2025-10-07 14:01                   ` Jacopo Mondi
2025-10-10  9:45                     ` Stefan Klug
2025-10-10 10:56                       ` Kieran Bingham
2026-01-15 12:04                         ` Sakari Ailus
2026-01-15 21:06                           ` Stefan Klug
2026-01-16 14:46                             ` Stefan Klug
2026-01-16 22:03                               ` Sakari Ailus
2026-01-13 14:46                     ` Jacopo Mondi
2026-01-14 12:54                       ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 40/66] media: Document enable_streams and disable_streams behaviour Sakari Ailus
2025-09-01 17:11   ` Jacopo Mondi
2025-09-03 21:29   ` Laurent Pinchart
2025-09-19 12:21     ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 41/66] media: Documentation: Add scaling and post-scaler crop for common raw Sakari Ailus
2025-09-01 17:12   ` Jacopo Mondi
2025-09-19 12:42     ` Sakari Ailus
2025-09-25 10:45       ` Jacopo Mondi
2025-10-02  7:12         ` Sakari Ailus
2025-10-02  7:18           ` Jacopo Mondi
2025-08-25  9:50 ` [PATCH v11 42/66] media: uapi: Add MIPI CCS configuration model Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 43/66] media: uapi: Add V4L2_CID_BINNING control for binning configuration Sakari Ailus
2025-09-01 17:27   ` Jacopo Mondi
2025-09-19 14:53     ` Sakari Ailus
2025-10-10 10:21   ` Stefan Klug
2025-10-20 14:42     ` David Plowman
2025-10-20 19:24       ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 44/66] media: uapi: Add controls for sub-sampling configuration Sakari Ailus
2025-09-01 17:29   ` Jacopo Mondi
2025-09-19 16:25     ` Sakari Ailus
2026-03-26 16:05   ` Benjamin Mugnier
2026-03-26 16:54     ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 45/66] media: Documentation: Add binning and sub-sampling controls Sakari Ailus
2025-09-01 17:30   ` Jacopo Mondi
2025-08-25  9:50 ` [PATCH v11 46/66] media: uapi: Add metadata layout for ov2740 embedded data Sakari Ailus
2025-09-03 21:43   ` Laurent Pinchart
2025-08-25  9:50 ` [PATCH v11 47/66] media: ov2740: Add support for " Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 48/66] media: ov2740: Add support for generic raw formats Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 49/66] media: ov2740: Add metadata layout control Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 50/66] media: ov2740: Add support for G_SELECTION IOCTL Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 51/66] media: v4l: Add V4L2_SUBDEV_ROUTE_FL_IMMUTABLE sub-device routing flag Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 52/66] media: v4l: Add V4L2_SUBDEV_ROUTE_FL_STATIC " Sakari Ailus
2025-09-01 17:32   ` Jacopo Mondi
2025-09-03 21:52   ` Laurent Pinchart
2025-09-19 16:45     ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 53/66] media: Documentation: Document IMMUTABLE and STATIC route flags Sakari Ailus
2025-09-01 17:35   ` Jacopo Mondi
2025-09-19 16:57     ` Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 54/66] media: uapi: v4l: subdev: Enable streams API Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 55/66] media: ccs: Add IMMUTABLE and STATIC route flags Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 56/66] media: ov2740: " Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 57/66] media: i2c: imx219: Inline imx219_update_pad_format() in its caller Sakari Ailus
2025-08-25  9:50 ` [PATCH v11 58/66] media: i2c: imx219: Add internal image sink pad Sakari Ailus
2025-08-25  9:51 ` [PATCH v11 59/66] media: i2c: imx219: Add image stream Sakari Ailus
2025-08-25  9:51 ` [PATCH v11 60/66] media: i2c: imx219: Report internal routes to userspace Sakari Ailus
2025-08-25  9:51 ` [PATCH v11 61/66] media: i2c: imx219: Report streams using frame descriptors Sakari Ailus
2025-08-25  9:51 ` [PATCH v11 62/66] media: i2c: imx219: Add embedded data support Sakari Ailus
2025-08-25  9:51 ` [PATCH v11 63/66] media: imx219: Add support for generic raw formats Sakari Ailus
2025-08-25  9:51 ` [PATCH v11 64/66] media: ccs: Add frame descriptor quirk Sakari Ailus
2025-08-25  9:51 ` [PATCH v11 65/66] media: ipu6: Add support for luma-only formats Sakari Ailus
2025-11-11  8:01   ` Bingbu Cao
2025-08-25  9:51 ` [PATCH v11 66/66] media: ipu6: Add support for raw CFA-agnostic formats Sakari Ailus
2025-11-11  8:03   ` Bingbu Cao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aWeIaBZeTcIXW2cb@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=benjamin.mugnier@foss.st.com \
    --cc=bingbu.cao@intel.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=dongcheng.yan@intel.com \
    --cc=eagle.alexander923@gmail.com \
    --cc=git@apitzsch.eu \
    --cc=hans@jjverkuil.nl \
    --cc=hdegoede@redhat.com \
    --cc=heimir.sverrisson@gmail.com \
    --cc=hongju.wang@intel.com \
    --cc=hpa@redhat.com \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=julien.massot@collabora.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mehdi.djait@linux.intel.com \
    --cc=mirela.rabulea@nxp.com \
    --cc=naush@raspberrypi.com \
    --cc=prabhakar.csengg@gmail.com \
    --cc=ribalda@kernel.org \
    --cc=stanislaw.gruszka@linux.intel.com \
    --cc=stefan.klug@ideasonboard.com \
    --cc=sylvain.petinot@foss.st.com \
    --cc=tian.shu.qiu@intel.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=tomm.merciai@gmail.com \
    --cc=umang.jain@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox