Subject: [PATCH v2] Input: Make ADS7846 independent on regulator

From: [email-masked] (Mark Brown)
Date: Tue, 5 Oct 2010 09:40:38 -0700

On Tue, Oct 05, 2010 at 09:16:08AM -0700, Dmitry Torokhov wrote:
> On Tue, Oct 05, 2010 at 08:49:07AM +0200, Igor Grinberg wrote:

> > You want each platform, that does not have a special regulated power supply
> > for the ads7846, to define a dummy regulator just to cope with that artificial
> > dependency of the device driver?
> > I think it is a waste and big code duplication in each platform
> > that does not have that special regulator.

It's a pretty good fit for most current systems - with current hardware
you will normally have some software control for the vast majority of
the regulators on the board if you have regulator control at all since
that's the way PMICs have gone.  Having a complete map of the regulator
usage in the system is useful since it allows us to do optimisations
like powering down idle regulators much more readily.

> I tend to agree, however I think that original patch that simply ignored
> failures from regulator_get() is not the best option either. Can we have
> a flag in platform data indicating that the board does not employ a
> regulator? Then we could retain the hard failure in cases when we expect
> regulator to be present while allowing to continue on boards that do not
> have it.

I really don't think it's a good idea to add this code to every single
regulator using driver - this seems like an enormous waste of time and
code complexity cost.  I have suggested several times that we should
extend the dummy regulator mode so that boards can enable it from code
as well as users enable it from Kconfig, I'm not sure why everyone is so
keen on bodging this in drivers.