mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Michael Grzeschik <mgr@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/4] regulator: pfuze: add support to other architectures
Date: Wed, 29 Jan 2020 23:19:20 +0100	[thread overview]
Message-ID: <20200129221920.g2ercgyrxmu62gc3@pengutronix.de> (raw)
In-Reply-To: <20200128084550.uxe7hn2qlvcik5tz@pengutronix.de>


[-- Attachment #1.1: Type: text/plain, Size: 2497 bytes --]

Hi Sascha,

On Tue, Jan 28, 2020 at 09:45:50AM +0100, Sascha Hauer wrote:
> Hi Michael,
> 
> On Mon, Jan 27, 2020 at 04:50:11PM +0100, Michael Grzeschik wrote:
> > Currently the pfuze driver is build dependent to ARCH_IMX6. To make it
> > possible to work with ARCH_IMX8 we move the imx6_poweroff call to an own
> > poweroff handler.
> > 
> > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> > ---
> >  arch/arm/mach-imx/imx6.c  | 8 ++++++++
> >  drivers/regulator/Kconfig | 2 +-
> >  drivers/regulator/pfuze.c | 2 --
> >  3 files changed, 9 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
> > index 41e0066add..8f1638c1ea 100644
> > --- a/arch/arm/mach-imx/imx6.c
> > +++ b/arch/arm/mach-imx/imx6.c
> > @@ -401,3 +401,11 @@ void __noreturn imx6_pm_stby_poweroff(void)
> >  
> >  	while(1);
> >  }
> > +
> > +static int imx6_init(void)
> > +{
> > +	poweroff_handler_register_fn(imx6_pm_stby_poweroff);
> > +
> > +	return 0;
> > +}
> 
> imx6_pm_stby_poweroff() only works when a pfuze is present and is
> configured correctly. Calling this on every i.MX board is not nice.

Right

> What you can do is to call pfuze_register_init_callback() from here.
> You'll have to add a static inline wrapper for this in case pfuze
> support is not compiled in.

So you mean, call pfuze_register_init_callback to register a callback
function which then itself registers the poweroff_handler as above?

I think that could work, but then the init_callback is already used for
every imx6. The callback would also be overwritten by users in board
code trying to preconfigure the pfuze into a sane state, right?

> I wonder how this compiles as my version of this file already has a
> function named imx6_init(). Using this is preferred btw as it's already
> made sure that it will run only on i.MX6.

Duh, it wont. I tried it with imx6 disabled.

> > +coredevice_initcall(imx6_init);
> 
> Note that this doesn't necessarily means that we are running an i.MX6.
> It could be whatever else is compiled in.

Yes, therefor the callback approach is to be prefered.

Michael

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-01-29 22:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-27 15:50 [PATCH 1/4] regulator: pfuze: remove unsued define Michael Grzeschik
2020-01-27 15:50 ` [PATCH 2/4] regulator: pfuze: add support to other architectures Michael Grzeschik
2020-01-28  8:45   ` Sascha Hauer
2020-01-29 22:19     ` Michael Grzeschik [this message]
2020-01-30  7:57       ` Sascha Hauer
2020-01-27 15:50 ` [PATCH 3/4] regulator: pfuze: add include regmap.h so struct regmap is known Michael Grzeschik
2020-01-27 15:50 ` [PATCH 4/4] ARM: phyCORE-i.MX8M SOM: add pmic initialisation for power good Michael Grzeschik
2020-01-28  8:48   ` Sascha Hauer

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=20200129221920.g2ercgyrxmu62gc3@pengutronix.de \
    --to=mgr@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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