public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* i8253 locking and PC speaker on non-{mips,x86}
@ 2011-05-28 11:21 Ralf Baechle
  2011-05-28 14:21 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Ralf Baechle @ 2011-05-28 11:21 UTC (permalink / raw)
  To: linux-arch, linux-kernel, alsa-devel, Jaroslav Kysela,
	Takashi Iwai

No longer terribly relevant these days but ...

drivers/input/misc/pcspkr.c:

#if defined(CONFIG_MIPS) || defined(CONFIG_X86)
/* Use the global PIT lock ! */
#include <asm/i8253.h>
#else
#include <asm/8253pit.h>
static DEFINE_RAW_SPINLOCK(i8253_lock);
#endif

sound/drivers/pcsp/pcsp.h:

#if defined(CONFIG_MIPS) || defined(CONFIG_X86)
/* Use the global PIT lock ! */
#include <asm/i8253.h>
#else
#include <asm/8253pit.h>
static DEFINE_RAW_SPINLOCK(i8253_lock);

$ git grep -F pcsp.h sound/drivers/pcsp
sound/drivers/pcsp/pcsp.c:#include "pcsp.h"
sound/drivers/pcsp/pcsp_input.c:#include "pcsp.h"
sound/drivers/pcsp/pcsp_lib.c:#include "pcsp.h"
sound/drivers/pcsp/pcsp_mixer.c:#include "pcsp.h"
$ git grep -w i8253_lock sound/drivers/pcsp/
sound/drivers/pcsp/pcsp.h:static DEFINE_RAW_SPINLOCK(i8253_lock);
sound/drivers/pcsp/pcsp_input.c:        raw_spin_lock_irqsave(&i8253_lock, flags
sound/drivers/pcsp/pcsp_input.c:        raw_spin_unlock_irqrestore(&i8253_lock, 
sound/drivers/pcsp/pcsp_lib.c:          raw_spin_lock_irqsave(&i8253_lock, flags
sound/drivers/pcsp/pcsp_lib.c:          raw_spin_unlock_irqrestore(&i8253_lock, 
sound/drivers/pcsp/pcsp_lib.c:  raw_spin_lock(&i8253_lock);
sound/drivers/pcsp/pcsp_lib.c:  raw_spin_unlock(&i8253_lock);
sound/drivers/pcsp/pcsp_lib.c:  raw_spin_lock(&i8253_lock);
sound/drivers/pcsp/pcsp_lib.c:  raw_spin_unlock(&i8253_lock);

Locks are great, everybody should have their own lock!

$ find . -name 8253pit.h
./arch/powerpc/include/asm/8253pit.h
./arch/alpha/include/asm/8253pit.h
$ cat arch/*/include/asm/8253pit.h
/*
 * 8253/8254 Programmable Interval Timer
 */
/*
 * 8253/8254 Programmable Interval Timer
 */
$

Eh...

$ git grep -w PCSPKR_PLATFORM 
arch/mips/Kconfig:      select PCSPKR_PLATFORM
arch/mips/Kconfig:      select PCSPKR_PLATFORM
arch/mips/Kconfig:      select PCSPKR_PLATFORM
arch/powerpc/platforms/amigaone/Kconfig:        select PCSPKR_PLATFORM
drivers/input/misc/Kconfig:     depends on PCSPKR_PLATFORM
init/Kconfig:config PCSPKR_PLATFORM
sound/drivers/Kconfig:  depends on PCSPKR_PLATFORM && X86 && HIGH_RES_TIMERS

So works on MIPS and x86.  Compiles on PowerPC but locking is wrong.  On
Alpha can't even be selected though it sees otherwise right except the
locking and even worse for the rest.

  Ralf

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: i8253 locking and PC speaker on non-{mips,x86}
  2011-05-28 11:21 i8253 locking and PC speaker on non-{mips,x86} Ralf Baechle
@ 2011-05-28 14:21 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2011-05-28 14:21 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-arch, linux-kernel, alsa-devel, Jaroslav Kysela

At Sat, 28 May 2011 12:21:20 +0100,
Ralf Baechle wrote:
> 
> No longer terribly relevant these days but ...
> 
> drivers/input/misc/pcspkr.c:
> 
> #if defined(CONFIG_MIPS) || defined(CONFIG_X86)
> /* Use the global PIT lock ! */
> #include <asm/i8253.h>
> #else
> #include <asm/8253pit.h>
> static DEFINE_RAW_SPINLOCK(i8253_lock);
> #endif
> 
> sound/drivers/pcsp/pcsp.h:
> 
> #if defined(CONFIG_MIPS) || defined(CONFIG_X86)
> /* Use the global PIT lock ! */
> #include <asm/i8253.h>
> #else
> #include <asm/8253pit.h>
> static DEFINE_RAW_SPINLOCK(i8253_lock);
> 
> $ git grep -F pcsp.h sound/drivers/pcsp
> sound/drivers/pcsp/pcsp.c:#include "pcsp.h"
> sound/drivers/pcsp/pcsp_input.c:#include "pcsp.h"
> sound/drivers/pcsp/pcsp_lib.c:#include "pcsp.h"
> sound/drivers/pcsp/pcsp_mixer.c:#include "pcsp.h"
> $ git grep -w i8253_lock sound/drivers/pcsp/
> sound/drivers/pcsp/pcsp.h:static DEFINE_RAW_SPINLOCK(i8253_lock);
> sound/drivers/pcsp/pcsp_input.c:        raw_spin_lock_irqsave(&i8253_lock, flags
> sound/drivers/pcsp/pcsp_input.c:        raw_spin_unlock_irqrestore(&i8253_lock, 
> sound/drivers/pcsp/pcsp_lib.c:          raw_spin_lock_irqsave(&i8253_lock, flags
> sound/drivers/pcsp/pcsp_lib.c:          raw_spin_unlock_irqrestore(&i8253_lock, 
> sound/drivers/pcsp/pcsp_lib.c:  raw_spin_lock(&i8253_lock);
> sound/drivers/pcsp/pcsp_lib.c:  raw_spin_unlock(&i8253_lock);
> sound/drivers/pcsp/pcsp_lib.c:  raw_spin_lock(&i8253_lock);
> sound/drivers/pcsp/pcsp_lib.c:  raw_spin_unlock(&i8253_lock);
> 
> Locks are great, everybody should have their own lock!

Yeah, if they were actually built.  But snd-pcsp driver is built only
for x86:

config SND_PCSP
	tristate "PC-Speaker support (READ HELP!)"
	depends on PCSPKR_PLATFORM && X86 && HIGH_RES_TIMERS
	depends on INPUT
	depends on EXPERIMENTAL

So, the current code in sound/drivers/pcsp/pcsp.h is harmless, but
just confusing because of copy-and-paste from
drivers/input/misc/pcspkr.c.
The part for non-x86 should be removed or commented better.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-28 14:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-28 11:21 i8253 locking and PC speaker on non-{mips,x86} Ralf Baechle
2011-05-28 14:21 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox