Browse Source

msm: disp: rotator: changes to enable rotator on 5.4 kernel

Few v4l2_ioctl_ops are deprecated on kernel upgrade. Made
changes to use the new simulated ops. Addressed compilation
issues on enabling rotator on 5.4 kernel.

Change-Id: I37add012306da433c4d7f8aaada3089b6ecdd819
Signed-off-by: Raviteja Tamatam <[email protected]>
Raviteja Tamatam 5 years ago
parent
commit
0a0acb4162
4 changed files with 38 additions and 83 deletions
  1. 13 10
      rotator/sde_rotator_core.c
  2. 25 66
      rotator/sde_rotator_dev.c
  3. 0 6
      rotator/sde_rotator_r3.c
  4. 0 1
      rotator/sde_rotator_smmu.c

+ 13 - 10
rotator/sde_rotator_core.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 // SPDX-License-Identifier: GPL-2.0-only
 /*
 /*
- * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
  */
  */
 
 
 #define pr_fmt(fmt)	"%s:%d: " fmt, __func__, __LINE__
 #define pr_fmt(fmt)	"%s:%d: " fmt, __func__, __LINE__
@@ -19,7 +19,7 @@
 #include <soc/qcom/secure_buffer.h>
 #include <soc/qcom/secure_buffer.h>
 #include <asm/cacheflush.h>
 #include <asm/cacheflush.h>
 #include <uapi/linux/sched/types.h>
 #include <uapi/linux/sched/types.h>
-#include <soc/qcom/qtee_shmbridge.h>
+#include <linux/qtee_shmbridge.h>
 
 
 #include "sde_rotator_base.h"
 #include "sde_rotator_base.h"
 #include "sde_rotator_core.h"
 #include "sde_rotator_core.h"
@@ -111,7 +111,8 @@ err:
 		icc_set_bw(bus->data_bus_hdl[j], ab, ab);
 		icc_set_bw(bus->data_bus_hdl[j], ab, ab);
 	ATRACE_END("msm_bus_scale_req_rot");
 	ATRACE_END("msm_bus_scale_req_rot");
 	pr_err("failed to set data bus quota %llu\n", quota);
 	pr_err("failed to set data bus quota %llu\n", quota);
