Re: [PATCH 3/5] misc: Driver for APDS990X ALS and proximity sensors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 05, 2010 at 12:23:23PM +0100, Alan Cox wrote:

> > +	chip->regs[0].supply = reg_vcc;
> > +	chip->regs[1].supply = reg_vled;

> Shouldn't these come from the provided platform data ? and again if there
> isn't a platform one supplied just skip the regulators. There are going

No, don't do this.  The device should just request the supplies that
correspond to the physical supplies for the device and let the regulator
API worry about actually providing regulators to match it.  If
regulators are getting passed in as platform data something has gone
wrong.

> to be cases of boxes with regulator API stuff in use but who don't have
> regulators for that device.

If there genuinely is no supply present on the pin then the device needs
to know that; if there is a supply present but it's not software managed
then the regulator API can cope with that.

Trying to handle this in individual device drivers just results in reams
of cut'n'paste code in device drivers, frequently requring the addition
of platform data to devices that would not otherwise require any.  We've
tried it, it's painful.  Having the machine specific data provided as a
generic regulator API service provides a great degree of simplification.
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux