devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org, Samuel Ortiz <sameo@linux.intel.com>,
	Dmitry Torokhov <dtor@mail.ru>,
	"devicetree-discuss@lists.ozlabs.org"
	<devicetree-discuss@lists.ozlabs.org>,
	Misael Lopez Cruz <misael.lopez@ti.com>,
	Liam Girdwood <lrg@ti.com>, "Cousson, Benoit" <b-cousson@ti.com>
Subject: Re: [PATCH] ASoC: twl6040: Support for DT
Date: Tue, 15 May 2012 11:00:25 +0300	[thread overview]
Message-ID: <4FB20D19.3030801@ti.com> (raw)
In-Reply-To: <20120514121127.GR31985@opensource.wolfsonmicro.com>

Hi Mark,

On 05/14/2012 03:11 PM, Mark Brown wrote:
> I'm just not seeing anything in the device tree that abstracts the chip
> top level from the function drivers; if there were then it'd be very
> much easier to see a general use for this.

While we are discussing on how to handle the twl6040 MFD deive via DT
and to whether load the child drivers via DT or to load them via
mfd_add_devices() I came up with this dts entry for the later case
(mfd_add_devices mode):

&i2c1 {
	twl6040: twl@4b {
		compatible = "ti,twl6040";
		reg = <0x4b>;

		interrupts = <0 119 4>;
		interrupt-parent = <&gic>;
		twl6040,audpwron-gpio = <&gpio4 31 0>;

		vio-supply = <&v1v8>;
		v2v1-supply = <&v2v1>;
		enable-active-high;

		/* regulators for vibra motor */
		vddvibl-supply = <&vbat>;
		vddvibr-supply = <&vbat>;

		vibra {
			/* Vibra driver, motor resistance parameters */
			ti,vibldrv-res = <8>;
			ti,vibrdrv-res = <3>;
			ti,viblmotor-res = <10>;
			ti,vibrmotor-res = <10>;
		};
	};
};

With this mode:
No need to tell that twl6040 is acts as interrupt controller since the
interrupts it is handling is only for internal functions dispatched via
a single irq line toward the CPU.

The audio (ASoC codec) child is always enabled since it is the main
function of the twl6040.

The tricky part is the vibra: it needs two regulators (to provide power
to the motors). Since the regulators can only be connected to the device
described in dt, this is what I need to do:
to get the vibra parameters (in the twl6040-vibra driver):

struct device_node *node = of_find_node_by_name(
				pdev->dev.parent->of_node, "vibra");

...
of_property_read_u32(node, "ti,vibldrv-res", &info->vibldrv_res);
...

To get the regulators needed by the vibra driver when booted with DT:

info->supplies[0].supply = "vddvibl";
info->supplies[1].supply = "vddvibr";
if (!pdata)
	ret = regulator_bulk_get(pdev->dev.parent,
		ARRAY_SIZE(info->supplies), info->supplies);
else
	ret = regulator_bulk_get(info->dev,
		ARRAY_SIZE(info->supplies), info->supplies);


I need to use the pdev->dev.parent to be able to get the needed
regulators. Is this acceptable?

-- 
Péter

  reply	other threads:[~2012-05-15  8:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20120509133511.GQ3955@opensource.wolfsonmicro.com>
     [not found] ` <20120509133511.GQ3955-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-05-11 11:02   ` [PATCH] ASoC: twl6040: Support for DT Cousson, Benoit
2012-05-11 13:08     ` Mark Brown
     [not found]       ` <20120511130816.GB3960-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-05-11 15:44         ` Cousson, Benoit
2012-05-11 20:34           ` Mark Brown
2012-05-14 11:38             ` Peter Ujfalusi
2012-05-14 12:11               ` Mark Brown
2012-05-15  8:00                 ` Peter Ujfalusi [this message]
2012-05-14 15:34         ` Tony Lindgren
2012-05-15  7:41           ` Peter Ujfalusi

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=4FB20D19.3030801@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=b-cousson@ti.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=dtor@mail.ru \
    --cc=lrg@ti.com \
    --cc=misael.lopez@ti.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).