All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
To: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Chanwoo Choi <cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Ian Campbell
	<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
	Krzysztof Kozlowski
	<k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Stephen Boyd <sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Andy Gross <agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Srinivas Kandagatla
	<srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 2/4] regulator: core: Expose init_data to of_parse_cb
Date: Tue, 3 Mar 2015 08:15:41 -0800	[thread overview]
Message-ID: <20150303161541.GE26334@sonymobile.com> (raw)
In-Reply-To: <20150303125033.GO21293-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>

On Tue 03 Mar 04:50 PST 2015, Mark Brown wrote:

> On Mon, Mar 02, 2015 at 08:25:38PM -0800, Bjorn Andersson wrote:
> 
> > Expose the newly created init_data to the driver's parse callback so
> > that it can futher enhance it with e.g. constraints of the regulator.
> 
> Why would the driver need to do that?  I guess I'll see later on in the
> series but the changelog should make that clear.  Drivers aren't
> supposed to ever need to look at their init data, modifying the init
> data from what the machine provied is usually a red flag.
> 

I think what you're getting at is that the init_data should come from a
board file or device tree. With the reworkings done in patch 4 this
makes more sense than it did before (e.g. I no longer call
of_get_regulator_init_data()).

However, by calling register_regulator() with dev->of_node being
non-NULL and desc->of_match being something that will match a DT entry
all init_data is now coming from device tree, through:

regulator_register()
  regulator_of_get_init_data()
    of_get_regulator_init_data()
      of_get_regulation_constraints()

As this matches a regulator, there is no way for the driver (or anyone
else to affect the init_data).

The problem at hand is that there is nothing in this code path telling
the core that we can do DRMS - something we can figure out in the driver
by basically looking at the ops for the registering regulator.

> > This is needed because calling regulator_register() with a of_node and
> > of_match will overwrite the passed config->init_data. An alternative way
> > would be to merge the parsed init_data with the driver provided one.
> 
> Put any explanation as to why the feature is needed in the changelog.

Point taken.

Let me know if you think I'm on a sane path with the above reasoning and
I can resend the patch with a better description of the problem at hand.

Regards,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Andersson <bjorn.andersson@sonymobile.com>
To: Mark Brown <broonie@kernel.org>
Cc: Chanwoo Choi <cw00.choi@samsung.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Kumar Gala <galak@codeaurora.org>,
	Lee Jones <lee.jones@linaro.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Pawel Moll <pawel.moll@arm.com>, Rob Herring <robh+dt@kernel.org>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Andy Gross <agross@codeaurora.org>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>
Subject: Re: [PATCH 2/4] regulator: core: Expose init_data to of_parse_cb
Date: Tue, 3 Mar 2015 08:15:41 -0800	[thread overview]
Message-ID: <20150303161541.GE26334@sonymobile.com> (raw)
In-Reply-To: <20150303125033.GO21293@sirena.org.uk>

On Tue 03 Mar 04:50 PST 2015, Mark Brown wrote:

> On Mon, Mar 02, 2015 at 08:25:38PM -0800, Bjorn Andersson wrote:
> 
> > Expose the newly created init_data to the driver's parse callback so
> > that it can futher enhance it with e.g. constraints of the regulator.
> 
> Why would the driver need to do that?  I guess I'll see later on in the
> series but the changelog should make that clear.  Drivers aren't
> supposed to ever need to look at their init data, modifying the init
> data from what the machine provied is usually a red flag.
> 

I think what you're getting at is that the init_data should come from a
board file or device tree. With the reworkings done in patch 4 this
makes more sense than it did before (e.g. I no longer call
of_get_regulator_init_data()).

However, by calling register_regulator() with dev->of_node being
non-NULL and desc->of_match being something that will match a DT entry
all init_data is now coming from device tree, through:

regulator_register()
  regulator_of_get_init_data()
    of_get_regulator_init_data()
      of_get_regulation_constraints()

