[i2c] [PATCH] basic gpio_chip support for 16-bit PCA9539 GPIO expander

eric miao eric.y.miao at gmail.com
Tue Dec 4 07:47:26 CET 2007


David,

I found there are quite a lot similar I/O chips that Philips/NXP offers, like
PCA9555 and PCA9535, I'm not 100% sure about the difference, but I'd
prefer to take some time looking into that and have another patch later,
which should be harmless.

Attached are the patches updated (sorry for the inconvenience). As suggested,
divided into two patches, and introduce a CONFIG_PCA9539_GENERIC_IRQ
option to be selected _only_ when the driver is selected to be built-in, thus
avoid ugly #ifdef MODULE in driver, and solve the dependency issue
in a cleaner way.

Validated on zylonite/pxa310. Please review.

On Dec 4, 2007 11:33 AM, David Brownell <david-b at pacbell.net> wrote:
> On Monday 03 December 2007, eric miao wrote:
>
> > >       Did you
> > > verify that nobody in mainline needs legacy driver support for
> > > these chips, by the way?
> > >
> >
> > #> grep -iR "pca9539" *
> >
> > gave me the following potential users of pca9539:
> >
> > arch/mips/configs/bigsur_defconfig:CONFIG_SENSORS_PCA9539=y
> > arch/mips/configs/mtx1_defconfig:CONFIG_SENSORS_PCA9539=m
> > ...
> > arch/arm/configs/picotux200_defconfig:CONFIG_SENSORS_PCA9539=m
> > ...
> >
> > and I doubt if these defconfigs are sane about their I2C configurations
> > (if you don't mind take a look into these files :-),
>
> I've seen that issue with a few defconfigs, yes.
>
>
> > and also with Ben's
> > acknowledgment, I don't think this would be a problem. If you don't
> > feel good about this, I can try adding those sysfs stuffs back, though
> > the final code might be a bit uglier.
>
> No, I don't much like that sysfs interface.  If nobody actually
> needs it (Ben might be the best person to know), I have no qualms
> with removing it.
>
>
> > >              (FWIW
> > > the only I2C driver I know of in mainline that handles any kind
> > > of pluggable IRQ handler is the menelaus driver in that same
> > > directory.  It doesn't use irq_chip.)
> > >
> >
> > Yes, because it's not an IRQ chip, the menelaus driver tries
> > only to access the I2C bus within interrupt context.
>
> I don't quite follow.  It doesn't access I2C from IRQ context;
> no I2C driver can do that.  AFAIK the driver predates genirq,
> but I'm not sure it would have used irq_chip anyway ...
>
>
> > > This driver seems like it should handle pca9535 chips too;
> > > the key difference seems to be that the '39 has a reset input
> > > instead of the extra address pin on the '35.
> > >
> > > Plus several other chips in this family look to be similar
> > > enough that this driver should be able to handle them without
> > > much work at all. ...
> >
> > I don't have those chips to test, so I'd prefer someone modifying
> > this later.
>
> Check the pca9535 docs though; I think you'll find that updating
> docs and Kconfig to say the '39 driver should handle the '35 is
> a "safe" change.
>
> - Dave
>



-- 
Cheers
- eric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-pxa-basic-gpio_chip-support-for-16-bit-PCA9539-GPIO.patch
Type: application/octet-stream
Size: 14180 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/i2c/attachments/20071204/ccd4c021/attachment-0002.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-pxa-add-Generic-IRQ-support-for-16-bit-PCA9539-GPIO.patch
Type: application/octet-stream
Size: 8248 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/i2c/attachments/20071204/ccd4c021/attachment-0003.obj 


More information about the i2c mailing list