Thread (9 messages) read the whole thread 9 messages, 3 authors, 2012-02-08

Re: Regulator support for smsc911x

From: Sascha Hauer <s.hauer@pengutronix.de>
Date: 2012-02-08 08:31:47

On Tue, Feb 07, 2012 at 07:39:14PM +0000, Mark Brown wrote:
On Tue, Feb 07, 2012 at 05:25:48PM -0200, Fabio Estevam wrote:
quoted
On Fri, Feb 3, 2012 at 9:11 AM, Mark Brown
quoted
quoted
There's also options c) set up the regulators for the board and d) don't
enable the regulator API if the board doesn't use regulators.
quoted
Option c would require that we change every single board.
Well, yes.
quoted
The patch below does option d.
quoted
What do you think?
Absolutely not.  Putting conditional code like this in drivers is nuts,
you would have to do the same thing in every single driver which is not
a useful use of anyone's time.  This is *clearly* a generic thing and
should therefore be handled in generic code for the same reason we don't
have driver specific platform data for actual usage of the API.

Really, anyone who wants this sort of thing should just enable dummy
regulators - it's exactly what you're implementing.  I'm pretty sure
your board does actually have power supplies for the chip, you've just
not told software about them.
Yes, my board also has a supply for the smc911x, it's the same as used
for the CPU...

There is also option e), something I've been thinking about for a while.
Implement a list of resources which can be attached to a device. By
resources I mean regulators, clocks and pinmux for example. A device
would then just call a make_me_work(state) function which iterates over
this list and enables/disables all resources as necessary. This way we
could attach everything we need to a device without cluttering the
driver code like we do today.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help