All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa-dev@sang-engineering.com>
To: Eduardo Valentin <edubezval@gmail.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 09:32:42 +0100	[thread overview]
Message-ID: <20161129083241.GA1458@katana> (raw)
In-Reply-To: <20161129020652.GA3701@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1768 bytes --]

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.

> > +	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.

> 
> > +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.

> > +	/* 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.

Thanks for the quick review, very much appreciated!

   Wolfram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-11-29  8:32 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 [this message]
2016-11-30  5:16       ` Eduardo Valentin
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=20161129083241.GA1458@katana \
    --to=wsa-dev@sang-engineering.com \
    --cc=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 \
    /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.