linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Pan <jacob.jun.pan@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "Lee Jones" <lee.jones@linaro.org>,
	"Aaron Lu" <aaron.lu@intel.com>,
	"Alexandre Courbot" <gnurou@gmail.com>,
	"Samuel Ortiz" <sameo@linux.intel.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Lejun Zhu" <lejun.zhu@intel.com>,
	"Radivoje Jovanovic" <radivoje.jovanovic@intel.com>,
	"Daniel Glöckner" <dg@emlix.com>,
	"ACPI Devel Maling List" <linux-acpi@vger.kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"Mark Brown" <broonie@linaro.org>
Subject: Re: [PATCH 2/2] PMIC / opregion: support PMIC customized operation region for CrystalCove
Date: Wed, 8 Oct 2014 04:58:12 -0700	[thread overview]
Message-ID: <20141008045812.734a24db@ultegra> (raw)
In-Reply-To: <CACRpkdaPFzq=Qya_UoZpxHom+VcynTwQL9EfdLb_Vpr=g6+Prg@mail.gmail.com>

On Wed, 8 Oct 2014 11:16:11 +0200
Linus Walleij <linus.walleij@linaro.org> wrote:

> On Wed, Oct 8, 2014 at 10:05 AM, Lee Jones <lee.jones@linaro.org>
> wrote:
> 
> > With the influx of new same-chip devices, I think the MFD subsystem
> > is fast becoming overloaded.  I think all of the PMIC handling
> > should in fact either live in Regulators or have its own subsystem.
> 
> You have a valid point, and it's been raised before that MFD risk
> being a dumping ground of the same kind that drivers/misc used to be
> (is?).
> 
> PMIC (Power Management Integrated Circuit) is often not even a
> correct name for the thing if it contains things like audio amplifiers
> USB PHY intrerfaces or LED boosters as some do.
> 
> MSIC (Mixed-Signal Integrated Circuit) is the correct name for
> silicon that is created as a one-stop shop for anything combining
> digital and analog constructions, often in a higher micron node
> (not as densely integrated) as a digital IC (the latter referred to
> as SoCs, "baseband", "CPU" and whatnot).
> 
> If they shall live in MFD the driver there should (IMHO) just be
> an exchange station, multiplexing messages and spawning
> MFD cells into platform devices for respective *real* subsystem,
> various misc stuff should not be allowed to be shoehorned
> into MFD just because there is no other place to put it.
> 
I agree since in most cases there are not much common code to
consolidate among cell drivers. MFD is convenient as an exchange
station as you pointed out but the same time, drivers can create their
own platform devices without MFD. Perhaps we can add a set of MFD
internal APIs for PMIC for the things are common, e.g.
- regmap
- irq chip

> This driver clearly does not qualify, look:
> 
ACPI is kind of special since it is already an abstraction of the HW
making it easy to consolidate code. Perhaps that is why Aaron provides
the kind of callbacks for each PMIC.
> > +static int intel_crc_pmic_update_power(struct regmap *regmap,
> > +                                    struct pmic_pwr_reg *preg,
> > bool on) +{
> > +     int data;
> > +
> > +     if (regmap_read(regmap, preg->reg, &data))
> > +             return -EIO;
> > +
> > +     if (on) {
> > +             data |= PWR_SOURCE_SELECT | BIT(preg->bit);
> > +     } else {
> > +             data &= ~BIT(preg->bit);
> > +             data |= PWR_SOURCE_SELECT;
> > +     }
> > +
> > +     if (regmap_write(regmap, preg->reg, data))
> > +             return -EIO;
> > +     return 0;
> > +}
> 
> Selecting power source? Isn't that something and MFD cell
> spawned driver in either drivers/regulator or drivers/power should
> be doing?
> 
The difference in this case is that opregion handler driver does not
need the interfaces provided by sys/class/power_supply, or regulator
etc. By moving them away from the opregion common code, you would need
to export the APIs. I think we can have opregion code under
drivers/acpi?
> I know I have sinned in this regard in the past. But let's move
> forward with defining what this subsystem should *REALLY*
> be.
> 

> Yours,
> Linus Walleij

[Jacob Pan]

  reply	other threads:[~2014-10-08 11:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-09  2:32 [PATCH 0/2] Support CrystalCove PMIC ACPI operation region Aaron Lu
2014-09-09  2:32 ` [PATCH 1/2] gpio / CrystalCove: support virtual GPIO Aaron Lu
2014-09-23 10:13   ` Linus Walleij
2014-09-24 11:18   ` Linus Walleij
2014-09-25  2:57     ` [PATCH v2 " Aaron Lu
2014-09-25 11:15       ` Mika Westerberg
2014-09-26  5:21         ` Aaron Lu
2014-09-25 13:16       ` Linus Walleij
2014-09-26  5:22         ` Aaron Lu
2014-09-09  2:32 ` [PATCH 2/2] PMIC / opregion: support PMIC customized operation region for CrystalCove Aaron Lu
2014-10-08  8:05   ` Lee Jones
2014-10-08  9:16     ` Linus Walleij
2014-10-08 11:58       ` Jacob Pan [this message]
2014-10-08 12:54       ` Mark Brown
2014-10-09  9:21     ` Aaron Lu
2014-10-13  9:02       ` Aaron Lu
2014-10-13 14:51         ` Rafael J. Wysocki
2014-09-09  2:37 ` [PATCH 0/2] Support CrystalCove PMIC ACPI operation region Aaron Lu
2014-09-15  2:57 ` Aaron Lu
2014-09-15 22:43   ` Lee Jones
  -- strict thread matches above, loose matches on Subject: below --
2014-09-09  2:26 Aaron Lu
2014-09-09  2:26 ` [PATCH 2/2] PMIC / opregion: support PMIC customized operation region for CrystalCove Aaron Lu

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=20141008045812.734a24db@ultegra \
    --to=jacob.jun.pan@linux.intel.com \
    --cc=aaron.lu@intel.com \
    --cc=arnd@arndb.de \
    --cc=broonie@linaro.org \
    --cc=dg@emlix.com \
    --cc=gnurou@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=lejun.zhu@intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=radivoje.jovanovic@intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=sameo@linux.intel.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).