From: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
To: "Vaittinen, Matti" <Matti.Vaittinen@fi.rohmeurope.com>
Cc: "rafael@kernel.org" <rafael@kernel.org>,
"mazziesaccount@gmail.com" <mazziesaccount@gmail.com>,
"mark.rutland@arm.com" <mark.rutland@arm.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"broonie@kernel.org" <broonie@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"sre@kernel.org" <sre@kernel.org>,
"Laine, Markus" <Markus.Laine@fi.rohmeurope.com>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
"robh+dt@kernel.org" <robh+dt@kernel.org>,
"Mutanen, Mikko" <Mikko.Mutanen@fi.rohmeurope.com>
Subject: Re: [PATCH v4 3/9] drivers: base: add linear ranges helpers
Date: Wed, 18 Mar 2020 14:50:52 +0100 [thread overview]
Message-ID: <20200318135052.GA2804430@kroah.com> (raw)
In-Reply-To: <910505f6a38298707fc27b135e49a7e2a941fb88.camel@fi.rohmeurope.com>
On Wed, Mar 18, 2020 at 01:42:26PM +0000, Vaittinen, Matti wrote:
> Hello Greg,
>
> On Wed, 2020-03-18 at 14:08 +0100, Greg Kroah-Hartman wrote:
> > On Tue, Feb 25, 2020 at 10:53:01AM +0200, Matti Vaittinen wrote:
> > > Many devices have control registers which control some measurable
> > > property. Often a register contains control field so that change in
> > > this field causes linear change in the controlled property. It is
> > > not
> > > a rare case that user wants to give 'meaningful' control values and
> > > driver needs to convert them to register field values. Even more
> > > often user wants to 'see' the currently set value - again in
> > > meaningful units - and driver needs to convert the values it reads
> > > from register to these meaningful units. Examples of this include:
> > >
> > > - regulators, voltage/current configurations
> > > - power, voltage/current configurations
> > > - clk(?) NCOs
> > >
> > > and maybe others I can't think of right now.
> > >
> > > Provide a linear_range helper which can do conversion from user
> > > value
> > > to register value 'selector'.
> > >
> > > The idea here is stolen from regulator framework and patches
> > > refactoring
> > > the regulator helpers to use this are following.
> > >
> > > Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> > > ---
> > >
> > > Changes since rfc-v3:
> > > - Kerneldoc fixes
> > > - Corrected commit message typo meaningfull => meaningful
> > >
> > > drivers/base/Kconfig | 3 +
> > > drivers/base/Makefile | 1 +
> > > drivers/base/linear_ranges.c | 246
> > > +++++++++++++++++++++++++++++++++++
> >
> > Why in drivers/base/ ?
> >
> > Why not in lib/ ?
>
> I was pondering which of these would be better. I decided to do with
> drivers/base because - in it's current form - this is really a driver
> related stuff. I see it somehow in same position as regmap code -
> although this is just a tiny helper compared to regmap. But this also
> has pretty driver specific audience :)
>
> And... I must admit I like things which I know. And I have been doing
> driver development and "know" a few of the driver related colleagues -
> hence working with them is easier for me ;) Getting to know the
> colleagues maintaining lib is a bit scary :] Yep, I'm Finnish if you
> happen to wonder why getting to know people is scary xD
>
> >
> > > include/linux/linear_range.h | 48 +++++++
> > > 4 files changed, 298 insertions(+)
> > > create mode 100644 drivers/base/linear_ranges.c
> > > create mode 100644 include/linux/linear_range.h
> > >
> > > diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
> > > index 5f0bc74d2409..636b6fa8e499 100644
> > > --- a/drivers/base/Kconfig
> > > +++ b/drivers/base/Kconfig
> > > @@ -209,4 +209,7 @@ config GENERIC_ARCH_TOPOLOGY
> > > appropriate scaling, sysfs interface for reading capacity
> > > values at
> > > runtime.
> > >
> > > +config LINEAR_RANGES
> > > + tristate
> >
> > No help text at all???
>
> Yes. The linear ranges has no meaning to be enabled alone. It only
> plays a role if it is used by some driver/subsystem. And
> drivers/subsystems should do
> select LINEAR_RANGES. So showing help in any config tool is not needed.
> This should actually not be visible in menuconfig or others. I think I
> have seen a few examples like this.
>
> Ayways, I have no obejctions to adding some text if absolutely needed.
> Any suggestions for a text politely saying - "please, pretend I am not
> here" - are welcome :) (Although, I think this really does not need
> help text).
This kind of implies it needs to be in lib/ that way the needed code
links it and all should be fine.
thanks,
greg k-h
next prev parent reply other threads:[~2020-03-18 13:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 8:51 [PATCH v4 0/9] Support ROHM BD99954 charger IC Matti Vaittinen
2020-02-25 8:52 ` [PATCH v4 1/9] dt-bindings: battery: add new battery parameters Matti Vaittinen
2020-03-02 22:00 ` Rob Herring
2020-02-25 8:52 ` [PATCH v4 2/9] dt_bindings: ROHM BD99954 Charger Matti Vaittinen
2020-03-02 22:07 ` Rob Herring
2020-03-03 6:30 ` Vaittinen, Matti
2020-02-25 8:53 ` [PATCH v4 3/9] drivers: base: add linear ranges helpers Matti Vaittinen
2020-03-18 13:08 ` Greg Kroah-Hartman
2020-03-18 13:42 ` Vaittinen, Matti
2020-03-18 13:50 ` gregkh [this message]
2020-03-23 15:39 ` Vaittinen, Matti
2020-02-25 8:53 ` [PATCH v4 4/9] power: supply: bd70528: rename linear_range to avoid collision Matti Vaittinen
2020-02-25 8:53 ` [PATCH v4 5/9] regulator: rename regulator_linear_range to linear_range Matti Vaittinen
2020-02-25 8:54 ` [PATCH v4 6/9] regulator: use linear_ranges helper Matti Vaittinen
2020-02-25 8:54 ` [PATCH v4 7/9] power: supply: bd70528: use linear ranges Matti Vaittinen
2020-02-25 8:55 ` [PATCH v4 8/9] power: supply: add battery parameters Matti Vaittinen
2020-02-25 8:55 ` [PATCH v4 9/9] power: supply: Support ROHM bd99954 charger Matti Vaittinen
2020-02-25 16:21 ` Randy Dunlap
2020-02-26 7:58 ` Vaittinen, Matti
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=20200318135052.GA2804430@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Markus.Laine@fi.rohmeurope.com \
--cc=Matti.Vaittinen@fi.rohmeurope.com \
--cc=Mikko.Mutanen@fi.rohmeurope.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mazziesaccount@gmail.com \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=sre@kernel.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).