2 * platform_max7315.c: max7315 platform data initilization file
4 * (C) Copyright 2013 Intel Corporation
5 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
13 #include <linux/init.h>
14 #include <linux/gpio.h>
15 #include <linux/i2c.h>
16 #include <linux/platform_data/pca953x.h>
17 #include <asm/intel-mid.h>
21 static void __init
*max7315_platform_data(void *info
)
23 static struct pca953x_platform_data max7315_pdata
[MAX7315_NUM
];
25 struct pca953x_platform_data
*max7315
= &max7315_pdata
[nr
];
26 struct i2c_board_info
*i2c_info
= info
;
28 char base_pin_name
[SFI_NAME_LEN
+ 1];
29 char intr_pin_name
[SFI_NAME_LEN
+ 1];
31 if (nr
== MAX7315_NUM
) {
32 pr_err("too many max7315s, we only support %d\n",
36 /* we have several max7315 on the board, we only need load several
37 * instances of the same pca953x driver to cover them
39 strcpy(i2c_info
->type
, "max7315");
41 sprintf(base_pin_name
, "max7315_%d_base", nr
);
42 sprintf(intr_pin_name
, "max7315_%d_int", nr
);
44 strcpy(base_pin_name
, "max7315_base");
45 strcpy(intr_pin_name
, "max7315_int");
48 gpio_base
= get_gpio_by_name(base_pin_name
);
49 intr
= get_gpio_by_name(intr_pin_name
);
53 max7315
->gpio_base
= gpio_base
;
55 i2c_info
->irq
= intr
+ INTEL_MID_IRQ_OFFSET
;
56 max7315
->irq_base
= gpio_base
+ INTEL_MID_IRQ_OFFSET
;
59 max7315
->irq_base
= -1;
64 static const struct devs_id max7315_dev_id __initconst
= {
65 .name
= "i2c_max7315",
66 .type
= SFI_DEV_TYPE_I2C
,
68 .get_platform_data
= &max7315_platform_data
,
71 static const struct devs_id max7315_2_dev_id __initconst
= {
72 .name
= "i2c_max7315_2",
73 .type
= SFI_DEV_TYPE_I2C
,
75 .get_platform_data
= &max7315_platform_data
,
78 sfi_device(max7315_dev_id
);
79 sfi_device(max7315_2_dev_id
);