Re: [RFC PATCH V3 4/5] platform: mtk-isp: Add Mediatek DIP driver

2019-09-19 Thread Tomasz Figa
On Thu, Sep 19, 2019 at 6:41 PM Frederic Chen
 wrote:
>
> Dear Tomasz,
>
>
> On Thu, 2019-09-12 at 14:58 +0900, Tomasz Figa wrote:
> > On Thu, Sep 12, 2019 at 2:41 AM Frederic Chen
> >  wrote:
> > >
> > > Hi Tomasz,
> > >
> > > I appreciate your helpful comments.
> > >
> > >
> > > On Tue, 2019-09-10 at 13:04 +0900, Tomasz Figa wrote:
> > > > Hi Frederic,
> > > >
> > > > On Tue, Sep 10, 2019 at 4:23 AM  wrote:
> > > > >
> > > > > From: Frederic Chen 
> > > > >
> > > > > This patch adds the driver of Digital Image Processing (DIP)
> > > > > unit in Mediatek ISP system, providing image format
> > > > > conversion, resizing, and rotation features.
> > > > >
> > > > > The mtk-isp directory will contain drivers for multiple IP
> > > > > blocks found in Mediatek ISP system. It will include ISP
> > > > > Pass 1 driver(CAM), sensor interface driver, DIP driver and
> > > > > face detection driver.
> > > > >
> > > > > Signed-off-by: Frederic Chen 
> > > > > ---
> > > > >  drivers/media/platform/mtk-isp/Makefile   |7 +
> > > > >  .../media/platform/mtk-isp/isp_50/Makefile|7 +
> > > > >  .../platform/mtk-isp/isp_50/dip/Makefile  |   18 +
> > > > >  .../platform/mtk-isp/isp_50/dip/mtk_dip-dev.c |  650 +
> > > > >  .../platform/mtk-isp/isp_50/dip/mtk_dip-dev.h |  566 +
> > > > >  .../platform/mtk-isp/isp_50/dip/mtk_dip-hw.h  |  156 ++
> > > > >  .../platform/mtk-isp/isp_50/dip/mtk_dip-sys.c |  521 
> > > > >  .../mtk-isp/isp_50/dip/mtk_dip-v4l2.c | 2255 
> > > > > +
> > > > >  8 files changed, 4180 insertions(+)
> > > > >  create mode 100644 drivers/media/platform/mtk-isp/Makefile
> > > > >  create mode 100644 drivers/media/platform/mtk-isp/isp_50/Makefile
> > > > >  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/Makefile
> > > > >  create mode 100644 
> > > > > drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-dev.c
> > > > >  create mode 100644 
> > > > > drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-dev.h
> > > > >  create mode 100644 
> > > > > drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-hw.h
> > > > >  create mode 100644 
> > > > > drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-sys.c
> > > > >  create mode 100644 
> > > > > drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-v4l2.c
> > > > >
> > > >
> > > > Thanks for sending v3!
> > > >
> > > > I'm going to do a full review a bit later, but please check one
> > > > comment about power handling below.
> > > >
> > > > Other than that one comment, from a quick look, I think we only have a
> > > > number of style issues left. Thanks for the hard work!
> > > >
> > > > [snip]
> > > > > +static void dip_runner_func(struct work_struct *work)
> > > > > +{
> > > > > +   struct mtk_dip_request *req = 
> > > > > mtk_dip_hw_mdp_work_to_req(work);
> > > > > +   struct mtk_dip_dev *dip_dev = req->dip_pipe->dip_dev;
> > > > > +   struct img_config *config_data =
> > > > > +   (struct img_config 
> > > > > *)req->working_buf->config_data.vaddr;
> > > > > +
> > > > > +   /*
> > > > > +* Call MDP/GCE API to do HW excecution
> > > > > +* Pass the framejob to MDP driver
> > > > > +*/
> > > > > +   pm_runtime_get_sync(dip_dev->dev);
> > > > > +   mdp_cmdq_sendtask(dip_dev->mdp_pdev, config_data,
> > > > > + >img_fparam.frameparam, NULL, false,
> > > > > + dip_mdp_cb_func, req);
> > > > > +}
> > > > [snip]
> > > > > +static void dip_composer_workfunc(struct work_struct *work)
> > > > > +{
> > > > > +   struct mtk_dip_request *req = mtk_dip_hw_fw_work_to_req(work);
> > > > > +   struct mtk_dip_dev *dip_dev = req->dip_pipe->dip_dev;
> > > > > +   struct img_ipi_param ipi_param;
> > > > > +   struct mtk_dip_hw_subframe *buf;
> > > > > +   int ret;
> > > > > +
> > > > > +   down(_dev->sem);
> > > > > +
> > > > > +   buf = mtk_dip_hw_working_buf_alloc(req->dip_pipe->dip_dev);
> > > > > +   if (!buf) {
> > > > > +   dev_err(req->dip_pipe->dip_dev->dev,
> > > > > +   "%s:%s:req(%p): no free working buffer 
> > > > > available\n",
> > > > > +   __func__, req->dip_pipe->desc->name, req);
> > > > > +   }
> > > > > +
> > > > > +   req->working_buf = buf;
> > > > > +   
> > > > > mtk_dip_wbuf_to_ipi_img_addr(>img_fparam.frameparam.subfrm_data,
> > > > > +>buffer);
> > > > > +   memset(buf->buffer.vaddr, 0, DIP_SUB_FRM_SZ);
> > > > > +   
> > > > > mtk_dip_wbuf_to_ipi_img_sw_addr(>img_fparam.frameparam.config_data,
> > > > > +   >config_data);
> > > > > +   memset(buf->config_data.vaddr, 0, DIP_COMP_SZ);
> > > > > +
> > > > > +   if (!req->img_fparam.frameparam.tuning_data.present) {
> > > > > +   /*
> > > > > +* When user enqueued without tuning buffer,
> > > > > +* it would use driver 

Re: [RFC PATCH V3 4/5] platform: mtk-isp: Add Mediatek DIP driver

2019-09-19 Thread Frederic Chen
Dear Tomasz,


On Thu, 2019-09-12 at 14:58 +0900, Tomasz Figa wrote:
> On Thu, Sep 12, 2019 at 2:41 AM Frederic Chen
>  wrote:
> >
> > Hi Tomasz,
> >
> > I appreciate your helpful comments.
> >
> >
> > On Tue, 2019-09-10 at 13:04 +0900, Tomasz Figa wrote:
> > > Hi Frederic,
> > >
> > > On Tue, Sep 10, 2019 at 4:23 AM  wrote:
> > > >
> > > > From: Frederic Chen 
> > > >
> > > > This patch adds the driver of Digital Image Processing (DIP)
> > > > unit in Mediatek ISP system, providing image format
> > > > conversion, resizing, and rotation features.
> > > >
> > > > The mtk-isp directory will contain drivers for multiple IP
> > > > blocks found in Mediatek ISP system. It will include ISP
> > > > Pass 1 driver(CAM), sensor interface driver, DIP driver and
> > > > face detection driver.
> > > >
> > > > Signed-off-by: Frederic Chen 
> > > > ---
> > > >  drivers/media/platform/mtk-isp/Makefile   |7 +
> > > >  .../media/platform/mtk-isp/isp_50/Makefile|7 +
> > > >  .../platform/mtk-isp/isp_50/dip/Makefile  |   18 +
> > > >  .../platform/mtk-isp/isp_50/dip/mtk_dip-dev.c |  650 +
> > > >  .../platform/mtk-isp/isp_50/dip/mtk_dip-dev.h |  566 +
> > > >  .../platform/mtk-isp/isp_50/dip/mtk_dip-hw.h  |  156 ++
> > > >  .../platform/mtk-isp/isp_50/dip/mtk_dip-sys.c |  521 
> > > >  .../mtk-isp/isp_50/dip/mtk_dip-v4l2.c | 2255 +
> > > >  8 files changed, 4180 insertions(+)
> > > >  create mode 100644 drivers/media/platform/mtk-isp/Makefile
> > > >  create mode 100644 drivers/media/platform/mtk-isp/isp_50/Makefile
> > > >  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/Makefile
> > > >  create mode 100644 
> > > > drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-dev.c
> > > >  create mode 100644 
> > > > drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-dev.h
> > > >  create mode 100644 
> > > > drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-hw.h
> > > >  create mode 100644 
> > > > drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-sys.c
> > > >  create mode 100644 
> > > > drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-v4l2.c
> > > >
> > >
> > > Thanks for sending v3!
> > >
> > > I'm going to do a full review a bit later, but please check one
> > > comment about power handling below.
> > >
> > > Other than that one comment, from a quick look, I think we only have a
> > > number of style issues left. Thanks for the hard work!
> > >
> > > [snip]
> > > > +static void dip_runner_func(struct work_struct *work)
> > > > +{
> > > > +   struct mtk_dip_request *req = mtk_dip_hw_mdp_work_to_req(work);
> > > > +   struct mtk_dip_dev *dip_dev = req->dip_pipe->dip_dev;
> > > > +   struct img_config *config_data =
> > > > +   (struct img_config 
> > > > *)req->working_buf->config_data.vaddr;
> > > > +
> > > > +   /*
> > > > +* Call MDP/GCE API to do HW excecution
> > > > +* Pass the framejob to MDP driver
> > > > +*/
> > > > +   pm_runtime_get_sync(dip_dev->dev);
> > > > +   mdp_cmdq_sendtask(dip_dev->mdp_pdev, config_data,
> > > > + >img_fparam.frameparam, NULL, false,
> > > > + dip_mdp_cb_func, req);
> > > > +}
> > > [snip]
> > > > +static void dip_composer_workfunc(struct work_struct *work)
> > > > +{
> > > > +   struct mtk_dip_request *req = mtk_dip_hw_fw_work_to_req(work);
> > > > +   struct mtk_dip_dev *dip_dev = req->dip_pipe->dip_dev;
> > > > +   struct img_ipi_param ipi_param;
> > > > +   struct mtk_dip_hw_subframe *buf;
> > > > +   int ret;
> > > > +
> > > > +   down(_dev->sem);
> > > > +
> > > > +   buf = mtk_dip_hw_working_buf_alloc(req->dip_pipe->dip_dev);
> > > > +   if (!buf) {
> > > > +   dev_err(req->dip_pipe->dip_dev->dev,
> > > > +   "%s:%s:req(%p): no free working buffer 
> > > > available\n",
> > > > +   __func__, req->dip_pipe->desc->name, req);
> > > > +   }
> > > > +
> > > > +   req->working_buf = buf;
> > > > +   
> > > > mtk_dip_wbuf_to_ipi_img_addr(>img_fparam.frameparam.subfrm_data,
> > > > +>buffer);
> > > > +   memset(buf->buffer.vaddr, 0, DIP_SUB_FRM_SZ);
> > > > +   
> > > > mtk_dip_wbuf_to_ipi_img_sw_addr(>img_fparam.frameparam.config_data,
> > > > +   >config_data);
> > > > +   memset(buf->config_data.vaddr, 0, DIP_COMP_SZ);
> > > > +
> > > > +   if (!req->img_fparam.frameparam.tuning_data.present) {
> > > > +   /*
> > > > +* When user enqueued without tuning buffer,
> > > > +* it would use driver internal buffer.
> > > > +*/
> > > > +   dev_dbg(dip_dev->dev,
> > > > +   "%s: frame_no(%d) has no tuning_data\n",
> > > > +   __func__, req->img_fparam.frameparam.frame_no);
> > > > +
> > > > +   

Re: [RFC PATCH V3 4/5] platform: mtk-isp: Add Mediatek DIP driver

2019-09-12 Thread Tomasz Figa
On Thu, Sep 12, 2019 at 2:41 AM Frederic Chen
 wrote:
>
> Hi Tomasz,
>
> I appreciate your helpful comments.
>
>
> On Tue, 2019-09-10 at 13:04 +0900, Tomasz Figa wrote:
> > Hi Frederic,
> >
> > On Tue, Sep 10, 2019 at 4:23 AM  wrote:
> > >
> > > From: Frederic Chen 
> > >
> > > This patch adds the driver of Digital Image Processing (DIP)
> > > unit in Mediatek ISP system, providing image format
> > > conversion, resizing, and rotation features.
> > >
> > > The mtk-isp directory will contain drivers for multiple IP
> > > blocks found in Mediatek ISP system. It will include ISP
> > > Pass 1 driver(CAM), sensor interface driver, DIP driver and
> > > face detection driver.
> > >
> > > Signed-off-by: Frederic Chen 
> > > ---
> > >  drivers/media/platform/mtk-isp/Makefile   |7 +
> > >  .../media/platform/mtk-isp/isp_50/Makefile|7 +
> > >  .../platform/mtk-isp/isp_50/dip/Makefile  |   18 +
> > >  .../platform/mtk-isp/isp_50/dip/mtk_dip-dev.c |  650 +
> > >  .../platform/mtk-isp/isp_50/dip/mtk_dip-dev.h |  566 +
> > >  .../platform/mtk-isp/isp_50/dip/mtk_dip-hw.h  |  156 ++
> > >  .../platform/mtk-isp/isp_50/dip/mtk_dip-sys.c |  521 
> > >  .../mtk-isp/isp_50/dip/mtk_dip-v4l2.c | 2255 +
> > >  8 files changed, 4180 insertions(+)
> > >  create mode 100644 drivers/media/platform/mtk-isp/Makefile
> > >  create mode 100644 drivers/media/platform/mtk-isp/isp_50/Makefile
> > >  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/Makefile
> > >  create mode 100644 
> > > drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-dev.c
> > >  create mode 100644 
> > > drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-dev.h
> > >  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-hw.h
> > >  create mode 100644 
> > > drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-sys.c
> > >  create mode 100644 
> > > drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-v4l2.c
> > >
> >
> > Thanks for sending v3!
> >
> > I'm going to do a full review a bit later, but please check one
> > comment about power handling below.
> >
> > Other than that one comment, from a quick look, I think we only have a
> > number of style issues left. Thanks for the hard work!
> >
> > [snip]
> > > +static void dip_runner_func(struct work_struct *work)
> > > +{
> > > +   struct mtk_dip_request *req = mtk_dip_hw_mdp_work_to_req(work);
> > > +   struct mtk_dip_dev *dip_dev = req->dip_pipe->dip_dev;
> > > +   struct img_config *config_data =
> > > +   (struct img_config *)req->working_buf->config_data.vaddr;
> > > +
> > > +   /*
> > > +* Call MDP/GCE API to do HW excecution
> > > +* Pass the framejob to MDP driver
> > > +*/
> > > +   pm_runtime_get_sync(dip_dev->dev);
> > > +   mdp_cmdq_sendtask(dip_dev->mdp_pdev, config_data,
> > > + >img_fparam.frameparam, NULL, false,
> > > + dip_mdp_cb_func, req);
> > > +}
> > [snip]
> > > +static void dip_composer_workfunc(struct work_struct *work)
> > > +{
> > > +   struct mtk_dip_request *req = mtk_dip_hw_fw_work_to_req(work);
> > > +   struct mtk_dip_dev *dip_dev = req->dip_pipe->dip_dev;
> > > +   struct img_ipi_param ipi_param;
> > > +   struct mtk_dip_hw_subframe *buf;
> > > +   int ret;
> > > +
> > > +   down(_dev->sem);
> > > +
> > > +   buf = mtk_dip_hw_working_buf_alloc(req->dip_pipe->dip_dev);
> > > +   if (!buf) {
> > > +   dev_err(req->dip_pipe->dip_dev->dev,
> > > +   "%s:%s:req(%p): no free working buffer 
> > > available\n",
> > > +   __func__, req->dip_pipe->desc->name, req);
> > > +   }
> > > +
> > > +   req->working_buf = buf;
> > > +   
> > > mtk_dip_wbuf_to_ipi_img_addr(>img_fparam.frameparam.subfrm_data,
> > > +>buffer);
> > > +   memset(buf->buffer.vaddr, 0, DIP_SUB_FRM_SZ);
> > > +   
> > > mtk_dip_wbuf_to_ipi_img_sw_addr(>img_fparam.frameparam.config_data,
> > > +   >config_data);
> > > +   memset(buf->config_data.vaddr, 0, DIP_COMP_SZ);
> > > +
> > > +   if (!req->img_fparam.frameparam.tuning_data.present) {
> > > +   /*
> > > +* When user enqueued without tuning buffer,
> > > +* it would use driver internal buffer.
> > > +*/
> > > +   dev_dbg(dip_dev->dev,
> > > +   "%s: frame_no(%d) has no tuning_data\n",
> > > +   __func__, req->img_fparam.frameparam.frame_no);
> > > +
> > > +   mtk_dip_wbuf_to_ipi_tuning_addr
> > > +   (>img_fparam.frameparam.tuning_data,
> > > +>tuning_buf);
> > > +   memset(buf->tuning_buf.vaddr, 0, DIP_TUNING_SZ);
> > > +   }
> > > +
> > > +   
> > > 

Re: [RFC PATCH V3 4/5] platform: mtk-isp: Add Mediatek DIP driver

2019-09-11 Thread Frederic Chen
Hi Tomasz,

I appreciate your helpful comments.


On Tue, 2019-09-10 at 13:04 +0900, Tomasz Figa wrote:
> Hi Frederic,
> 
> On Tue, Sep 10, 2019 at 4:23 AM  wrote:
> >
> > From: Frederic Chen 
> >
> > This patch adds the driver of Digital Image Processing (DIP)
> > unit in Mediatek ISP system, providing image format
> > conversion, resizing, and rotation features.
> >
> > The mtk-isp directory will contain drivers for multiple IP
> > blocks found in Mediatek ISP system. It will include ISP
> > Pass 1 driver(CAM), sensor interface driver, DIP driver and
> > face detection driver.
> >
> > Signed-off-by: Frederic Chen 
> > ---
> >  drivers/media/platform/mtk-isp/Makefile   |7 +
> >  .../media/platform/mtk-isp/isp_50/Makefile|7 +
> >  .../platform/mtk-isp/isp_50/dip/Makefile  |   18 +
> >  .../platform/mtk-isp/isp_50/dip/mtk_dip-dev.c |  650 +
> >  .../platform/mtk-isp/isp_50/dip/mtk_dip-dev.h |  566 +
> >  .../platform/mtk-isp/isp_50/dip/mtk_dip-hw.h  |  156 ++
> >  .../platform/mtk-isp/isp_50/dip/mtk_dip-sys.c |  521 
> >  .../mtk-isp/isp_50/dip/mtk_dip-v4l2.c | 2255 +
> >  8 files changed, 4180 insertions(+)
> >  create mode 100644 drivers/media/platform/mtk-isp/Makefile
> >  create mode 100644 drivers/media/platform/mtk-isp/isp_50/Makefile
> >  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/Makefile
> >  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-dev.c
> >  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-dev.h
> >  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-hw.h
> >  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-sys.c
> >  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-v4l2.c
> >
> 
> Thanks for sending v3!
> 
> I'm going to do a full review a bit later, but please check one
> comment about power handling below.
> 
> Other than that one comment, from a quick look, I think we only have a
> number of style issues left. Thanks for the hard work!
> 
> [snip]
> > +static void dip_runner_func(struct work_struct *work)
> > +{
> > +   struct mtk_dip_request *req = mtk_dip_hw_mdp_work_to_req(work);
> > +   struct mtk_dip_dev *dip_dev = req->dip_pipe->dip_dev;
> > +   struct img_config *config_data =
> > +   (struct img_config *)req->working_buf->config_data.vaddr;
> > +
> > +   /*
> > +* Call MDP/GCE API to do HW excecution
> > +* Pass the framejob to MDP driver
> > +*/
> > +   pm_runtime_get_sync(dip_dev->dev);
> > +   mdp_cmdq_sendtask(dip_dev->mdp_pdev, config_data,
> > + >img_fparam.frameparam, NULL, false,
> > + dip_mdp_cb_func, req);
> > +}
> [snip]
> > +static void dip_composer_workfunc(struct work_struct *work)
> > +{
> > +   struct mtk_dip_request *req = mtk_dip_hw_fw_work_to_req(work);
> > +   struct mtk_dip_dev *dip_dev = req->dip_pipe->dip_dev;
> > +   struct img_ipi_param ipi_param;
> > +   struct mtk_dip_hw_subframe *buf;
> > +   int ret;
> > +
> > +   down(_dev->sem);
> > +
> > +   buf = mtk_dip_hw_working_buf_alloc(req->dip_pipe->dip_dev);
> > +   if (!buf) {
> > +   dev_err(req->dip_pipe->dip_dev->dev,
> > +   "%s:%s:req(%p): no free working buffer available\n",
> > +   __func__, req->dip_pipe->desc->name, req);
> > +   }
> > +
> > +   req->working_buf = buf;
> > +   
> > mtk_dip_wbuf_to_ipi_img_addr(>img_fparam.frameparam.subfrm_data,
> > +>buffer);
> > +   memset(buf->buffer.vaddr, 0, DIP_SUB_FRM_SZ);
> > +   
> > mtk_dip_wbuf_to_ipi_img_sw_addr(>img_fparam.frameparam.config_data,
> > +   >config_data);
> > +   memset(buf->config_data.vaddr, 0, DIP_COMP_SZ);
> > +
> > +   if (!req->img_fparam.frameparam.tuning_data.present) {
> > +   /*
> > +* When user enqueued without tuning buffer,
> > +* it would use driver internal buffer.
> > +*/
> > +   dev_dbg(dip_dev->dev,
> > +   "%s: frame_no(%d) has no tuning_data\n",
> > +   __func__, req->img_fparam.frameparam.frame_no);
> > +
> > +   mtk_dip_wbuf_to_ipi_tuning_addr
> > +   (>img_fparam.frameparam.tuning_data,
> > +>tuning_buf);
> > +   memset(buf->tuning_buf.vaddr, 0, DIP_TUNING_SZ);
> > +   }
> > +
> > +   
> > mtk_dip_wbuf_to_ipi_img_sw_addr(>img_fparam.frameparam.self_data,
> > +   >frameparam);
> > +   memcpy(buf->frameparam.vaddr, >img_fparam.frameparam,
> > +  sizeof(req->img_fparam.frameparam));
> > +   ipi_param.usage = IMG_IPI_FRAME;
> > +   ipi_param.frm_param.handle = req->id;
> > +   

Re: [RFC PATCH V3 4/5] platform: mtk-isp: Add Mediatek DIP driver

2019-09-09 Thread Tomasz Figa
Hi Frederic,

On Tue, Sep 10, 2019 at 4:23 AM  wrote:
>
> From: Frederic Chen 
>
> This patch adds the driver of Digital Image Processing (DIP)
> unit in Mediatek ISP system, providing image format
> conversion, resizing, and rotation features.
>
> The mtk-isp directory will contain drivers for multiple IP
> blocks found in Mediatek ISP system. It will include ISP
> Pass 1 driver(CAM), sensor interface driver, DIP driver and
> face detection driver.
>
> Signed-off-by: Frederic Chen 
> ---
>  drivers/media/platform/mtk-isp/Makefile   |7 +
>  .../media/platform/mtk-isp/isp_50/Makefile|7 +
>  .../platform/mtk-isp/isp_50/dip/Makefile  |   18 +
>  .../platform/mtk-isp/isp_50/dip/mtk_dip-dev.c |  650 +
>  .../platform/mtk-isp/isp_50/dip/mtk_dip-dev.h |  566 +
>  .../platform/mtk-isp/isp_50/dip/mtk_dip-hw.h  |  156 ++
>  .../platform/mtk-isp/isp_50/dip/mtk_dip-sys.c |  521 
>  .../mtk-isp/isp_50/dip/mtk_dip-v4l2.c | 2255 +
>  8 files changed, 4180 insertions(+)
>  create mode 100644 drivers/media/platform/mtk-isp/Makefile
>  create mode 100644 drivers/media/platform/mtk-isp/isp_50/Makefile
>  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/Makefile
>  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-dev.c
>  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-dev.h
>  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-hw.h
>  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-sys.c
>  create mode 100644 drivers/media/platform/mtk-isp/isp_50/dip/mtk_dip-v4l2.c
>

Thanks for sending v3!

I'm going to do a full review a bit later, but please check one
comment about power handling below.

Other than that one comment, from a quick look, I think we only have a
number of style issues left. Thanks for the hard work!

[snip]
> +static void dip_runner_func(struct work_struct *work)
> +{
> +   struct mtk_dip_request *req = mtk_dip_hw_mdp_work_to_req(work);
> +   struct mtk_dip_dev *dip_dev = req->dip_pipe->dip_dev;
> +   struct img_config *config_data =
> +   (struct img_config *)req->working_buf->config_data.vaddr;
> +
> +   /*
> +* Call MDP/GCE API to do HW excecution
> +* Pass the framejob to MDP driver
> +*/
> +   pm_runtime_get_sync(dip_dev->dev);
> +   mdp_cmdq_sendtask(dip_dev->mdp_pdev, config_data,
> + >img_fparam.frameparam, NULL, false,
> + dip_mdp_cb_func, req);
> +}
[snip]
> +static void dip_composer_workfunc(struct work_struct *work)
> +{
> +   struct mtk_dip_request *req = mtk_dip_hw_fw_work_to_req(work);
> +   struct mtk_dip_dev *dip_dev = req->dip_pipe->dip_dev;
> +   struct img_ipi_param ipi_param;
> +   struct mtk_dip_hw_subframe *buf;
> +   int ret;
> +
> +   down(_dev->sem);
> +
> +   buf = mtk_dip_hw_working_buf_alloc(req->dip_pipe->dip_dev);
> +   if (!buf) {
> +   dev_err(req->dip_pipe->dip_dev->dev,
> +   "%s:%s:req(%p): no free working buffer available\n",
> +   __func__, req->dip_pipe->desc->name, req);
> +   }
> +
> +   req->working_buf = buf;
> +   mtk_dip_wbuf_to_ipi_img_addr(>img_fparam.frameparam.subfrm_data,
> +>buffer);
> +   memset(buf->buffer.vaddr, 0, DIP_SUB_FRM_SZ);
> +   
> mtk_dip_wbuf_to_ipi_img_sw_addr(>img_fparam.frameparam.config_data,
> +   >config_data);
> +   memset(buf->config_data.vaddr, 0, DIP_COMP_SZ);
> +
> +   if (!req->img_fparam.frameparam.tuning_data.present) {
> +   /*
> +* When user enqueued without tuning buffer,
> +* it would use driver internal buffer.
> +*/
> +   dev_dbg(dip_dev->dev,
> +   "%s: frame_no(%d) has no tuning_data\n",
> +   __func__, req->img_fparam.frameparam.frame_no);
> +
> +   mtk_dip_wbuf_to_ipi_tuning_addr
> +   (>img_fparam.frameparam.tuning_data,
> +>tuning_buf);
> +   memset(buf->tuning_buf.vaddr, 0, DIP_TUNING_SZ);
> +   }
> +
> +   mtk_dip_wbuf_to_ipi_img_sw_addr(>img_fparam.frameparam.self_data,
> +   >frameparam);
> +   memcpy(buf->frameparam.vaddr, >img_fparam.frameparam,
> +  sizeof(req->img_fparam.frameparam));
> +   ipi_param.usage = IMG_IPI_FRAME;
> +   ipi_param.frm_param.handle = req->id;
> +   ipi_param.frm_param.scp_addr = (u32)buf->frameparam.scp_daddr;
> +
> +   mutex_lock(_dev->hw_op_lock);
> +   atomic_inc(_dev->num_composing);
> +   ret = scp_ipi_send(dip_dev->scp_pdev, SCP_IPI_DIP, _param,
> +  sizeof(ipi_param), 0);

We're not holding the pm_runtime enable count here
(pm_runtime_get_sync() wasn't