linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>
Subject: Re: Single gpio shared by LED and switch?
Date: Mon, 7 Sep 2015 15:22:44 +0200	[thread overview]
Message-ID: <CAMuHMdUrhrJv_3UX32AMC2Z_f4xp+LABgDCjgWdcJFa6=k9n_g@mail.gmail.com> (raw)
In-Reply-To: <55ED8B36.60108@samsung.com>

Hi Jacek,

On Mon, Sep 7, 2015 at 3:03 PM, Jacek Anaszewski
<j.anaszewski@samsung.com> wrote:
> On 09/01/2015 07:00 PM, Geert Uytterhoeven wrote:
>> I'm wondering if there already exists a driver for a gpio that's connected
>> to both an LED and an input switch.
>>
>> I'd expect such a hardware configuration to be fairly common, as gpios can
>> be
>> a limited resource.
>> Most of the time the gpio would be in output mode, driving the LED, but at
>> regular intervals the mode would be changed for a very short moment to
>> input,
>> to monitor the state of the switch.
>>
>> I had a quick look at various drivers (and of course at
>> Documentation/gpio/drivers-on-gpio.txt), but couldn't find any.
>>
>> Does such a hybrid of "leds-gpio" and "gpio-keys(-polled)" already exists?
>
> Can you share an example of such a circuit? Would it be possible to

Something like this?

                     VCC         VCC
                      |           |
                      R           R
                      |           |
              __|__   |           |
          +---o   o---+          _|_
          |           |          \ /
          |           |          ---
         GND          R           |
                      |           |
                      |         |-+
                      |         |<+
GPIO -----------------+---------|-|
                                  |
                                  |
                                 GND

> construct it without additional GPIO driven transistor?

Perhaps just like this?

                     VCC
                      |
                      R
                      |
                      |
                     _|_
                     \ /
                     ---
                      |
                      |
GPIO -----R-----------+
                      |
                      |
                    | o
                   -|
                    | o
                      |
                      |
                     GND

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2015-09-07 13:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01 17:00 Single gpio shared by LED and switch? Geert Uytterhoeven
2015-09-07 13:03 ` Jacek Anaszewski
2015-09-07 13:22   ` Geert Uytterhoeven [this message]
2015-09-08 10:51     ` Jacek Anaszewski
2015-09-08 14:37       ` Linus Walleij
2015-09-09  7:25         ` Jacek Anaszewski
2015-09-09  7:35           ` Geert Uytterhoeven

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='CAMuHMdUrhrJv_3UX32AMC2Z_f4xp+LABgDCjgWdcJFa6=k9n_g@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=j.anaszewski@samsung.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    /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).