media: rkisp1: isp: Rename rkisp1_device.active_sensor to source

The active_sensor field of the rkisp1_device structure points to the ASD
data for the active source. The source may however not be a sensor, so
the naming is a bit confusing. Furthermore, the driver doesn't need to
access the full ASD from the active_sensor field, only the subdev
pointer is needed, when stopping streaming.

Rename the field to source, and turn it into a v4l2_subdev pointer.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
Laurent Pinchart 2022-06-14 20:10:59 +01:00 committed by Mauro Carvalho Chehab
parent 055972a0f5
commit 745ba74ad6
2 changed files with 14 additions and 17 deletions

View File

@ -410,7 +410,7 @@ struct rkisp1_debug {
* @v4l2_dev: v4l2_device variable
* @media_dev: media_device variable
* @notifier: a notifier to register on the v4l2-async API to be notified on the sensor
* @active_sensor: sensor in-use, set when streaming on
* @source: source subdev in-use, set when starting streaming
* @csi: internal CSI-2 receiver
* @isp: ISP sub-device
* @resizer_devs: resizer sub-devices
@ -430,7 +430,7 @@ struct rkisp1_device {
struct v4l2_device v4l2_dev;
struct media_device media_dev;
struct v4l2_async_notifier notifier;
struct rkisp1_sensor_async *active_sensor;
struct v4l2_subdev *source;
struct rkisp1_csi csi;
struct rkisp1_isp isp;
struct rkisp1_resizer resizer_devs[2];

View File

@ -58,7 +58,7 @@
* Helpers
*/
static struct v4l2_subdev *rkisp1_get_remote_sensor(struct v4l2_subdev *sd)
static struct v4l2_subdev *rkisp1_get_remote_source(struct v4l2_subdev *sd)
{
struct media_pad *local, *remote;
struct media_entity *sensor_me;
@ -749,12 +749,11 @@ static int rkisp1_isp_s_stream(struct v4l2_subdev *sd, int enable)
struct rkisp1_device *rkisp1 =
container_of(sd->v4l2_dev, struct rkisp1_device, v4l2_dev);
struct rkisp1_isp *isp = &rkisp1->isp;
struct v4l2_subdev *sensor_sd;
struct rkisp1_sensor_async *asd;
int ret;
if (!enable) {
v4l2_subdev_call(rkisp1->active_sensor->sd, video, s_stream,
false);
v4l2_subdev_call(rkisp1->source, video, s_stream, false);
rkisp1_csi_stop(&rkisp1->csi);
rkisp1_isp_stop(rkisp1);
@ -762,35 +761,33 @@ static int rkisp1_isp_s_stream(struct v4l2_subdev *sd, int enable)
return 0;
}
sensor_sd = rkisp1_get_remote_sensor(sd);
if (!sensor_sd) {
dev_warn(rkisp1->dev, "No link between isp and sensor\n");
rkisp1->source = rkisp1_get_remote_source(sd);
if (!rkisp1->source) {
dev_warn(rkisp1->dev, "No link between isp and source\n");
return -ENODEV;
}
rkisp1->active_sensor = container_of(sensor_sd->asd,
struct rkisp1_sensor_async, asd);
asd = container_of(rkisp1->source->asd, struct rkisp1_sensor_async,
asd);
if (rkisp1->active_sensor->mbus_type != V4L2_MBUS_CSI2_DPHY)
if (asd->mbus_type != V4L2_MBUS_CSI2_DPHY)
return -EINVAL;
rkisp1->isp.frame_sequence = -1;
mutex_lock(&isp->ops_lock);
ret = rkisp1_config_cif(rkisp1, rkisp1->active_sensor->mbus_type,
rkisp1->active_sensor->mbus_flags);
ret = rkisp1_config_cif(rkisp1, asd->mbus_type, asd->mbus_flags);
if (ret)
goto mutex_unlock;
rkisp1_isp_start(rkisp1);
ret = rkisp1_csi_start(&rkisp1->csi, rkisp1->active_sensor);
ret = rkisp1_csi_start(&rkisp1->csi, asd);
if (ret) {
rkisp1_isp_stop(rkisp1);
goto mutex_unlock;
}
ret = v4l2_subdev_call(rkisp1->active_sensor->sd, video, s_stream,
true);
ret = v4l2_subdev_call(rkisp1->source, video, s_stream, true);
if (ret) {
rkisp1_isp_stop(rkisp1);
rkisp1_csi_stop(&rkisp1->csi);