From: Pavel Machek <pavel@ucw.cz>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Sakari Ailus <sakari.ailus@iki.fi>,
mchehab@kernel.org, kernel list <linux-kernel@vger.kernel.org>,
ivo.g.dimitrov.75@gmail.com, sre@kernel.org,
pali.rohar@gmail.com, linux-media@vger.kernel.org
Subject: Re: [PATCH] omap3isp: add support for CSI1 bus
Date: Wed, 15 Feb 2017 10:42:29 +0100 [thread overview]
Message-ID: <20170215094228.GA8586@amd> (raw)
In-Reply-To: <10545906.Gxg3yScdu4@avalon>
[-- Attachment #1: Type: text/plain, Size: 5567 bytes --]
Hi!
> > diff --git a/drivers/media/platform/omap3isp/isp.c
> > b/drivers/media/platform/omap3isp/isp.c index 0321d84..88bc7c6 100644
> > --- a/drivers/media/platform/omap3isp/isp.c
> > +++ b/drivers/media/platform/omap3isp/isp.c
> > @@ -2024,21 +2024,92 @@ enum isp_of_phy {
> > ISP_OF_PHY_CSIPHY2,
> > };
> >
> > -static int isp_of_parse_node(struct device *dev, struct device_node *node,
> > - struct isp_async_subdev *isd)
> > +void __isp_of_parse_node_csi1(struct device *dev,
> > + struct isp_ccp2_cfg *buscfg,
> > + struct v4l2_of_endpoint *vep)
>
> This function isn't use anywhere else, you can merge it with
> isp_of_parse_node_csi1().
I'd prefer not to. First, it will be used separately in future, and
second, expresions would be uglier.
> > +{
> > + buscfg->lanecfg.clk.pos = vep->bus.mipi_csi1.clock_lane;
> > + buscfg->lanecfg.clk.pol =
> > + vep->bus.mipi_csi1.lane_polarity[0];
> > + dev_dbg(dev, "clock lane polarity %u, pos %u\n",
> > + buscfg->lanecfg.clk.pol,
> > + buscfg->lanecfg.clk.pos);
> > +
> > + buscfg->lanecfg.data[0].pos = vep->bus.mipi_csi2.data_lanes[0];
> > + buscfg->lanecfg.data[0].pol =
> > + vep->bus.mipi_csi2.lane_polarities[1];
>
> bus.mipi_csi2 ?
Good catch. Fixed.
> > - ret = v4l2_of_parse_endpoint(node, &vep);
> > - if (ret)
> > - return ret;
> > + if (vep->base.port == ISP_OF_PHY_CSIPHY1)
> > + buscfg->interface = ISP_INTERFACE_CSI2C_PHY1;
> > + else
> > + buscfg->interface = ISP_INTERFACE_CSI2A_PHY2;
>
> I would keep this code in the caller to avoid code duplication with
> isp_of_parse_node_csi1().
Take a closer look. Code in _csi1 is different.
> > break;
> >
> > default:
> > + return -1;
>
> Please use the appropriate error code.
Ok.
> > + return 0;
> > +}
> > +
> > +static int isp_of_parse_node_endpoint(struct device *dev,
> > + struct device_node *node,
> > + struct isp_async_subdev *isd)
> > +{
> > + struct isp_bus_cfg *buscfg;
> > + struct v4l2_of_endpoint vep;
> > + int ret;
> > +
> > + isd->bus = devm_kzalloc(dev, sizeof(*isd->bus), GFP_KERNEL);
>
> Why do you now need to allocate this manually ?
bus is now a pointer.
> > + dev_dbg(dev, "parsing endpoint %s, interface %u\n", node->full_name,
> > + vep.base.port);
> > +
> > + if (isp_endpoint_to_buscfg(dev, vep, buscfg))
>
> I'm fine splitting the CSI1/CSI2 parsing code to separate functions, but I
> don't think there's a need to split isp_endpoint_to_buscfg(). You can keep
> that part inline.
I'd prefer smaller functions here. I tried to read the original and it
was not too easy.
> > diff --git a/drivers/media/platform/omap3isp/ispccp2.c
> > b/drivers/media/platform/omap3isp/ispccp2.c index ca09523..4edb55a 100644
> > --- a/drivers/media/platform/omap3isp/ispccp2.c
> > +++ b/drivers/media/platform/omap3isp/ispccp2.c
> > @@ -160,6 +163,33 @@ static int ccp2_if_enable(struct isp_ccp2_device *ccp2,
> > u8 enable) return ret;
> > }
> >
> > + if (isp->revision == ISP_REVISION_2_0) {
>
> The isp_csiphy.c code checks phy->isp->phy_type for the same purpose,
> shouldn't you use that too ?
Do you want me to do phy->isp->phy_type == ISP_PHY_TYPE_3430 check
here? Can do...
> > + buscfg = &((struct isp_bus_cfg *)sensor->host_priv)->bus.ccp2;
> > +
> > +
>
> One blank line is enough.
Ok.
> > + if (enable) {
> > + csirxfe = OMAP343X_CONTROL_CSIRXFE_PWRDNZ |
> > + OMAP343X_CONTROL_CSIRXFE_RESET;
> > +
> > + if (buscfg->phy_layer)
> > + csirxfe |= OMAP343X_CONTROL_CSIRXFE_SELFORM;
> > +
> > + if (buscfg->strobe_clk_pol)
> > + csirxfe |= OMAP343X_CONTROL_CSIRXFE_CSIB_INV;
> > + } else
> > + csirxfe = 0;
>
> You need curly braces for the else statement too.
Easy enough.
> > +
> > + regmap_write(isp->syscon, isp->syscon_offset, csirxfe);
>
> Isn't this already configured by csiphy_routing_cfg_3430(), called through
> omap3isp_csiphy_acquire() ? You'll need to add support for the strobe/clock
> polarity there, but the rest should already be handled.
Let me check...
> > @@ -69,11 +69,15 @@
> > * @V4L2_MBUS_PARALLEL: parallel interface with hsync and vsync
> > * @V4L2_MBUS_BT656: parallel interface with embedded synchronisation, can
> > * also be used for BT.1120
> > + * @V4L2_MBUS_CSI1: MIPI CSI-1 serial interface
> > + * @V4L2_MBUS_CCP2: CCP2 (Compact Camera Port 2)
>
> It would help if you could provide, in comments or in the commit message, a
> few pointers to information about CSI-1 and CCP2.
There's not much good information :-(.
http://electronics.stackexchange.com/questions/134395/differences-between-mipi-csi1-and-mipi-csi2
>
> > /**
> > + * struct v4l2_of_bus_csi1 - CSI-1/CCP2 data bus structure
> > + * @clock_inv: polarity of clock/strobe signal
> > + * false - not inverted, true - inverted
> > + * @strobe: false - data/clock, true - data/strobe
> > + * @data_lane: the number of the data lane
> > + * @clock_lane: the number of the clock lane
> > + */
> > +struct v4l2_of_bus_mipi_csi1 {
> > + bool clock_inv;
> > + bool strobe;
> > + bool lane_polarity[2];
>
> This field isn't documented.
Yep, automatic checker already told me. Plus, similar field elsewhere
is called "lane_polarities" but I believe "polarity" is a better name.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2017-02-15 9:42 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-28 18:30 [PATCH] dt: bindings: Add support for CSI1 bus Pavel Machek
2017-01-02 7:00 ` Sakari Ailus
2017-01-11 21:38 ` Pavel Machek
2017-01-03 20:38 ` Rob Herring
2017-01-04 8:54 ` Sakari Ailus
2017-01-11 22:06 ` Pavel Machek
2017-01-11 22:19 ` Sakari Ailus
2017-01-11 22:53 ` [PATCHv2] " Pavel Machek
2017-01-11 23:55 ` Sebastian Reichel
2017-01-12 12:06 ` Baruch Siach
2017-01-19 21:37 ` Sakari Ailus
2017-01-19 21:49 ` Sakari Ailus
2017-01-20 7:59 ` Ivaylo Dimitrov
2017-01-20 11:46 ` Sakari Ailus
2017-02-03 11:50 ` Pavel Machek
2017-02-03 14:16 ` Sakari Ailus
2017-02-06 9:53 ` Pavel Machek
2017-02-06 9:49 ` Pavel Machek
2017-02-08 8:38 ` Sakari Ailus
2017-02-08 12:57 ` [PATCH] omap3isp: add " Pavel Machek
2017-02-08 18:32 ` kbuild test robot
2017-02-08 21:03 ` Laurent Pinchart
2017-02-15 9:42 ` Pavel Machek [this message]
2017-02-20 0:59 ` Laurent Pinchart
2017-02-20 12:06 ` [PATCH] omap3isp: avoid uninitialized memory Pavel Machek
2017-02-21 11:20 ` Sakari Ailus
2017-03-01 11:45 ` [media] omap3isp: Correctly set IO_OUT_SEL and VP_CLK_POL for CCP2 mode Pavel Machek
2017-03-03 11:13 ` kbuild test robot
2017-03-03 21:48 ` Pavel Machek
2017-03-10 1:24 ` [kbuild-all] " Ye Xiaolong
2017-03-10 2:49 ` Fengguang Wu
2017-03-04 15:15 ` Sakari Ailus
2017-03-04 19:44 ` Pavel Machek
2017-03-02 9:01 ` [PATCH] omap3isp: add support for CSI1 bus Pavel Machek
2017-03-02 10:16 ` [PATCHv2] " Pavel Machek
2017-03-02 11:24 ` Sakari Ailus
2017-03-02 12:38 ` Pavel Machek
2017-03-03 22:17 ` Sakari Ailus
2017-03-04 13:03 ` Sakari Ailus
2017-03-04 15:39 ` Sakari Ailus
2017-03-04 18:44 ` Laurent Pinchart
2017-04-26 21:19 ` [bug] omap3isp: missing support for ENUM_FMT Pavel Machek
2017-04-28 7:59 ` Sakari Ailus
2017-03-04 22:53 ` [PATCHv2] omap3isp: add support for CSI1 bus Pavel Machek
2017-03-05 14:13 ` Pavel Machek
2017-03-06 7:23 ` [PATCH] v4l2-fwnode: Fix clock lane parsing Pavel Machek
2017-03-10 22:54 ` Sakari Ailus
2017-06-13 12:22 ` v4l2-fwnode: status, plans for merge, any branch to merge against? Pavel Machek
2017-06-13 12:47 ` Sakari Ailus
2017-06-13 21:09 ` Pavel Machek
2017-06-14 11:06 ` Sakari Ailus
2017-06-14 19:41 ` Pavel Machek
2017-06-15 22:07 ` Sakari Ailus
2017-06-16 6:23 ` Pavel Machek
2017-06-15 22:22 ` n900 camera on v4.12-rc (was Re: v4l2-fwnode: status, plans for merge, any branch to merge against?) Pavel Machek
2017-06-15 22:23 ` [PATCH] omap3isp: fix compilation Pavel Machek
2017-06-16 8:03 ` Hans Verkuil
2017-06-16 11:59 ` Sakari Ailus
2017-07-04 15:08 ` v4l2-fwnode: status, plans for merge, any branch to merge against? Pavel Machek
2017-07-05 9:32 ` Sakari Ailus
2017-07-06 10:38 ` Pavel Machek
2017-07-11 16:12 ` Sakari Ailus
2017-07-12 16:32 ` Pavel Machek
2017-07-12 20:31 ` omap3isp: is capture mode working? what hardware? was " Pavel Machek
2017-03-06 7:57 ` [RFC] omap3isp: add support for CSI1 bus Pavel Machek
2017-03-10 13:41 ` Pavel Machek
2017-04-11 18:15 ` Pavel Machek
2017-05-03 7:43 ` [PATCHv2] " Sakari Ailus
2017-05-03 19:50 ` Pavel Machek
2017-05-03 20:24 ` Pavel Machek
2017-03-02 12:45 ` [PATCH] omap3isp: wait for regulators to come up Pavel Machek
2017-03-02 14:46 ` Laurent Pinchart
2017-03-04 15:33 ` Sakari Ailus
2017-02-15 10:23 ` [PATCH] omap3isp: add support for CSI1 bus Pavel Machek
2017-02-15 16:57 ` Sebastian Reichel
2017-02-15 17:06 ` Pavel Machek
2017-02-08 23:03 ` [PATCHv2] dt: bindings: Add " Rob Herring
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=20170215094228.GA8586@amd \
--to=pavel@ucw.cz \
--cc=ivo.g.dimitrov.75@gmail.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=pali.rohar@gmail.com \
--cc=sakari.ailus@iki.fi \
--cc=sre@kernel.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).