Commit 556d821a authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Hans Verkuil

media: vimc: Centralize subdev internal_ops initialization

Initialize the subdev internal_ops field in the vimc_ent_sd_register()
function. This handles the internal ops the same way as the subdev ops,
and prepares for moving to the V4L2 subdev active state API.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent 0b3b27bb
...@@ -358,6 +358,7 @@ int vimc_ent_sd_register(struct vimc_ent_device *ved, ...@@ -358,6 +358,7 @@ int vimc_ent_sd_register(struct vimc_ent_device *ved,
u32 function, u32 function,
u16 num_pads, u16 num_pads,
struct media_pad *pads, struct media_pad *pads,
const struct v4l2_subdev_internal_ops *int_ops,
const struct v4l2_subdev_ops *sd_ops) const struct v4l2_subdev_ops *sd_ops)
{ {
int ret; int ret;
...@@ -367,6 +368,7 @@ int vimc_ent_sd_register(struct vimc_ent_device *ved, ...@@ -367,6 +368,7 @@ int vimc_ent_sd_register(struct vimc_ent_device *ved,
/* Initialize the subdev */ /* Initialize the subdev */
v4l2_subdev_init(sd, sd_ops); v4l2_subdev_init(sd, sd_ops);
sd->internal_ops = int_ops;
sd->entity.function = function; sd->entity.function = function;
sd->entity.ops = &vimc_ent_sd_mops; sd->entity.ops = &vimc_ent_sd_mops;
sd->owner = THIS_MODULE; sd->owner = THIS_MODULE;
......
...@@ -215,6 +215,7 @@ const struct vimc_pix_map *vimc_pix_map_by_pixelformat(u32 pixelformat); ...@@ -215,6 +215,7 @@ const struct vimc_pix_map *vimc_pix_map_by_pixelformat(u32 pixelformat);
* @num_pads: number of pads to initialize * @num_pads: number of pads to initialize
* @pads: the array of pads of the entity, the caller should set the * @pads: the array of pads of the entity, the caller should set the
* flags of the pads * flags of the pads
* @int_ops: pointer to &struct v4l2_subdev_internal_ops.
* @sd_ops: pointer to &struct v4l2_subdev_ops. * @sd_ops: pointer to &struct v4l2_subdev_ops.
* *
* Helper function initialize and register the struct vimc_ent_device and struct * Helper function initialize and register the struct vimc_ent_device and struct
...@@ -227,6 +228,7 @@ int vimc_ent_sd_register(struct vimc_ent_device *ved, ...@@ -227,6 +228,7 @@ int vimc_ent_sd_register(struct vimc_ent_device *ved,
u32 function, u32 function,
u16 num_pads, u16 num_pads,
struct media_pad *pads, struct media_pad *pads,
const struct v4l2_subdev_internal_ops *int_ops,
const struct v4l2_subdev_ops *sd_ops); const struct v4l2_subdev_ops *sd_ops);
/** /**
......
...@@ -591,12 +591,11 @@ static struct vimc_ent_device *vimc_debayer_add(struct vimc_device *vimc, ...@@ -591,12 +591,11 @@ static struct vimc_ent_device *vimc_debayer_add(struct vimc_device *vimc,
ret = vimc_ent_sd_register(&vdebayer->ved, &vdebayer->sd, v4l2_dev, ret = vimc_ent_sd_register(&vdebayer->ved, &vdebayer->sd, v4l2_dev,
vcfg_name, vcfg_name,
MEDIA_ENT_F_PROC_VIDEO_PIXEL_ENC_CONV, 2, MEDIA_ENT_F_PROC_VIDEO_PIXEL_ENC_CONV, 2,
vdebayer->pads, &vimc_debayer_ops); vdebayer->pads, &vimc_debayer_internal_ops,
&vimc_debayer_ops);
if (ret) if (ret)
goto err_free_hdl; goto err_free_hdl;
vdebayer->sd.internal_ops = &vimc_debayer_internal_ops;
vdebayer->ved.process_frame = vimc_debayer_process_frame; vdebayer->ved.process_frame = vimc_debayer_process_frame;
vdebayer->ved.dev = vimc->mdev.dev; vdebayer->ved.dev = vimc->mdev.dev;
vdebayer->mean_win_size = vimc_debayer_ctrl_mean_win_size.def; vdebayer->mean_win_size = vimc_debayer_ctrl_mean_win_size.def;
......
...@@ -72,7 +72,7 @@ static struct vimc_ent_device *vimc_lens_add(struct vimc_device *vimc, ...@@ -72,7 +72,7 @@ static struct vimc_ent_device *vimc_lens_add(struct vimc_device *vimc,
ret = vimc_ent_sd_register(&vlens->ved, &vlens->sd, v4l2_dev, ret = vimc_ent_sd_register(&vlens->ved, &vlens->sd, v4l2_dev,
vcfg_name, MEDIA_ENT_F_LENS, 0, vcfg_name, MEDIA_ENT_F_LENS, 0,
NULL, &vimc_lens_ops); NULL, NULL, &vimc_lens_ops);
if (ret) if (ret)
goto err_free_hdl; goto err_free_hdl;
......
...@@ -421,14 +421,13 @@ static struct vimc_ent_device *vimc_scaler_add(struct vimc_device *vimc, ...@@ -421,14 +421,13 @@ static struct vimc_ent_device *vimc_scaler_add(struct vimc_device *vimc,
ret = vimc_ent_sd_register(&vscaler->ved, &vscaler->sd, v4l2_dev, ret = vimc_ent_sd_register(&vscaler->ved, &vscaler->sd, v4l2_dev,
vcfg_name, vcfg_name,
MEDIA_ENT_F_PROC_VIDEO_SCALER, 2, MEDIA_ENT_F_PROC_VIDEO_SCALER, 2,
vscaler->pads, &vimc_scaler_ops); vscaler->pads, &vimc_scaler_internal_ops,
&vimc_scaler_ops);
if (ret) { if (ret) {
kfree(vscaler); kfree(vscaler);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
vscaler->sd.internal_ops = &vimc_scaler_internal_ops;
vscaler->ved.process_frame = vimc_scaler_process_frame; vscaler->ved.process_frame = vimc_scaler_process_frame;
vscaler->ved.dev = vimc->mdev.dev; vscaler->ved.dev = vimc->mdev.dev;
......
...@@ -424,12 +424,10 @@ static struct vimc_ent_device *vimc_sensor_add(struct vimc_device *vimc, ...@@ -424,12 +424,10 @@ static struct vimc_ent_device *vimc_sensor_add(struct vimc_device *vimc,
ret = vimc_ent_sd_register(&vsensor->ved, &vsensor->sd, v4l2_dev, ret = vimc_ent_sd_register(&vsensor->ved, &vsensor->sd, v4l2_dev,
vcfg_name, vcfg_name,
MEDIA_ENT_F_CAM_SENSOR, 1, &vsensor->pad, MEDIA_ENT_F_CAM_SENSOR, 1, &vsensor->pad,
&vimc_sensor_ops); &vimc_sensor_internal_ops, &vimc_sensor_ops);
if (ret) if (ret)
goto err_free_tpg; goto err_free_tpg;
vsensor->sd.internal_ops = &vimc_sensor_internal_ops;
vsensor->ved.process_frame = vimc_sensor_process_frame; vsensor->ved.process_frame = vimc_sensor_process_frame;
vsensor->ved.dev = vimc->mdev.dev; vsensor->ved.dev = vimc->mdev.dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment