Rockbox mail archiveSubject: Re: Classic holdswitch polling
Re: Classic holdswitch polling
From: Michael Sparmann <theseven_at_gmx.net>
Date: Mon, 05 Mar 2012 12:40:38 +0100
> a) Put PMU polling into a critical section and continue polling from
> irq handler. The delay for some i2c operations (i2c_read(date)) is
> relatively high so i think this is not the best solution, but its easy
> and probably it will work.
Will not work, because if some other thread was accessing I2C while that
IRQ fires, the IRQ handler will mess up a thread's I2C access.
Things that are run from an IRQ handler are in fact in a critical
section, no need to arbitrarily create one :)
> b) To get PMU polling out of the interrupt handler. For me this is a
> better solution, its a minor change but there is no obvious place to
> do it, actually it is managed on the tick interrupt for all targets.
> The powermgmt thread doesn't seems to be an appropriate place, but
> creating a new thread only for this target looks wasteful, maybe the
> backlight thread or the misc event handler? .
Well, I don't see another way to solve this, but I'm not quite certain
if changing this just for a single target is a good idea. Does this
stuff need to be done in IRQ mode at all? Do we even need such a thing
as tick tasks? Or would it be better to have kind of a tick task thread?
It might be best to wait until 3.11 is released and then do some more
general rework in this area that moves the tick tasks out of IRQ mode
altogether. Might cause, but also solve, some more issues :)