mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
media: rockchip: isp: fix compile error
Change-Id: I2f4705c826cd8368eed207d7b2ed9b6717bdaa7d Signed-off-by: Cai YiWei <cyw@rock-chips.com>
This commit is contained in:
@@ -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/isp/Kconfig"
|
||||
|
||||
config VIDEO_TI_CAL
|
||||
tristate "TI CAL (Camera Adaptation Layer) driver"
|
||||
|
||||
@@ -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_ISP) += rockchip/isp/
|
||||
|
||||
obj-y += omap/
|
||||
|
||||
|
||||
@@ -1295,9 +1295,9 @@ static int bridge_s_power(struct v4l2_subdev *sd, int on)
|
||||
"%s %d\n", __func__, on);
|
||||
|
||||
if (on)
|
||||
ret = v4l2_pipeline_pm_use(&sd->entity, 1);
|
||||
ret = v4l2_pipeline_pm_get(&sd->entity);
|
||||
else
|
||||
ret = v4l2_pipeline_pm_use(&sd->entity, 0);
|
||||
v4l2_pipeline_pm_put(&sd->entity);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -678,7 +678,7 @@ int rkisp_fh_open(struct file *filp)
|
||||
|
||||
ret = v4l2_fh_open(filp);
|
||||
if (!ret) {
|
||||
ret = v4l2_pipeline_pm_use(&stream->vnode.vdev.entity, 1);
|
||||
ret = v4l2_pipeline_pm_get(&stream->vnode.vdev.entity);
|
||||
if (ret < 0)
|
||||
vb2_fop_release(filp);
|
||||
}
|
||||
@@ -692,12 +692,8 @@ int rkisp_fop_release(struct file *file)
|
||||
int ret;
|
||||
|
||||
ret = vb2_fop_release(file);
|
||||
if (!ret) {
|
||||
ret = v4l2_pipeline_pm_use(&stream->vnode.vdev.entity, 0);
|
||||
if (ret < 0)
|
||||
v4l2_err(&stream->ispdev->v4l2_dev,
|
||||
"set pipeline power failed %d\n", ret);
|
||||
}
|
||||
if (!ret)
|
||||
v4l2_pipeline_pm_put(&stream->vnode.vdev.entity);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -990,7 +986,7 @@ static const struct v4l2_ioctl_ops rkisp_v4l2_ioctl_ops = {
|
||||
.vidioc_streamoff = vb2_ioctl_streamoff,
|
||||
.vidioc_enum_input = rkisp_enum_input,
|
||||
.vidioc_try_fmt_vid_cap_mplane = rkisp_try_fmt_vid_cap_mplane,
|
||||
.vidioc_enum_fmt_vid_cap_mplane = rkisp_enum_fmt_vid_cap_mplane,
|
||||
.vidioc_enum_fmt_vid_cap = rkisp_enum_fmt_vid_cap_mplane,
|
||||
.vidioc_s_fmt_vid_cap_mplane = rkisp_s_fmt_vid_cap_mplane,
|
||||
.vidioc_g_fmt_vid_cap_mplane = rkisp_g_fmt_vid_cap_mplane,
|
||||
.vidioc_s_selection = rkisp_s_selection,
|
||||
@@ -1031,7 +1027,7 @@ int rkisp_register_stream_vdev(struct rkisp_stream *stream)
|
||||
node->pad.flags = MEDIA_PAD_FL_SINK;
|
||||
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);
|
||||
|
||||
@@ -874,7 +874,7 @@ static int rkisp_stream_init(struct rkisp_device *dev, u32 id)
|
||||
init_waitqueue_head(&stream->done);
|
||||
spin_lock_init(&stream->vbq_lock);
|
||||
|
||||
stream->linked = MEDIA_LNK_FL_ENABLED;
|
||||
stream->linked = true;
|
||||
switch (id) {
|
||||
case RKISP_STREAM_SP:
|
||||
strlcpy(vdev->name, SP_VDEV_NAME,
|
||||
|
||||
@@ -316,7 +316,7 @@ void hdr_destroy_buf(struct rkisp_device *dev)
|
||||
if (atomic_read(&dev->cap_dev.refcnt) > 1 ||
|
||||
!dev->active_sensor ||
|
||||
(dev->active_sensor &&
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2))
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2_DPHY))
|
||||
return;
|
||||
|
||||
atomic_set(&dev->hdr.refcnt, 0);
|
||||
@@ -347,7 +347,7 @@ int hdr_update_dmatx_buf(struct rkisp_device *dev)
|
||||
|
||||
if (!dev->active_sensor ||
|
||||
(dev->active_sensor &&
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2) ||
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2_DPHY) ||
|
||||
(dev->isp_inp & INP_CIF))
|
||||
return 0;
|
||||
|
||||
@@ -413,7 +413,7 @@ int hdr_config_dmatx(struct rkisp_device *dev)
|
||||
if (atomic_inc_return(&dev->hdr.refcnt) > 1 ||
|
||||
!dev->active_sensor ||
|
||||
(dev->active_sensor &&
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2) ||
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2_DPHY) ||
|
||||
(dev->isp_inp & INP_CIF))
|
||||
return 0;
|
||||
|
||||
@@ -480,7 +480,7 @@ void hdr_stop_dmatx(struct rkisp_device *dev)
|
||||
if (atomic_dec_return(&dev->hdr.refcnt) ||
|
||||
!dev->active_sensor ||
|
||||
(dev->active_sensor &&
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2) ||
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2_DPHY) ||
|
||||
(dev->isp_inp & INP_CIF))
|
||||
return;
|
||||
|
||||
@@ -860,7 +860,7 @@ static int dmatx3_config_mi(struct rkisp_stream *stream)
|
||||
|
||||
if (!dev->active_sensor ||
|
||||
(dev->active_sensor &&
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2)) {
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2_DPHY)) {
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"only mipi sensor support rawwr3\n");
|
||||
return -EINVAL;
|
||||
@@ -904,7 +904,7 @@ static int dmatx2_config_mi(struct rkisp_stream *stream)
|
||||
|
||||
if (!dev->active_sensor ||
|
||||
(dev->active_sensor &&
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2)) {
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2_DPHY)) {
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"only mipi sensor support rawwr2 path\n");
|
||||
return -EINVAL;
|
||||
@@ -947,7 +947,7 @@ static int dmatx1_config_mi(struct rkisp_stream *stream)
|
||||
|
||||
if (!dev->active_sensor ||
|
||||
(dev->active_sensor &&
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2)) {
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2_DPHY)) {
|
||||
if (stream->id == RKISP_STREAM_DMATX1)
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"only mipi sensor support dmatx1 path\n");
|
||||
@@ -993,7 +993,7 @@ static int dmatx0_config_mi(struct rkisp_stream *stream)
|
||||
|
||||
if (!dev->active_sensor ||
|
||||
(dev->active_sensor &&
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2)) {
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2_DPHY)) {
|
||||
if (stream->id == RKISP_STREAM_DMATX0)
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"only mipi sensor support rawwr0 path\n");
|
||||
@@ -1999,7 +1999,7 @@ static int rkisp_stream_init(struct rkisp_device *dev, u32 id)
|
||||
init_waitqueue_head(&stream->done);
|
||||
spin_lock_init(&stream->vbq_lock);
|
||||
|
||||
stream->linked = MEDIA_LNK_FL_ENABLED;
|
||||
stream->linked = true;
|
||||
/* isp2 disable MP/SP, enable BRIDGE default */
|
||||
if (id == RKISP_STREAM_MP)
|
||||
stream->linked = false;
|
||||
|
||||
@@ -323,7 +323,7 @@ static int dmatx3_config_mi(struct rkisp_stream *stream)
|
||||
|
||||
if (!dev->active_sensor ||
|
||||
(dev->active_sensor &&
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2)) {
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2_DPHY)) {
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"only mipi sensor support rawwr3\n");
|
||||
return -EINVAL;
|
||||
@@ -366,7 +366,7 @@ static int dmatx2_config_mi(struct rkisp_stream *stream)
|
||||
|
||||
if (!dev->active_sensor ||
|
||||
(dev->active_sensor &&
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2)) {
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2_DPHY)) {
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"only mipi sensor support rawwr2 path\n");
|
||||
return -EINVAL;
|
||||
@@ -408,7 +408,7 @@ static int dmatx0_config_mi(struct rkisp_stream *stream)
|
||||
|
||||
if (!dev->active_sensor ||
|
||||
(dev->active_sensor &&
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2)) {
|
||||
dev->active_sensor->mbus.type != V4L2_MBUS_CSI2_DPHY)) {
|
||||
if (stream->id == RKISP_STREAM_DMATX0)
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"only mipi sensor support rawwr0 path\n");
|
||||
@@ -1284,7 +1284,7 @@ static int rkisp_stream_init(struct rkisp_device *dev, u32 id)
|
||||
INIT_LIST_HEAD(&stream->buf_queue);
|
||||
init_waitqueue_head(&stream->done);
|
||||
spin_lock_init(&stream->vbq_lock);
|
||||
stream->linked = MEDIA_LNK_FL_ENABLED;
|
||||
stream->linked = true;
|
||||
|
||||
switch (id) {
|
||||
case RKISP_STREAM_SP:
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/media.h>
|
||||
#include <linux/rk-video-format.h>
|
||||
#include <media/media-device.h>
|
||||
#include <media/media-entity.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
|
||||
@@ -103,14 +103,15 @@ out:
|
||||
}
|
||||
|
||||
static int rkisp_csi_g_mbus_config(struct v4l2_subdev *sd,
|
||||
struct v4l2_mbus_config *config)
|
||||
unsigned int pad_id,
|
||||
struct v4l2_mbus_config *config)
|
||||
{
|
||||
struct v4l2_subdev *remote_sd;
|
||||
|
||||
if (!sd)
|
||||
return -ENODEV;
|
||||
remote_sd = get_remote_subdev(sd);
|
||||
return v4l2_subdev_call(remote_sd, video, g_mbus_config, config);
|
||||
return v4l2_subdev_call(remote_sd, pad, get_mbus_config, pad_id, config);
|
||||
}
|
||||
|
||||
static int rkisp_csi_get_set_fmt(struct v4l2_subdev *sd,
|
||||
@@ -159,10 +160,10 @@ static const struct media_entity_operations rkisp_csi_media_ops = {
|
||||
static const struct v4l2_subdev_pad_ops rkisp_csi_pad_ops = {
|
||||
.set_fmt = rkisp_csi_get_set_fmt,
|
||||
.get_fmt = rkisp_csi_get_set_fmt,
|
||||
.get_mbus_config = rkisp_csi_g_mbus_config,
|
||||
};
|
||||
|
||||
static const struct v4l2_subdev_video_ops rkisp_csi_video_ops = {
|
||||
.g_mbus_config = rkisp_csi_g_mbus_config,
|
||||
.s_stream = rkisp_csi_s_stream,
|
||||
};
|
||||
|
||||
|
||||
@@ -320,7 +320,7 @@ static int rkisp_create_links(struct rkisp_device *dev)
|
||||
for (s = 0; s < dev->num_sensors; ++s) {
|
||||
struct rkisp_sensor_info *sensor = &dev->sensors[s];
|
||||
u32 type = sensor->sd->entity.function;
|
||||
bool en = s ? 0 : MEDIA_LNK_FL_ENABLED;
|
||||
bool en = s ? 0 : true;
|
||||
|
||||
for (pad = 0; pad < sensor->sd->entity.num_pads; pad++)
|
||||
if (sensor->sd->entity.pads[pad].flags & MEDIA_PAD_FL_SOURCE)
|
||||
@@ -342,8 +342,8 @@ static int rkisp_create_links(struct rkisp_device *dev)
|
||||
ret = media_create_pad_link(&sensor->sd->entity, pad,
|
||||
&dev->isp_sdev.sd.entity, RKISP_ISP_PAD_SINK, en);
|
||||
} else {
|
||||
v4l2_subdev_call(sensor->sd, video,
|
||||
g_mbus_config, &sensor->mbus);
|
||||
v4l2_subdev_call(sensor->sd, pad,
|
||||
get_mbus_config, 0, &sensor->mbus);
|
||||
if (sensor->mbus.type == V4L2_MBUS_CCP2) {
|
||||
/* mipi-phy lvds link -> isp */
|
||||
dev->isp_inp = INP_LVDS;
|
||||
@@ -411,7 +411,7 @@ static int _set_pipeline_default_fmt(struct rkisp_device *dev)
|
||||
rkisp_set_stream_def_fmt(dev, RKISP_STREAM_SP,
|
||||
width, height, V4L2_PIX_FMT_NV12);
|
||||
if ((dev->isp_ver == ISP_V20 || dev->isp_ver == ISP_V21) &&
|
||||
dev->active_sensor->mbus.type == V4L2_MBUS_CSI2) {
|
||||
dev->active_sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) {
|
||||
width = dev->active_sensor->fmt[1].format.width;
|
||||
height = dev->active_sensor->fmt[1].format.height;
|
||||
code = dev->active_sensor->fmt[1].format.code;
|
||||
@@ -532,15 +532,14 @@ static int isp_subdev_notifier(struct rkisp_device *isp_dev)
|
||||
struct device *dev = isp_dev->dev;
|
||||
int ret;
|
||||
|
||||
v4l2_async_notifier_init(ntf);
|
||||
|
||||
ret = v4l2_async_notifier_parse_fwnode_endpoints(
|
||||
dev, ntf, sizeof(struct rkisp_async_subdev),
|
||||
rkisp_fwnode_parse);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (!ntf->num_subdevs)
|
||||
return -ENODEV; /* no endpoint */
|
||||
|
||||
ntf->ops = &subdev_notifier_ops;
|
||||
|
||||
return v4l2_async_notifier_register(&isp_dev->v4l2_dev, ntf);
|
||||
@@ -588,10 +587,6 @@ static int rkisp_register_platform_subdevs(struct rkisp_device *dev)
|
||||
if (ret < 0) {
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
"Failed to register subdev notifier(%d)\n", ret);
|
||||
/* maybe use dmarx to input image */
|
||||
ret = v4l2_device_register_subdev_nodes(&dev->v4l2_dev);
|
||||
if (ret == 0)
|
||||
return 0;
|
||||
goto err_unreg_luma_vdev;
|
||||
}
|
||||
|
||||
|
||||
@@ -843,7 +843,7 @@ static const struct v4l2_ioctl_ops rkisp_dmarx_ioctl = {
|
||||
.vidioc_streamon = vb2_ioctl_streamon,
|
||||
.vidioc_streamoff = vb2_ioctl_streamoff,
|
||||
.vidioc_try_fmt_vid_out_mplane = rkisp_try_fmt_vid_out_mplane,
|
||||
.vidioc_enum_fmt_vid_out_mplane = rkisp_enum_fmt_vid_out_mplane,
|
||||
.vidioc_enum_fmt_vid_out = rkisp_enum_fmt_vid_out_mplane,
|
||||
.vidioc_s_fmt_vid_out_mplane = rkisp_s_fmt_vid_out_mplane,
|
||||
.vidioc_g_fmt_vid_out_mplane = rkisp_g_fmt_vid_out_mplane,
|
||||
.vidioc_querycap = rkisp_querycap,
|
||||
@@ -883,7 +883,7 @@ static int rkisp_register_dmarx_video(struct rkisp_stream *stream)
|
||||
V4L2_BUF_TYPE_VIDEO_OUTPUT_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,
|
||||
"%s failed with error %d\n", __func__, ret);
|
||||
|
||||
@@ -84,7 +84,7 @@ static int rkisp_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);
|
||||
}
|
||||
@@ -98,12 +98,8 @@ static int rkisp_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->dev->v4l2_dev,
|
||||
"set pipeline power failed %d\n", ret);
|
||||
}
|
||||
if (!ret)
|
||||
v4l2_pipeline_pm_put(&luma->vnode.vdev.entity);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -473,7 +469,7 @@ int rkisp_register_luma_vdev(struct rkisp_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");
|
||||
|
||||
@@ -235,7 +235,7 @@ static int rkisp_params_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);
|
||||
}
|
||||
@@ -253,12 +253,8 @@ static int rkisp_params_fop_release(struct file *file)
|
||||
params->ops->fop_release(params);
|
||||
|
||||
ret = vb2_fop_release(file);
|
||||
if (!ret) {
|
||||
ret = v4l2_pipeline_pm_use(¶ms->vnode.vdev.entity, 0);
|
||||
if (ret < 0)
|
||||
v4l2_err(¶ms->dev->v4l2_dev,
|
||||
"set pipeline power failed %d\n", ret);
|
||||
}
|
||||
if (!ret)
|
||||
v4l2_pipeline_pm_put(¶ms->vnode.vdev.entity);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -402,7 +398,7 @@ int rkisp_register_params_vdev(struct rkisp_isp_params_vdev *params_vdev,
|
||||
ret = media_entity_pads_init(&vdev->entity, 1, &node->pad);
|
||||
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");
|
||||
|
||||
@@ -87,7 +87,7 @@ static int rkisp_stats_fh_open(struct file *filp)
|
||||
|
||||
ret = v4l2_fh_open(filp);
|
||||
if (!ret) {
|
||||
ret = v4l2_pipeline_pm_use(&stats->vnode.vdev.entity, 1);
|
||||
ret = v4l2_pipeline_pm_get(&stats->vnode.vdev.entity);
|
||||
if (ret < 0)
|
||||
vb2_fop_release(filp);
|
||||
}
|
||||
@@ -101,12 +101,8 @@ static int rkisp_stats_fop_release(struct file *file)
|
||||
int ret;
|
||||
|
||||
ret = vb2_fop_release(file);
|
||||
if (!ret) {
|
||||
ret = v4l2_pipeline_pm_use(&stats->vnode.vdev.entity, 0);
|
||||
if (ret < 0)
|
||||
v4l2_err(&stats->dev->v4l2_dev,
|
||||
"set pipeline power failed %d\n", ret);
|
||||
}
|
||||
if (!ret)
|
||||
v4l2_pipeline_pm_put(&stats->vnode.vdev.entity);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -325,7 +321,7 @@ int rkisp_register_stats_vdev(struct rkisp_isp_stats_vdev *stats_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");
|
||||
|
||||
@@ -318,12 +318,11 @@ static int isp_open(struct inode *inode, struct file *file)
|
||||
return single_open(file, isp_show, data);
|
||||
}
|
||||
|
||||
static const struct file_operations ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = isp_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
static const struct proc_ops ops = {
|
||||
.proc_open = isp_open,
|
||||
.proc_read = seq_read,
|
||||
.proc_lseek = seq_lseek,
|
||||
.proc_release = single_release,
|
||||
};
|
||||
|
||||
int rkisp_proc_init(struct rkisp_device *dev)
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/compat.h>
|
||||
#include <linux/iopoll.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
@@ -341,12 +342,12 @@ int rkisp_update_sensor_info(struct rkisp_device *dev)
|
||||
return -ENODEV;
|
||||
|
||||
sensor = sd_to_sensor(dev, sensor_sd);
|
||||
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)
|
||||
return ret;
|
||||
|
||||
if (sensor->mbus.type == V4L2_MBUS_CSI2) {
|
||||
if (sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) {
|
||||
u8 vc = 0;
|
||||
|
||||
memset(dev->csi_dev.mipi_di, 0,
|
||||
@@ -358,8 +359,12 @@ int rkisp_update_sensor_info(struct rkisp_device *dev)
|
||||
fmt->which = V4L2_SUBDEV_FORMAT_ACTIVE;
|
||||
ret = v4l2_subdev_call(sensor->sd, pad, get_fmt,
|
||||
&sensor->cfg, fmt);
|
||||
if (ret && ret != -ENOIOCTLCMD)
|
||||
return ret;
|
||||
if (ret && ret != -ENOIOCTLCMD) {
|
||||
if (i)
|
||||
*fmt = sensor->fmt[0];
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
ret = mbus_pixelcode_to_mipi_dt(fmt->format.code);
|
||||
if (ret < 0) {
|
||||
v4l2_err(&dev->v4l2_dev,
|
||||
@@ -1155,7 +1160,7 @@ static int rkisp_config_isp(struct rkisp_device *dev)
|
||||
} else if (in_fmt->fmt_type == FMT_YUV) {
|
||||
acq_mult = 2;
|
||||
if (sensor &&
|
||||
(sensor->mbus.type == V4L2_MBUS_CSI2 ||
|
||||
(sensor->mbus.type == V4L2_MBUS_CSI2_DPHY ||
|
||||
sensor->mbus.type == V4L2_MBUS_CCP2)) {
|
||||
isp_ctrl = CIF_ISP_CTRL_ISP_MODE_ITU601;
|
||||
} else {
|
||||
@@ -1346,7 +1351,7 @@ static int rkisp_config_path(struct rkisp_device *dev)
|
||||
u32 dpcl = readl(dev->base_addr + CIF_VI_DPCL);
|
||||
|
||||
/* isp input interface selects */
|
||||
if ((sensor && sensor->mbus.type == V4L2_MBUS_CSI2) ||
|
||||
if ((sensor && sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) ||
|
||||
dev->isp_inp & (INP_RAWRD0 | INP_RAWRD1 | INP_RAWRD2 | INP_CIF)) {
|
||||
/* mipi sensor->isp or isp read from ddr */
|
||||
dpcl |= CIF_VI_DPCL_IF_SEL_MIPI;
|
||||
@@ -1595,7 +1600,7 @@ static int rkisp_isp_start(struct rkisp_device *dev)
|
||||
atomic_read(&dev->hw_dev->refcnt));
|
||||
|
||||
/* Activate MIPI */
|
||||
if (sensor && sensor->mbus.type == V4L2_MBUS_CSI2) {
|
||||
if (sensor && sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) {
|
||||
if (dev->isp_ver == ISP_V12 || dev->isp_ver == ISP_V13) {
|
||||
/* clear interrupts state */
|
||||
readl(base + CIF_ISP_CSI0_ERR1);
|
||||
@@ -2419,7 +2424,6 @@ rkisp_isp_queue_event_sof(struct rkisp_isp_subdev *isp)
|
||||
atomic_inc_return(&isp->frm_sync_seq) - 1,
|
||||
};
|
||||
|
||||
event.timestamp = ns_to_timespec(ktime_get_ns());
|
||||
v4l2_event_queue(isp->sd.devnode, &event);
|
||||
}
|
||||
|
||||
@@ -2465,6 +2469,10 @@ static long rkisp_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
||||
isp_dev->csi_dev.memory = 0;
|
||||
break;
|
||||
case RKISP_CMD_GET_SHARED_BUF:
|
||||
if (!IS_ENABLED(CONFIG_VIDEO_ROCKCHIP_THUNDER_BOOT_ISP)) {
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
}
|
||||
resmem = (struct rkisp_thunderboot_resmem *)arg;
|
||||
resmem->resmem_padr = isp_dev->resmem_pa;
|
||||
resmem->resmem_size = isp_dev->resmem_size;
|
||||
@@ -2494,6 +2502,10 @@ static long rkisp_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
||||
}
|
||||
break;
|
||||
case RKISP_CMD_FREE_SHARED_BUF:
|
||||
if (!IS_ENABLED(CONFIG_VIDEO_ROCKCHIP_THUNDER_BOOT_ISP)) {
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
}
|
||||
if (isp_dev->resmem_pa && isp_dev->resmem_size) {
|
||||
dma_unmap_single(isp_dev->dev, isp_dev->resmem_pa,
|
||||
sizeof(struct rkisp_thunderboot_resmem_head),
|
||||
@@ -2515,6 +2527,10 @@ static long rkisp_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
||||
rkisp_params_set_ldchbuf_size(&isp_dev->params_vdev, ldchsize);
|
||||
break;
|
||||
case RKISP_CMD_GET_SHM_BUFFD:
|
||||
if (!IS_ENABLED(CONFIG_VIDEO_ROCKCHIP_THUNDER_BOOT_ISP)) {
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
}
|
||||
shmem = (struct rkisp_thunderboot_shmem *)arg;
|
||||
ret = rkisp_tb_shm_ioctl(shmem);
|
||||
break;
|
||||
@@ -2558,11 +2574,19 @@ static long rkisp_compat_ioctl32(struct v4l2_subdev *sd,
|
||||
ret = rkisp_ioctl(sd, cmd, &mode);
|
||||
break;
|
||||
case RKISP_CMD_GET_SHARED_BUF:
|
||||
if (!IS_ENABLED(CONFIG_VIDEO_ROCKCHIP_THUNDER_BOOT_ISP)) {
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
}
|
||||
ret = rkisp_ioctl(sd, cmd, &resmem);
|
||||
if (!ret && copy_to_user(up, &resmem, sizeof(resmem)))
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
case RKISP_CMD_FREE_SHARED_BUF:
|
||||
if (!IS_ENABLED(CONFIG_VIDEO_ROCKCHIP_THUNDER_BOOT_ISP)) {
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
}
|
||||
ret = rkisp_ioctl(sd, cmd, NULL);
|
||||
break;
|
||||
case RKISP_CMD_GET_LDCHBUF_INFO:
|
||||
@@ -2576,6 +2600,10 @@ static long rkisp_compat_ioctl32(struct v4l2_subdev *sd,
|
||||
ret = rkisp_ioctl(sd, cmd, &ldchsize);
|
||||
break;
|
||||
case RKISP_CMD_GET_SHM_BUFFD:
|
||||
if (!IS_ENABLED(CONFIG_VIDEO_ROCKCHIP_THUNDER_BOOT_ISP)) {
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
}
|
||||
if (copy_from_user(&shmem, up, sizeof(shmem)))
|
||||
return -EFAULT;
|
||||
ret = rkisp_ioctl(sd, cmd, &shmem);
|
||||
@@ -2950,7 +2978,7 @@ void rkisp_isp_isr(unsigned int isp_mis,
|
||||
}
|
||||
if (dev->cap_dev.stream[RKISP_STREAM_SP].interlaced) {
|
||||
/* 0 = ODD 1 = EVEN */
|
||||
if (dev->active_sensor->mbus.type == V4L2_MBUS_CSI2) {
|
||||
if (dev->active_sensor->mbus.type == V4L2_MBUS_CSI2_DPHY) {
|
||||
void __iomem *addr = NULL;
|
||||
|
||||
if (dev->isp_ver == ISP_V10 ||
|
||||
|
||||
@@ -71,7 +71,7 @@ static void *shm_vmap(struct dma_buf *dma_buf)
|
||||
{
|
||||
struct shm_data *data = dma_buf->priv;
|
||||
|
||||
return vm_map_ram(data->pages, data->npages, 0, PAGE_KERNEL);
|
||||
return vm_map_ram(data->pages, data->npages, 0);
|
||||
}
|
||||
|
||||
static void shm_vunmap(struct dma_buf *dma_buf, void *vaddr)
|
||||
@@ -81,20 +81,6 @@ static void shm_vunmap(struct dma_buf *dma_buf, void *vaddr)
|
||||
vm_unmap_ram(vaddr, data->npages);
|
||||
}
|
||||
|
||||
static void *shm_kmap(struct dma_buf *dma_buf, unsigned long page_num)
|
||||
{
|
||||
struct shm_data *data = dma_buf->priv;
|
||||
|
||||
return kmap(data->pages[page_num]);
|
||||
}
|
||||
|
||||
static void shm_kunmap(struct dma_buf *dma_buf, unsigned long page_num, void *addr)
|
||||
{
|
||||
struct shm_data *data = dma_buf->priv;
|
||||
|
||||
return kunmap(data->pages[page_num]);
|
||||
}
|
||||
|
||||
static int shm_mmap(struct dma_buf *dma_buf, struct vm_area_struct *vma)
|
||||
{
|
||||
struct shm_data *data = dma_buf->priv;
|
||||
@@ -138,8 +124,6 @@ static const struct dma_buf_ops shm_dmabuf_ops = {
|
||||
.map_dma_buf = shm_map_dma_buf,
|
||||
.unmap_dma_buf = shm_unmap_dma_buf,
|
||||
.release = shm_release,
|
||||
.map = shm_kmap,
|
||||
.unmap = shm_kunmap,
|
||||
.mmap = shm_mmap,
|
||||
.vmap = shm_vmap,
|
||||
.vunmap = shm_vunmap,
|
||||
|
||||
@@ -106,9 +106,8 @@ static void *vb2_dma_sg_alloc(struct device *dev, unsigned long dma_attrs,
|
||||
* No need to sync to the device, this will happen later when the
|
||||
* prepare() memop is called.
|
||||
*/
|
||||
sgt->nents = dma_map_sg_attrs(buf->dev, sgt->sgl, sgt->orig_nents,
|
||||
buf->dma_dir, DMA_ATTR_SKIP_CPU_SYNC);
|
||||
if (!sgt->nents)
|
||||
if (dma_map_sgtable(buf->dev, sgt, buf->dma_dir,
|
||||
DMA_ATTR_SKIP_CPU_SYNC))
|
||||
goto fail_map;
|
||||
|
||||
buf->handler.refcount = &buf->refcount;
|
||||
@@ -139,8 +138,8 @@ static void vb2_dma_sg_put(void *buf_priv)
|
||||
int i = buf->num_pages;
|
||||
|
||||
if (refcount_dec_and_test(&buf->refcount)) {
|
||||
dma_unmap_sg_attrs(buf->dev, sgt->sgl, sgt->orig_nents,
|
||||
buf->dma_dir, DMA_ATTR_SKIP_CPU_SYNC);
|
||||
dma_unmap_sgtable(buf->dev, sgt, buf->dma_dir,
|
||||
DMA_ATTR_SKIP_CPU_SYNC);
|
||||
if (buf->vaddr)
|
||||
vm_unmap_ram(buf->vaddr, buf->num_pages);
|
||||
sg_free_table(buf->dma_sgt);
|
||||
@@ -156,12 +155,7 @@ static void vb2_dma_sg_prepare(void *buf_priv)
|
||||
struct vb2_dma_sg_buf *buf = buf_priv;
|
||||
struct sg_table *sgt = buf->dma_sgt;
|
||||
|
||||
/* DMABUF exporter will flush the cache for us */
|
||||
if (buf->db_attach)
|
||||
return;
|
||||
|
||||
dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->orig_nents,
|
||||
buf->dma_dir);
|
||||
dma_sync_sgtable_for_device(buf->dev, sgt, buf->dma_dir);
|
||||
}
|
||||
|
||||
static void vb2_dma_sg_finish(void *buf_priv)
|
||||
@@ -169,11 +163,7 @@ static void vb2_dma_sg_finish(void *buf_priv)
|
||||
struct vb2_dma_sg_buf *buf = buf_priv;
|
||||
struct sg_table *sgt = buf->dma_sgt;
|
||||
|
||||
/* DMABUF exporter will flush the cache for us */
|
||||
if (buf->db_attach)
|
||||
return;
|
||||
|
||||
dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir);
|
||||
dma_sync_sgtable_for_cpu(buf->dev, sgt, buf->dma_dir);
|
||||
}
|
||||
|
||||
static void *vb2_dma_sg_get_userptr(struct device *dev, unsigned long vaddr,
|
||||
@@ -197,8 +187,7 @@ static void *vb2_dma_sg_get_userptr(struct device *dev, unsigned long vaddr,
|
||||
buf->offset = vaddr & ~PAGE_MASK;
|
||||
buf->size = size;
|
||||
buf->dma_sgt = &buf->sg_table;
|
||||
vec = vb2_create_framevec(vaddr, size, dma_dir == DMA_FROM_DEVICE ||
|
||||
dma_dir == DMA_BIDIRECTIONAL);
|
||||
vec = vb2_create_framevec(vaddr, size);
|
||||
if (IS_ERR(vec))
|
||||
goto userptr_fail_pfnvec;
|
||||
buf->vec = vec;
|
||||
@@ -217,9 +206,8 @@ static void *vb2_dma_sg_get_userptr(struct device *dev, unsigned long vaddr,
|
||||
* No need to sync to the device, this will happen later when the
|
||||
* prepare() memop is called.
|
||||
*/
|
||||
sgt->nents = dma_map_sg_attrs(buf->dev, sgt->sgl, sgt->orig_nents,
|
||||
buf->dma_dir, DMA_ATTR_SKIP_CPU_SYNC);
|
||||
if (!sgt->nents)
|
||||
if (dma_map_sgtable(buf->dev, sgt, buf->dma_dir,
|
||||
DMA_ATTR_SKIP_CPU_SYNC))
|
||||
goto userptr_fail_map;
|
||||
|
||||
return buf;
|
||||
@@ -243,8 +231,7 @@ static void vb2_dma_sg_put_userptr(void *buf_priv)
|
||||
struct sg_table *sgt = &buf->sg_table;
|
||||
int i = buf->num_pages;
|
||||
|
||||
dma_unmap_sg_attrs(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir,
|
||||
DMA_ATTR_SKIP_CPU_SYNC);
|
||||
dma_unmap_sgtable(buf->dev, sgt, buf->dma_dir, DMA_ATTR_SKIP_CPU_SYNC);
|
||||
if (buf->vaddr)
|
||||
vm_unmap_ram(buf->vaddr, buf->num_pages);
|
||||
sg_free_table(buf->dma_sgt);
|
||||
@@ -266,8 +253,7 @@ static void *vb2_dma_sg_vaddr(void *buf_priv)
|
||||
if (buf->db_attach)
|
||||
buf->vaddr = dma_buf_vmap(buf->db_attach->dmabuf);
|
||||
else
|
||||
buf->vaddr = vm_map_ram(buf->pages,
|
||||
buf->num_pages, -1, PAGE_KERNEL);
|
||||
buf->vaddr = vm_map_ram(buf->pages, buf->num_pages, -1);
|
||||
}
|
||||
|
||||
/* add offset in case userptr is not page-aligned */
|
||||
@@ -284,28 +270,18 @@ static unsigned int vb2_dma_sg_num_users(void *buf_priv)
|
||||
static int vb2_dma_sg_mmap(void *buf_priv, struct vm_area_struct *vma)
|
||||
{
|
||||
struct vb2_dma_sg_buf *buf = buf_priv;
|
||||
unsigned long uaddr = vma->vm_start;
|
||||
unsigned long usize = vma->vm_end - vma->vm_start;
|
||||
int i = 0;
|
||||
int err;
|
||||
|
||||
if (!buf) {
|
||||
pr_err("No memory to map\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
do {
|
||||
int ret;
|
||||
|
||||
ret = vm_insert_page(vma, uaddr, buf->pages[i++]);
|
||||
if (ret) {
|
||||
pr_err("Remapping memory, error: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
uaddr += PAGE_SIZE;
|
||||
usize -= PAGE_SIZE;
|
||||
} while (usize > 0);
|
||||
|
||||
err = vm_map_pages(vma, buf->pages, buf->num_pages);
|
||||
if (err) {
|
||||
pr_err("Remapping memory, error: %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Use common vm_area operations to track buffer refcount.
|
||||
@@ -378,8 +354,7 @@ static void vb2_dma_sg_dmabuf_ops_detach(struct dma_buf *dbuf,
|
||||
|
||||
/* release the scatterlist cache */
|
||||
if (attach->dma_dir != DMA_NONE)
|
||||
dma_unmap_sg(db_attach->dev, sgt->sgl, sgt->orig_nents,
|
||||
attach->dma_dir);
|
||||
dma_unmap_sgtable(db_attach->dev, sgt, attach->dma_dir, 0);
|
||||
sg_free_table(sgt);
|
||||
kfree(attach);
|
||||
db_attach->priv = NULL;
|
||||
@@ -404,15 +379,12 @@ static struct sg_table *vb2_dma_sg_dmabuf_ops_map(
|
||||
|
||||
/* release any previous cache */
|
||||
if (attach->dma_dir != DMA_NONE) {
|
||||
dma_unmap_sg(db_attach->dev, sgt->sgl, sgt->orig_nents,
|
||||
attach->dma_dir);
|
||||
dma_unmap_sgtable(db_attach->dev, sgt, attach->dma_dir, 0);
|
||||
attach->dma_dir = DMA_NONE;
|
||||
}
|
||||
|
||||
/* mapping to the client with new direction */
|
||||
sgt->nents = dma_map_sg(db_attach->dev, sgt->sgl, sgt->orig_nents,
|
||||
dma_dir);
|
||||
if (!sgt->nents) {
|
||||
if (dma_map_sgtable(db_attach->dev, sgt, dma_dir, 0)) {
|
||||
pr_err("failed to map scatterlist\n");
|
||||
mutex_unlock(lock);
|
||||
return ERR_PTR(-EIO);
|
||||
@@ -437,11 +409,26 @@ static void vb2_dma_sg_dmabuf_ops_release(struct dma_buf *dbuf)
|
||||
vb2_dma_sg_put(dbuf->priv);
|
||||
}
|
||||
|
||||
static void *vb2_dma_sg_dmabuf_ops_kmap(struct dma_buf *dbuf, unsigned long pgnum)
|
||||
static int
|
||||
vb2_dma_sg_dmabuf_ops_begin_cpu_access(struct dma_buf *dbuf,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
struct vb2_dma_sg_buf *buf = dbuf->priv;
|
||||
struct sg_table *sgt = buf->dma_sgt;
|
||||
|
||||
return buf->vaddr ? buf->vaddr + pgnum * PAGE_SIZE : NULL;
|
||||
dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
vb2_dma_sg_dmabuf_ops_end_cpu_access(struct dma_buf *dbuf,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
struct vb2_dma_sg_buf *buf = dbuf->priv;
|
||||
struct sg_table *sgt = buf->dma_sgt;
|
||||
|
||||
dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *vb2_dma_sg_dmabuf_ops_vmap(struct dma_buf *dbuf)
|
||||
@@ -462,7 +449,8 @@ static const struct dma_buf_ops vb2_dma_sg_dmabuf_ops = {
|
||||
.detach = vb2_dma_sg_dmabuf_ops_detach,
|
||||
.map_dma_buf = vb2_dma_sg_dmabuf_ops_map,
|
||||
.unmap_dma_buf = vb2_dma_sg_dmabuf_ops_unmap,
|
||||
.map = vb2_dma_sg_dmabuf_ops_kmap,
|
||||
.begin_cpu_access = vb2_dma_sg_dmabuf_ops_begin_cpu_access,
|
||||
.end_cpu_access = vb2_dma_sg_dmabuf_ops_end_cpu_access,
|
||||
.vmap = vb2_dma_sg_dmabuf_ops_vmap,
|
||||
.mmap = vb2_dma_sg_dmabuf_ops_mmap,
|
||||
.release = vb2_dma_sg_dmabuf_ops_release,
|
||||
|
||||
Reference in New Issue
Block a user