From 7040b686dfea53c2fbfb85c418784ebf4e47f4db Mon Sep 17 00:00:00 2001 From: Zefa Chen Date: Fri, 10 Sep 2021 09:15:23 +0800 Subject: [PATCH] media: rockchip: cif: fix compile error Signed-off-by: Zefa Chen Change-Id: I56537c637deb714f186e163227c194b65968c187 --- drivers/media/platform/Kconfig | 1 + drivers/media/platform/Makefile | 1 + drivers/media/platform/rockchip/cif/capture.c | 87 +++++++++---------- .../media/platform/rockchip/cif/cif-luma.c | 12 +-- drivers/media/platform/rockchip/cif/dev.c | 19 ++-- .../media/platform/rockchip/cif/mipi-csi2.c | 15 ++-- drivers/media/platform/rockchip/cif/procfs.c | 13 ++- .../media/platform/rockchip/cif/subdev-itf.c | 6 +- 8 files changed, 70 insertions(+), 84 deletions(-) diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index a8444f499d7b..cee64693d844 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig @@ -153,6 +153,7 @@ source "drivers/media/platform/xilinx/Kconfig" source "drivers/media/platform/rcar-vin/Kconfig" source "drivers/media/platform/atmel/Kconfig" source "drivers/media/platform/sunxi/Kconfig" +source "drivers/media/platform/rockchip/cif/Kconfig" source "drivers/media/platform/rockchip/isp/Kconfig" config VIDEO_TI_CAL diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile index 03ee0317b065..a79454f82c89 100644 --- a/drivers/media/platform/Makefile +++ b/drivers/media/platform/Makefile @@ -53,6 +53,7 @@ obj-$(CONFIG_VIDEO_RENESAS_JPU) += rcar_jpu.o obj-$(CONFIG_VIDEO_RENESAS_VSP1) += vsp1/ obj-$(CONFIG_VIDEO_ROCKCHIP_RGA) += rockchip/rga/ +obj-$(CONFIG_VIDEO_ROCKCHIP_CIF) += rockchip/cif/ obj-$(CONFIG_VIDEO_ROCKCHIP_ISP) += rockchip/isp/ obj-y += omap/ diff --git a/drivers/media/platform/rockchip/cif/capture.c b/drivers/media/platform/rockchip/cif/capture.c index e3bea884943f..71cc837f36b5 100644 --- a/drivers/media/platform/rockchip/cif/capture.c +++ b/drivers/media/platform/rockchip/cif/capture.c @@ -606,7 +606,7 @@ static int get_csi_crop_align(const struct cif_input_fmt *fmt_in) static const struct cif_input_fmt *get_input_fmt(struct v4l2_subdev *sd, struct v4l2_rect *rect, - u32 pad, int *vc) + u32 pad_id, int *vc) { struct v4l2_subdev_format fmt; struct rkmodule_channel_info ch_info; @@ -622,7 +622,7 @@ cif_input_fmt *get_input_fmt(struct v4l2_subdev *sd, struct v4l2_rect *rect, "sensor fmt invalid, set to default size\n"); goto set_default; } - ch_info.index = pad; + ch_info.index = pad_id; ret = v4l2_subdev_call(sd, core, ioctl, RKMODULE_GET_CHANNEL_INFO, @@ -649,7 +649,7 @@ cif_input_fmt *get_input_fmt(struct v4l2_subdev *sd, struct v4l2_rect *rect, } } else { - vc = -1; + *vc = -1; } v4l2_dbg(1, rkcif_debug, sd->v4l2_dev, @@ -1286,7 +1286,7 @@ static void rkcif_assign_new_buffer_init(struct rkcif_stream *stream, struct rkcif_dummy_buffer *dummy_buf = &dev->dummy_buf; struct csi_channel_info *channel = &dev->channels[channel_id]; - if (mbus_cfg->type == V4L2_MBUS_CSI2 || + if (mbus_cfg->type == V4L2_MBUS_CSI2_DPHY || mbus_cfg->type == V4L2_MBUS_CCP2) { frm0_addr_y = get_reg_index_of_frm0_y_addr(channel_id); frm0_addr_uv = get_reg_index_of_frm0_uv_addr(channel_id); @@ -1400,7 +1400,7 @@ static int rkcif_assign_new_buffer_update(struct rkcif_stream *stream, int ret = 0; unsigned long flags; - if (mbus_cfg->type == V4L2_MBUS_CSI2 || + if (mbus_cfg->type == V4L2_MBUS_CSI2_DPHY || mbus_cfg->type == V4L2_MBUS_CCP2) { frm_addr_y = stream->frame_phase & CIF_CSI_FRAME0_READY ? get_reg_index_of_frm0_y_addr(channel_id) : @@ -1500,7 +1500,7 @@ static int rkcif_assign_new_buffer_update(struct rkcif_stream *stream, } v4l2_info(&dev->v4l2_dev, "not active buffer, skip current frame, %s stream[%d]\n", - (mbus_cfg->type == V4L2_MBUS_CSI2 || + (mbus_cfg->type == V4L2_MBUS_CSI2_DPHY || mbus_cfg->type == V4L2_MBUS_CCP2) ? "mipi/lvds" : "dvp", stream->id); } @@ -1563,7 +1563,7 @@ static int rkcif_update_new_buffer_wake_up_mode(struct rkcif_stream *stream) int channel_id = stream->id; int ret = 0; - if (mbus_cfg->type == V4L2_MBUS_CSI2 || + if (mbus_cfg->type == V4L2_MBUS_CSI2_DPHY || mbus_cfg->type == V4L2_MBUS_CCP2) { frm_addr_y = stream->frame_phase & CIF_CSI_FRAME0_READY ? get_reg_index_of_frm0_y_addr(channel_id) : @@ -1603,7 +1603,7 @@ static int rkcif_update_new_buffer_wake_up_mode(struct rkcif_stream *stream) } v4l2_info(&dev->v4l2_dev, "not active buffer, skip current frame, %s stream[%d]\n", - (mbus_cfg->type == V4L2_MBUS_CSI2 || + (mbus_cfg->type == V4L2_MBUS_CSI2_DPHY || mbus_cfg->type == V4L2_MBUS_CCP2) ? "mipi/lvds" : "dvp", stream->id); } @@ -1888,7 +1888,7 @@ static int rkcif_csi_channel_set(struct rkcif_stream *stream, CIF_MIPI_LVDS_SW_HURRY_ENABLE | CIF_MIPI_LVDS_SW_WATER_LINE_25 | CIF_MIPI_LVDS_SW_WATER_LINE_ENABLE; - if (mbus_type == V4L2_MBUS_CSI2) { + if (mbus_type == V4L2_MBUS_CSI2_DPHY) { val &= ~CIF_MIPI_LVDS_SW_SEL_LVDS; } else if (mbus_type == V4L2_MBUS_CCP2) { if (channel->fmt_val == CSI_WRDDR_TYPE_RAW12) @@ -1925,7 +1925,7 @@ static int rkcif_csi_channel_set(struct rkcif_stream *stream, RKCIF_YUV_ADDR_STATE_INIT, channel->id); - if (mbus_type == V4L2_MBUS_CSI2) { + if (mbus_type == V4L2_MBUS_CSI2_DPHY) { //need always enable crop val = CSI_ENABLE_CAPTURE | channel->fmt_val | channel->cmd_mode_en << 4 | CSI_ENABLE_CROP | @@ -1966,13 +1966,13 @@ static int rkcif_csi_stream_start(struct rkcif_stream *stream) if (stream->state != RKCIF_STATE_RESET_IN_STREAMING) stream->frame_idx = 0; - if (mbus_type == V4L2_MBUS_CSI2) { + if (mbus_type == V4L2_MBUS_CSI2_DPHY) { rkcif_csi_get_vc_num(dev, flags); channel = &dev->channels[stream->id]; channel->id = stream->id; rkcif_csi_channel_init(stream, channel); - rkcif_csi_channel_set(stream, channel, V4L2_MBUS_CSI2); + rkcif_csi_channel_set(stream, channel, V4L2_MBUS_CSI2_DPHY); } else if (mbus_type == V4L2_MBUS_CCP2) { rkcif_csi_get_vc_num(dev, flags); @@ -2009,11 +2009,11 @@ static void rkcif_stream_stop(struct rkcif_stream *stream) u32 val; int id; - if (mbus_cfg->type == V4L2_MBUS_CSI2 || + if (mbus_cfg->type == V4L2_MBUS_CSI2_DPHY || mbus_cfg->type == V4L2_MBUS_CCP2) { id = stream->id; val = rkcif_read_register(cif_dev, get_reg_index_of_id_ctrl0(id)); - if (mbus_cfg->type == V4L2_MBUS_CSI2) + if (mbus_cfg->type == V4L2_MBUS_CSI2_DPHY) val &= ~CSI_ENABLE_CAPTURE; else val &= ~LVDS_ENABLE_CAPTURE; @@ -2654,7 +2654,7 @@ static int rkcif_sanity_check_fmt(struct rkcif_stream *stream, return -EINVAL; } - if (dev->active_sensor->mbus.type == V4L2_MBUS_CSI2) { + if (dev->active_sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) { if (crop->left > 0) { int align_x = get_csi_crop_align(stream->cif_fmt_in); @@ -2697,8 +2697,8 @@ int rkcif_update_sensor_info(struct rkcif_stream *stream) __func__, stream->id); return -ENODEV; } - ret = v4l2_subdev_call(sensor->sd, video, g_mbus_config, - &sensor->mbus); + ret = v4l2_subdev_call(sensor->sd, pad, get_mbus_config, + 0, &sensor->mbus); if (ret && ret != -ENOIOCTLCMD) { v4l2_err(&stream->cifdev->v4l2_dev, "%s: get remote %s mbus failed!\n", __func__, sensor->sd->name); @@ -2710,8 +2710,8 @@ int rkcif_update_sensor_info(struct rkcif_stream *stream) terminal_sensor = &stream->cifdev->terminal_sensor; get_remote_terminal_sensor(stream, &terminal_sensor->sd); if (terminal_sensor->sd) { - ret = v4l2_subdev_call(terminal_sensor->sd, video, g_mbus_config, - &terminal_sensor->mbus); + ret = v4l2_subdev_call(terminal_sensor->sd, pad, get_mbus_config, + 0, &terminal_sensor->mbus); if (ret && ret != -ENOIOCTLCMD) { v4l2_err(&stream->cifdev->v4l2_dev, "%s: get terminal %s mbus failed!\n", @@ -2720,7 +2720,7 @@ int rkcif_update_sensor_info(struct rkcif_stream *stream) } } - if (terminal_sensor->mbus.type == V4L2_MBUS_CSI2 || + if (terminal_sensor->mbus.type == V4L2_MBUS_CSI2_DPHY || terminal_sensor->mbus.type == V4L2_MBUS_CCP2) { switch (terminal_sensor->mbus.flags & V4L2_MBUS_CSI2_LANES) { case V4L2_MBUS_CSI2_1_LANE: @@ -2842,7 +2842,7 @@ static int rkcif_stream_start(struct rkcif_stream *stream) } } - if (dev->active_sensor->mbus.type == V4L2_MBUS_CSI2) { + if (dev->active_sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) { inputmode = INPUT_MODE_MIPI; /* if cif is linked with mipi, @@ -3043,7 +3043,7 @@ static int rkcif_start_streaming(struct vb2_queue *queue, unsigned int count) } if (dev->chip_id >= CHIP_RK1808_CIF) { - if (dev->active_sensor->mbus.type == V4L2_MBUS_CSI2 || + if (dev->active_sensor->mbus.type == V4L2_MBUS_CSI2_DPHY || dev->active_sensor->mbus.type == V4L2_MBUS_CCP2) ret = rkcif_csi_stream_start(stream); else @@ -3178,7 +3178,7 @@ static void rkcif_set_fmt(struct rkcif_stream *stream, input_rect.width = RKCIF_DEFAULT_WIDTH; input_rect.height = RKCIF_DEFAULT_HEIGHT; - if (dev->active_sensor && dev->active_sensor->sd) { + if (dev->terminal_sensor.sd) { cif_fmt_in = get_input_fmt(dev->terminal_sensor.sd, &input_rect, stream->id, &vc); stream->cif_fmt_in = cif_fmt_in; @@ -3249,7 +3249,7 @@ static void rkcif_set_fmt(struct rkcif_stream *stream, } if (fmt->fmt_type == CIF_FMT_TYPE_RAW && stream->is_compact && - (dev->active_sensor->mbus.type == V4L2_MBUS_CSI2 || + (dev->active_sensor->mbus.type == V4L2_MBUS_CSI2_DPHY || dev->active_sensor->mbus.type == V4L2_MBUS_CCP2)) { bpl = ALIGN(width * fmt->raw_bpp / 8, 256); } else { @@ -3398,7 +3398,7 @@ static int rkcif_fh_open(struct file *filp) ret = v4l2_fh_open(filp); if (!ret) { - ret = v4l2_pipeline_pm_use(&vnode->vdev.entity, 1); + ret = v4l2_pipeline_pm_get(&vnode->vdev.entity); if (ret < 0) vb2_fop_release(filp); } @@ -3415,12 +3415,8 @@ static int rkcif_fh_release(struct file *filp) int ret = 0; ret = vb2_fop_release(filp); - if (!ret) { - ret = v4l2_pipeline_pm_use(&vnode->vdev.entity, 0); - if (ret < 0) - v4l2_err(&cifdev->v4l2_dev, - "set pipeline power failed %d\n", ret); - } + if (!ret) + v4l2_pipeline_pm_put(&vnode->vdev.entity); mutex_lock(&cifdev->stream_lock); if (!atomic_dec_return(&cifdev->fh_cnt)) @@ -3587,7 +3583,7 @@ static int rkcif_querycap(struct file *file, void *priv, return 0; } -static int rkcif_cropcap(struct file *file, void *fh, +static __maybe_unused int rkcif_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cap) { struct rkcif_stream *stream = video_drvdata(file); @@ -3614,7 +3610,7 @@ static int rkcif_cropcap(struct file *file, void *fh, return ret; } -static int rkcif_s_crop(struct file *file, void *fh, const struct v4l2_crop *a) +static __maybe_unused int rkcif_s_crop(struct file *file, void *fh, const struct v4l2_crop *a) { struct rkcif_stream *stream = video_drvdata(file); struct rkcif_device *dev = stream->cifdev; @@ -3670,7 +3666,7 @@ static int rkcif_s_crop(struct file *file, void *fh, const struct v4l2_crop *a) return ret; } -static int rkcif_g_crop(struct file *file, void *fh, struct v4l2_crop *a) +static __maybe_unused int rkcif_g_crop(struct file *file, void *fh, struct v4l2_crop *a) { struct rkcif_stream *stream = video_drvdata(file); @@ -3822,13 +3818,10 @@ static const struct v4l2_ioctl_ops rkcif_v4l2_ioctl_ops = { .vidioc_streamoff = vb2_ioctl_streamoff, .vidioc_enum_input = rkcif_enum_input, .vidioc_try_fmt_vid_cap_mplane = rkcif_try_fmt_vid_cap_mplane, - .vidioc_enum_fmt_vid_cap_mplane = rkcif_enum_fmt_vid_cap_mplane, + .vidioc_enum_fmt_vid_cap = rkcif_enum_fmt_vid_cap_mplane, .vidioc_s_fmt_vid_cap_mplane = rkcif_s_fmt_vid_cap_mplane, .vidioc_g_fmt_vid_cap_mplane = rkcif_g_fmt_vid_cap_mplane, .vidioc_querycap = rkcif_querycap, - .vidioc_cropcap = rkcif_cropcap, - .vidioc_s_crop = rkcif_s_crop, - .vidioc_g_crop = rkcif_g_crop, .vidioc_s_selection = rkcif_s_selection, .vidioc_g_selection = rkcif_g_selection, .vidioc_enum_frameintervals = rkcif_enum_frameintervals, @@ -3938,7 +3931,7 @@ static int rkcif_register_stream_vdev(struct rkcif_stream *stream, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); vdev->queue = &node->buf_queue; - ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1); + ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1); if (ret < 0) { v4l2_err(v4l2_dev, "video_register_device failed with error %d\n", ret); @@ -4132,13 +4125,13 @@ err: return -EINVAL; } -static int rkcif_lvds_g_mbus_config(struct v4l2_subdev *sd, +static int rkcif_lvds_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id, struct v4l2_mbus_config *mbus) { struct v4l2_subdev *sensor_sd = get_lvds_remote_sensor(sd); int ret; - ret = v4l2_subdev_call(sensor_sd, video, g_mbus_config, mbus); + ret = v4l2_subdev_call(sensor_sd, pad, get_mbus_config, 0, mbus); if (ret) return ret; @@ -4179,10 +4172,10 @@ static const struct v4l2_subdev_pad_ops rkcif_lvds_sd_pad_ops = { .get_fmt = rkcif_lvds_sd_get_fmt, .set_selection = rkcif_lvds_sd_set_selection, .get_selection = rkcif_lvds_sd_get_selection, + .get_mbus_config = rkcif_lvds_g_mbus_config, }; static const struct v4l2_subdev_video_ops rkcif_lvds_sd_video_ops = { - .g_mbus_config = rkcif_lvds_g_mbus_config, .s_stream = rkcif_lvds_sd_s_stream, }; @@ -4706,7 +4699,7 @@ static void rkcif_dynamic_crop(struct rkcif_stream *stream) return; mbus = &cif_dev->active_sensor->mbus; - if (mbus->type == V4L2_MBUS_CSI2 || + if (mbus->type == V4L2_MBUS_CSI2_DPHY || mbus->type == V4L2_MBUS_CCP2) { struct csi_channel_info *channel = &cif_dev->channels[stream->id]; @@ -5207,7 +5200,7 @@ u32 rkcif_get_sof(struct rkcif_device *cif_dev) u32 val = 0x0; struct rkcif_sensor_info *sensor = cif_dev->active_sensor; - if (sensor->mbus.type == V4L2_MBUS_CSI2) + if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) val = rkcif_csi2_get_sof(); else if (sensor->mbus.type == V4L2_MBUS_CCP2) val = rkcif_lvds_get_sof(cif_dev); @@ -5828,7 +5821,7 @@ void rkcif_irq_pingpong(struct rkcif_device *cif_dev) return; mbus = &cif_dev->active_sensor->mbus; - if ((mbus->type == V4L2_MBUS_CSI2 || + if ((mbus->type == V4L2_MBUS_CSI2_DPHY || mbus->type == V4L2_MBUS_CCP2) && (cif_dev->chip_id == CHIP_RK1808_CIF || cif_dev->chip_id == CHIP_RV1126_CIF || @@ -5872,7 +5865,7 @@ void rkcif_irq_pingpong(struct rkcif_device *cif_dev) } if (intstat & CSI_FRAME0_START_ID0) { - if (mbus->type == V4L2_MBUS_CSI2) + if (mbus->type == V4L2_MBUS_CSI2_DPHY) rkcif_csi2_event_inc_sof(); else if (mbus->type == V4L2_MBUS_CCP2) rkcif_lvds_event_inc_sof(cif_dev); @@ -5883,7 +5876,7 @@ void rkcif_irq_pingpong(struct rkcif_device *cif_dev) } if (intstat & CSI_FRAME1_START_ID0) { - if (mbus->type == V4L2_MBUS_CSI2) + if (mbus->type == V4L2_MBUS_CSI2_DPHY) rkcif_csi2_event_inc_sof(); else if (mbus->type == V4L2_MBUS_CCP2) rkcif_lvds_event_inc_sof(cif_dev); diff --git a/drivers/media/platform/rockchip/cif/cif-luma.c b/drivers/media/platform/rockchip/cif/cif-luma.c index fb1d8612128c..774001506ab4 100644 --- a/drivers/media/platform/rockchip/cif/cif-luma.c +++ b/drivers/media/platform/rockchip/cif/cif-luma.c @@ -91,7 +91,7 @@ static int rkcif_luma_fh_open(struct file *filp) ret = v4l2_fh_open(filp); if (!ret) { - ret = v4l2_pipeline_pm_use(¶ms->vnode.vdev.entity, 1); + ret = v4l2_pipeline_pm_get(¶ms->vnode.vdev.entity); if (ret < 0) vb2_fop_release(filp); } @@ -105,12 +105,8 @@ static int rkcif_luma_fop_release(struct file *file) int ret; ret = vb2_fop_release(file); - if (!ret) { - ret = v4l2_pipeline_pm_use(&luma->vnode.vdev.entity, 0); - if (ret < 0) - v4l2_err(&luma->cifdev->v4l2_dev, - "set pipeline power failed %d\n", ret); - } + if (!ret) + v4l2_pipeline_pm_put(&luma->vnode.vdev.entity); return ret; } @@ -478,7 +474,7 @@ int rkcif_register_luma_vdev(struct rkcif_luma_vdev *luma_vdev, if (ret < 0) goto err_release_queue; - ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1); + ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1); if (ret < 0) { dev_err(&vdev->dev, "could not register Video for Linux device\n"); diff --git a/drivers/media/platform/rockchip/cif/dev.c b/drivers/media/platform/rockchip/cif/dev.c index 445a3ca864e7..ca0c17cca7ee 100644 --- a/drivers/media/platform/rockchip/cif/dev.c +++ b/drivers/media/platform/rockchip/cif/dev.c @@ -688,8 +688,9 @@ static int subdev_notifier_complete(struct v4l2_async_notifier *notifier) if (sd->ops) { if (sd == sensor->sd) { ret = v4l2_subdev_call(sd, - video, - g_mbus_config, + pad, + get_mbus_config, + 0, &sensor->mbus); if (ret) v4l2_err(v4l2_dev, @@ -699,7 +700,7 @@ static int subdev_notifier_complete(struct v4l2_async_notifier *notifier) } if (sensor->mbus.type == V4L2_MBUS_CCP2 || - sensor->mbus.type == V4L2_MBUS_CSI2) { + sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) { switch (sensor->mbus.flags & V4L2_MBUS_CSI2_LANES) { case V4L2_MBUS_CSI2_1_LANE: @@ -806,13 +807,13 @@ static int rkcif_fwnode_parse(struct device *dev, if (vep->bus_type != V4L2_MBUS_BT656 && vep->bus_type != V4L2_MBUS_PARALLEL && - vep->bus_type != V4L2_MBUS_CSI2 && + vep->bus_type != V4L2_MBUS_CSI2_DPHY && vep->bus_type != V4L2_MBUS_CCP2) return 0; rk_asd->mbus.type = vep->bus_type; - if (vep->bus_type == V4L2_MBUS_CSI2) { + if (vep->bus_type == V4L2_MBUS_CSI2_DPHY) { rk_asd->mbus.flags = vep->bus.mipi_csi2.flags; rk_asd->lanes = vep->bus.mipi_csi2.num_data_lanes; } else if (vep->bus_type == V4L2_MBUS_CCP2) { @@ -835,6 +836,8 @@ static int cif_subdev_notifier(struct rkcif_device *cif_dev) struct device *dev = cif_dev->dev; int ret; + v4l2_async_notifier_init(ntf); + ret = v4l2_async_notifier_parse_fwnode_endpoints( dev, ntf, sizeof(struct rkcif_async_subdev), rkcif_fwnode_parse); @@ -844,12 +847,6 @@ static int cif_subdev_notifier(struct rkcif_device *cif_dev) return ret; } - if (!ntf->num_subdevs) { - v4l2_warn(&cif_dev->v4l2_dev, - "%s: no subdev be found!\n", __func__); - return -ENODEV; /* no endpoint */ - } - ntf->ops = &subdev_notifier_ops; ret = v4l2_async_notifier_register(&cif_dev->v4l2_dev, ntf); diff --git a/drivers/media/platform/rockchip/cif/mipi-csi2.c b/drivers/media/platform/rockchip/cif/mipi-csi2.c index 37bcddfe47ea..99aacaf827aa 100644 --- a/drivers/media/platform/rockchip/cif/mipi-csi2.c +++ b/drivers/media/platform/rockchip/cif/mipi-csi2.c @@ -215,7 +215,7 @@ static void csi2_update_sensor_info(struct csi2_dev *csi2) struct v4l2_mbus_config mbus; int ret = 0; - ret = v4l2_subdev_call(sensor->sd, video, g_mbus_config, &mbus); + ret = v4l2_subdev_call(sensor->sd, pad, get_mbus_config, 0, &mbus); if (ret) { v4l2_err(&csi2->sd, "update sensor info failed!\n"); return; @@ -568,16 +568,16 @@ static int csi2_set_selection(struct v4l2_subdev *sd, return ret; } -static int csi2_g_mbus_config(struct v4l2_subdev *sd, +static int csi2_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id, struct v4l2_mbus_config *mbus) { struct csi2_dev *csi2 = sd_to_dev(sd); struct v4l2_subdev *sensor_sd = get_remote_sensor(sd); int ret; - ret = v4l2_subdev_call(sensor_sd, video, g_mbus_config, mbus); + ret = v4l2_subdev_call(sensor_sd, pad, get_mbus_config, 0, mbus); if (ret) { - mbus->type = V4L2_MBUS_CSI2; + mbus->type = V4L2_MBUS_CSI2_DPHY; mbus->flags = csi2->bus.flags; mbus->flags |= BIT(csi2->bus.num_data_lanes - 1); } @@ -633,7 +633,6 @@ static const struct v4l2_subdev_core_ops csi2_core_ops = { }; static const struct v4l2_subdev_video_ops csi2_video_ops = { - .g_mbus_config = csi2_g_mbus_config, .s_stream = csi2_s_stream, }; @@ -642,6 +641,7 @@ static const struct v4l2_subdev_pad_ops csi2_pad_ops = { .set_fmt = csi2_get_set_fmt, .get_selection = csi2_get_selection, .set_selection = csi2_set_selection, + .get_mbus_config = csi2_g_mbus_config, }; static const struct v4l2_subdev_ops csi2_subdev_ops = { @@ -843,6 +843,8 @@ static int csi2_notifier(struct csi2_dev *csi2) struct v4l2_async_notifier *ntf = &csi2->notifier; int ret; + v4l2_async_notifier_init(ntf); + ret = v4l2_async_notifier_parse_fwnode_endpoints_by_port(csi2->dev, &csi2->notifier, sizeof(struct v4l2_async_subdev), 0, @@ -850,9 +852,6 @@ static int csi2_notifier(struct csi2_dev *csi2) if (ret < 0) return ret; - if (!ntf->num_subdevs) - return -ENODEV; /* no endpoint */ - csi2->sd.subdev_notifier = &csi2->notifier; csi2->notifier.ops = &csi2_async_ops; ret = v4l2_async_subdev_notifier_register(&csi2->sd, &csi2->notifier); diff --git a/drivers/media/platform/rockchip/cif/procfs.c b/drivers/media/platform/rockchip/cif/procfs.c index 0895f06a71a1..51c75b7415e4 100644 --- a/drivers/media/platform/rockchip/cif/procfs.c +++ b/drivers/media/platform/rockchip/cif/procfs.c @@ -272,7 +272,7 @@ static void rkcif_show_format(struct rkcif_device *dev, struct seq_file *f) mbus_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH ? "high active" : "low active"); } else { seq_printf(f, "\tinterface:%s\n", - sensor->mbus.type == V4L2_MBUS_CSI2 ? "mipi csi2" : + sensor->mbus.type == V4L2_MBUS_CSI2_DPHY ? "mipi csi2" : sensor->mbus.type == V4L2_MBUS_CCP2 ? "lvds" : "unknown"); seq_printf(f, "\tlanes:%d\n", sensor->lanes); seq_puts(f, "\tvc channel:"); @@ -373,12 +373,11 @@ static int rkcif_proc_open(struct inode *inode, struct file *file) return single_open(file, rkcif_proc_show, data); } -static const struct file_operations rkcif_proc_fops = { - .owner = THIS_MODULE, - .open = rkcif_proc_open, - .release = single_release, - .read = seq_read, - .llseek = seq_lseek, +static const struct proc_ops rkcif_proc_fops = { + .proc_open = rkcif_proc_open, + .proc_release = single_release, + .proc_read = seq_read, + .proc_lseek = seq_lseek, }; int rkcif_proc_init(struct rkcif_device *dev) diff --git a/drivers/media/platform/rockchip/cif/subdev-itf.c b/drivers/media/platform/rockchip/cif/subdev-itf.c index d2f510a11a6b..e685fdc637c4 100644 --- a/drivers/media/platform/rockchip/cif/subdev-itf.c +++ b/drivers/media/platform/rockchip/cif/subdev-itf.c @@ -44,7 +44,7 @@ static int sditf_g_frame_interval(struct v4l2_subdev *sd, return -EINVAL; } -static int sditf_g_mbus_config(struct v4l2_subdev *sd, +static int sditf_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id, struct v4l2_mbus_config *config) { struct sditf_priv *priv = to_sditf_priv(sd); @@ -56,7 +56,7 @@ static int sditf_g_mbus_config(struct v4l2_subdev *sd, if (cif_dev->active_sensor) { sensor_sd = cif_dev->active_sensor->sd; - return v4l2_subdev_call(sensor_sd, video, g_mbus_config, config); + return v4l2_subdev_call(sensor_sd, pad, get_mbus_config, 0, config); } return -EINVAL; @@ -143,11 +143,11 @@ static const struct v4l2_subdev_pad_ops sditf_subdev_pad_ops = { .set_fmt = sditf_get_set_fmt, .get_fmt = sditf_get_set_fmt, .get_selection = sditf_get_selection, + .get_mbus_config = sditf_g_mbus_config, }; static const struct v4l2_subdev_video_ops sditf_video_ops = { .g_frame_interval = sditf_g_frame_interval, - .g_mbus_config = sditf_g_mbus_config, }; static const struct v4l2_subdev_core_ops sditf_core_ops = {