From: Eduardo Valentin <edubezval@gmail.com>
To: Wolfram Sang <wsa-dev@sang-engineering.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
linux-pm@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Zhang Rui <rui.zhang@intel.com>,
Khiem Nguyen <khiem.nguyen.xt@renesas.com>,
Kuninori Morimoto <kuninori.morimoto.gx@gmail.com>,
Hien Dang <hien.dang.eb@renesas.com>,
Thao Nguyen <thao.nguyen.yb@rvc.renesas.com>
Subject: Re: [PATCH v3 2/4] thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal driver
Date: Tue, 29 Nov 2016 21:16:38 -0800 [thread overview]
Message-ID: <20161130051637.GA27252@localhost.localdomain> (raw)
In-Reply-To: <20161129083241.GA1458@katana>
Hey,
On Tue, Nov 29, 2016 at 09:32:42AM +0100, Wolfram Sang wrote:
> Hi Eduardo,
>
> > No commit message ? :-( generally speaking here, it is a good practice
> > to describe what you are doing, what you have considered, and what you
> > have tested, just for the sake of code history/documentation.
>
> OK, can do.
cool!
>
> > > + spin_lock_irqsave(&tsc->lock, flags);
> >
> > Why do you need a full blown spin lock irqsave? Can this locking be
> > solved by a simple mutex?
>
> Currently, it can be a mutex, yes. This is a "left-over" from the
> version which had interrupt support. I am not fully done with
> refactoring the irqs, but I thought it is likely we need this lock then
> again, so I chose to leave it. I can use a mutex for now if you prefer.
yes, yield the processor when possible, please. So, if your locking
don't really need to disable IRQs, then avoid doing it. If a mutex is
enough, use it.
>
> >
> > > +static void r8a7795_thermal_init(struct rcar_gen3_thermal_tsc *tsc)
> > > +{
> > > + unsigned long flags;
> > > +
> > > + spin_lock_irqsave(&tsc->lock, flags);
> > > +
> > > + rcar_gen3_thermal_write(tsc, REG_GEN3_CTSR, CTSR_THBGR);
> > > + rcar_gen3_thermal_write(tsc, REG_GEN3_CTSR, 0x0);
> > > +
> > > + udelay(1000);
> >
> > Why do you disable irqs, then busyloop for 1ms?
>
> Uh yes, this is ugly. I don't think we need to lock during init, but
> I'll double check later.
>
OK. You could probably leave the (mutex) lock, if you think you need it.
But also consider using usleep_range(1000) instead. Have a look at:
Documentation/timers/timers-howto.txt
for a better explanation.
> > > + /* default values if FUSEs are missing */
> > > + int ptat[3] = { 2351, 1509, 435 };
> > > + int thcode[TSC_MAX_NUM][3] = {
> > > + { 3248, 2800, 2221 },
> > > + { 3245, 2795, 2216 },
> > > + { 3250, 2805, 2237 },
> > > + };
> >
> > are these fuses valid for both? 7796 and 7797? or would you need a
> > different array for each version?
>
> According to the information I have today, it is the same array. And all
> later versions are promised to have fuse registers. This is already
> documented, but such HW is not available to me currently.
>
Ok. If you have the confirmation for that, then it is fine. I just asked
because cases I saw (different manufacturer of course) would have different values
to be programmed, depending on the chip version.
Anyways, just checking.
> Thanks for the quick review, very much appreciated!
>
> Wolfram
>
next prev parent reply other threads:[~2016-11-30 5:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-28 21:09 [PATCH v3 0/4] thermal: add driver for R-Car Gen3 Wolfram Sang
2016-11-28 21:09 ` [PATCH v3 1/4] thermal: rcar_gen3_thermal: Document the " Wolfram Sang
2016-11-28 21:09 ` [PATCH v3 2/4] thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal driver Wolfram Sang
2016-11-29 2:06 ` Eduardo Valentin
2016-11-29 8:32 ` Wolfram Sang
2016-11-30 5:16 ` Eduardo Valentin [this message]
2016-11-29 8:43 ` Geert Uytterhoeven
2016-11-29 18:55 ` Wolfram Sang
2016-11-28 21:09 ` [PATCH v3 3/4] arm64: dts: r8a7795: Add R-Car Gen3 thermal support Wolfram Sang
2016-11-28 21:09 ` [PATCH v3 4/4] arm64: dts: r8a7796: " Wolfram Sang
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=20161130051637.GA27252@localhost.localdomain \
--to=edubezval@gmail.com \
--cc=hien.dang.eb@renesas.com \
--cc=khiem.nguyen.xt@renesas.com \
--cc=kuninori.morimoto.gx@gmail.com \
--cc=linux-pm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=rui.zhang@intel.com \
--cc=thao.nguyen.yb@rvc.renesas.com \
--cc=wsa+renesas@sang-engineering.com \
--cc=wsa-dev@sang-engineering.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;
as well as URLs for NNTP newsgroup(s).