From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759519AbdADOsl (ORCPT ); Wed, 4 Jan 2017 09:48:41 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:56643 "EHLO relay1.mentorg.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759037AbdADOsV (ORCPT ); Wed, 4 Jan 2017 09:48:21 -0500 Subject: Re: [PATCH v2 13/19] media: imx: Add IC subdev drivers To: Steve Longerbeam , , , , , , , , , References: <1483477049-19056-1-git-send-email-steve_longerbeam@mentor.com> <1483477049-19056-14-git-send-email-steve_longerbeam@mentor.com> CC: , , , , , Steve Longerbeam From: Vladimir Zapolskiy Message-ID: <96684048-c5ad-3e64-0fbc-61dcaf184519@mentor.com> Date: Wed, 4 Jan 2017 16:48:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Icedove/45.2.0 MIME-Version: 1.0 In-Reply-To: <1483477049-19056-14-git-send-email-steve_longerbeam@mentor.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [137.202.0.87] X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/03/2017 10:57 PM, Steve Longerbeam wrote: > This is a set of three media entity subdevice drivers for the i.MX > Image Converter. The i.MX IC module contains three independent > "tasks": > > - Pre-processing Encode task: video frames are routed directly from > the CSI and can be scaled, color-space converted, and rotated. > Scaled output is limited to 1024x1024 resolution. Output frames > are routed to the camera interface entities (camif). > > - Pre-processing Viewfinder task: this task can perform the same > conversions as the pre-process encode task, but in addition can > be used for hardware motion compensated deinterlacing. Frames can > come either directly from the CSI or from the SMFC entities (memory > buffers via IDMAC channels). Scaled output is limited to 1024x1024 > resolution. Output frames can be routed to various sinks including > the post-processing task entities. > > - Post-processing task: same conversions as pre-process encode. However > this entity sends frames to the i.MX IPU image converter which supports > image tiling, which allows scaled output up to 4096x4096 resolution. > Output frames can be routed to the camera interfaces. > > Signed-off-by: Steve Longerbeam > --- [snip] > +static int imx_ic_probe(struct platform_device *pdev) > +{ > + struct imx_media_internal_sd_platformdata *pdata; > + struct imx_ic_priv *priv; > + int ret; > + > + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); > + if (!priv) > + return -ENOMEM; > + > + platform_set_drvdata(pdev, &priv->sd); > + priv->dev = &pdev->dev; > + > + /* get our ipu_id, grp_id and IC task id */ > + pdata = priv->dev->platform_data; > + priv->ipu_id = pdata->ipu_id; > + switch (pdata->grp_id) { > + case IMX_MEDIA_GRP_ID_IC_PRPENC: > + priv->task_id = IC_TASK_ENCODER; > + break; > + case IMX_MEDIA_GRP_ID_IC_PRPVF: > + priv->task_id = IC_TASK_VIEWFINDER; > + break; > + case IMX_MEDIA_GRP_ID_IC_PP0...IMX_MEDIA_GRP_ID_IC_PP3: > + priv->task_id = IC_TASK_POST_PROCESSOR; > + break; > + default: > + return -EINVAL; > + } > + > + v4l2_subdev_init(&priv->sd, ic_ops[priv->task_id]->subdev_ops); > + v4l2_set_subdevdata(&priv->sd, priv); > + priv->sd.internal_ops = ic_ops[priv->task_id]->internal_ops; > + priv->sd.entity.ops = ic_ops[priv->task_id]->entity_ops; > + priv->sd.entity.function = MEDIA_ENT_F_PROC_VIDEO_SCALER; > + priv->sd.dev = &pdev->dev; > + priv->sd.owner = THIS_MODULE; > + priv->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; > + priv->sd.grp_id = pdata->grp_id; > + strncpy(priv->sd.name, pdata->sd_name, sizeof(priv->sd.name)); > + > + ret = ic_ops[priv->task_id]->init(priv); > + if (ret) > + return ret; > + > + ret = v4l2_async_register_subdev(&priv->sd); > + if (ret) > + goto remove; > + > + return 0; > +remove: > + ic_ops[priv->task_id]->remove(priv); > + return ret; if (ret) ic_ops[priv->task_id]->remove(priv); return ret; as an alternative. [snip] > +static const struct platform_device_id imx_ic_ids[] = { > + { .name = "imx-ipuv3-ic" }, > + { }, > +}; > +MODULE_DEVICE_TABLE(platform, imx_ic_ids); > + > +static struct platform_driver imx_ic_driver = { > + .probe = imx_ic_probe, > + .remove = imx_ic_remove, > + .id_table = imx_ic_ids, > + .driver = { > + .name = "imx-ipuv3-ic", > + .owner = THIS_MODULE, Please drop .owner assignment. > + }, > +}; > +module_platform_driver(imx_ic_driver); > + > +MODULE_DESCRIPTION("i.MX IC subdev driver"); > +MODULE_AUTHOR("Steve Longerbeam "); > +MODULE_LICENSE("GPL"); > +MODULE_ALIAS("platform:imx-ipuv3-ic"); > diff --git a/drivers/staging/media/imx/imx-ic-pp.c b/drivers/staging/media/imx/imx-ic-pp.c > new file mode 100644 > index 0000000..5ef0581 > --- /dev/null > +++ b/drivers/staging/media/imx/imx-ic-pp.c > @@ -0,0 +1,636 @@ > +/* > + * V4L2 IC Post-Processor Subdev for Freescale i.MX5/6 SOC > + * > + * Copyright (c) 2014-2016 Mentor Graphics Inc. > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include Please sort the list of headers alphabetically. > +#include > +#include