Re: [PATCH] leds: pca955x: add GPIO support

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

 




Hello,

On 05/13/2017 01:26 PM, Pavel Machek wrote:
> On Tue 2017-05-09 08:36:12, Cédric Le Goater wrote:
>> The PCA955x family of chips are I2C LED blinkers whose pins not used
>> to control LEDs can be used as general purpose I/Os (GPIOs).
>>
>> The following adds support for device tree and Open Firmware to be
>> able do define different operation modes for each pin. See bindings
>> documentation for more details. The pca955x driver is then extended
>> with a gpio_chip when pins are operating in GPIO mode.
> 
> Actually.. maybe better solution would be to turn this into GPIO
> driver, and then use gpio-leds on top...?

yes probably. We could introduce a new driver for the PCA955[0-3]
when all pins are in GPIO mode. I have taken the approach of the 
leds-pca9532 which behaves quite similarly. 

> What is the difference between pin in GPIO mode and pin in LED mode?

Well, first of all the PCA955[0-3] are LED blinkers chips, and not 
GPIO chips. So you have an extra couple registers to set the frequency 
and the pwm.

As for the pins in GPIO mode, here is what the specs says : 

- For input, set LEDn to high-impedance (01) and then read the pin 
  state via the input register.

- For output, LED output pin is HIGH when the output is programmed 
  as high-impedance, and LOW when the output is programmed LOW through 
  the LS register. The output can also be pulse-width controlled when 
  PWM0 or PWM1 are used.

So for output, GPIO control is quite similar to LED control. For input,
the INPUTx registers need to be read.

Thanks,

C. 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux