From: Rodolfo Giometti <giometti@enneenne.com>
To: Liam Girdwood <lrg@slimlogic.co.uk>,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: linux-kernel@vger.kernel.org
Subject: regulator_register() API
Date: Tue, 9 Jun 2009 15:59:47 +0200 [thread overview]
Message-ID: <20090609135947.GB18591@gundam.enneenne.com> (raw)
Hello,
I'm trying to add the regulator support to my driver for max8821
(white led charge pump with mono class D audio amp and dual LDO).
Current regulator_register() implementation forces the caller to
allocate a proper device for each regulators and also the line:
struct regulator_init_data *init_data = dev->platform_data;
forces the user to define the pointer platform_data as a "struct
regulator_init_data" only.
Since max8821 has both leds and LDOs I compared the functions
regulator_register() and led_classdev_register() and IMHO the latter
is more versatile/easy-to-use than the former. :)
In a multifunctional device connected with an I2C bus (as the max8821
is) it's quite complex defining a regulator device since I must
provide a new device for each regulators and redefing platform_data
for each registration.
However if the regulator_register() worked in a similar way to
led_classdev_register(), I simply can do something like this:
for (i = 0; i < regulators_num; i++) {
/* init regulators structs */
...
ret = regulator_register(&client->dev, ®[i].dev);
if (ret < 0)
dev_warn(&client->dev, "unable to register\n");
}
and writing the support for my multifunctional device will be
easier. :)
What about if I add a new function regulator_classdev_register() which
in turn calls regulator_register() doing in a similar way than
led_classdev_register() does?
This will keep backward compatibility with old drivers and may offer a
more versatile way to define a regulator expecially for
multifunctional devices.
Ciao,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti@enneenne.com
Linux Device Driver giometti@linux.it
Embedded Systems phone: +39 349 2432127
UNIX programming skype: rodolfo.giometti
next reply other threads:[~2009-06-09 14:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-09 13:59 Rodolfo Giometti [this message]
2009-06-09 15:18 ` regulator_register() API Mark Brown
2009-06-09 15:52 ` Rodolfo Giometti
2009-06-09 22:06 ` 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=20090609135947.GB18591@gundam.enneenne.com \
--to=giometti@enneenne.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
/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