[ltp] [PATCH] 2.6.16 ThinkPad T43/R52/*60 PnP IrDA support (try 2)

Henrique de Moraes Holschuh linux-thinkpad@linux-thinkpad.org
Sun, 4 Jun 2006 11:36:11 -0300


The old 2.6.16 patches, based on 2.6.17rc5 do NOT work.  Changes in 2.6.17
cause the patch to hose the kernel and become highly instable after a rmmod.

So, here is a *hack* that seems to work fine.  It is based on the old
patches we had for 2.6.12-2.6.15 in thinkwiki.org.

This hacked version of the nsc-ircc should support the T43/R52, as well as
any other models that used to work before *and* need PnP support to enable
the FIR device -- if stock nsc-ircc supports your ThinkPad, do *not* apply
this patch.  

You absolutely *must* have the FIR device enabled in BIOS for it to have a
chance of working, btw.

Since the mailinglist is eating my posts, I will reply with the patch, and
with the "already patched" nsc-ircc.c and nsc-ircc.h.

Please test, and report back.  I still don't have a FIR device to play with,
but I can and did test module load/unload and sw-suspend2 hibernation.

Notes:

1. Just like the old patches, it has *no* power management support, so
*unload the module on suspend and hibernate*, otherwise I doubt IrDA will
work after a resume.  This should disable IrDA and conserve power during
sleep, as a bonus.  

THIS MEANS YOU ARE TO ADD nsc-ircc TO THE SWSUSPEND2 MODULE BLACKLIST WHEN
USING THIS PATCH!

2. It can be loaded and unloaded (modprobe'd/rmmod'ed) as much as you want,
I tried it 100 times and nothing weird happened to the kernel.  So, it does
*not* have the same bug as the 2.6.17-rc5 modules on a 2.6.16 tree.

3. It *does not do PnP auto-detection*.  I could implement this, I
suppose... but it is a waste of time better spent on 2.6.17, and what
existed in 2.6.15 does not work right (in 2.6.16? ever?) anyway.

4. You *have* to specify the dongle_id, io, irq and dma parameters.

How it works:

PnP is used only to enable and disable the device on module load/unload, so
you have to give it the correct "io=0x2f8 irq=3 dma=3" (change as needed)
parameters.  The PnP layer does *not* change or autoconfig anything.
If running in debug mode, the module now tells you this (and tells you what
it thinks the io, dma and irq parameters should be, btw!).

The nsc-ircc code *does* attempt to autodetect the dongle, but it does this
doing some dubious IO operations to the FIR controller, which appear to not
be working right all the time (otherwise we would never have to specify the
dongle id :P).  It is much better -- and 50us faster -- to specify the
dongle_id manually.  I have no datasheets to know if increasing the
autodetect delay of 50us to 100us would help, but who wants the kernel
spinning in place for no good reason anyway?

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh