Skip to contentSkip to conversation

UCB1400: Passing IRQ through platform_data

DISCUSSION Marek Vasut 3 participants 10 messages Mar 22, 2010 – Mar 24, 2010 1 message not in the archive HID

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Dne Po 22. března 2010 07:03:29 Graham Gower napsal(a):

Quoted 8 lines

Hi Marek,
I wish to use the ucb1400_ts driver on my device. But I'm having trouble passing the platform_data to the ucb1400_core driver.

I couldn't see any in tree examples of this being done and my attempts to do this via registering a platform_driver for ucb1400_core have failed (probably since this driver is ac97_bus_type, not a platform_driver).

Quoted 6 lines

Can you provide me with info regarding the correct method for passing the irq to the driver?

Thanks,
-Graham

static struct ucb1400_pdata pdata = {
	.irq	= IRQ_GPIO(123),
};
static struct platform_device ucb1400_core = {
        .name   = "ucb1400_core",
        .id     = -1,
	.dev	= {
		.platform_data = &pdata,
	},
};
init() {
	platform_device_register(&ucb1400_core);
}

Like this ?

btw. you don't have to pass pdata at all ... the logic for auto-detecting IRQ is still there and is active if no pdata are supplied.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 28 lines · Marek Vasut

Dne Po 22. března 2010 07:03:29 Graham Gower napsal(a):

Quoted 8 lines

Hi Marek,
I wish to use the ucb1400_ts driver on my device. But I'm having trouble passing the platform_data to the ucb1400_core driver.

I couldn't see any in tree examples of this being done and my attempts to do this via registering a platform_driver for ucb1400_core have failed (probably since this driver is ac97_bus_type, not a platform_driver).

Quoted 6 lines

Can you provide me with info regarding the correct method for passing the irq to the driver?

Thanks,
-Graham

static struct ucb1400_pdata pdata = {
	.irq	= IRQ_GPIO(123),
};
static struct platform_device ucb1400_core = {
        .name   = "ucb1400_core",
        .id     = -1,
	.dev	= {
		.platform_data = &pdata,
	},
};
Quoted 5 lines
init() {
	platform_device_register(&ucb1400_core);
}

Like this ?

That is the first thing I tried and it doesn't work. I suggest you printk the pdata in the ucb1400_core driver after having done this to confirm (I got NULL). You don't need to register a platform driver for ucb1400_core_probe() to be called anyway - presumably its enumerated from the ac97 bus.

Quoted 3 lines

btw. you don't have to pass pdata at all ... the logic for auto-detecting IRQ is still there and is active if no pdata are supplied.

This does not work for me. I have not yet investigated why.

-Graham

PS: I am on mips, not arm. Arm CC removed.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

Dne Po 22. března 2010 23:44:26 Graham Gower napsal(a):

Quoted 33 lines
Quoted 32 lines · Marek Vasut

Dne Po 22. března 2010 07:03:29 Graham Gower napsal(a):

Quoted 9 lines

Hi Marek,
I wish to use the ucb1400_ts driver on my device. But I'm having trouble passing the platform_data to the ucb1400_core driver.

I couldn't see any in tree examples of this being done and my attempts to do this via registering a platform_driver for ucb1400_core have failed (probably since this driver is ac97_bus_type, not a platform_driver).

Quoted 5 lines

Can you provide me with info regarding the correct method for passing the irq to the driver?

Thanks,
-Graham

static struct ucb1400_pdata pdata = {
	.irq	= IRQ_GPIO(123),
};
static struct platform_device ucb1400_core = {
        .name   = "ucb1400_core",
        .id     = -1,
	.dev	= {
		.platform_data = &pdata,
	},
};
init() {
	platform_device_register(&ucb1400_core);
}
Quoted 7 lines
Quoted 1 line

Like this ?

That is the first thing I tried and it doesn't work. I suggest you printk the pdata in the ucb1400_core driver after having done this to confirm (I
got NULL). You don't need to register a platform driver for ucb1400_core_probe() to be called anyway - presumably its enumerated from the ac97 bus.

Oh yes you have to, otherwise the pdata won't be passed. Besides, it's weird probe()'s called if you didn't register it. But obviously whatever calls it doesn't pass the pdata.

And yes, I printk'd it when I was sending this patch in and it worked for me ... register the platform device and you should be ok.

Quoted 5 lines
Quoted 3 lines

btw. you don't have to pass pdata at all ... the logic for auto-detecting IRQ is still there and is active if no pdata are supplied.

This does not work for me. I have not yet investigated why.

I'd better get rid of that autodetection stuff altogether, but fttb it can be there.

Quoted 5 lines

-Graham

PS: I am on mips, not arm. Arm CC removed.

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 42 lines · Marek Vasut

Dne Po 22. března 2010 23:44:26 Graham Gower napsal(a):

Quoted 33 lines
Quoted 32 lines · Marek Vasut

Dne Po 22. března 2010 07:03:29 Graham Gower napsal(a):

Quoted 9 lines

Hi Marek,
I wish to use the ucb1400_ts driver on my device. But I'm having trouble passing the platform_data to the ucb1400_core driver.

I couldn't see any in tree examples of this being done and my attempts to do this via registering a platform_driver for ucb1400_core have failed (probably since this driver is ac97_bus_type, not a platform_driver).

Quoted 5 lines

Can you provide me with info regarding the correct method for passing the irq to the driver?

Thanks,
-Graham

static struct ucb1400_pdata pdata = {
	.irq	= IRQ_GPIO(123),
};
static struct platform_device ucb1400_core = {
        .name   = "ucb1400_core",
        .id     = -1,
	.dev	= {
		.platform_data = &pdata,
	},
};
init() {
	platform_device_register(&ucb1400_core);
}
Quoted 7 lines
Quoted 1 line

Like this ?

That is the first thing I tried and it doesn't work. I suggest you printk the pdata in the ucb1400_core driver after having done this to confirm (I
got NULL). You don't need to register a platform driver for ucb1400_core_probe() to be called anyway - presumably its enumerated from the ac97 bus.

Quoted 3 lines

Oh yes you have to, otherwise the pdata won't be passed. Besides, it's weird probe()'s called if you didn't register it. But obviously whatever calls it doesn't pass the pdata.

The driver is registered with platform_driver_register, as such it will be tied to the platform bus not the ac97 bus. Being a platform driver, you do need a matching platform_device_register so that you get a device<->driver binding.

Quoted 10 lines

And yes, I printk'd it when I was sending this patch in and it worked for me ... register the platform device and you should be ok.

Quoted 5 lines
Quoted 3 lines

btw. you don't have to pass pdata at all ... the logic for auto-detecting IRQ is still there and is active if no pdata are supplied.

This does not work for me. I have not yet investigated why.

I'd better get rid of that autodetection stuff altogether, but fttb it can be there.

Another reason your irq might not be working is that its not valid. Is gpio 123 a valid IRQ producer on your platform? IRQ_GPIO(123) might resolve to (ucb->irq < 0) which would cause the probe to try auto detecting the irq.

BTW, this driver looks a little scary.

The 'platform data' that is passed to the driver is also the 'private data' used by the driver. Since the only data passed by the platform is the irq it would probably be cleaner to pass a struct ucb1400_pdata to the driver and kzalloc the private struct ucb1400_ts data in the driver.

Just my 0.02...

Regards,
Hartley

#5 lore raw
Quoted 40 lines · H Hartley Sweeten
Quoted 39 lines · Marek Vasut

Dne Po 22. března 2010 23:44:26 Graham Gower napsal(a):

Quoted 38 lines
Quoted 27 lines · Marek Vasut

Dne Po 22. března 2010 07:03:29 Graham Gower napsal(a):

Quoted 9 lines

Hi Marek,
I wish to use the ucb1400_ts driver on my device. But I'm having trouble passing the platform_data to the ucb1400_core driver.

I couldn't see any in tree examples of this being done and my attempts to do this via registering a platform_driver for ucb1400_core have failed (probably since this driver is ac97_bus_type, not a platform_driver).

Quoted 5 lines

Can you provide me with info regarding the correct method for passing the irq to the driver?

Thanks,
-Graham

static struct ucb1400_pdata pdata = {
	.irq	= IRQ_GPIO(123),
};
static struct platform_device ucb1400_core = {
        .name   = "ucb1400_core",
        .id     = -1,
	.dev	= {
		.platform_data = &pdata,
	},
};
Quoted 5 lines
init() {
	platform_device_register(&ucb1400_core);
}

Like this ?

That is the first thing I tried and it doesn't work. I suggest you printk the pdata in the ucb1400_core driver after having done this to confirm (I
got NULL). You don't need to register a platform driver for ucb1400_core_probe() to be called anyway - presumably its enumerated from the ac97 bus.

Quoted 7 lines
Quoted 3 lines

Oh yes you have to, otherwise the pdata won't be passed. Besides, it's weird probe()'s called if you didn't register it. But obviously whatever calls it doesn't pass the pdata.

The driver is registered with platform_driver_register, as such it will be tied to the platform bus not the ac97 bus. Being a platform driver, you do need a matching platform_device_register so that you get a device<->driver binding.

I suspect we are looking at different files, or different versions of the file. I'm looking at drivers/mfd/ucb1400_core.c, which looks like this:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=drivers/mfd/ucb1400_core.c;hb=HEAD

The ucb1400_core is registered with driver_register.

I have grepped my tree and the only places I see "ucb12400_core" are in a couple of arm board files and in my board file. Mine is commented out, and I definitely still get the probe being called.

I added dump_stack() to the probe function.

[<80014f50>] dump_stack+0x8/0x34
[<801b1dec>] ucb1400_core_probe+0x48/0x1ac
[<801ab114>] driver_probe_device+0x128/0x254
[<801aa440>] bus_for_each_drv+0x60/0xb0
[<801ab3e4>] device_attach+0x60/0x88
[<801aa234>] bus_probe_device+0x30/0x54
[<801a8a74>] device_add+0x368/0x4f0
[<80210970>] snd_ac97_dev_register+0xa0/0xd8
[<801ef6e8>] snd_device_register_all+0x44/0x80
[<801eb2f4>] snd_card_register+0x64/0x18c
[<80216f3c>] snd_soc_instantiate_cards+0x368/0x5c4
[<80217214>] soc_probe+0x7c/0xc4
[<801ab114>] driver_probe_device+0x128/0x254
[<801aa440>] bus_for_each_drv+0x60/0xb0
[<801ab3e4>] device_attach+0x60/0x88
[<801aa234>] bus_probe_device+0x30/0x54
[<801a8a74>] device_add+0x368/0x4f0
[<801aca5c>] platform_device_add+0x14c/0x1b8
[<803813a4>] quokka_init+0x98/0xec
[<800180f0>] do_one_initcall+0x68/0x200
[<80371328>] kernel_init+0xc4/0x164
[<8001ac2c>] kernel_thread_helper+0x10/0x18
Quoted 5 lines
Quoted 5 lines

And yes, I printk'd it when I was sending this patch in and it worked for me ... register the platform device and you should be ok.

Quoted 2 lines
Quoted 2 lines

btw. you don't have to pass pdata at all ... the logic for auto-detecting IRQ is still there and is active if no pdata are supplied.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

This does not work for me. I have not yet investigated why.

I'd better get rid of that autodetection stuff altogether, but fttb it can be there.

Another reason your irq might not be working is that its not valid. Is gpio 123 a valid IRQ producer on your platform? IRQ_GPIO(123) might resolve to (ucb->irq < 0) which would cause the probe to try auto detecting the irq.

This has nothing to do with the irq number that I'm passing (which is not 123 anyway). The ucb1400_core's dev->platform_data pointer is NULL.

Quoted 8 lines

BTW, this driver looks a little scary.

The 'platform data' that is passed to the driver is also the 'private data' used by the driver. Since the only data passed by the platform is the irq it would probably be cleaner to pass a struct ucb1400_pdata to the driver and kzalloc the private struct ucb1400_ts data in the driver.

Quoted 4 lines

Just my 0.02...

Regards,
Hartley

-Graham
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
Quoted 10 lines · Graham Gower
Quoted 9 lines · H Hartley Sweeten
Quoted 8 lines
Quoted 5 lines

