RE: UCB1400: Passing IRQ through platform_data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday, March 22, 2010 5:59 PM, Marek Vasut wrote:
> Dne Po 22. března 2010 23:44:26 Graham Gower napsal(a):
>> Marek Vasut wrote:
>>> Dne Po 22. března 2010 07:03:29 Graham Gower napsal(a):
>>>> 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).
>>>>
>>>> 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 ?
>> 
>> 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.

> 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.
>> 
>>> 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��.n��������+%������w��{.n�����{��)��^n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�m


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux