From: slongerbeam@gmail.com (Steve Longerbeam)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 11/19] media: imx: Add CSI subdev driver
Date: Fri, 6 Jan 2017 10:05:54 -0800 [thread overview]
Message-ID: <4800b65e-1168-9a10-df5e-4e9eaa0d99d3@gmail.com> (raw)
In-Reply-To: <21b54a7b-1254-a14f-767c-c92feed7433d@mentor.com>
On 01/04/2017 05:44 AM, Vladimir Zapolskiy wrote:
>
>> diff --git a/drivers/staging/media/imx/imx-csi.c b/drivers/staging/media/imx/imx-csi.c
>> new file mode 100644
>> index 0000000..975eafb
>> --- /dev/null
>> +++ b/drivers/staging/media/imx/imx-csi.c
>> @@ -0,0 +1,638 @@
>> +/*
>> + * V4L2 Capture CSI 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 <linux/module.h>
>> +#include <linux/platform_device.h>
>> +#include <media/v4l2-device.h>
>> +#include <media/v4l2-subdev.h>
>> +#include <media/videobuf2-dma-contig.h>
>> +#include <media/v4l2-of.h>
>> +#include <media/v4l2-ctrls.h>
> Please add the headers alphabetically ordered.
done.
>> +
>> +static int csi_start(struct csi_priv *priv)
>> +{
>> + int ret;
>> +
>> + if (!priv->sensor) {
>> + v4l2_err(&priv->sd, "no sensor attached\n");
>> + return -EINVAL;
>> + }
>> +
>> + ret = csi_setup(priv);
>> + if (ret)
>> + return ret;
>> +
>> + /* start the frame interval monitor */
>> + ret = imx_media_fim_set_stream(priv->fim, priv->sensor, true);
>> + if (ret)
>> + return ret;
>> +
>> + ret = ipu_csi_enable(priv->csi);
>> + if (ret) {
>> + v4l2_err(&priv->sd, "CSI enable error: %d\n", ret);
>> + return ret;
>> + }
>> +
>> + return 0;
> if (ret)
> v4l2_err(&priv->sd, "CSI enable error: %d\n", ret);
>
> return ret;
I failed to cleanup in this path, so it is now:
ret = ipu_csi_enable(priv->csi);
if (ret) {
v4l2_err(&priv->sd, "CSI enable error: %d\n", ret);
goto fim_off;
}
return 0;
fim_off:
if (priv->fim)
imx_media_fim_set_stream(priv->fim, priv->sensor, false);
return ret;
>> +
>> +static int csi_link_setup(struct media_entity *entity,
>> + const struct media_pad *local,
>> + const struct media_pad *remote, u32 flags)
>> +{
>> + struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
>> + struct csi_priv *priv = v4l2_get_subdevdata(sd);
>> + struct v4l2_subdev *remote_sd;
>> +
>> + dev_dbg(priv->dev, "link setup %s -> %s", remote->entity->name,
>> + local->entity->name);
>> +
>> + remote_sd = media_entity_to_v4l2_subdev(remote->entity);
>> +
>> + if (local->flags & MEDIA_PAD_FL_SINK) {
>> + if (flags & MEDIA_LNK_FL_ENABLED) {
>> + if (priv->src_sd)
>> + return -EBUSY;
>> + priv->src_sd = remote_sd;
>> + } else {
>> + priv->src_sd = NULL;
>> + return 0;
> You can remove the return above.
right, fixed.
>
>> +
>> + ret = v4l2_async_register_subdev(&priv->sd);
>> + if (ret)
>> + goto free_ctrls;
>> +
>> + return 0;
>> +free_ctrls:
>> + v4l2_ctrl_handler_free(&priv->ctrl_hdlr);
>> + return ret;
> This is a functionally equal and simplified version:
>
> if (ret)
> v4l2_ctrl_handler_free(&priv->ctrl_hdlr);
>
> return ret;
thanks, done.
>> +
>> +static struct platform_driver imx_csi_driver = {
>> + .probe = imx_csi_probe,
>> + .remove = imx_csi_remove,
>> + .id_table = imx_csi_ids,
>> + .driver = {
>> + .name = "imx-ipuv3-csi",
>> + .owner = THIS_MODULE,
> Please drop .owner.
ok, I tested this and there are no regressions, done
for all modules.
Steve
next prev parent reply other threads:[~2017-01-06 18:05 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-03 20:57 [PATCH v2 00/19] i.MX Media Driver Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 01/19] ARM: dts: imx6qdl: Add compatible, clocks, irqs to MIPI CSI-2 node Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 02/19] ARM: dts: imx6qdl: Add mipi_ipu1/2 multiplexers, mipi_csi, and their connections Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 03/19] ARM: dts: imx6qdl: add media device Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 04/19] ARM: dts: imx6-sabrelite: add OV5642 and OV5640 camera sensors Steve Longerbeam
2017-01-04 12:25 ` Vladimir Zapolskiy
2017-01-05 19:20 ` Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 05/19] ARM: dts: imx6-sabresd: " Steve Longerbeam
2017-01-04 12:33 ` Vladimir Zapolskiy
2017-01-05 22:30 ` Steve Longerbeam
2017-01-04 15:26 ` Fabio Estevam
2017-01-07 0:25 ` Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 06/19] ARM: dts: imx6-sabreauto: create i2cmux for i2c3 Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 07/19] ARM: dts: imx6-sabreauto: add reset-gpios property for max7310_b Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 08/19] ARM: dts: imx6-sabreauto: add pinctrl for gpt input capture Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 09/19] ARM: dts: imx6-sabreauto: add the ADV7180 video decoder Steve Longerbeam
2017-01-04 12:41 ` Vladimir Zapolskiy
2017-01-05 22:31 ` Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 11/19] media: imx: Add CSI subdev driver Steve Longerbeam
2017-01-04 13:44 ` Vladimir Zapolskiy
2017-01-06 18:05 ` Steve Longerbeam [this message]
2017-01-03 20:57 ` [PATCH v2 12/19] media: imx: Add SMFC " Steve Longerbeam
2017-01-04 14:23 ` Vladimir Zapolskiy
2017-01-06 18:11 ` Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 13/19] media: imx: Add IC subdev drivers Steve Longerbeam
2017-01-04 14:48 ` Vladimir Zapolskiy
2017-01-06 18:34 ` Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 14/19] media: imx: Add Camera Interface subdev driver Steve Longerbeam
2017-01-04 14:55 ` Vladimir Zapolskiy
2017-01-06 18:42 ` Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 15/19] media: imx: Add MIPI CSI-2 Receiver " Steve Longerbeam
2017-01-04 15:05 ` Vladimir Zapolskiy
2017-01-06 18:58 ` Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 16/19] media: imx: Add video switch " Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 17/19] media: imx: Add MIPI CSI-2 OV5640 sensor " Steve Longerbeam
2017-01-03 20:57 ` [PATCH v2 19/19] ARM: imx_v6_v7_defconfig: Enable staging video4linux drivers Steve Longerbeam
2017-01-03 21:10 ` [PATCH v2 00/19] i.MX Media Driver Fabio Estevam
[not found] ` <1483477049-19056-11-git-send-email-steve_longerbeam@mentor.com>
2017-01-04 13:33 ` [PATCH v2 10/19] media: Add i.MX media core driver Vladimir Zapolskiy
2017-01-06 1:21 ` Steve Longerbeam
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=4800b65e-1168-9a10-df5e-4e9eaa0d99d3@gmail.com \
--to=slongerbeam@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).