From: Thierry Reding <thierry.reding@gmail.com>
To: Mikko Perttunen <mperttunen@nvidia.com>
Cc: achew@nvidia.com, dnibade@nvidia.com,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
srasal@nvidia.com, linux-tegra@vger.kernel.org,
Arto Merilainen <amerilainen@nvidia.com>
Subject: Re: [PATCH 3/4] drm/tegra: Add VIC support
Date: Fri, 22 May 2015 12:25:29 +0200 [thread overview]
Message-ID: <20150522102528.GD16507@ulmo> (raw)
In-Reply-To: <555DEE5F.2060100@nvidia.com>
[-- Attachment #1.1: Type: text/plain, Size: 2132 bytes --]
On Thu, May 21, 2015 at 05:40:31PM +0300, Mikko Perttunen wrote:
> On 05/21/2015 04:20 PM, Arto Merilainen wrote:
[...]
> > +static int vic_is_addr_reg(struct device *dev, u32 class, u32 offset, u32 val)
> > +{
> > + struct vic *vic = dev_get_drvdata(dev);
> > +
> > + /* handle host class */
> > + if (class == HOST1X_CLASS_HOST1X) {
> > + if (offset == 0x2b)
> > + return true;
> > + return false;
>
> "return (offset == 0x2b);" perhaps?
I think this should really be extracted into a separate helper. If we
ever need to take into account additional offsets we would otherwise
have to extend every driver rather than just the helper.
Also I think the 0x2b should be replaced by some symbolic name.
According to the TRM 0x2b is the host1x class method named
NV_CLASS_HOST_INDCTRL_0. Oddly enough that doesn't seem to be an address
register. Instead the address seems to be in the INDOFF2 and INDOFF
methods (0x2c and 0x2d). I also can't tell from the TRM what exactly
these are supposed to do.
Arto, can you clarify?
> > + if (IS_ERR(vic->rst)) {
> > + dev_err(&pdev->dev, "cannot get reset\n");
> > + return PTR_ERR(vic->rst);
> > + }
> > +
> > + platform_set_drvdata(pdev, vic);
> > +
> > + INIT_LIST_HEAD(&vic->client.base.list);
> > + vic->client.base.ops = &vic_client_ops;
> > + vic->client.base.dev = dev;
> > + vic->client.base.class = vic_config->class_id;
> > + vic->client.base.syncpts = syncpts;
> > + vic->client.base.num_syncpts = 1;
> > + vic->dev = dev;
> > + vic->config = vic_config;
> > +
> > + INIT_LIST_HEAD(&vic->client.list);
> > + vic->client.ops = &vic_ops;
> > +
> > + err = tegra_powergate_sequence_power_up(vic->config->powergate_id,
> > + vic->clk, vic->rst);
> > + if (err) {
> > + dev_err(dev, "cannot turn on the device\n");
> > + return err;
> > + }
> > +
> > + err = host1x_client_register(&vic->client.base);
> > + if (err < 0) {
>
> You used 'if (err) {' previously, so maybe also here.
For consistency with other Tegra DRM code these checks should use (at
least where possible) the (err < 0) notation.
Thierry
[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Mikko Perttunen <mperttunen@nvidia.com>
Cc: Arto Merilainen <amerilainen@nvidia.com>,
linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, achew@nvidia.com,
srasal@nvidia.com, dnibade@nvidia.com
Subject: Re: [PATCH 3/4] drm/tegra: Add VIC support
Date: Fri, 22 May 2015 12:25:29 +0200 [thread overview]
Message-ID: <20150522102528.GD16507@ulmo> (raw)
In-Reply-To: <555DEE5F.2060100@nvidia.com>
[-- Attachment #1: Type: text/plain, Size: 2132 bytes --]
On Thu, May 21, 2015 at 05:40:31PM +0300, Mikko Perttunen wrote:
> On 05/21/2015 04:20 PM, Arto Merilainen wrote:
[...]
> > +static int vic_is_addr_reg(struct device *dev, u32 class, u32 offset, u32 val)
> > +{
> > + struct vic *vic = dev_get_drvdata(dev);
> > +
> > + /* handle host class */
> > + if (class == HOST1X_CLASS_HOST1X) {
> > + if (offset == 0x2b)
> > + return true;
> > + return false;
>
> "return (offset == 0x2b);" perhaps?
I think this should really be extracted into a separate helper. If we
ever need to take into account additional offsets we would otherwise
have to extend every driver rather than just the helper.
Also I think the 0x2b should be replaced by some symbolic name.
According to the TRM 0x2b is the host1x class method named
NV_CLASS_HOST_INDCTRL_0. Oddly enough that doesn't seem to be an address
register. Instead the address seems to be in the INDOFF2 and INDOFF
methods (0x2c and 0x2d). I also can't tell from the TRM what exactly
these are supposed to do.
Arto, can you clarify?
> > + if (IS_ERR(vic->rst)) {
> > + dev_err(&pdev->dev, "cannot get reset\n");
> > + return PTR_ERR(vic->rst);
> > + }
> > +
> > + platform_set_drvdata(pdev, vic);
> > +
> > + INIT_LIST_HEAD(&vic->client.base.list);
> > + vic->client.base.ops = &vic_client_ops;
> > + vic->client.base.dev = dev;
> > + vic->client.base.class = vic_config->class_id;
> > + vic->client.base.syncpts = syncpts;
> > + vic->client.base.num_syncpts = 1;
> > + vic->dev = dev;
> > + vic->config = vic_config;
> > +
> > + INIT_LIST_HEAD(&vic->client.list);
> > + vic->client.ops = &vic_ops;
> > +
> > + err = tegra_powergate_sequence_power_up(vic->config->powergate_id,
> > + vic->clk, vic->rst);
> > + if (err) {
> > + dev_err(dev, "cannot turn on the device\n");
> > + return err;
> > + }
> > +
> > + err = host1x_client_register(&vic->client.base);
> > + if (err < 0) {
>
> You used 'if (err) {' previously, so maybe also here.
For consistency with other Tegra DRM code these checks should use (at
least where possible) the (err < 0) notation.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-05-22 10:25 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-21 13:20 [PATCH 0/4] Add VIC support for Tegra124 Arto Merilainen
2015-05-21 13:20 ` Arto Merilainen
2015-05-21 13:20 ` [PATCH 1/4] host1x: Store device address to all bufs Arto Merilainen
2015-05-21 13:20 ` Arto Merilainen
2015-05-21 13:20 ` [PATCH 2/4] host1x: Pass register value in firewall Arto Merilainen
2015-05-21 13:20 ` Arto Merilainen
2015-05-21 13:20 ` [PATCH 3/4] drm/tegra: Add VIC support Arto Merilainen
2015-05-21 13:20 ` Arto Merilainen
[not found] ` <1432214425-27137-4-git-send-email-amerilainen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-05-21 14:40 ` Mikko Perttunen
2015-05-21 14:40 ` Mikko Perttunen
[not found] ` <555DEE5F.2060100-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-05-21 15:10 ` Arto Merilainen
2015-05-21 15:10 ` Arto Merilainen
[not found] ` <555DF576.7070307-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-05-21 15:44 ` Mikko Perttunen
2015-05-21 15:44 ` Mikko Perttunen
[not found] ` <555DFD48.4000609-/1wQRMveznE@public.gmane.org>
2015-05-22 10:02 ` Thierry Reding
2015-05-22 10:02 ` Thierry Reding
2015-05-22 10:12 ` Arto Merilainen
2015-05-22 10:12 ` Arto Merilainen
2015-05-22 10:13 ` Arto Merilainen
2015-05-22 10:13 ` Arto Merilainen
2015-05-22 10:25 ` Thierry Reding [this message]
2015-05-22 10:25 ` Thierry Reding
2015-05-25 7:11 ` Arto Merilainen
2015-05-25 7:11 ` Arto Merilainen
2015-05-22 11:47 ` Thierry Reding
2015-05-22 11:47 ` Thierry Reding
2015-05-25 8:25 ` Arto Merilainen
2015-05-25 8:25 ` Arto Merilainen
2015-05-21 13:20 ` [PATCH 4/4] ARM: tegra: Add VIC for Tegra124 Arto Merilainen
2015-05-21 13:20 ` Arto Merilainen
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=20150522102528.GD16507@ulmo \
--to=thierry.reding@gmail.com \
--cc=achew@nvidia.com \
--cc=amerilainen@nvidia.com \
--cc=dnibade@nvidia.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mperttunen@nvidia.com \
--cc=srasal@nvidia.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.