That is the first thing I tried and it doesn't work. I suggest you printk the pdata in the ucb1400_core driver after having done this to confirm (I
got NULL). You don't need to register a platform driver for ucb1400_core_probe() to be called anyway - presumably its enumerated from the ac97 bus.

Oh yes you have to, otherwise the pdata won't be passed. Besides, it's weird probe()'s called if you didn't register it. But obviously whatever calls it doesn't pass the pdata.

Quoted 7 lines
Quoted 3 lines

The driver is registered with platform_driver_register, as such it will be tied to the platform bus not the ac97 bus. Being a platform driver, you do need a matching platform_device_register so that you get a device<->driver binding.

I suspect we are looking at different files, or different versions of the file. I'm looking at drivers/mfd/ucb1400_core.c, which looks like this:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=drivers/mfd/ucb1400_core.c;hb=HEAD

Ah, I just saw that. I was only looking at the ucb1400_ts.c driver itself and the only direct in-tree user arch/avr32/boards/atngw100/mrmt.c. I didn't notice that there was also a mfd driver.

Quoted 1 line

The ucb1400_core is registered with driver_register.

That mfd driver still registers it's children as platform drivers using platform_device_alloc, platform_device_add_data, and platform_device_add.

Quoted 3 lines

I have grepped my tree and the only places I see "ucb12400_core" are in a couple of arm board files and in my board file. Mine is commented out, and I definitely still get the probe being called.

The only in tree users of the mfd driver appear to be mach-pxa/cm-x2xx.c and mach-pxa/palmtc.c, neither of which pass the platform_data.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

And yes, I printk'd it when I was sending this patch in and it worked for me ... register the platform device and you should be ok.

Quoted 3 lines
Quoted 2 lines

btw. you don't have to pass pdata at all ... the logic for auto-detecting IRQ is still there and is active if no pdata are supplied.

This does not work for me. I have not yet investigated why.

I'd better get rid of that autodetection stuff altogether, but fttb it can be there.

Quoted 6 lines
Quoted 3 lines

Another reason your irq might not be working is that its not valid. Is gpio 123 a valid IRQ producer on your platform? IRQ_GPIO(123) might resolve to (ucb->irq < 0) which would cause the probe to try auto detecting the irq.

This has nothing to do with the irq number that I'm passing (which is not 123 anyway). The ucb1400_core's dev->platform_data pointer is NULL.

That number was from the avr code. Sorry for any confusion.

Quoted 9 lines
Quoted 9 lines

BTW, this driver looks a little scary.

The 'platform data' that is passed to the driver is also the 'private data' used by the driver. Since the only data passed by the platform is the irq it would probably be cleaner to pass a struct ucb1400_pdata to the driver and kzalloc the private struct ucb1400_ts data in the driver.

Just my 0.02...

I'm going to step out of this one.

I started looking at the mfd driver to see if I could help out with your problem. I honestly don't even get how this all works....

The two in-tree users register the 'ucb1400_core' device differently. cm-x2xx.c uses platform_device_register and palmtc.c uses platform_add_devices. Those two paths are completely different, but they probably get to the same state eventually.

The ucb1400_core driver registers a 'device_driver' on the ac97 bus. As such, it probably does get probed by the ac97 bus not the platform bus. The actual ucb1400_core probe function probably isn't even tied to the correct platform data, it's parameter is a struct device * not a struct platform_device *.

Anyway, good luck. Sorry I can't offer any help.

Regards,
Hartley

#7 lore raw

Dne Út 23. března 2010 03:08:21 H Hartley Sweeten napsal(a):

Quoted 17 lines · Graham Gower
Quoted 16 lines
Quoted 14 lines · H Hartley Sweeten
Quoted 9 lines
Quoted 5 lines

That is the first thing I tried and it doesn't work. I suggest you printk the pdata in the ucb1400_core driver after having done this to confirm (I got NULL). You don't need to register a platform driver for
ucb1400_core_probe() to be called anyway - presumably its enumerated
from the ac97 bus.

Oh yes you have to, otherwise the pdata won't be passed. Besides, it's weird probe()'s called if you didn't register it. But obviously whatever calls it doesn't pass the pdata.

The driver is registered with platform_driver_register, as such it will be tied to the platform bus not the ac97 bus. Being a platform driver, you do need a matching platform_device_register so that you get a device<->driver binding.

Quoted 8 lines
Quoted 4 lines

I suspect we are looking at different files, or different versions of the file. I'm looking at drivers/mfd/ucb1400_core.c, which looks like this:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f
=drivers/mfd/ucb1400_core.c;hb=HEAD

Ah, I just saw that. I was only looking at the ucb1400_ts.c driver itself
and the only direct in-tree user arch/avr32/boards/atngw100/mrmt.c. I didn't notice that there was also a mfd driver.

There's no ucb1400_ts anymore. There's only the MFD driver, nothing else.

Quoted 6 lines
Quoted 2 lines

The ucb1400_core is registered with driver_register.

That mfd driver still registers it's children as platform drivers using platform_device_alloc, platform_device_add_data, and platform_device_add.

Quoted 6 lines
Quoted 3 lines

I have grepped my tree and the only places I see "ucb12400_core" are in a couple of arm board files and in my board file. Mine is commented out, and I definitely still get the probe being called.

The only in tree users of the mfd driver appear to be mach-pxa/cm-x2xx.c
and mach-pxa/palmtc.c, neither of which pass the platform_data.

You can pass platform data as I said in the earlier example. That was tested on PalmTC.

Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 4 lines

And yes, I printk'd it when I was sending this patch in and it worked for me ... register the platform device and you should be ok.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

btw. you don't have to pass pdata at all ... the logic for auto-detecting IRQ is still there and is active if no pdata are supplied.

This does not work for me. I have not yet investigated why.

I'd better get rid of that autodetection stuff altogether, but fttb it can be there.

Another reason your irq might not be working is that its not valid. Is gpio 123 a valid IRQ producer on your platform? IRQ_GPIO(123) might resolve to (ucb->irq < 0) which would cause the probe to try auto detecting the irq.

Quoted 4 lines
Quoted 2 lines

This has nothing to do with the irq number that I'm passing (which is not 123 anyway). The ucb1400_core's dev->platform_data pointer is NULL.

That number was from the avr code. Sorry for any confusion.

The '123' was just a silly number, an example, you need to fill you own ... it wasnt from AVR code.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

BTW, this driver looks a little scary.

The 'platform data' that is passed to the driver is also the 'private data' used by the driver. Since the only data passed by the platform is the irq it would probably be cleaner to pass a struct ucb1400_pdata to the driver and kzalloc the private struct ucb1400_ts data in the driver.

Quoted 6 lines
Quoted 1 line
Quoted 1 line

Just my 0.02...

I'm going to step out of this one.

I started looking at the mfd driver to see if I could help out with your
problem. I honestly don't even get how this all works....

Maybe I'm starting to recall how that whole thing worked. I took a look at the code and my guess might be -- it takes pdata from the ac97 bus. I'm not sure here, but pxa2xx-ac97 allows passing platform data through the ac97 bus, dunno how are other platform's ac97 implementations. If I'm right here, you might need to fix your mips-whatever-ac97 to allow passing platform data and then pass them through there.

If that's the case, the earlier example was wrong and you should start digging around ac97 (see git log for pxa2xx-ac97.c and find a patch that added this passing of platform data there).

Quoted 12 lines

The two in-tree users register the 'ucb1400_core' device differently.
cm-x2xx.c uses platform_device_register and palmtc.c uses platform_add_devices. Those two paths are completely different, but they probably get to the same state eventually.

The ucb1400_core driver registers a 'device_driver' on the ac97 bus. As
such, it probably does get probed by the ac97 bus not the platform bus. The actual ucb1400_core probe function probably isn't even tied to the correct platform data, it's parameter is a struct device * not a struct platform_device *.

Quoted 5 lines

Anyway, good luck. Sorry I can't offer any help.

Regards,
Hartley

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
Quoted 10 lines · Marek Vasut

