[RFC PATCH 14/14] [DNM] media: camss: hacks for MSM8974

Luca Weiss
2022-05-22T16:28:45Z

Remove IOMMU_DMA dependency from VIDEO_QCOM_CAMSS: We don't have IOMMU
on msm8974 yet.

DMA_SG -> DMA_CONTIG: Taking a photo without this works but is offset
and doing weird stuff.

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
drivers/media/platform/qcom/camss/Kconfig | 4 ++--
drivers/media/platform/qcom/camss/camss-video.c | 14 +++++++-------
2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/qcom/camss/Kconfig b/drivers/media/platform/qcom/camss/Kconfig
index 4eda48cb1adf..e382fd77ecc3 100644
--- a/drivers/media/platform/qcom/camss/Kconfig
+++ b/drivers/media/platform/qcom/camss/Kconfig
@@ -2,8 +2,8 @@ config VIDEO_QCOM_CAMSS
tristate "Qualcomm V4L2 Camera Subsystem driver"
depends on V4L_PLATFORM_DRIVERS
depends on VIDEO_DEV
- depends on (ARCH_QCOM && IOMMU_DMA) || COMPILE_TEST
+ depends on ARCH_QCOM || COMPILE_TEST
select MEDIA_CONTROLLER
select VIDEO_V4L2_SUBDEV_API
- select VIDEOBUF2_DMA_SG
+ select VIDEOBUF2_DMA_CONTIG
select V4L2_FWNODE
diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c
index ca955808fd6d..885a809cc941 100644
--- a/drivers/media/platform/qcom/camss/camss-video.c
+++ b/drivers/media/platform/qcom/camss/camss-video.c
@@ -13,7 +13,7 @@
#include <media/v4l2-device.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-mc.h>
-#include <media/videobuf2-dma-sg.h>
+#include <media/videobuf2-dma-contig.h>

#include "camss-video.h"
#include "camss.h"
@@ -410,15 +410,15 @@ static int video_buf_init(struct vb2_buffer *vb)
vb);
const struct v4l2_pix_format_mplane *format =
&video->active_fmt.fmt.pix_mp;
- struct sg_table *sgt;
+ //struct sg_table *sgt;
unsigned int i;

for (i = 0; i < format->num_planes; i++) {
- sgt = vb2_dma_sg_plane_desc(vb, i);
- if (!sgt)
- return -EFAULT;
+ //sgt = vb2_dma_sg_plane_desc(vb, i);
+ //if (!sgt)
+ // return -EFAULT;

- buffer->addr[i] = sg_dma_address(sgt->sgl);
+ buffer->addr[i] = vb2_dma_contig_plane_dma_addr(vb, i); //sg_dma_address(sgt->sgl);
}

if (format->pixelformat == V4L2_PIX_FMT_NV12 ||
@@ -966,7 +966,7 @@ int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev,

q = &video->vb2_q;
q->drv_priv = video;
- q->mem_ops = &vb2_dma_sg_memops;
+ q->mem_ops = &vb2_dma_contig_memops;
q->ops = &msm_video_vb2_q_ops;
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
q->io_modes = VB2_DMABUF | VB2_MMAP | VB2_READ;
--
2.36.0