* How to pass I2C platform_data under ACPI
@ 2014-04-03 8:10 Pallala, Ramakrishna
2014-04-03 11:12 ` mika.westerberg
0 siblings, 1 reply; 8+ messages in thread
From: Pallala, Ramakrishna @ 2014-04-03 8:10 UTC (permalink / raw)
To: mika.westerberg@linux.intel.com, linux-acpi@vger.kernel.org,
linaro-acpi@lists.linaro.org, linux-kernel@vger.kernel.org
Hi All,
I am trying to enable a i2c client driver under ACPI. The device is being enumerated behind adapter device and I am getting IRQ resource as well.
The problem I have now is, how do I pass the platform data to driver?
struct i2c_board_info {
char type[I2C_NAME_SIZE];
unsigned short flags;
unsigned short addr;
void *platform_data; ===========> how can I initialize this filed.
struct dev_archdata *archdata;
struct device_node *of_node;
struct acpi_dev_node acpi_node;
int irq;
};
In non ACPI environment I used to initialize the platform_data under board or platforms files. Under ACPI how do I do that?
Thanks,
Ram
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: How to pass I2C platform_data under ACPI
2014-04-03 8:10 How to pass I2C platform_data under ACPI Pallala, Ramakrishna
@ 2014-04-03 11:12 ` mika.westerberg
2014-04-03 11:25 ` Pallala, Ramakrishna
0 siblings, 1 reply; 8+ messages in thread
From: mika.westerberg @ 2014-04-03 11:12 UTC (permalink / raw)
To: Pallala, Ramakrishna
Cc: linux-acpi@vger.kernel.org, linaro-acpi@lists.linaro.org,
linux-kernel@vger.kernel.org
On Thu, Apr 03, 2014 at 08:10:40AM +0000, Pallala, Ramakrishna wrote:
> Hi All,
>
> I am trying to enable a i2c client driver under ACPI. The device is being enumerated behind adapter device and I am getting IRQ resource as well.
>
> The problem I have now is, how do I pass the platform data to driver?
>
> struct i2c_board_info {
> char type[I2C_NAME_SIZE];
> unsigned short flags;
> unsigned short addr;
> void *platform_data; ===========> how can I initialize this filed.
> struct dev_archdata *archdata;
> struct device_node *of_node;
> struct acpi_dev_node acpi_node;
> int irq;
> };
>
> In non ACPI environment I used to initialize the platform_data under
> board or platforms files. Under ACPI how do I do that?
If you can't extract that information from ACPI namespace, then one option
is to pass platform data along with the device ACPI ID:
static const struct acpi_device_id my_acpi_match[] = {
{ "MYID0001", (kernel_ulong_t)&my_platform_data }
...
{ },
};
static struct i2c_driver i2c_hid_driver = {
.driver = {
...
.acpi_match_table = ACPI_PTR(my_acpi_match),
},
...
^ permalink raw reply [flat|nested] 8+ messages in thread* RE: How to pass I2C platform_data under ACPI
2014-04-03 11:12 ` mika.westerberg
@ 2014-04-03 11:25 ` Pallala, Ramakrishna
2014-04-03 11:38 ` mika.westerberg
0 siblings, 1 reply; 8+ messages in thread
From: Pallala, Ramakrishna @ 2014-04-03 11:25 UTC (permalink / raw)
To: mika.westerberg@linux.intel.com
Cc: linux-acpi@vger.kernel.org, linaro-acpi@lists.linaro.org,
linux-kernel@vger.kernel.org
>> In non ACPI environment I used to initialize the platform_data under
>> board or platforms files. Under ACPI how do I do that?
>
>If you can't extract that information from ACPI namespace, then one option is to pass platform data along with the device ACPI ID:
>
>static const struct acpi_device_id my_acpi_match[] = {
> { "MYID0001", (kernel_ulong_t)&my_platform_data }
> ...
> { },
>};
Thanks for the Quick reply.
So If I want to use different platform_data for different boards can I do something like below?
And initialize the platform data in either driver or in separate module which gets compiled along with driver?
static const struct acpi_device_id my_acpi_match[] = {
{ "MYID0001", (kernel_ulong_t)&my_platform_data1 }
{ "MYID0002", (kernel_ulong_t)&my_platform_data2 }
...
{ },
Thanks,
Ram
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: How to pass I2C platform_data under ACPI
2014-04-03 11:25 ` Pallala, Ramakrishna
@ 2014-04-03 11:38 ` mika.westerberg
2014-04-03 13:34 ` [Linaro-acpi] " Arnd Bergmann
0 siblings, 1 reply; 8+ messages in thread
From: mika.westerberg @ 2014-04-03 11:38 UTC (permalink / raw)
To: Pallala, Ramakrishna
Cc: linux-acpi@vger.kernel.org, linaro-acpi@lists.linaro.org,
linux-kernel@vger.kernel.org
On Thu, Apr 03, 2014 at 11:25:34AM +0000, Pallala, Ramakrishna wrote:
> >> In non ACPI environment I used to initialize the platform_data under
> >> board or platforms files. Under ACPI how do I do that?
> >
> >If you can't extract that information from ACPI namespace, then one option is to pass platform data along with the device ACPI ID:
> >
> >static const struct acpi_device_id my_acpi_match[] = {
> > { "MYID0001", (kernel_ulong_t)&my_platform_data }
> > ...
> > { },
> >};
>
> Thanks for the Quick reply.
>
> So If I want to use different platform_data for different boards can I
> do something like below?
Exactly.
> And initialize the platform data in either driver or in separate module
> which gets compiled along with driver?
Typically it has been done in the same driver but I don't see any problems
having a separate module as well.
> static const struct acpi_device_id my_acpi_match[] = {
> { "MYID0001", (kernel_ulong_t)&my_platform_data1 }
> { "MYID0002", (kernel_ulong_t)&my_platform_data2 }
> ...
> { },
>
> Thanks,
> Ram
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [Linaro-acpi] How to pass I2C platform_data under ACPI
2014-04-03 11:38 ` mika.westerberg
@ 2014-04-03 13:34 ` Arnd Bergmann
2014-04-03 13:58 ` mika.westerberg
0 siblings, 1 reply; 8+ messages in thread
From: Arnd Bergmann @ 2014-04-03 13:34 UTC (permalink / raw)
To: linaro-acpi
Cc: mika.westerberg@linux.intel.com, Pallala, Ramakrishna,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
On Thursday 03 April 2014 14:38:33 mika.westerberg@linux.intel.com wrote:
> On Thu, Apr 03, 2014 at 11:25:34AM +0000, Pallala, Ramakrishna wrote:
> > >> In non ACPI environment I used to initialize the platform_data under
> > >> board or platforms files. Under ACPI how do I do that?
> > >
> > >If you can't extract that information from ACPI namespace, then one option is to pass platform data along with the device ACPI ID:
> > >
> > >static const struct acpi_device_id my_acpi_match[] = {
> > > { "MYID0001", (kernel_ulong_t)&my_platform_data }
> > > ...
> > > { },
> > >};
> >
> > Thanks for the Quick reply.
> >
> > So If I want to use different platform_data for different boards can I
> > do something like below?
>
> Exactly.
>
> > And initialize the platform data in either driver or in separate module
> > which gets compiled along with driver?
>
> Typically it has been done in the same driver but I don't see any problems
> having a separate module as well.
>
> > static const struct acpi_device_id my_acpi_match[] = {
> > { "MYID0001", (kernel_ulong_t)&my_platform_data1 }
> > { "MYID0002", (kernel_ulong_t)&my_platform_data2 }
> > ...
> > { },
We definitely don't want per-board match entries, that does not scale.
The driver should be reasonably generic and get all the necessary data
out of well-defined tables. You can have different IDs when there
are only a few cases that are actually relevant, but it has to be
conceivable that the same driver get used on future hardware without
changes.
Arnd
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [Linaro-acpi] How to pass I2C platform_data under ACPI
2014-04-03 13:34 ` [Linaro-acpi] " Arnd Bergmann
@ 2014-04-03 13:58 ` mika.westerberg
2014-04-03 13:59 ` Pallala, Ramakrishna
0 siblings, 1 reply; 8+ messages in thread
From: mika.westerberg @ 2014-04-03 13:58 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linaro-acpi, Pallala, Ramakrishna, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org
On Thu, Apr 03, 2014 at 03:34:30PM +0200, Arnd Bergmann wrote:
> On Thursday 03 April 2014 14:38:33 mika.westerberg@linux.intel.com wrote:
> > On Thu, Apr 03, 2014 at 11:25:34AM +0000, Pallala, Ramakrishna wrote:
> > > >> In non ACPI environment I used to initialize the platform_data under
> > > >> board or platforms files. Under ACPI how do I do that?
> > > >
> > > >If you can't extract that information from ACPI namespace, then one option is to pass platform data along with the device ACPI ID:
> > > >
> > > >static const struct acpi_device_id my_acpi_match[] = {
> > > > { "MYID0001", (kernel_ulong_t)&my_platform_data }
> > > > ...
> > > > { },
> > > >};
> > >
> > > Thanks for the Quick reply.
> > >
> > > So If I want to use different platform_data for different boards can I
> > > do something like below?
> >
> > Exactly.
> >
> > > And initialize the platform data in either driver or in separate module
> > > which gets compiled along with driver?
> >
> > Typically it has been done in the same driver but I don't see any problems
> > having a separate module as well.
> >
> > > static const struct acpi_device_id my_acpi_match[] = {
> > > { "MYID0001", (kernel_ulong_t)&my_platform_data1 }
> > > { "MYID0002", (kernel_ulong_t)&my_platform_data2 }
> > > ...
> > > { },
>
> We definitely don't want per-board match entries, that does not scale.
> The driver should be reasonably generic and get all the necessary data
> out of well-defined tables. You can have different IDs when there
> are only a few cases that are actually relevant, but it has to be
> conceivable that the same driver get used on future hardware without
> changes.
Yes, I meant that when the platform data information is not available in
ACPI namespace, then (and only then) pass the data by means of different
IDs.
Preferably this information is included in the ACPI namespace.
^ permalink raw reply [flat|nested] 8+ messages in thread* RE: [Linaro-acpi] How to pass I2C platform_data under ACPI
2014-04-03 13:58 ` mika.westerberg
@ 2014-04-03 13:59 ` Pallala, Ramakrishna
2014-04-03 15:05 ` Arnd Bergmann
0 siblings, 1 reply; 8+ messages in thread
From: Pallala, Ramakrishna @ 2014-04-03 13:59 UTC (permalink / raw)
To: mika.westerberg@linux.intel.com, Arnd Bergmann
Cc: linaro-acpi@lists.linaro.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org
>> > > And initialize the platform data in either driver or in separate
>> > > module which gets compiled along with driver?
>> >
>> > Typically it has been done in the same driver but I don't see any
>> > problems having a separate module as well.
>> >
>> > > static const struct acpi_device_id my_acpi_match[] = {
>> > > { "MYID0001", (kernel_ulong_t)&my_platform_data1 }
>> > > { "MYID0002", (kernel_ulong_t)&my_platform_data2 }
>> > > ...
>> > > { },
>>
>> We definitely don't want per-board match entries, that does not scale.
>> The driver should be reasonably generic and get all the necessary data
>> out of well-defined tables. You can have different IDs when there are
>> only a few cases that are actually relevant, but it has to be
>> conceivable that the same driver get used on future hardware without
>> changes.
>
>Yes, I meant that when the platform data information is not available in ACPI namespace, then (and only then) pass the data by means of different IDs.
>
>Preferably this information is included in the ACPI namespace.
The idea is use the single platform_data struct and initiaze it accordingly from the driver's __init call based on the board/platform.
Thanks for your inputs.
Ram.
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [Linaro-acpi] How to pass I2C platform_data under ACPI
2014-04-03 13:59 ` Pallala, Ramakrishna
@ 2014-04-03 15:05 ` Arnd Bergmann
0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2014-04-03 15:05 UTC (permalink / raw)
To: Pallala, Ramakrishna
Cc: mika.westerberg@linux.intel.com, linaro-acpi@lists.linaro.org,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
On Thursday 03 April 2014 13:59:18 Pallala, Ramakrishna wrote:
> >> We definitely don't want per-board match entries, that does not scale.
> >> The driver should be reasonably generic and get all the necessary data
> >> out of well-defined tables. You can have different IDs when there are
> >> only a few cases that are actually relevant, but it has to be
> >> conceivable that the same driver get used on future hardware without
> >> changes.
> >
> >Yes, I meant that when the platform data information is not available
> >in ACPI namespace, then (and only then) pass the data by means of different IDs.
> >
> >Preferably this information is included in the ACPI namespace.
>
> The idea is use the single platform_data struct and initiaze it
> accordingly from the driver's __init call based on the board/platform.
In general, you should think of it as being isolated from the board or
platform question, and not rely on an an initcall to do this for you.
A device driver, in particular for a device on something like an i2c
bus, should be able to figure out all the dependencies in its own
probe() function, without code on the platform side or in a specific
driver initcall.
What information it needs of course depends on the specific device,
but if you boot using FDT or ACPI, all the information you need should
be encoded in the data passed from the boot loader in a generic and
documented fashion. What data specifically do you want to pass here
that was previously encoded in platform data?
Arnd
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-04-03 15:05 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-03 8:10 How to pass I2C platform_data under ACPI Pallala, Ramakrishna
2014-04-03 11:12 ` mika.westerberg
2014-04-03 11:25 ` Pallala, Ramakrishna
2014-04-03 11:38 ` mika.westerberg
2014-04-03 13:34 ` [Linaro-acpi] " Arnd Bergmann
2014-04-03 13:58 ` mika.westerberg
2014-04-03 13:59 ` Pallala, Ramakrishna
2014-04-03 15:05 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).