From: Rui Miguel Silva <rmfrfs@gmail.com>
To: Steve Longerbeam <slongerbeam@gmail.com>
Cc: "open list:STAGING SUBSYSTEM" <devel@driverdev.osuosl.org>,
Fabio Estevam <festevam@gmail.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
open list <linux-kernel@vger.kernel.org>,
NXP Linux Team <linux-imx@nxp.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>,
linux-media@vger.kernel.org
Subject: Re: [PATCH v2 1/8] media: staging/imx: Switch to sync registration for IPU subdevs
Date: Tue, 30 Apr 2019 22:56:54 +0100 [thread overview]
Message-ID: <m3a7g7nom1.fsf@gmail.com> (raw)
In-Reply-To: <20190428190916.26567-2-slongerbeam@gmail.com>
Hi Steve,
On Sun 28 Apr 2019 at 20:09, Steve Longerbeam wrote:
> Because the IPU sub-devices VDIC and IC are not present in the
> device-tree, platform devices were created for them instead. This
> allowed these sub-devices to be added to the media device's async
> notifier and registered asynchronously along with the other
> sub-devices that do have a device-tree presence (CSI and devices
> external to the IPU and SoC).
>
> But that approach isn't really necessary. The IPU sub-devices don't
> actually require a backing device (sd->dev is allowed to be NULL).
> And that approach can't get around the fact that the IPU sub-devices
> are not part of a device hierarchy, which makes it awkward to retrieve
> the parent IPU of these devices.
>
> By registering them synchronously, they can be registered from the CSI
> async bound notifier, so the init function for them can be given the CSI
> subdev, who's dev->parent is the IPU. That is a somewhat cleaner way
> to retrieve the parent IPU.
>
> So convert to synchronous registration for the VDIC and IC task
> sub-devices, at the time a CSI sub-device is bound. There is no longer
> a backing device for them (sd->dev is NULL), but that's ok. Also
> set the VDIC/IC sub-device owner as the IPU, so that a reference can
> be taken on the IPU module.
>
> Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
I am trying to bisect when my capture starts to fail to work with
this series, since they are so many changes and reorg that I got
lost on some of them. But... see below.
> ---
> drivers/staging/media/imx/imx-ic-common.c | 70 ++--
> drivers/staging/media/imx/imx-ic-prp.c | 34 +-
> drivers/staging/media/imx/imx-ic-prpencvf.c | 70 ++--
> drivers/staging/media/imx/imx-ic.h | 7 +-
> drivers/staging/media/imx/imx-media-capture.c | 7 +-
> drivers/staging/media/imx/imx-media-csi.c | 2 +-
> drivers/staging/media/imx/imx-media-dev.c | 121 +-----
> .../staging/media/imx/imx-media-internal-sd.c | 356 ++++++++----------
> drivers/staging/media/imx/imx-media-of.c | 38 +-
> drivers/staging/media/imx/imx-media-vdic.c | 85 ++---
> drivers/staging/media/imx/imx-media.h | 67 ++--
> drivers/staging/media/imx/imx7-media-csi.c | 3 +-
> 12 files changed, 325 insertions(+), 535 deletions(-)
>
> + dev_dbg(priv->ipu_dev, "%s: link setup %s -> %s",
<snip>
> + sd->name, remote->entity->name, local->entity->name);
>
> mutex_lock(&priv->lock);
>
> @@ -864,9 +856,6 @@ static int vdic_registered(struct v4l2_subdev *sd)
> int i, ret;
> u32 code;
>
> - /* get media device */
> - priv->md = dev_get_drvdata(sd->v4l2_dev->dev);
> -
> for (i = 0; i < VDIC_NUM_PADS; i++) {
> priv->pad[i].flags = (i == VDIC_SRC_PAD_DIRECT) ?
> MEDIA_PAD_FL_SOURCE : MEDIA_PAD_FL_SINK;
> @@ -938,77 +927,55 @@ static const struct v4l2_subdev_internal_ops vdic_internal_ops = {
> .unregistered = vdic_unregistered,
> };
>
> -static int imx_vdic_probe(struct platform_device *pdev)
> +struct v4l2_subdev *imx_media_vdic_register(struct imx_media_dev *imxmd,
> + struct device *ipu_dev,
> + struct ipu_soc *ipu,
> + u32 grp_id)
> {
> - struct imx_media_ipu_internal_sd_pdata *pdata;
> + struct v4l2_device *v4l2_dev = &imxmd->v4l2_dev;
> struct vdic_priv *priv;
> int ret;
>
> - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> + priv = devm_kzalloc(ipu_dev, sizeof(*priv), GFP_KERNEL);
> if (!priv)
> - return -ENOMEM;
> + return ERR_PTR(-ENOMEM);
>
> - platform_set_drvdata(pdev, &priv->sd);
> - priv->dev = &pdev->dev;
> -
> - pdata = priv->dev->platform_data;
> - priv->ipu_id = pdata->ipu_id;
> + priv->ipu_dev = ipu_dev;
> + priv->ipu = ipu;
> + priv->md = imxmd;
>
> v4l2_subdev_init(&priv->sd, &vdic_subdev_ops);
> v4l2_set_subdevdata(&priv->sd, priv);
> priv->sd.internal_ops = &vdic_internal_ops;
> priv->sd.entity.ops = &vdic_entity_ops;
> priv->sd.entity.function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER;
> - priv->sd.dev = &pdev->dev;
> - priv->sd.owner = THIS_MODULE;
> + priv->sd.owner = ipu_dev->driver->owner;
> priv->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
> - /* get our group id */
> - priv->sd.grp_id = pdata->grp_id;
> - strscpy(priv->sd.name, pdata->sd_name, sizeof(priv->sd.name));
> + priv->sd.grp_id = grp_id;
> + imx_media_grp_id_to_sd_name(priv->sd.name, sizeof(priv->sd.name),
> + priv->sd.grp_id, ipu_get_num(ipu));
>
> mutex_init(&priv->lock);
>
> - ret = v4l2_async_register_subdev(&priv->sd);
> + ret = v4l2_device_register_subdev(v4l2_dev, &priv->sd);
> if (ret)
> goto free;
>
> - return 0;
> + return &priv->sd;
> free:
> mutex_destroy(&priv->lock);
> - return ret;
> + return ERR_PTR(ret);
> }
>
> -static int imx_vdic_remove(struct platform_device *pdev)
> +int imx_media_vdic_unregister(struct v4l2_subdev *sd)
> {
> - struct v4l2_subdev *sd = platform_get_drvdata(pdev);
> struct vdic_priv *priv = v4l2_get_subdevdata(sd);
>
> v4l2_info(sd, "Removing\n");
>
> - v4l2_async_unregister_subdev(sd);
> + v4l2_device_unregister_subdev(sd);
> mutex_destroy(&priv->lock);
> media_entity_cleanup(&sd->entity);
>
> return 0;
> }
> -
> -static const struct platform_device_id imx_vdic_ids[] = {
> - { .name = "imx-ipuv3-vdic" },
> - { },
> -};
> -MODULE_DEVICE_TABLE(platform, imx_vdic_ids);
> -
> -static struct platform_driver imx_vdic_driver = {
> - .probe = imx_vdic_probe,
> - .remove = imx_vdic_remove,
> - .id_table = imx_vdic_ids,
> - .driver = {
> - .name = "imx-ipuv3-vdic",
> - },
> -};
> -module_platform_driver(imx_vdic_driver);
> -
> -MODULE_DESCRIPTION("i.MX VDIC subdev driver");
> -MODULE_AUTHOR("Steve Longerbeam <steve_longerbeam@mentor.com>");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("platform:imx-ipuv3-vdic");
This breaks compilation until patch 6/8. I think you need to make
some makefile changes also in this patch.
WARNING: modpost: missing MODULE_LICENSE() in drivers/staging/media/imx/imx-media-ic.o
see include/linux/module.h for more information
WARNING: modpost: missing MODULE_LICENSE() in drivers/staging/media/imx/imx-media-vdic.o
see include/linux/module.h for more information
ERROR: "imx_media_ic_register" [drivers/staging/media/imx/imx-media.ko] undefined!
ERROR: "imx_media_vdic_register" [drivers/staging/media/imx/imx-media.ko] undefined!
ERROR: "imx_media_vdic_unregister" [drivers/staging/media/imx/imx-media.ko] undefined!
ERROR: "imx_media_ic_unregister" [drivers/staging/media/imx/imx-media.ko] undefined!
make[2]: *** [scripts/Makefile.modpost:91: __modpost] Error 1
make[1]: *** [/dev/shm/linux-git/Makefile:1263: modules] Error 2
make: *** [Makefile:170: sub-make] Error 2
---
Cheers,
Rui
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Rui Miguel Silva <rmfrfs@gmail.com>
To: Steve Longerbeam <slongerbeam@gmail.com>
Cc: linux-media@vger.kernel.org,
Philipp Zabel <p.zabel@pengutronix.de>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>,
"open list\:STAGING SUBSYSTEM" <devel@driverdev.osuosl.org>,
"moderated list\:ARM\/FREESCALE IMX \/ MXC ARM ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/8] media: staging/imx: Switch to sync registration for IPU subdevs
Date: Tue, 30 Apr 2019 22:56:54 +0100 [thread overview]
Message-ID: <m3a7g7nom1.fsf@gmail.com> (raw)
In-Reply-To: <20190428190916.26567-2-slongerbeam@gmail.com>
Hi Steve,
On Sun 28 Apr 2019 at 20:09, Steve Longerbeam wrote:
> Because the IPU sub-devices VDIC and IC are not present in the
> device-tree, platform devices were created for them instead. This
> allowed these sub-devices to be added to the media device's async
> notifier and registered asynchronously along with the other
> sub-devices that do have a device-tree presence (CSI and devices
> external to the IPU and SoC).
>
> But that approach isn't really necessary. The IPU sub-devices don't
> actually require a backing device (sd->dev is allowed to be NULL).
> And that approach can't get around the fact that the IPU sub-devices
> are not part of a device hierarchy, which makes it awkward to retrieve
> the parent IPU of these devices.
>
> By registering them synchronously, they can be registered from the CSI
> async bound notifier, so the init function for them can be given the CSI
> subdev, who's dev->parent is the IPU. That is a somewhat cleaner way
> to retrieve the parent IPU.
>
> So convert to synchronous registration for the VDIC and IC task
> sub-devices, at the time a CSI sub-device is bound. There is no longer
> a backing device for them (sd->dev is NULL), but that's ok. Also
> set the VDIC/IC sub-device owner as the IPU, so that a reference can
> be taken on the IPU module.
>
> Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
I am trying to bisect when my capture starts to fail to work with
this series, since they are so many changes and reorg that I got
lost on some of them. But... see below.
> ---
> drivers/staging/media/imx/imx-ic-common.c | 70 ++--
> drivers/staging/media/imx/imx-ic-prp.c | 34 +-
> drivers/staging/media/imx/imx-ic-prpencvf.c | 70 ++--
> drivers/staging/media/imx/imx-ic.h | 7 +-
> drivers/staging/media/imx/imx-media-capture.c | 7 +-
> drivers/staging/media/imx/imx-media-csi.c | 2 +-
> drivers/staging/media/imx/imx-media-dev.c | 121 +-----
> .../staging/media/imx/imx-media-internal-sd.c | 356 ++++++++----------
> drivers/staging/media/imx/imx-media-of.c | 38 +-
> drivers/staging/media/imx/imx-media-vdic.c | 85 ++---
> drivers/staging/media/imx/imx-media.h | 67 ++--
> drivers/staging/media/imx/imx7-media-csi.c | 3 +-
> 12 files changed, 325 insertions(+), 535 deletions(-)
>
> + dev_dbg(priv->ipu_dev, "%s: link setup %s -> %s",
<snip>
> + sd->name, remote->entity->name, local->entity->name);
>
> mutex_lock(&priv->lock);
>
> @@ -864,9 +856,6 @@ static int vdic_registered(struct v4l2_subdev *sd)
> int i, ret;
> u32 code;
>
> - /* get media device */
> - priv->md = dev_get_drvdata(sd->v4l2_dev->dev);
> -
> for (i = 0; i < VDIC_NUM_PADS; i++) {
> priv->pad[i].flags = (i == VDIC_SRC_PAD_DIRECT) ?
> MEDIA_PAD_FL_SOURCE : MEDIA_PAD_FL_SINK;
> @@ -938,77 +927,55 @@ static const struct v4l2_subdev_internal_ops vdic_internal_ops = {
> .unregistered = vdic_unregistered,
> };
>
> -static int imx_vdic_probe(struct platform_device *pdev)
> +struct v4l2_subdev *imx_media_vdic_register(struct imx_media_dev *imxmd,
> + struct device *ipu_dev,
> + struct ipu_soc *ipu,
> + u32 grp_id)
> {
> - struct imx_media_ipu_internal_sd_pdata *pdata;
> + struct v4l2_device *v4l2_dev = &imxmd->v4l2_dev;
> struct vdic_priv *priv;
> int ret;
>
> - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> + priv = devm_kzalloc(ipu_dev, sizeof(*priv), GFP_KERNEL);
> if (!priv)
> - return -ENOMEM;
> + return ERR_PTR(-ENOMEM);
>
> - platform_set_drvdata(pdev, &priv->sd);
> - priv->dev = &pdev->dev;
> -
> - pdata = priv->dev->platform_data;
> - priv->ipu_id = pdata->ipu_id;
> + priv->ipu_dev = ipu_dev;
> + priv->ipu = ipu;
> + priv->md = imxmd;
>
> v4l2_subdev_init(&priv->sd, &vdic_subdev_ops);
> v4l2_set_subdevdata(&priv->sd, priv);
> priv->sd.internal_ops = &vdic_internal_ops;
> priv->sd.entity.ops = &vdic_entity_ops;
> priv->sd.entity.function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER;
> - priv->sd.dev = &pdev->dev;
> - priv->sd.owner = THIS_MODULE;
> + priv->sd.owner = ipu_dev->driver->owner;
> priv->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
> - /* get our group id */
> - priv->sd.grp_id = pdata->grp_id;
> - strscpy(priv->sd.name, pdata->sd_name, sizeof(priv->sd.name));
> + priv->sd.grp_id = grp_id;
> + imx_media_grp_id_to_sd_name(priv->sd.name, sizeof(priv->sd.name),
> + priv->sd.grp_id, ipu_get_num(ipu));
>
> mutex_init(&priv->lock);
>
> - ret = v4l2_async_register_subdev(&priv->sd);
> + ret = v4l2_device_register_subdev(v4l2_dev, &priv->sd);
> if (ret)
> goto free;
>
> - return 0;
> + return &priv->sd;
> free:
> mutex_destroy(&priv->lock);
> - return ret;
> + return ERR_PTR(ret);
> }
>
> -static int imx_vdic_remove(struct platform_device *pdev)
> +int imx_media_vdic_unregister(struct v4l2_subdev *sd)
> {
> - struct v4l2_subdev *sd = platform_get_drvdata(pdev);
> struct vdic_priv *priv = v4l2_get_subdevdata(sd);
>
> v4l2_info(sd, "Removing\n");
>
> - v4l2_async_unregister_subdev(sd);
> + v4l2_device_unregister_subdev(sd);
> mutex_destroy(&priv->lock);
> media_entity_cleanup(&sd->entity);
>
> return 0;
> }
> -
> -static const struct platform_device_id imx_vdic_ids[] = {
> - { .name = "imx-ipuv3-vdic" },
> - { },
> -};
> -MODULE_DEVICE_TABLE(platform, imx_vdic_ids);
> -
> -static struct platform_driver imx_vdic_driver = {
> - .probe = imx_vdic_probe,
> - .remove = imx_vdic_remove,
> - .id_table = imx_vdic_ids,
> - .driver = {
> - .name = "imx-ipuv3-vdic",
> - },
> -};
> -module_platform_driver(imx_vdic_driver);
> -
> -MODULE_DESCRIPTION("i.MX VDIC subdev driver");
> -MODULE_AUTHOR("Steve Longerbeam <steve_longerbeam@mentor.com>");
> -MODULE_LICENSE("GPL");
> -MODULE_ALIAS("platform:imx-ipuv3-vdic");
This breaks compilation until patch 6/8. I think you need to make
some makefile changes also in this patch.
WARNING: modpost: missing MODULE_LICENSE() in drivers/staging/media/imx/imx-media-ic.o
see include/linux/module.h for more information
WARNING: modpost: missing MODULE_LICENSE() in drivers/staging/media/imx/imx-media-vdic.o
see include/linux/module.h for more information
ERROR: "imx_media_ic_register" [drivers/staging/media/imx/imx-media.ko] undefined!
ERROR: "imx_media_vdic_register" [drivers/staging/media/imx/imx-media.ko] undefined!
ERROR: "imx_media_vdic_unregister" [drivers/staging/media/imx/imx-media.ko] undefined!
ERROR: "imx_media_ic_unregister" [drivers/staging/media/imx/imx-media.ko] undefined!
make[2]: *** [scripts/Makefile.modpost:91: __modpost] Error 1
make[1]: *** [/dev/shm/linux-git/Makefile:1263: modules] Error 2
make: *** [Makefile:170: sub-make] Error 2
---
Cheers,
Rui
next prev parent reply other threads:[~2019-04-30 21:57 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-28 19:09 [PATCH v2 0/8] Switch to sync registration for IPU subdevs Steve Longerbeam
2019-04-28 19:09 ` [PATCH v2 1/8] media: staging/imx: " Steve Longerbeam
2019-04-28 19:09 ` Steve Longerbeam
2019-04-30 21:56 ` Rui Miguel Silva [this message]
2019-04-30 21:56 ` Rui Miguel Silva
2019-04-30 21:59 ` Steve Longerbeam
2019-04-30 21:59 ` Steve Longerbeam
2019-04-28 19:09 ` [PATCH v2 2/8] media: staging/imx: Pass device to alloc/free_dma_buf Steve Longerbeam
2019-04-28 19:09 ` Steve Longerbeam
2019-04-28 19:09 ` [PATCH v2 3/8] media: staging/imx: Move add_video_device into capture_device_register Steve Longerbeam
2019-04-28 19:09 ` Steve Longerbeam
2019-04-28 19:09 ` [PATCH v2 4/8] Revert "media: imx: Set capture compose rectangle in capture_device_set_format" Steve Longerbeam
2019-04-28 19:09 ` Steve Longerbeam
2019-04-30 22:00 ` Rui Miguel Silva
2019-04-30 22:00 ` Rui Miguel Silva
2019-04-30 22:07 ` Steve Longerbeam
2019-04-30 22:07 ` Steve Longerbeam
2019-04-28 19:09 ` [PATCH v2 5/8] media: staging/imx: Remove capture_device_set_format Steve Longerbeam
2019-04-28 19:09 ` Steve Longerbeam
2019-04-28 19:09 ` [PATCH v2 6/8] media: staging/imx: Re-organize modules Steve Longerbeam
2019-04-28 19:09 ` Steve Longerbeam
2019-04-28 19:09 ` [PATCH v2 7/8] media: staging/imx: Improve pipeline searching Steve Longerbeam
2019-04-28 19:09 ` Steve Longerbeam
2019-04-28 19:09 ` [PATCH v2 8/8] media: staging/imx: Don't set driver data for v4l2_dev Steve Longerbeam
2019-04-28 19:09 ` Steve Longerbeam
2019-04-30 9:19 ` [PATCH v2 0/8] Switch to sync registration for IPU subdevs Rui Miguel Silva
2019-04-30 18:38 ` Rui Miguel Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3a7g7nom1.fsf@gmail.com \
--to=rmfrfs@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=slongerbeam@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.