Maybe I'm starting to recall how that whole thing worked. I took a look at the code and my guess might be -- it takes pdata from the ac97 bus. I'm not sure here, but pxa2xx-ac97 allows passing platform data through the ac97 bus, dunno how are other platform's ac97 implementations. If I'm right here, you might need to fix your mips-whatever-ac97 to allow passing platform data and then pass them through there.

If that's the case, the earlier example was wrong and you should start digging around ac97 (see git log for pxa2xx-ac97.c and find a patch that added this passing of platform data there).

Thanks, that was the clue I needed. With a small fix[0], I can now pass the platform_data successfully through the ac97 codec.

-Graham

[0] http://mailman.alsa-project.org/pipermail/alsa-devel/2010-March/026419.html

#9 lore raw
In reply to Graham Gower

Dne Út 23. března 2010 02:39:19 Graham Gower napsal(a):

Quoted 81 lines
Quoted 44 lines · H Hartley Sweeten
Quoted 43 lines · Marek Vasut

Dne Po 22. března 2010 23:44:26 Graham Gower napsal(a):

Quoted 41 lines
Quoted 29 lines · Marek Vasut

Dne Po 22. března 2010 07:03:29 Graham Gower napsal(a):

Quoted 10 lines

Hi Marek,
I wish to use the ucb1400_ts driver on my device. But I'm having trouble passing the platform_data to the ucb1400_core driver.

I couldn't see any in tree examples of this being done and my attempts to do this via registering a platform_driver for ucb1400_core have failed (probably since this driver is ac97_bus_type, not a
platform_driver).

Quoted 5 lines

Can you provide me with info regarding the correct method for passing the irq to the driver?

Thanks,
-Graham

static struct ucb1400_pdata pdata = {
	.irq	= IRQ_GPIO(123),
};
static struct platform_device ucb1400_core = {
        .name   = "ucb1400_core",
        .id     = -1,
	.dev	= {
		.platform_data = &pdata,
	},
};
Quoted 5 lines
init() {
	platform_device_register(&ucb1400_core);
}

Like this ?

That is the first thing I tried and it doesn't work. I suggest you printk the pdata in the ucb1400_core driver after having done this to confirm (I got NULL). You don't need to register a platform driver for
ucb1400_core_probe() to be called anyway - presumably its enumerated
from the ac97 bus.

Quoted 8 lines
Quoted 3 lines

Oh yes you have to, otherwise the pdata won't be passed. Besides, it's weird probe()'s called if you didn't register it. But obviously whatever calls it doesn't pass the pdata.

The driver is registered with platform_driver_register, as such it will be tied to the platform bus not the ac97 bus. Being a platform driver, you do need a matching platform_device_register so that you get a device<->driver binding.

I suspect we are looking at different files, or different versions of the
file. I'm looking at drivers/mfd/ucb1400_core.c, which looks like this:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=d
rivers/mfd/ucb1400_core.c;hb=HEAD

The ucb1400_core is registered with driver_register.

I have grepped my tree and the only places I see "ucb12400_core" are in a
couple of arm board files and in my board file. Mine is commented out, and I definitely still get the probe being called.

I added dump_stack() to the probe function.

[<80014f50>] dump_stack+0x8/0x34
[<801b1dec>] ucb1400_core_probe+0x48/0x1ac
[<801ab114>] driver_probe_device+0x128/0x254
[<801aa440>] bus_for_each_drv+0x60/0xb0
[<801ab3e4>] device_attach+0x60/0x88
[<801aa234>] bus_probe_device+0x30/0x54
[<801a8a74>] device_add+0x368/0x4f0
[<80210970>] snd_ac97_dev_register+0xa0/0xd8
[<801ef6e8>] snd_device_register_all+0x44/0x80
[<801eb2f4>] snd_card_register+0x64/0x18c
[<80216f3c>] snd_soc_instantiate_cards+0x368/0x5c4
[<80217214>] soc_probe+0x7c/0xc4
[<801ab114>] driver_probe_device+0x128/0x254
[<801aa440>] bus_for_each_drv+0x60/0xb0
Quoted 8 lines
[<801ab3e4>] device_attach+0x60/0x88
[<801aa234>] bus_probe_device+0x30/0x54
[<801a8a74>] device_add+0x368/0x4f0
[<801aca5c>] platform_device_add+0x14c/0x1b8
[<803813a4>] quokka_init+0x98/0xec
[<800180f0>] do_one_initcall+0x68/0x200
[<80371328>] kernel_init+0xc4/0x164
[<8001ac2c>] kernel_thread_helper+0x10/0x18

Aren't you probing it from some driver or something ?

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

And yes, I printk'd it when I was sending this patch in and it worked for me ... register the platform device and you should be ok.

Quoted 5 lines
Quoted 3 lines

btw. you don't have to pass pdata at all ... the logic for auto-detecting IRQ is still there and is active if no pdata are supplied.

This does not work for me. I have not yet investigated why.

I'd better get rid of that autodetection stuff altogether, but fttb it can be there.

Quoted 7 lines
Quoted 4 lines

Another reason your irq might not be working is that its not valid. Is gpio 123 a valid IRQ producer on your platform? IRQ_GPIO(123) might resolve to (ucb->irq < 0) which would cause the probe to try auto detecting the irq.

This has nothing to do with the irq number that I'm passing (which is not
123 anyway). The ucb1400_core's dev->platform_data pointer is NULL.

We know it is NULL ... that's because you're not passing it.

Quoted 8 lines
Quoted 8 lines

BTW, this driver looks a little scary.

The 'platform data' that is passed to the driver is also the 'private data' used by the driver. Since the only data passed by the platform is the irq it would probably be cleaner to pass a struct ucb1400_pdata to the driver and kzalloc the private struct ucb1400_ts data in the driver.

Quoted 7 lines
Quoted 4 lines

Just my 0.02...

Regards,
Hartley

-Graham

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw
Quoted 33 lines · Marek Vasut

Dne Út 23. března 2010 02:39:19 Graham Gower napsal(a):

Quoted 22 lines

The ucb1400_core is registered with driver_register.

I have grepped my tree and the only places I see "ucb12400_core" are in a
couple of arm board files and in my board file. Mine is commented out, and I definitely still get the probe being called.

I added dump_stack() to the probe function.

[<80014f50>] dump_stack+0x8/0x34
[<801b1dec>] ucb1400_core_probe+0x48/0x1ac
[<801ab114>] driver_probe_device+0x128/0x254
[<801aa440>] bus_for_each_drv+0x60/0xb0
[<801ab3e4>] device_attach+0x60/0x88
[<801aa234>] bus_probe_device+0x30/0x54
[<801a8a74>] device_add+0x368/0x4f0
[<80210970>] snd_ac97_dev_register+0xa0/0xd8
[<801ef6e8>] snd_device_register_all+0x44/0x80
[<801eb2f4>] snd_card_register+0x64/0x18c
[<80216f3c>] snd_soc_instantiate_cards+0x368/0x5c4
[<80217214>] soc_probe+0x7c/0xc4
[<801ab114>] driver_probe_device+0x128/0x254
[<801aa440>] bus_for_each_drv+0x60/0xb0
Quoted 8 lines
[<801ab3e4>] device_attach+0x60/0x88
[<801aa234>] bus_probe_device+0x30/0x54
[<801a8a74>] device_add+0x368/0x4f0
[<801aca5c>] platform_device_add+0x14c/0x1b8
[<803813a4>] quokka_init+0x98/0xec
[<800180f0>] do_one_initcall+0x68/0x200
[<80371328>] kernel_init+0xc4/0x164
[<8001ac2c>] kernel_thread_helper+0x10/0x18
Quoted 1 line

Aren't you probing it from some driver or something ?

I register an ac97 platform driver from an arch_initcall function. It looks like the ucb1400_core driver is probed once the ac97 device is found.

Quoted 4 lines
Quoted 2 lines

This has nothing to do with the irq number that I'm passing (which is not
123 anyway). The ucb1400_core's dev->platform_data pointer is NULL.

We know it is NULL ... that's because you're not passing it.

When I attempt to pass it via a platform device with platform_add_devices, it is still NULL. I suspected that it was NULL because the ucb1400_core isn't a platform_driver - thus I commented out the platform device for ucb1400_core in my arch_initcall and sure enough the probe was still being called.

-Graham
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html