linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: Richard Purdie <rpurdie@rpsys.net>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
	Joel Stanley <joel@jms.id.au>
Subject: Re: [PATCH] leds: pca955x: add GPIO support
Date: Mon, 22 May 2017 21:53:36 +0200	[thread overview]
Message-ID: <20170522195336.GA15681@amd> (raw)
In-Reply-To: <b1834a28-f094-0c46-4ac1-7830575701c7@kaod.org>

[-- Attachment #1: Type: text/plain, Size: 2045 bytes --]

Hi!

> > 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.

Does the GPIO mode differ electrically?

> > 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.

Well.. PWM is used all over the place, not only for LEDs.

> 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.

Ok, makes sense. So you have GPIO pins with PWM support. (And some
kind of blinking? Blinking sounds like a low frequency PWM to me :-).

Can you take a look at drivers/pwm?

Thanks,
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

      reply	other threads:[~2017-05-22 19:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-09  6:36 [PATCH] leds: pca955x: add GPIO support Cédric Le Goater
2017-05-11 20:23 ` Jacek Anaszewski
2017-05-12  6:24   ` Cédric Le Goater
     [not found]     ` <7d30134c-c8c6-3475-1a7a-534199167b5c-Bxea+6Xhats@public.gmane.org>
2017-05-15 19:23       ` Jacek Anaszewski
2017-06-09 11:13         ` Cédric Le Goater
     [not found]           ` <24ff150b-0c12-3b5c-fbcd-5b8bedce3139-Bxea+6Xhats@public.gmane.org>
2017-06-09 20:56             ` Jacek Anaszewski
     [not found]               ` <0c738e3d-4c13-9ba2-d1ef-50e471019756-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-06-10  6:00                 ` Cédric Le Goater
     [not found]   ` <20b94199-a154-53cd-96d1-910ae3de1085-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-05-23  8:18     ` Linus Walleij
2017-05-23 10:58       ` Cédric Le Goater
     [not found] ` <1494311772-21872-1-git-send-email-clg-Bxea+6Xhats@public.gmane.org>
2017-05-13 11:26   ` Pavel Machek
2017-05-15  6:29     ` Cédric Le Goater
2017-05-22 19:53       ` Pavel Machek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170522195336.GA15681@amd \
    --to=pavel@ucw.cz \
    --cc=clg@kaod.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jacek.anaszewski@gmail.com \
    --cc=joel@jms.id.au \
    --cc=linux-leds@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=rpurdie@rpsys.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).