linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
To: Lee Jones <lee.jones@linaro.org>
Cc: mazziesaccount@gmail.com, Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Sebastian Reichel <sre@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org,
	linux-watchdog@vger.kernel.org, heikki.haikola@fi.rohmeurope.com,
	mikko.mutanen@fi.rohmeurope.com
Subject: Re: [PATCH v11 2/8] mfd: bd70528: Support ROHM bd70528 PMIC - core
Date: Wed, 3 Apr 2019 13:10:03 +0300	[thread overview]
Message-ID: <20190403101003.GC3493@localhost.localdomain> (raw)
In-Reply-To: <20190403093015.GJ11301@dell>

On Wed, Apr 03, 2019 at 10:30:15AM +0100, Lee Jones wrote:
> On Wed, 03 Apr 2019, Matti Vaittinen wrote:
> 
> > Hello Lee,
> > 
> > Thanks for taking a look on this again =) I agree with most of the
> > comments and correct them at next version.
> > 
> > On Wed, Apr 03, 2019 at 08:31:52AM +0100, Lee Jones wrote:
> > > On Mon, 25 Mar 2019, Matti Vaittinen wrote:
> > > 
> > > > ROHM BD70528MWV is an ultra-low quiescent current general
> > > > purpose single-chip power management IC for battery-powered
> > > > portable devices.
> > > > 
> > > > Add MFD core which enables chip access for following subdevices:
> > > > 	- regulators/LED drivers
> > > > 	- battery-charger
> > > > 	- gpios
> > > > 	- 32.768kHz clk
> > > > 	- RTC
> > > > 	- watchdog
> > > > 
> > > > Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> > > > + * Mapping of main IRQ register bits to sub irq register offsets so
> > > 
> > > "sub-IRQ"
> > > 
> > > > + * that we can access corect sub IRQ registers based on bits that
> > > 
> > > "sub IRQ" is also fine, but please standardise.
> > > 
> > > I do prefer "sub-IRQ" though.
> > 
> > I'll go with "sub-IRQ" then
> > 
> > > > +
> > > > +#define WD_CTRL_MAGIC1 0x55
> > > > +#define WD_CTRL_MAGIC2 0xAA
> > > > +/**
> > > > + * bd70528_wdt_set - arm or disarm watchdog timer
> > > > + *
> > > > + * @data:	device data for the PMIC instance we want to operate on
> > > > + * @enable:	new state of WDT. zero to disable, non zero to enable
> > > > + * @old_state:	previous state of WDT will be filled here
> > > > + *
> > > > + * Arm or disarm WDT on BD70528 PMIC. Expected to be called only by
> > > > + * BD70528 RTC and BD70528 WDT drivers. The rtc_timer_lock must be taken
> > > > + * by calling bd70528_wdt_lock before calling bd70528_wdt_set.
> > > > + */
> > > > +int bd70528_wdt_set(struct rohm_regmap_dev *data, int enable, int *old_state)
> > > 
> > > Why doesn't this reside in the watchdog driver?
> > 
> > If my memory serves me right we shortly discussed this already during v8
> > review ;) Cant blame you though as I have seen some of the mail traffic
> > going through your inbox :D
> > 
> > The motivation to have the functions exported from MFD is to not create
> > sirect dependency between RTC and WDT. There may be cases where we want
> > to leave either RTC or WDT out of compilation. MFD is always needed so
> > the dependency from MFD to RTC/WDT does not harm.
> > 
> > (Here's some discussion necromancy if you are interested in re-reading
> > how we did end up with this implementation:
> > https://lore.kernel.org/lkml/20190212091723.GZ20638@dell/)
> > 
> > I hope you are still Ok with having the WDT control functions in MFD.
> 
> OOI, why does the RTC need to control the WDT?

I thought I had a comment about this somewhere in code... O_o Must have
been in some development branch I had :/

Anyways, setting the RTC counter may cause watchdog to trigger. It is not
further explained why but I would guess watchdog uses RTC counter to check
if it should've been pinged already. So RTC needs to disable watch dog for
the duration of hwclock setting and enable it again after the new time is
set. I can add a comment about this to MFD driver if it helps :)

Br,
	Matti Vaittinen

-- 
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~

  reply	other threads:[~2019-04-03 10:10 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-25 12:04 [PATCH v11 0/8] support ROHM BD70528 PMIC Matti Vaittinen
2019-03-25 12:04 ` [PATCH v11 1/8] mfd: regulator: clk: split rohm-bd718x7.h Matti Vaittinen
2019-04-03  6:19   ` Lee Jones
2019-03-25 12:05 ` [PATCH v11 2/8] mfd: bd70528: Support ROHM bd70528 PMIC - core Matti Vaittinen
2019-04-03  7:31   ` Lee Jones
2019-04-03  8:47     ` Matti Vaittinen
2019-04-03  9:30       ` Lee Jones
2019-04-03 10:10         ` Matti Vaittinen [this message]
2019-04-03 11:25           ` Lee Jones
2019-04-03 11:45             ` Vaittinen, Matti
2019-04-04  2:52               ` Lee Jones
2019-04-04  5:57                 ` Vaittinen, Matti
2019-04-04  6:54                   ` Lee Jones
2019-04-04  7:24                     ` Matti Vaittinen
2019-04-04  7:56                       ` Alexandre Belloni
2019-04-04  8:10                         ` Vaittinen, Matti
2019-04-04  8:21                           ` Lee Jones
2019-04-04  8:06                       ` Lee Jones
2019-03-25 12:05 ` [PATCH v11 3/8] clk: bd718x7: Support ROHM BD70528 clk block Matti Vaittinen
2019-03-25 12:05 ` [PATCH v11 4/8] dt-bindings: mfd: Document first ROHM BD70528 bindings Matti Vaittinen
2019-04-03  7:34   ` Lee Jones
2019-04-03  9:04     ` Matti Vaittinen
2019-03-25 12:06 ` [PATCH v11 5/8] gpio: Initial support for ROHM bd70528 GPIO block Matti Vaittinen
2019-03-25 12:06 ` [PATCH v11 6/8] rtc: bd70528: Initial support for ROHM bd70528 RTC Matti Vaittinen
2019-03-25 17:04   ` Alexandre Belloni
2019-03-26 13:51     ` Vaittinen, Matti
2019-03-26 14:05       ` Alexandre Belloni
2019-03-25 12:06 ` [PATCH v11 7/8] power: supply: Initial support for ROHM BD70528 PMIC charger block Matti Vaittinen
2019-03-25 12:07 ` [PATCH v11 8/8] watchdog: bd70528: Initial support for ROHM BD70528 watchdog block Matti Vaittinen

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=20190403101003.GC3493@localhost.localdomain \
    --to=matti.vaittinen@fi.rohmeurope.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=heikki.haikola@fi.rohmeurope.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mark.rutland@arm.com \
    --cc=mazziesaccount@gmail.com \
    --cc=mikko.mutanen@fi.rohmeurope.com \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=sre@kernel.org \
    --cc=wim@linux-watchdog.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).