All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Carikli <denis@eukrea.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
Date: Tue, 10 Jun 2014 13:29:33 +0000	[thread overview]
Message-ID: <5397083D.4090400@eukrea.com> (raw)
In-Reply-To: <20140317062026.GZ17250@pengutronix.de>

On 03/17/2014 07:20 AM, Sascha Hauer wrote:
> On Fri, Mar 14, 2014 at 10:12:47AM +0100, Denis Carikli wrote:
>>
>> +		of_property_read_string(display_np, "regulator-name",
>> +					&regulator_name);
>> +
>
> [...]
>
>> +	/* In dt mode,
>> +	 * using devm_regulator_get would require that the proprety referencing
>> +	 * the regulator phandle has to be inside the mx3fb node.
>> +	 */
>> +	if (np) {
>> +		if (regulator_name)
>> +			mx3fbi->reg_lcd = regulator_get(NULL, regulator_name);
>> +
>> +		if (IS_ERR(mx3fbi->reg_lcd))
>> +			return PTR_ERR(mx3fbi->reg_lcd);
>> +	} else {
>> +		/* Permit that driver without a regulator in non-dt mode */
>> +		mx3fbi->reg_lcd = regulator_get(dev, "lcd");
>> +	}
>
> This patch adds regulator support for the display of a i.MX3 IPU. The
> problem Denis has to solve here is that he needs to get the regulator,
> but the display devicenode doesn't have a struct device associated with
> it, so he cannot provide one to regulator_get(). One way out here could
> be a of_regulator_get(struct device_node *). Mark, would this be ok with
> you?

Here, the display devicenode has no struct device associated with it 
like mentioned above.
Because of that, retriving the regulator from the devicetree, for 
instance like regulator_dev_lookup() does, would require a different 
approach.

As I understand it, what happen in regulator_dev_lookup when 
regulator_get(NULL, regulator_name) is used is the following:

Since the struct device is NULL, it skips the struct device based 
lookup, but also the devicetree lookup (it uses dev->of_node for that)
At the end it falls back on a match on the regulator name to find it.

would keeping regulator_get(NULL, regulator_name); in the driver instead 
be better for now?

Denis.

WARNING: multiple messages have this Message-ID (diff)
From: denis@eukrea.com (Denis Carikli)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
Date: Tue, 10 Jun 2014 15:29:33 +0200	[thread overview]
Message-ID: <5397083D.4090400@eukrea.com> (raw)
In-Reply-To: <20140317062026.GZ17250@pengutronix.de>

On 03/17/2014 07:20 AM, Sascha Hauer wrote:
> On Fri, Mar 14, 2014 at 10:12:47AM +0100, Denis Carikli wrote:
>>
>> +		of_property_read_string(display_np, "regulator-name",
>> +					&regulator_name);
>> +
>
> [...]
>
>> +	/* In dt mode,
>> +	 * using devm_regulator_get would require that the proprety referencing
>> +	 * the regulator phandle has to be inside the mx3fb node.
>> +	 */
>> +	if (np) {
>> +		if (regulator_name)
>> +			mx3fbi->reg_lcd = regulator_get(NULL, regulator_name);
>> +
>> +		if (IS_ERR(mx3fbi->reg_lcd))
>> +			return PTR_ERR(mx3fbi->reg_lcd);
>> +	} else {
>> +		/* Permit that driver without a regulator in non-dt mode */
>> +		mx3fbi->reg_lcd = regulator_get(dev, "lcd");
>> +	}
>
> This patch adds regulator support for the display of a i.MX3 IPU. The
> problem Denis has to solve here is that he needs to get the regulator,
> but the display devicenode doesn't have a struct device associated with
> it, so he cannot provide one to regulator_get(). One way out here could
> be a of_regulator_get(struct device_node *). Mark, would this be ok with
> you?

Here, the display devicenode has no struct device associated with it 
like mentioned above.
Because of that, retriving the regulator from the devicetree, for 
instance like regulator_dev_lookup() does, would require a different 
approach.

As I understand it, what happen in regulator_dev_lookup when 
regulator_get(NULL, regulator_name) is used is the following:

Since the struct device is NULL, it skips the struct device based 
lookup, but also the devicetree lookup (it uses dev->of_node for that)
At the end it falls back on a match on the regulator name to find it.

would keeping regulator_get(NULL, regulator_name); in the driver instead 
be better for now?

Denis.

  reply	other threads:[~2014-06-10 13:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14  9:12 [PATCH v7][ 1/5] video: mx3fb: Use devm_kzalloc Denis Carikli
2014-03-14  9:12 ` Denis Carikli
2014-03-14  9:12 ` [PATCH v7][ 2/5] video: mx3fb: Add device tree suport Denis Carikli
2014-03-14  9:12   ` Denis Carikli
2014-03-14  9:12 ` [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support Denis Carikli
2014-03-14  9:12   ` Denis Carikli
2014-03-14  9:23   ` [PATCH v7][ 3/5] video: mx3fb: Introduce =?UTF-8?B?cmVndWxhdG9yIHN1c Alexander Shiyan
2014-03-14  9:23     ` [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support Alexander Shiyan
2014-03-14 11:23     ` Denis Carikli
2014-03-14 11:23       ` Denis Carikli
2014-03-14 12:38       ` [PATCH v7][ 3/5] video: mx3fb: Introduce =?UTF-8?B?cmVndWxhdG9yIHN1c Alexander Shiyan
2014-03-14 12:38         ` [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support Alexander Shiyan
2014-03-17  6:20   ` Sascha Hauer
2014-03-17  6:20     ` Sascha Hauer
2014-06-10 13:29     ` Denis Carikli [this message]
2014-06-10 13:29       ` Denis Carikli
2014-08-22 22:00       ` Mark Brown
2014-08-22 22:00         ` Mark Brown
2014-06-19  6:58   ` Denis Carikli
2014-06-19  6:58     ` Denis Carikli
2014-03-14  9:12 ` [PATCH v7][ 4/5] ARM: dts: i.MX35: Add display support Denis Carikli
2014-03-14  9:12   ` Denis Carikli
2014-03-14  9:12 ` =?UTF-8?q?=5BPATCH=20v7=5D=5B=205/5=5D=20ARM=3A=20dts=3A=20mbimxsd35=20Add=20video=20and=20displays= Denis Carikli
2014-03-14  9:12   ` [PATCH v7][ 5/5] ARM: dts: mbimxsd35 Add video and displays support Denis Carikli
2014-05-08 10:31 ` [PATCH v7][ 1/5] video: mx3fb: Use devm_kzalloc Tomi Valkeinen
2014-05-08 10:31   ` Tomi Valkeinen

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=5397083D.4090400@eukrea.com \
    --to=denis@eukrea.com \
    --cc=linux-arm-kernel@lists.infradead.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.