2 * platform_tca6416.c: tca6416 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/platform_data/pca953x.h>
14 #include <linux/i2c.h>
15 #include <linux/gpio.h>
16 #include <asm/intel-mid.h>
18 #define TCA6416_NAME "tca6416"
19 #define TCA6416_BASE "tca6416_base"
20 #define TCA6416_INTR "tca6416_int"
22 static void *tca6416_platform_data(void *info
)
24 static struct pca953x_platform_data tca6416
;
25 struct i2c_board_info
*i2c_info
= info
;
27 char base_pin_name
[SFI_NAME_LEN
+ 1];
28 char intr_pin_name
[SFI_NAME_LEN
+ 1];
30 strcpy(i2c_info
->type
, TCA6416_NAME
);
31 strcpy(base_pin_name
, TCA6416_BASE
);
32 strcpy(intr_pin_name
, TCA6416_INTR
);
34 gpio_base
= get_gpio_by_name(base_pin_name
);
35 intr
= get_gpio_by_name(intr_pin_name
);
39 tca6416
.gpio_base
= gpio_base
;
41 i2c_info
->irq
= intr
+ INTEL_MID_IRQ_OFFSET
;
42 tca6416
.irq_base
= gpio_base
+ INTEL_MID_IRQ_OFFSET
;
45 tca6416
.irq_base
= -1;
50 static const struct devs_id tca6416_dev_id __initconst
= {
52 .type
= SFI_DEV_TYPE_I2C
,
54 .get_platform_data
= &tca6416_platform_data
,
57 sfi_device(tca6416_dev_id
);