[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8A42379416420646B9BFAC9682273B6D0E33B2C0@limkexm3.ad.analog.com>
Date: Fri, 2 Oct 2009 15:39:09 +0100
From: "Hennerich, Michael" <Michael.Hennerich@...log.com>
To: "Samuel Ortiz" <sameo@...ux.intel.com>
CC: "Mike Frysinger" <vapier@...too.org>,
<linux-kernel@...r.kernel.org>,
<uclinux-dist-devel@...ckfin.uclinux.org>,
"Bryan Wu" <cooloney@...nel.org>
Subject: RE: [PATCH v2] mfd: ADP5520 Multifunction LCD Backlight and Keypad Input Device Driver
>With 2 of those devices, your board file would look like that:
>
>static struct i2c_board_info __initdata board_i2c_board_info[] = {
> { /* APD5520 #1 */
> I2C_BOARD_INFO("pmic-adp5520", SLAVE_ADDR_1),
> .platform_data = &apd5520_platform_1,
> },
> { /* APD5520 #2 */
> I2C_BOARD_INFO("pmic-adp5520", SLAVE_ADDR_2),
> .platform_data = &apd5520_platform_2,
> },
>};
>
>and your platform data would be an aggregation of all subdevices
platform data
>structures:
>
>struct adp5520_platform_data {
> struct adp5520_leds_platfrom_data *leds;
> struct adp5520_keys_platfrom_data *keyp;
> struct adp5520_gpio_platfrom_data *gpio;
>}
>
>Then, your mfd/adp5520.c will have that piece of code:
>
>static struct platform_device adp5520_gpio_device = {
> .name = "adp5520-gpio",
> .id = -1,
>}
>
>static struct platform_device *adp5520_subdevs[] = {
> &adp5520_gpio_device,
> &adp5520_leds_device,
> &adp5520_keyp_device,
>}
>
>Finally, your i2c probe routine would assign platform_data pointers to
te
>right devices:
>
>static int __devinit adp5520_probe(struct i2c_client *client,
> const struct i2c_device_id *id)
>{
> struct adp5520_platform_data *pdata = client->dev.platform_data;
>[...]
> for (i = 0; i < ARRAY_SIZE(adp5520_subdevs); i++) {
> adp5520_subdevs[i]->dev.parent = &client->dev;
> adp5520_assign_pdata(&adp5520_subdevs[i], pdata);
> }
>
> platform_add_devices(adp5520_subdevs,
> ARRAY_SIZE(adp5520_subdevs));
>}
>
>Where adp5520_assign_pdata() is a routine setting the platform_device's
>platform_data pointer according e.g. to the platform_device name field.
>
>Would that make sense to you ?
>
>Cheers,
>Samuel.
I think that should work.
Thanks,
Michael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists