devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Cc: Samuel Ortiz <sameo@linux.intel.com>,
	Lee Jones <lee.jones@linaro.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org, Ben Dooks <ben-linux@fluff.org>,
	Kukjin Kim <kgene.kim@samsung.com>,
	Russell King <linux@arm.linux.org.uk>,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>
Subject: Re: [RFT v3 06/14] regulator: max77802: Remove support for board files
Date: Thu, 30 Oct 2014 13:53:07 +0100	[thread overview]
Message-ID: <1414673587.23399.13.camel@AMDC1943> (raw)
In-Reply-To: <54523224.3010407@collabora.co.uk>

On czw, 2014-10-30 at 13:42 +0100, Javier Martinez Canillas wrote:
> Hello Krzysztof,
> 
> On 10/30/2014 01:30 PM, Krzysztof Kozlowski wrote:
> tor_of_get_init_data() function?
> >> > 
> >> > The regulator_of_get_init_data() searches from dev->of_node or its child
> >> > node.
> >> > 
> >> > But dev->of_node is NULL.
> >> > 
> >> > That's why of_compatible is needed.
> >> 
> >> Yes but regulator_register() does dev = config->dev and config->dev is set
> >> to config.dev = iodev->dev in the driver probe function which is the
> >> pdev->dev.parent (the PMIC struct device) that has an associated of_node.
> >> 
> >> So, regulator_of_get_init_data() will call of_get_child_by_name() passing
> >> the PMIC of_node and the sub-node name that contains the regulators. That
> >> is, whatever was set in desc->regulators_node and that should be enough.
> > 
> > I missed that one in max77802 (in max77686: config.dev = &pdev->dev).
> > Now I wonder if it is proper to attach regulators to driver's parent
> > device. Consider regulator_register, around line 3640:
> > 	rdev->dev.parent = dev;
> > The parent of regulators will be equal to parent of regulator driver -
> > main MFD driver.
> >
> 
> An early version of the max77802 regulator driver also set config.dev to
> &pdev->dev but then Mark asked me if I was sure that it should not be the
> MFD device instead.
> 
> I then read in regulator_register() that the rdev->dev.parent was set
> to the device passed in config.dev as you said so I was convinced that it
> should be the parent device instead.
> 
> Please take a look at [0] for that discussion.

To me a intuitive structure would be:
MFD device
  |
  - clock device
     |
     - clock1
     - clock2
  - regulator device
     |
     - LDO1
     - LDO2
etc.

This also maps to structure in DTS. dev_err* messages and any
allocations should be done on behalf of regulator device, not parent.

Various drivers do this differently... The wm8* drivers set it mostly to
parent (MFD)...

I do not insists, especially because using parent's device would make
this driver simpler.

Mark, maybe you could shed light on it?


Best regards,
Krzysztof

  reply	other threads:[~2014-10-30 12:53 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30 11:20 [PATCH v3 00/14] regulator: max77686: Add GPIO control Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 01/14] mfd: max77686/802: Map regulator driver to its own of_node Krzysztof Kozlowski
2014-10-31 12:23   ` Mark Brown
2014-10-31 13:07     ` Krzysztof Kozlowski
2014-10-31 18:06       ` Mark Brown
2014-10-30 11:20 ` [PATCH v3 02/14] mfd/regulator: dt-bindings: max77686: Document of_compatible for regulator Krzysztof Kozlowski
2014-11-03 17:00   ` Lee Jones
2014-11-04  7:53     ` Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 03/14] regulator: dt-bindings: max77802: " Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 04/14] regulator: max77686: Consistently index opmode array by rdev id Krzysztof Kozlowski
2014-10-30 11:20 ` [RFT v3 05/14] regulator: max77802: Don't ignore return value of current opmode Krzysztof Kozlowski
     [not found]   ` <1414668053-31370-6-git-send-email-k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-10-30 11:42     ` Javier Martinez Canillas
2014-10-30 11:20 ` [RFT v3 06/14] regulator: max77802: Remove support for board files Krzysztof Kozlowski
     [not found]   ` <1414668053-31370-7-git-send-email-k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-10-30 11:50     ` Javier Martinez Canillas
2014-10-30 12:10       ` Krzysztof Kozlowski
2014-10-30 12:21         ` Javier Martinez Canillas
2014-10-30 12:30           ` Krzysztof Kozlowski
2014-10-30 12:42             ` Javier Martinez Canillas
2014-10-30 12:53               ` Krzysztof Kozlowski [this message]
2014-10-30 14:02                 ` Javier Martinez Canillas
2014-10-30 11:20 ` [PATCH v3 07/14] regulator: max77686: " Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 08/14] mfd: max77686/802: " Krzysztof Kozlowski
2014-11-03 17:01   ` Lee Jones
2014-11-04  7:51     ` Krzysztof Kozlowski
2014-11-04  8:07       ` Lee Jones
2014-10-30 11:20 ` [PATCH v3 09/14] regulator: max77686: Initialize opmode explicitly to normal mode Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 10/14] regulator: max77686: Add GPIO control Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 11/14] mfd/regulator: dt-bindings: max77686: Document gpio properties Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 12/14] ARM: dts: exynos4412-trats: Switch max77686 regulators to GPIO control Krzysztof Kozlowski
2014-10-30 11:20 ` [PATCH v3 13/14] ARM: dts: exynos5420-peach: Update to new max77802 regulator compatible Krzysztof Kozlowski
     [not found] ` <1414668053-31370-1-git-send-email-k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-10-30 11:20   ` [PATCH v3 14/14] ARM: dts: exynos5800-peach: " Krzysztof Kozlowski

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=1414673587.23399.13.camel@AMDC1943 \
    --to=k.kozlowski@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=ben-linux@fluff.org \
    --cc=broonie@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=javier.martinez@collabora.co.uk \
    --cc=kgene.kim@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=m.szyprowski@samsung.com \
    --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).