-	if (!bus->curr_quota_val) {
+
+	if (!bus->curr_quota_val)
 		pr_err("rotator: data bus was set to 0\n");
 		pr_err("rotator: data bus was set to 0\n");
 
 
 	return ret;
 	return ret;
@@ -594,7 +595,6 @@ static int sde_rotator_secure_session_ctrl(bool enable)
 			mdata->sec_cam_en = 1;
 			mdata->sec_cam_en = 1;
 			sde_smmu_secure_ctrl(0);
 			sde_smmu_secure_ctrl(0);
 
 
-			dmac_flush_range(sid_info, sid_info + 1);
 			ret = qcom_scm_mem_protect_sd_ctrl(SDE_ROTATOR_DEVICE,
 			ret = qcom_scm_mem_protect_sd_ctrl(SDE_ROTATOR_DEVICE,
 						mem_addr, mem_size, vmid);
 						mem_addr, mem_size, vmid);
 			if (ret) {
 			if (ret) {
@@ -621,7 +621,6 @@ static int sde_rotator_secure_session_ctrl(bool enable)
 			vmid = VMID_CP_PIXEL;
 			vmid = VMID_CP_PIXEL;
 			mdata->sec_cam_en = 0;
 			mdata->sec_cam_en = 0;
 
 
-			dmac_flush_range(sid_info, sid_info + 1);
 			ret = qcom_scm_mem_protect_sd_ctrl(SDE_ROTATOR_DEVICE,
 			ret = qcom_scm_mem_protect_sd_ctrl(SDE_ROTATOR_DEVICE,
 					mem_addr, mem_size, vmid);
 					mem_addr, mem_size, vmid);
 			if (ret)
 			if (ret)
@@ -2748,16 +2747,20 @@ static int sde_rotator_parse_dt_bus(struct sde_rot_mgr *mgr,
 data_bus:
 data_bus:
 	for (i = 0; i < SDE_ROTATION_BUS_PATH_MAX; i++) {
 	for (i = 0; i < SDE_ROTATION_BUS_PATH_MAX; i++) {
 		snprintf(bus_name, 32, "%s%d", "qcom,rot-data-bus", i);
 		snprintf(bus_name, 32, "%s%d", "qcom,rot-data-bus", i);
-		ret = of_property_match_string(pdev->dev.of_node,
+		ret = of_property_match_string(dev->dev.of_node,
 			"interconnect-names", bus_name);
 			"interconnect-names", bus_name);
 		if (ret < 0) {
 		if (ret < 0) {
 			if (!mgr->data_bus.data_paths_cnt) {
 			if (!mgr->data_bus.data_paths_cnt) {
-				pr_debug("rotator: bus %s dt node missing\n", bus_name);
+				pr_debug("rotator: bus %s dt node missing\n",
+					bus_name);
 				return 0;
 				return 0;
-			} else
+			} else {
 				goto end;
 				goto end;
-		} else
-			mgr->data_bus.data_bus_hdl[i] = of_icc_get(&pdev->dev, bus_name);
+			}
+		} else {
+			mgr->data_bus.data_bus_hdl[i] =
+				of_icc_get(&dev->dev, bus_name);
+		}
 
 
 		if (IS_ERR_OR_NULL(mgr->data_bus.data_bus_hdl[i])) {
 		if (IS_ERR_OR_NULL(mgr->data_bus.data_bus_hdl[i])) {
 			SDEROT_ERR("rotator: get data bus %s failed\n",
 			SDEROT_ERR("rotator: get data bus %s failed\n",

+ 25 - 66
rotator/sde_rotator_dev.c

@@ -2421,62 +2421,22 @@ static int sde_rotator_streamoff(struct file *file,
 }
 }
 
 
 /*
 /*
- * sde_rotator_cropcap - V4l2 ioctl crop capabilities.
+ * sde_rotator_g_selection - V4l2 ioctl get crop.
  * @file: Pointer to file struct.
  * @file: Pointer to file struct.
  * @fh: V4l2 File handle.
  * @fh: V4l2 File handle.
- * @a: Pointer to v4l2_cropcap struct need to be set.
+ * @selection: Pointer to v4l2_selection struct need to be set.
  */
  */
-static int sde_rotator_cropcap(struct file *file, void *fh,
-	struct v4l2_cropcap *a)
+static int sde_rotator_g_selection(struct file *file, void *fh,
+	struct v4l2_selection *selection)
 {
 {
 	struct sde_rotator_ctx *ctx = sde_rotator_ctx_from_fh(fh);
 	struct sde_rotator_ctx *ctx = sde_rotator_ctx_from_fh(fh);
-	struct v4l2_format *format;
-	struct v4l2_rect *crop;
 
 
-	switch (a->type) {
+	switch (selection->type) {
 	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
 	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
-		format = &ctx->format_out;
-		crop = &ctx->crop_out;
+		selection->r = ctx->crop_out;
 		break;
 		break;
 	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
 	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
-		format = &ctx->format_cap;
-		crop = &ctx->crop_cap;
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	a->bounds.top = 0;
-	a->bounds.left = 0;
-	a->bounds.width = format->fmt.pix.width;
-	a->bounds.height = format->fmt.pix.height;
-
-	a->defrect = *crop;
-
-	a->pixelaspect.numerator = 1;
-	a->pixelaspect.denominator = 1;
-
-	SDEROT_EVTLOG(format->fmt.pix.width, format->fmt.pix.height, a->type);
-	return 0;
-}
-
-/*
- * sde_rotator_g_crop - V4l2 ioctl get crop.
- * @file: Pointer to file struct.
- * @fh: V4l2 File handle.
- * @crop: Pointer to v4l2_crop struct need to be set.
- */
-static int sde_rotator_g_crop(struct file *file, void *fh,
-	struct v4l2_crop *crop)
-{
-	struct sde_rotator_ctx *ctx = sde_rotator_ctx_from_fh(fh);
-
-	switch (crop->type) {
-	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
-		crop->c = ctx->crop_out;
-		break;
-	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
-		crop->c = ctx->crop_cap;
+		selection->r = ctx->crop_cap;
 		break;
 		break;
 	default:
 	default:
 		return -EINVAL;
 		return -EINVAL;
@@ -2485,13 +2445,13 @@ static int sde_rotator_g_crop(struct file *file, void *fh,
 }
 }
 
 
 /*
 /*
- * sde_rotator_s_crop - V4l2 ioctl set crop.
+ * sde_rotator_s_selection - V4l2 ioctl set crop.
  * @file: Pointer to file struct.
  * @file: Pointer to file struct.
  * @fh: V4l2 File handle.
  * @fh: V4l2 File handle.
- * @crop: Pointer to v4l2_crop struct need to be set.
+ * @selection: Pointer to v4l2_selection struct need to be set.
  */
  */
-static int sde_rotator_s_crop(struct file *file, void *fh,
-	const struct v4l2_crop *crop)
+static int sde_rotator_s_selection(struct file *file, void *fh,
+	struct v4l2_selection *selection)
 {
 {
 	struct sde_rotator_ctx *ctx = sde_rotator_ctx_from_fh(fh);
 	struct sde_rotator_ctx *ctx = sde_rotator_ctx_from_fh(fh);
 	struct sde_rotator_device *rot_dev = ctx->rot_dev;
 	struct sde_rotator_device *rot_dev = ctx->rot_dev;
@@ -2500,12 +2460,12 @@ static int sde_rotator_s_crop(struct file *file, void *fh,
 
 
 	sde_rotator_get_item_from_ctx(ctx, &item);
 	sde_rotator_get_item_from_ctx(ctx, &item);
 
 
-	rect.left = max_t(__u32, crop->c.left, 0);
-	rect.top = max_t(__u32, crop->c.top, 0);
-	rect.height = max_t(__u32, crop->c.height, 0);
-	rect.width = max_t(__u32, crop->c.width, 0);
+	rect.left = max_t(__u32, selection->r.left, 0);
+	rect.top = max_t(__u32, selection->r.top, 0);
+	rect.height = max_t(__u32, selection->r.height, 0);
+	rect.width = max_t(__u32, selection->r.width, 0);
 
 
-	if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
+	if (selection->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
 		rect.left = min_t(__u32, rect.left,
 		rect.left = min_t(__u32, rect.left,
 				ctx->format_out.fmt.pix.width - 1);
 				ctx->format_out.fmt.pix.width - 1);
 		rect.top = min_t(__u32, rect.top,
 		rect.top = min_t(__u32, rect.top,
@@ -2524,9 +2484,9 @@ static int sde_rotator_s_crop(struct file *file, void *fh,
 
 
 		SDEDEV_DBG(rot_dev->dev,
 		SDEDEV_DBG(rot_dev->dev,
 			"s_crop s:%d t:%d (%u,%u,%u,%u)->(%u,%u,%u,%u)\n",
 			"s_crop s:%d t:%d (%u,%u,%u,%u)->(%u,%u,%u,%u)\n",
-			ctx->session_id, crop->type,
-			crop->c.left, crop->c.top,
-			crop->c.width, crop->c.height,
+			ctx->session_id, selection->type,
+			selection->r.left, selection->r.top,
+			selection->r.width, selection->r.height,
 			item.src_rect.x, item.src_rect.y,
 			item.src_rect.x, item.src_rect.y,
 			item.src_rect.w, item.src_rect.h);
 			item.src_rect.w, item.src_rect.h);
 
 
@@ -2534,7 +2494,7 @@ static int sde_rotator_s_crop(struct file *file, void *fh,
 		ctx->crop_out.top = item.src_rect.y;
 		ctx->crop_out.top = item.src_rect.y;
 		ctx->crop_out.width = item.src_rect.w;
 		ctx->crop_out.width = item.src_rect.w;
 		ctx->crop_out.height = item.src_rect.h;
 		ctx->crop_out.height = item.src_rect.h;
-	} else if (crop->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
+	} else if (selection->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
 		rect.left = min_t(__u32, rect.left,
 		rect.left = min_t(__u32, rect.left,
 				ctx->format_cap.fmt.pix.width - 1);
 				ctx->format_cap.fmt.pix.width - 1);
 		rect.top = min_t(__u32, rect.top,
 		rect.top = min_t(__u32, rect.top,
@@ -2553,9 +2513,9 @@ static int sde_rotator_s_crop(struct file *file, void *fh,
 
 
 		SDEDEV_DBG(rot_dev->dev,
 		SDEDEV_DBG(rot_dev->dev,
 			"s_crop s:%d t:%d (%u,%u,%u,%u)->(%u,%u,%u,%u)\n",
 			"s_crop s:%d t:%d (%u,%u,%u,%u)->(%u,%u,%u,%u)\n",
-			ctx->session_id, crop->type,
-			crop->c.left, crop->c.top,
-			crop->c.width, crop->c.height,
+			ctx->session_id, selection->type,
+			selection->r.left, selection->r.top,
+			selection->r.width, selection->r.height,
 			item.dst_rect.x, item.dst_rect.y,
 			item.dst_rect.x, item.dst_rect.y,
 			item.dst_rect.w, item.dst_rect.h);
 			item.dst_rect.w, item.dst_rect.h);
 
 
@@ -2879,9 +2839,8 @@ static const struct v4l2_ioctl_ops sde_rotator_ioctl_ops = {
 	.vidioc_querybuf          = sde_rotator_querybuf,
 	.vidioc_querybuf          = sde_rotator_querybuf,
 	.vidioc_streamon          = sde_rotator_streamon,
 	.vidioc_streamon          = sde_rotator_streamon,
 	.vidioc_streamoff         = sde_rotator_streamoff,
 	.vidioc_streamoff         = sde_rotator_streamoff,
-	.vidioc_cropcap           = sde_rotator_cropcap,
-	.vidioc_g_crop            = sde_rotator_g_crop,
-	.vidioc_s_crop            = sde_rotator_s_crop,
+	.vidioc_g_selection       = sde_rotator_g_selection,
+	.vidioc_s_selection       = sde_rotator_s_selection,
 	.vidioc_g_parm            = sde_rotator_g_parm,
 	.vidioc_g_parm            = sde_rotator_g_parm,
 	.vidioc_s_parm            = sde_rotator_s_parm,
 	.vidioc_s_parm            = sde_rotator_s_parm,
 	.vidioc_default           = sde_rotator_private_ioctl,
 	.vidioc_default           = sde_rotator_private_ioctl,

+ 0 - 6
rotator/sde_rotator_r3.c

@@ -4068,12 +4068,6 @@ int sde_rotator_r3_init(struct sde_rot_mgr *mgr)
 		INIT_LIST_HEAD(&rot->sbuf_ctx[i]);
 		INIT_LIST_HEAD(&rot->sbuf_ctx[i]);
 	}
 	}
 
 
-	/* set rotator CBCR to shutoff memory/periphery on clock off.*/
-	clk_set_flags(mgr->rot_clk[SDE_ROTATOR_CLK_MDSS_ROT].clk,
-			CLKFLAG_NORETAIN_MEM);
-	clk_set_flags(mgr->rot_clk[SDE_ROTATOR_CLK_MDSS_ROT].clk,
-			CLKFLAG_NORETAIN_PERIPH);
-
 	mdata->sde_rot_hw = rot;
 	mdata->sde_rot_hw = rot;
 	return 0;
 	return 0;
 error_hw_rev_init:
 error_hw_rev_init:

+ 0 - 1
rotator/sde_rotator_smmu.c

@@ -16,7 +16,6 @@
 #include <linux/dma-buf.h>
 #include <linux/dma-buf.h>
 #include <linux/of_platform.h>
 #include <linux/of_platform.h>
 #include <linux/msm_dma_iommu_mapping.h>
 #include <linux/msm_dma_iommu_mapping.h>
-#include <asm/dma-iommu.h>
 
 
 #include "soc/qcom/secure_buffer.h"
 #include "soc/qcom/secure_buffer.h"
 #include "sde_rotator_base.h"
 #include "sde_rotator_base.h"