Skip to content

Sort out i8253 and PC speaker locking and headers

[email protected] alsa-devel linux-alpha linux-arch linux-arm-kernel linux-input linux-mips linuxppc-dev lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 31 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14i8253: Create <linux/i8253.h> and make all in kernel users to use it.arch/arm/mach-footbridge/isa-timer.c arch/mips/cobalt/time.c arch/mips/jazz/irq.c +16 more+29 -182 replies
2/14i8253: Unify all kernel declarations of i8253_lock in <linux/i8253.h>.arch/arm/include/asm/i8253.h arch/mips/include/asm/i8253.h arch/x86/include/asm/i8253.h +1 more+14 -312 replies
3/14i8253: Consolidate all kernel definitions of i8253_lock in lib/i8253-lock.c.lib/Kconfig lib/Makefile lib/i8253-lock.c+18 -02 replies
4/14i8253: Make MIPS use the shared i8253_lock.arch/mips/Kconfig arch/mips/kernel/i8253.c+1 -30 replies
5/14i8253: Make x86 use the shared i8253_lock.arch/x86/Kconfig arch/x86/kernel/i8253.c+1 -30 replies
6/14i8253: Make pcspkr input driver use the shared i8253_lock.drivers/input/misc/pcspkr.c+1 -82 replies
7/14i8253: Make pcsp sound driver use the shared i8253_lock.sound/drivers/pcsp/pcsp.h+1 -73 replies
8/14i8253: Alpha: Cleanup remaining users of i8253pit.harch/alpha/kernel/sys_ruffian.c arch/alpha/kernel/time.c+0 -22 replies
9/14i8253: Alpha, PowerPC: Remove unused <asm/8253pit.h> header.arch/alpha/include/asm/8253pit.h arch/powerpc/include/asm/8253pit.h+0 -63 replies
10/14i8253: x86: Consolidate definitions of global_clock_eventarch/x86/include/asm/apb_timer.h arch/x86/include/asm/i8253.h arch/x86/include/asm/time.h +4 more+8 -52 replies
11/14i8253: Consolidate definitions of PIT_LATCHarch/arm/include/asm/i8253.h arch/mips/include/asm/i8253.h arch/x86/include/asm/i8253.h +1 more+4 -62 replies
12/14i8253: Move remaining content and delete <asm/i8253.h>arch/arm/include/asm/i8253.h arch/mips/include/asm/i8253.h arch/mips/include/asm/time.h +3 more+6 -213 replies
13/14PCSPKR: Cleanup Kconfig dependenciesarch/alpha/Kconfig arch/mips/Kconfig arch/powerpc/platforms/chrp/Kconfig +4 more+10 -13 replies
14/14PCSPKR: MIPS: Make config dependencies finer grained.arch/mips/Kconfig+3 -12 replies

Reviews trailers per patch

3 of 14 patches have a Reviewed-by or Acked-by.

PatchTakashi IwaiBenjamin Herrenschmidt
1/14
2/14
3/14
4/14
5/14
6/14
7/14A-b A-b A-b
8/14
9/14A-b A-b
10/14
11/14
12/14
13/14A-b A-b A-b
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [patch 00/14] Sort out i8253 and PC speaker locking and headers

No longer terribly relevant these days but still broken and just an eyesore mess of neglience just as I've already raised it a few days ago. Time to sort this.

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 the status is:

Alpha: There is no PCSPKR_PLATFORM so while a platform device is
being installed no drivers will be built. I don't know which Alpha platforms or even if all of Alpha should be doing a PCSPKR_PLATFORM so I haven't even tried to sort this.
ARM: No PC speaker supported, yeah :)
PowerPC: Should compile but the locking is wrong but only the AmigaOne
platforms should be affected.
MIPS: Ok.
x86: Ok.
All others: No PC speaker supported

Also only the plain old IBM PC XT was using a i8253; every later system had i8254. So maybe this is the time for renaming the support code?

Ralf