2004-09-05 02:44:13

by [email protected]

[permalink] [raw]
Subject: Intel ICH - sound/pci/intel8x0.c

The joystick PCI ID table in intel8x0.c is not correct. Joysticks and
MIDI ports are ISA devices and need be located by manual probing. This
ID table needs to be removed. Joystick and MIDI ports do not have PCI
IDs.

The PCI IDs in this table are for the ISA bridge chips, not the
joystick port. These PC IDs should belong to the PCI bus driver. If I
fix the PCI bus driver to claim these like it should, joystick support
won't work any more.

static struct pci_device_id snd_intel8x0_joystick_ids[] = {
{ 0x8086, 0x2410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* 82801AA */
{ 0x8086, 0x2420, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* 82901AB */
{ 0x8086, 0x2440, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICH2 */
{ 0x8086, 0x244c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICH2M */
{ 0x8086, 0x248c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICH3 */
// { 0x8086, 0x7195, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* 440MX */
// { 0x1039, 0x7012, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* SI7012 */
{ 0x10de, 0x01b2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* NFORCE */
{ 0x10de, 0x006b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* NFORCE2 */
{ 0x10de, 0x00db, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* NFORCE3 */
{ 0, }
};

2410 82801AA ISA Bridge (LPC)
2420 82801AB ISA Bridge (LPC)
2440 82801BA ISA Bridge (LPC)
244c 82801BAM ISA Bridge (LPC)
248c 82801CAM ISA Bridge (LPC)
01b2 nForce ISA Bridge

--
Jon Smirl
[email protected]


2004-09-05 12:58:10

by Alan

[permalink] [raw]
Subject: Re: Intel ICH - sound/pci/intel8x0.c

On Sul, 2004-09-05 at 03:43, Jon Smirl wrote:
> The joystick PCI ID table in intel8x0.c is not correct. Joysticks and
> MIDI ports are ISA devices and need be located by manual probing. This
> ID table needs to be removed. Joystick and MIDI ports do not have PCI
> IDs.

It isn't that simple. The LPC bridge also contains the controls for the
joystick ports. You also need them for hotplug handling of the bridge
should someone stick one in a laptop docking station. The ID table also
ensures the driver is loaded. It's probably true that it will need
splitting up a bit if another driver also needs ownership of the LPC
bridge but for now that hasn't happened.

Also a lot of other vendors Midi and joystick ports do have PCI ids.

Alan

2004-09-05 15:26:07

by [email protected]

[permalink] [raw]
Subject: Re: Intel ICH - sound/pci/intel8x0.c

Ok, I can change so I don't have to take ownership of the bridge from
the PCI driver so there isn't a conflict. "Intel ICH Joystick" is a
deceptive name for this driver. It should be named something like "LPC
bridge" since there are other things on that device than the joystick.
Why does just the joystick need a special driver and nothing else on
that bridge needs one? Wouldn't PS/2, serial, parallel, etc all have
this problem?

"Intel ICH" is also a bad driver name. I'd prefer something like
"snd_intel8x0" since that is what the module is named.

On Sun, 05 Sep 2004 12:55:27 +0100, Alan Cox <[email protected]> wrote:
> Also a lot of other vendors Midi and joystick ports do have PCI ids.

I was thinking about this from the probing side. You can't count on
midi and joystick ports having PCI IDs so you have to manually probe.
But I also see how a card with a PCI ID could have these ports on it
and also include logic for turning them off and on.

On Sun, 05 Sep 2004 12:55:27 +0100, Alan Cox <[email protected]> wrote:
> On Sul, 2004-09-05 at 03:43, Jon Smirl wrote:
> > The joystick PCI ID table in intel8x0.c is not correct. Joysticks and
> > MIDI ports are ISA devices and need be located by manual probing. This
> > ID table needs to be removed. Joystick and MIDI ports do not have PCI
> > IDs.
>
> It isn't that simple. The LPC bridge also contains the controls for the
> joystick ports. You also need them for hotplug handling of the bridge
> should someone stick one in a laptop docking station. The ID table also
> ensures the driver is loaded. It's probably true that it will need
> splitting up a bit if another driver also needs ownership of the LPC
> bridge but for now that hasn't happened.
>
> Also a lot of other vendors Midi and joystick ports do have PCI ids.
>
> Alan
>
--
Jon Smirl
[email protected]

2004-09-05 18:49:48

by Matthieu Castet

[permalink] [raw]
Subject: Re: Intel ICH - sound/pci/intel8x0.c

On Sul, 2004-09-05 at 03:43, Jon Smirl wrote:
> The joystick PCI ID table in intel8x0.c is not correct. Joysticks and
> MIDI ports are ISA devices and need be located by manual probing. This
> ID table needs to be removed. Joystick and MIDI ports do not have PCI
> IDs.

I agree, that was I explain in a previous post
(http://marc.theaimsgroup.com/?l=linux-kernel&m=109420281830288&w=2)
see the PS.


> It isn't that simple. The LPC bridge also contains the controls for
> the
> joystick ports. You also need them for hotplug handling of the bridge
> should someone stick one in a laptop docking station. The ID table
> also
> ensures the driver is loaded. It's probably true that it will need
> splitting up a bit if another driver also needs ownership of the LPC
> bridge but for now that hasn't happened.

Not for jostick and midi stuff you have to use pnp bus.
On my computer it works well :
I have removed the support of MIDI and GAMEPORT in alsa driver.
The gameport is handle with ns558
The midi device with a mpu401_pnp I post on the alsa mailling list
(http://sourceforge.net/mailarchive/forum.php?thread_id=5468125&forum_id=1751)
For that it work well you need a pnpbios patch
(http://marc.theaimsgroup.com/?l=linux-kernel&m=109411306024720&w=2) or
even try to use my pnpacpi patch
(http://marc.theaimsgroup.com/?l=linux-kernel&m=109430451522335&w=2)
And the isapnp hotplug script auto load the right module...

Regards,
Matthieu

2004-09-05 21:24:13

by [email protected]

[permalink] [raw]
Subject: Re: Intel ICH - sound/pci/intel8x0.c

I'd don't know enough about the LPC bridge chip to know what the
correct answer is for this. Right now I tend to think that the PCI
driver should own the bridge chip. If not the PCI driver then there
should be an explicit bridge driver. I don' think it is correct that a
joystick driver is attaching to a bridge chip given the simple fact
that all legacy IO - joystick, PS/2, parallel, serial, etc is located
off from that same bridge chip.

Matthieu's comments about using PNP for this seem to make sense. Are
we missing implementation of an ACPI feature for controlling these
ports?

On Sun, 5 Sep 2004 20:48:52 +0200, Matthieu Castet
<[email protected]> wrote:
> On Sul, 2004-09-05 at 03:43, Jon Smirl wrote:
> > The joystick PCI ID table in intel8x0.c is not correct. Joysticks and
> > MIDI ports are ISA devices and need be located by manual probing. This
> > ID table needs to be removed. Joystick and MIDI ports do not have PCI
> > IDs.
>
> I agree, that was I explain in a previous post
> (http://marc.theaimsgroup.com/?l=linux-kernel&m=109420281830288&w=2)
> see the PS.
>
>
> > It isn't that simple. The LPC bridge also contains the controls for
> > the
> > joystick ports. You also need them for hotplug handling of the bridge
> > should someone stick one in a laptop docking station. The ID table
> > also
> > ensures the driver is loaded. It's probably true that it will need
> > splitting up a bit if another driver also needs ownership of the LPC
> > bridge but for now that hasn't happened.
>
> Not for jostick and midi stuff you have to use pnp bus.
> On my computer it works well :
> I have removed the support of MIDI and GAMEPORT in alsa driver.
> The gameport is handle with ns558
> The midi device with a mpu401_pnp I post on the alsa mailling list
> (http://sourceforge.net/mailarchive/forum.php?thread_id=5468125&forum_id=1751)
> For that it work well you need a pnpbios patch
> (http://marc.theaimsgroup.com/?l=linux-kernel&m=109411306024720&w=2) or
> even try to use my pnpacpi patch
> (http://marc.theaimsgroup.com/?l=linux-kernel&m=109430451522335&w=2)
> And the isapnp hotplug script auto load the right module...
>
> Regards,
> Matthieu
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>



--
Jon Smirl
[email protected]

2004-09-05 21:52:41

by Alan

[permalink] [raw]
Subject: Re: Intel ICH - sound/pci/intel8x0.c

On Sul, 2004-09-05 at 22:24, Jon Smirl wrote:
> I'd don't know enough about the LPC bridge chip to know what the
> correct answer is for this. Right now I tend to think that the PCI
> driver should own the bridge chip. If not the PCI driver then there
> should be an explicit bridge driver. I don' think it is correct that a
> joystick driver is attaching to a bridge chip given the simple fact

Nobody else currently needs to attach to it so why make life needlessly
complicated.

> that all legacy IO - joystick, PS/2, parallel, serial, etc is located
> off from that same bridge chip.
>
> Matthieu's comments about using PNP for this seem to make sense. Are
> we missing implementation of an ACPI feature for controlling these
> ports?

See previous discussion. We have isapnp, biospnp but not great acpi pnp.
None of them help because you need to deal with hotplug.

Alan

2004-09-06 02:09:40

by Randy.Dunlap

[permalink] [raw]
Subject: Re: Intel ICH - sound/pci/intel8x0.c

On Sun, 05 Sep 2004 21:49:50 +0100 Alan Cox wrote:

| On Sul, 2004-09-05 at 22:24, Jon Smirl wrote:
| > I'd don't know enough about the LPC bridge chip to know what the
| > correct answer is for this. Right now I tend to think that the PCI
| > driver should own the bridge chip. If not the PCI driver then there
| > should be an explicit bridge driver. I don' think it is correct that a
| > joystick driver is attaching to a bridge chip given the simple fact
|
| Nobody else currently needs to attach to it so why make life needlessly
| complicated.

What I/O addresses are we talking about here?
There is someone working on a SD/MMC (blah blah) memory card interface
that is on LPC, using what used to be reserved as timer IO ports
(0x40 - 0x5f), and he's splitting timer ports up into 2 ranges:
0x40 - 0x43 and 0x50 - 0x53, so that the LPC ports are available.

| > that all legacy IO - joystick, PS/2, parallel, serial, etc is located
| > off from that same bridge chip.
| >
| > Matthieu's comments about using PNP for this seem to make sense. Are
| > we missing implementation of an ACPI feature for controlling these
| > ports?
|
| See previous discussion. We have isapnp, biospnp but not great acpi pnp.
| None of them help because you need to deal with hotplug.

--
~Randy

2004-09-06 02:13:30

by [email protected]

[permalink] [raw]
Subject: Re: Intel ICH - sound/pci/intel8x0.c

On Sun, 05 Sep 2004 21:49:50 +0100, Alan Cox <[email protected]> wrote:
> Nobody else currently needs to attach to it so why make life needlessly
> complicated.

I just read the relevant parts of the ICH manual. This driver is
definitely misnamed. It should be called an "LPC bridge" driver and
moved out of the sound directory. The config words that it is using
control the joystick and midi, but they also control the floppy,
parallel port, serial ports, MSS, SB16, USB, SMbus, IDE, etc.

Shouldn't the BIOS have set these up correctly, does the driver really
need to mess with them?

I also don't see how this is related to hotplug. Just because a LPC
bridge is plugged in doesn't mean that I should immediatle enable
joystick/midi ports, what if I already have those ports on a different
device?

--
Jon Smirl
[email protected]

2004-09-06 04:07:24

by [email protected]

[permalink] [raw]
Subject: Re: Intel ICH - sound/pci/intel8x0.c

> On Sun, 05 Sep 2004 21:49:50 +0100 Alan Cox wrote:
> | On Sul, 2004-09-05 at 22:24, Jon Smirl wrote:
> | > I'd don't know enough about the LPC bridge chip to know what the
> | > correct answer is for this. Right now I tend to think that the PCI
> | > driver should own the bridge chip. If not the PCI driver then there
> | > should be an explicit bridge driver. I don' think it is correct that a
> | > joystick driver is attaching to a bridge chip given the simple fact
> |
> | Nobody else currently needs to attach to it so why make life needlessly
> | complicated.

I just spent a while looking at the code. The joystick driver doesn't
need to exist. Instead the snd_intel8x0_probe() routine could have a
loop that does pci_get_subsys() over the ID's in
snd_intel8x0_joystick_ids[]. When it finds one, use the config space
to enable the joystick/midiports. You can locate the ports since
pci_get_subsys() returns the pci_dev* for the bridge device. Save the
pci_dev* and set the ports back in snd_intel8x0_remove(). Don't forget
to pci_put() the bridge device.

This isn't a device driver for the bridge, we just want to locate it
and flip some bits. Later on if a driver for the bridge get written it
should support an API for setting these bits and the search loop can
be removed.

All of these devices are listed as Intel LPC bridges:
2410, 2420, 2440, 244c, 2450, 2480, 2484, 24c0, 24cc, 24d0, 24dc,
25a1, 2640, 2641, 2642
I have a 24D0 which isn't in the driver list, this is probably why
MIDI doesn't work on my system.

--
Jon Smirl
[email protected]

2004-09-06 08:33:39

by Matthieu Castet

[permalink] [raw]
Subject: Re: Intel ICH - sound/pci/intel8x0.c

> On Sul, 2004-09-05 at 22:24, Jon Smirl wrote:
> > I'd don't know enough about the LPC bridge chip to know what the
> > correct answer is for this. Right now I tend to think that the PCI
> > driver should own the bridge chip. If not the PCI driver then there
> > should be an explicit bridge driver. I don' think it is correct that a
> > joystick driver is attaching to a bridge chip given the simple fact
>
> Nobody else currently needs to attach to it so why make life needlessly
> complicated.
>
heu hw_random and i8xx_tco use also the lpc bridge, but hopefully they
don't attach it.
> > that all legacy IO - joystick, PS/2, parallel, serial, etc is located
> > off from that same bridge chip.
> >
> > Matthieu's comments about using PNP for this seem to make sense. Are
> > we missing implementation of an ACPI feature for controlling these
> > ports?
>
> See previous discussion. We have isapnp, biospnp but not great acpi pnp.
That why I start a patch implementing acpi PnP, but nobody seem
interested :(
> None of them help because you need to deal with hotplug.
Heu, I don't understant why you need to deal with hotplug ?
PnP modules works like pci modules. You make a list of know id, and then
you call {pci,pnp}_{port,irq,dma}_{start,len,...} to access resource of
the device.
Hotplug is need like for pci modules to autoload it.

Also using the LPC brigde the alsa driver don't know about the io port
and irq resource you had to pass them via modules option.
For the gameport, alsa driver use a hardcode value of 0x200 that is
wrong on my computer (it is 0x201).
For the midi port it don't use the irq...
With PnP, the bios/acpi give theses resourse.

For the bit you had to write in the LPC for enable io port, I made a
little test and even if you writte bit that disable the io gameport it
still work. Moreover, I think the bios autoset these bits.

Matthieu

2004-09-06 08:41:27

by Matthieu Castet

[permalink] [raw]
Subject: Re: Intel ICH - sound/pci/intel8x0.c

> I just spent a while looking at the code. The joystick driver doesn't
> need to exist. Instead the snd_intel8x0_probe() routine could have a
> loop that does pci_get_subsys() over the ID's in
> snd_intel8x0_joystick_ids[]. When it finds one, use the config space
> to enable the joystick/midiports. You can locate the ports since
> pci_get_subsys() returns the pci_dev* for the bridge device. Save the
> pci_dev* and set the ports back in snd_intel8x0_remove(). Don't forget
> to pci_put() the bridge device.
>
yes, that is done in hw_random and 8xx_tco for a long time...

> This isn't a device driver for the bridge, we just want to locate it
> and flip some bits. Later on if a driver for the bridge get written it
> should support an API for setting these bits and the search loop can
> be removed.
>
> All of these devices are listed as Intel LPC bridges:
> 2410, 2420, 2440, 244c, 2450, 2480, 2484, 24c0, 24cc, 24d0, 24dc,
> 25a1, 2640, 2641, 2642
> I have a 24D0 which isn't in the driver list, this is probably why
> MIDI doesn't work on my system.
Also check that you pass the righ io port to the modules (the irq won't
be use, it will use only polling mode )...

If you had enable pnpbios in your kernel, you could see your midi port
with :
for i in /sys/bus/pnp/devices/* ; do if [ "$(<$i/id)" = "PNP0b006" ];
then cat $i/resources;cat $i/options; fi ; done

Matthieu

2004-09-06 10:57:09

by Takashi Iwai

[permalink] [raw]
Subject: Re: Intel ICH - sound/pci/intel8x0.c

At Sat, 4 Sep 2004 22:43:01 -0400,
Jon Smirl wrote:
>
> The joystick PCI ID table in intel8x0.c is not correct. Joysticks and
> MIDI ports are ISA devices and need be located by manual probing. This
> ID table needs to be removed. Joystick and MIDI ports do not have PCI
> IDs.

They were already removed from the latest ALSA cvs codes.
So, this should be fixed in the next ALSA update patchset.


Takashi

2004-09-06 12:29:29

by Alan

[permalink] [raw]
Subject: Re: Intel ICH - sound/pci/intel8x0.c

On Llu, 2004-09-06 at 09:31, Matthieu Castet wrote:
> > None of them help because you need to deal with hotplug.
> Heu, I don't understant why you need to deal with hotplug ?
> PnP modules works like pci modules. You make a list of know id, and then

ISAPnP has no hotplug functionality. If I have an ICH or 440MX in laptop
docking stations the ISAPnP world simply can't report it, while the PCI
hotplug layer can.

2004-09-06 14:11:51

by [email protected]

[permalink] [raw]
Subject: Re: Intel ICH - sound/pci/intel8x0.c

The hotplug event of interest is the insertion of the snd_intel8x0
chip, not the insertion of the LPC bridge. It's hooking to both
events, it only needs to hook to the snd_intel8x0 event and then
search for a bridge if there is one.

Takashi says the code is already gone in the alsa tree so we don't
know how they fixed it.


On Mon, 06 Sep 2004 12:27:19 +0100, Alan Cox <[email protected]> wrote:
> On Llu, 2004-09-06 at 09:31, Matthieu Castet wrote:
> > > None of them help because you need to deal with hotplug.
> > Heu, I don't understant why you need to deal with hotplug ?
> > PnP modules works like pci modules. You make a list of know id, and then
>
> ISAPnP has no hotplug functionality. If I have an ICH or 440MX in laptop
> docking stations the ISAPnP world simply can't report it, while the PCI
> hotplug layer can.
>
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>



--
Jon Smirl
[email protected]

2004-09-06 15:49:33

by Matthieu Castet

[permalink] [raw]
Subject: Re: Intel ICH - sound/pci/intel8x0.c

> Takashi says the code is already gone in the alsa tree so we don't
> know how they fixed it.
They ask to use generic modules instead.

look at the cvs log :

Summary: remove gameport/MIDI support

snd-intel8x0's gameport/MIDI code has quite a few problems: the port
addresses cannot be detected reliably (or not at all with newer LPC
bridge devices), joystick port address 0x208 isn't supported, the MIDI
interrupt isn't detected, PnP isn't supported, changing the port
addresses in the LPC bridge configuration doesn't affect the devices
in the Super-I/O chip connected to the LPC bus, and registering this
driver for the LPC bridge PCI device prevents other drivers using the
LPC's PCI id from loading later.

All these problems can be cured by removing the offending code and
using the proper modules for these devices (ns558/snd-mpu401) instead.