As this matches a regulator, there is no way for the driver (or anyone
else to affect the init_data).

The problem at hand is that there is nothing in this code path telling
the core that we can do DRMS - something we can figure out in the driver
by basically looking at the ops for the registering regulator.

> > This is needed because calling regulator_register() with a of_node and
> > of_match will overwrite the passed config->init_data. An alternative way
> > would be to merge the parsed init_data with the driver provided one.
> 
> Put any explanation as to why the feature is needed in the changelog.

Point taken.

Let me know if you think I'm on a sane path with the above reasoning and
I can resend the patch with a better description of the problem at hand.

Regards,
Bjorn

  parent reply	other threads:[~2015-03-03 16:15 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03  4:25 [PATCH 0/4] Refactor Qualcomm RPM regulator to single platform_device Bjorn Andersson
2015-03-03  4:25 ` Bjorn Andersson
2015-03-03  4:25 ` [PATCH 1/4] mfd: devicetree: bindings: Add Qualcomm RPM regulator subnodes Bjorn Andersson
2015-03-03  4:25   ` Bjorn Andersson
     [not found]   ` <1425356740-26285-2-git-send-email-bjorn.andersson-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
2015-03-03 12:47     ` Mark Brown
2015-03-03 12:47       ` Mark Brown
     [not found]       ` <20150303124700.GN21293-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-03-03 16:02         ` Bjorn Andersson
2015-03-03 16:02           ` Bjorn Andersson
2015-03-05  0:33           ` Mark Brown
2015-03-03 18:53   ` Stephen Boyd
2015-03-03 21:54     ` Bjorn Andersson
2015-03-03 22:02       ` Stephen Boyd
2015-03-03 22:17         ` Bjorn Andersson
2015-03-03 23:25           ` Stephen Boyd
2015-03-03  4:25 ` [PATCH 2/4] regulator: core: Expose init_data to of_parse_cb Bjorn Andersson
2015-03-03  4:25   ` Bjorn Andersson
2015-03-03 12:50   ` Mark Brown
     [not found]     ` <20150303125033.GO21293-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-03-03 16:15       ` Bjorn Andersson [this message]
2015-03-03 16:15         ` Bjorn Andersson
     [not found]         ` <20150303161541.GE26334-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
2015-03-05  0:42           ` Mark Brown
2015-03-05  0:42             ` Mark Brown
2015-03-03  4:25 ` [PATCH 3/4] regulator: qcom: Refactor of-parsing code Bjorn Andersson
2015-03-03  4:25   ` Bjorn Andersson
2015-03-03 14:13   ` Mark Brown
2015-03-03 16:26     ` Bjorn Andersson
2015-03-03 18:56   ` Stephen Boyd
2015-03-03 22:07     ` Bjorn Andersson
2015-03-03  4:25 ` [PATCH 4/4] regulator: qcom: Rework to single platform device Bjorn Andersson
2015-03-03  4:25   ` Bjorn Andersson
2015-03-03 22:09   ` Stephen Boyd
2015-03-03 22:32     ` Bjorn Andersson
2015-03-03 23:52       ` Mark Brown
     [not found]         ` <20150303235209.GG21293-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-03-04  0:01           ` Stephen Boyd
2015-03-04  0:01             ` Stephen Boyd
2015-03-04  0:09             ` Mark Brown
2015-03-04 19:35   ` Stephen Boyd
2015-03-04 23:51     ` Bjorn Andersson
2015-03-05  0:56       ` Mark Brown
     [not found]     ` <54F75E8F.2070900-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-03-05  0:30       ` Mark Brown
2015-03-05  0:30         ` Mark Brown
2015-03-05  1:46         ` Stephen Boyd
2015-03-05 10:38           ` Mark Brown

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=20150303161541.GE26334@sonymobile.com \
    --to=bjorn.andersson-/mt0ovthwylzjqsbc5gl+g@public.gmane.org \
    --cc=agross-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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 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.