diff options
author | Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> | 2018-11-23 21:22:37 +0530 |
---|---|---|
committer | Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> | 2018-11-23 21:22:37 +0530 |
commit | e89b90550f3bfdf483d472e0723bcb8b57ecdd34 (patch) | |
tree | 640081094a96332d3a4b94732e881ed23e2c1a4c /drivers/media/platform/hisi/isp/isp-cvdr.c | |
parent | d68335c072a803e002b21519e5ca27269e8a0bfe (diff) | |
download | 96b-common-hikey_v4l2_4.15.tar.gz |
media: hisi: ISP: Add video device and some cleanupshikey_v4l2_4.15
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Diffstat (limited to 'drivers/media/platform/hisi/isp/isp-cvdr.c')
-rw-r--r-- | drivers/media/platform/hisi/isp/isp-cvdr.c | 76 |
1 files changed, 58 insertions, 18 deletions
diff --git a/drivers/media/platform/hisi/isp/isp-cvdr.c b/drivers/media/platform/hisi/isp/isp-cvdr.c index 666dd016028f..b6a1b2c71d70 100644 --- a/drivers/media/platform/hisi/isp/isp-cvdr.c +++ b/drivers/media/platform/hisi/isp/isp-cvdr.c @@ -180,6 +180,7 @@ void isp_cvdr_init(struct cvdr_device *cvdr) prefetch_bypass = 1; + pr_info("%s: %d\n", __func__, __LINE__); for (i = 0; i < CVDR_VP_WR_NBR; ++i) { base = ((cvdr_vp_wr_bw[i].srt == CVDR_SRT) ? cvdr->cvdr_srt : cvdr->cvdr_rt); @@ -227,8 +228,8 @@ void isp_cvdr_init(struct cvdr_device *cvdr) } /* - * cvdr_set_power - Power on/off CSIPHY module - * @sd: CSIPHY V4L2 subdevice + * cvdr_set_power - Power on/off CVDR module + * @sd: CVDR V4L2 subdevice * @on: Requested power state * * Return 0 on success or a negative error code otherwise @@ -241,8 +242,8 @@ static int cvdr_set_power(struct v4l2_subdev *sd, int on) } /* - * cvdr_set_stream - Enable/disable streaming on CSIPHY module - * @sd: CSIPHY V4L2 subdevice + * cvdr_set_stream - Enable/disable streaming on CVDR module + * @sd: CVDR V4L2 subdevice * @enable: Requested streaming state * * Return 0 on success or a negative error code otherwise @@ -253,6 +254,7 @@ static int cvdr_set_stream(struct v4l2_subdev *sd, int enable) struct isp *isp = cvdr->isp; int ret = 0; + pr_info("%s: %d\n", __func__, __LINE__); enable_irq(cvdr->irq_vic1); isp_cvdr_init(cvdr); isp_cvdr_config(cvdr, isp->hw_addr); @@ -263,7 +265,7 @@ static int cvdr_set_stream(struct v4l2_subdev *sd, int enable) /* * cvdr_init_formats - Initialize formats on all pads - * @sd: CSIPHY V4L2 subdevice + * @sd: CVDR V4L2 subdevice * @fh: V4L2 subdev file handle * * Initialize all pad formats with default values. @@ -278,10 +280,12 @@ static int cvdr_init_formats(struct v4l2_subdev *sd, irqreturn_t isp_vic1_handler(int irq, void *dev) { + pr_info("%s: %d\n", __func__, __LINE__); struct cvdr_device *cvdr = dev; struct isp *isp = cvdr->isp; unsigned int val = isp_clear_irq(isp, IRQ_MERGER_DEBUG_1); + pr_info("%s: %d\n", __func__, __LINE__); if (val & (1 << IRQ_MERGER_SR_4_CVDR_RT_SOF_VPWR_23_OFFSET)) isp_cvdr_config(cvdr, isp->hw_addr + frame_num2Offset(isp, isp->frame_num + 1)); @@ -290,10 +294,9 @@ irqreturn_t isp_vic1_handler(int irq, void *dev) } /* - * isp_cvdr_subdev_init - Initialize CSIPHY device structure and resources - * @sr: CSIPHY device - * @res: CSIPHY module resources table - * @id: CSIPHY module id + * isp_cvdr_subdev_init - Initialize CVDR device structure and resources + * @cvdr: CVDR device + * @res: CVDR module resources table * * Return 0 on success or a negative error code otherwise */ @@ -307,6 +310,8 @@ int isp_cvdr_subdev_init(struct isp *isp, int ret; cvdr->isp = isp; + + r = platform_get_resource_byname(pdev, IORESOURCE_MEM, res[0].reg); cvdr->cvdr_rt = devm_ioremap_resource(dev, r); if (IS_ERR(cvdr->cvdr_rt)) { @@ -347,7 +352,7 @@ int isp_cvdr_subdev_init(struct isp *isp, } /* - * cvdr_link_setup - Setup CSIPHY connections + * cvdr_link_setup - Setup CVDR connections * @entity: Pointer to media entity structure * @local: Pointer to local pad * @remote: Pointer to remote pad @@ -397,8 +402,8 @@ static const struct media_entity_operations cvdr_media_ops = { }; /* - * isp_cvdr_register_entity - Register subdev node for CSIPHY module - * @sr: CSIPHY device + * isp_cvdr_register_entity - Register subdev node for CVDR module + * @cvdr: CVDR device * @v4l2_dev: V4L2 device * * Return 0 on success or a negative error code otherwise @@ -409,7 +414,9 @@ int isp_cvdr_register_entity(struct cvdr_device *cvdr, struct v4l2_subdev *sd = &cvdr->subdev; struct media_pad *pads = cvdr->pads; struct device *dev = cvdr->isp->dev; + struct isp_video *video_out = &cvdr->video_out; int ret; + char name[32]; v4l2_subdev_init(sd, &cvdr_v4l2_ops); sd->internal_ops = &cvdr_v4l2_internal_ops; @@ -424,12 +431,12 @@ int isp_cvdr_register_entity(struct cvdr_device *cvdr, return ret; } - pads[ISP_CSIPHY_PAD_SINK].flags = MEDIA_PAD_FL_SINK; - pads[ISP_CSIPHY_PAD_SRC].flags = MEDIA_PAD_FL_SOURCE; + pads[ISP_CVDR_PAD_SINK].flags = MEDIA_PAD_FL_SINK; + pads[ISP_CVDR_PAD_SRC].flags = MEDIA_PAD_FL_SOURCE; sd->entity.function = MEDIA_ENT_F_IO_V4L; sd->entity.ops = &cvdr_media_ops; - ret = media_entity_pads_init(&sd->entity, ISP_CSIPHY_PADS_NUM, pads); + ret = media_entity_pads_init(&sd->entity, ISP_CVDR_PADS_NUM, pads); if (ret < 0) { dev_err(dev, "Failed to init media entity: %d\n", ret); return ret; @@ -438,15 +445,48 @@ int isp_cvdr_register_entity(struct cvdr_device *cvdr, ret = v4l2_device_register_subdev(v4l2_dev, sd); if (ret < 0) { dev_err(dev, "Failed to register subdev: %d\n", ret); - media_entity_cleanup(&sd->entity); + goto error_reg_subdev; + } + + video_out->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; + video_out->isp = cvdr->isp; + snprintf(name, ARRAY_SIZE(name), "%s", "hisi_video"); + ret = isp_video_register(video_out, v4l2_dev, name); + if (ret < 0) { + dev_err(dev, "Failed to register video node: %d\n", + ret); + goto error_reg_video; } + pr_info("Linking entities: %s->%s\n", sd->entity.name, video_out->vdev.entity.name); + ret = media_create_pad_link( + &sd->entity, ISP_CVDR_PAD_SRC, + &video_out->vdev.entity, 0, + MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED); + if (ret < 0) { + dev_err(dev, "Failed to link %s->%s entities: %d\n", + sd->entity.name, video_out->vdev.entity.name, + ret); + goto error_link; + } + + return ret; + +error_link: + isp_video_unregister(video_out); + +error_reg_video: + v4l2_device_unregister_subdev(sd); + +error_reg_subdev: + media_entity_cleanup(&sd->entity); + return ret; } /* - * isp_cvdr_unregister_entity - Unregister CSIPHY module subdev node - * @sr: CSIPHY device + * isp_cvdr_unregister_entity - Unregister CVDR module subdev node + * @cvdr: CVDR device */ void isp_cvdr_unregister_entity(struct cvdr_device *cvdr) { |