All of lore.kernel.org
 help / color / mirror / Atom feed
From: mandeepsandhu.chd@gmail.com (Mandeep Sandhu)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Putting artificial delays in a char driver
Date: Thu, 19 May 2011 17:00:33 +0530	[thread overview]
Message-ID: <BANLkTinMixUbdoXE04TEiO78ssX4fHeBUw@mail.gmail.com> (raw)

Hi All,

I was fiddling around with an IR remote driver for my embedded
platform to see if I can make the IR LED light (connected to GPIO's)
blink on IR activity.

The IR driver behaves like a char driver. The way to make the LED
on/off is to simply write to some GPIO reg with a 1/0. So I was
switching on the LED at the beginning of the function that reads data
(in ISR context) and then switching it off at the end of that
function.

The problem was that all this happens too fats and I'm barely able to
see the LED blink (there's only a faint flicker)! :)

I tired various places in the driver to keep on/off calls as "far" as
possible (ON in ISR and then OFF _after_ a copy_to_user()), but that
did not help much.

Whats the recommended way of solving this issue? I'm working on
drivers after a really long time (last time I worked on a driver was
when LDD 2nd ed was published!) so I'm not sure if bottom-halves or
work-queues should be used.

I was thinking what if I introduce an artificial delay in my driver
where I "sleep/wait" for a few millsecs after switching on the LED and
then switch it off after the incoming data has been processed. Is that
a good idea?

TIA,
-mandeep

             reply	other threads:[~2011-05-19 11:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-19 11:30 Mandeep Sandhu [this message]
2011-05-19 11:51 ` Putting artificial delays in a char driver Felix Varghese
2011-05-20  6:40   ` Mandeep Sandhu
2011-05-19 12:30 ` Joachim Holst
2011-05-20  6:43   ` Mandeep Sandhu

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=BANLkTinMixUbdoXE04TEiO78ssX4fHeBUw@mail.gmail.com \
    --to=mandeepsandhu.chd@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.