From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "Maxime Ripard" <maxime.ripard@bootlin.com>,
"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
"Hans Verkuil" <hverkuil@xs4all.nl>,
"Linux Media Mailing List" <linux-media@vger.kernel.org>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
Fukawa <tomoharu.fukawa.eb@renesas.com>,
"Kieran Bingham" <kieran.bingham@ideasonboard.com>
Subject: Re: [PATCH v13 2/2] rcar-csi2: add Renesas R-Car MIPI CSI-2 receiver driver
Date: Thu, 05 Apr 2018 11:26:45 +0300 [thread overview]
Message-ID: <1571834.H8Xd6h4YlB@avalon> (raw)
In-Reply-To: <CAMuHMdXoprxZNP6KuYjcYW5EYjzAAFqNn6orK24pv7k_fO+i4A@mail.gmail.com>
Hi Geert,
On Thursday, 5 April 2018 10:33:55 EEST Geert Uytterhoeven wrote:
> On Wed, Apr 4, 2018 at 5:26 PM, Laurent Pinchart wrote:
> > On Thursday, 29 March 2018 14:30:39 EEST Maxime Ripard wrote:
> >> On Tue, Feb 13, 2018 at 12:01:32AM +0100, Niklas Söderlund wrote:
> >> > + switch (priv->lanes) {
> >> > + case 1:
> >> > + phycnt = PHYCNT_ENABLECLK | PHYCNT_ENABLE_0;
> >> > + break;
> >> > + case 2:
> >> > + phycnt = PHYCNT_ENABLECLK | PHYCNT_ENABLE_1 |
> >> > PHYCNT_ENABLE_0;
> >> > + break;
> >> > + case 4:
> >> > + phycnt = PHYCNT_ENABLECLK | PHYCNT_ENABLE_3 |
> >> > PHYCNT_ENABLE_2 |
> >> > + PHYCNT_ENABLE_1 | PHYCNT_ENABLE_0;
> >> > + break;
> >> > + default:
> >> > + return -EINVAL;
> >> > + }
> >>
> >> I guess you could have a simpler construct here using this:
> >>
> >> phycnt = PHYCNT_ENABLECLK;
> >>
> >> switch (priv->lanes) {
> >>
> >> case 4:
> >> phycnt |= PHYCNT_ENABLE_3 | PHYCNT_ENABLE_2;
> >>
> >> case 2:
> >> phycnt |= PHYCNT_ENABLE_1;
> >>
> >> case 1:
> >> phycnt |= PHYCNT_ENABLE_0;
> >> break;
> >>
> >> default:
> >> return -EINVAL;
> >>
> >> }
> >>
> >> But that's really up to you.
> >
> > Wouldn't Niklas' version generate simpler code as it uses direct
> > assignments ?
> Alternatively, you could check for a valid number of lanes, and use
> knowledge about the internal lane bits:
>
> phycnt = PHYCNT_ENABLECLK;
> phycnt |= (1 << priv->lanes) - 1;
If Niklas is fine with that, I like it too.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2018-04-05 8:26 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-12 23:01 [PATCH v13 0/2] rcar-csi2: add Renesas R-Car MIPI CSI-2 Niklas Söderlund
2018-02-12 23:01 ` [PATCH v13 1/2] rcar-csi2: add Renesas R-Car MIPI CSI-2 receiver documentation Niklas Söderlund
2018-04-04 14:49 ` Laurent Pinchart
2018-02-12 23:01 ` [PATCH v13 2/2] rcar-csi2: add Renesas R-Car MIPI CSI-2 receiver driver Niklas Söderlund
2018-03-13 22:23 ` Kieran Bingham
2018-04-04 15:25 ` Laurent Pinchart
2018-04-15 18:50 ` Niklas Söderlund
2018-04-15 18:48 ` Niklas Söderlund
2018-03-29 11:30 ` Maxime Ripard
2018-04-04 15:26 ` Laurent Pinchart
2018-04-05 7:33 ` Geert Uytterhoeven
2018-04-05 8:26 ` Laurent Pinchart [this message]
2018-04-15 20:35 ` Niklas Söderlund
2018-04-04 20:13 ` Sakari Ailus
2018-04-15 20:47 ` Niklas Söderlund
2018-04-16 9:30 ` Sakari Ailus
2018-04-15 20:33 ` Niklas Söderlund
2018-04-04 15:15 ` Laurent Pinchart
2018-04-15 21:26 ` Niklas Söderlund
2018-04-23 23:23 ` Laurent Pinchart
2018-04-05 9:10 ` jacopo mondi
2018-04-05 13:06 ` jacopo mondi
2018-04-15 23:16 ` Niklas Söderlund
2018-04-16 12:46 ` jacopo mondi
2018-04-17 0:05 ` Niklas Söderlund
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=1571834.H8Xd6h4YlB@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=geert@linux-m68k.org \
--cc=hverkuil@xs4all.nl \
--cc=kieran.bingham@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=maxime.ripard@bootlin.com \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=sakari.ailus@linux.intel.com \
--cc=tomoharu.fukawa.eb@renesas.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox