1 // SPDX-License-Identifier: GPL-2.0-only
3 * platform_tca6416.c: tca6416 platform data initialization file
5 * (C) Copyright 2013 Intel Corporation
6 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
9 #include <linux/platform_data/pca953x.h>
10 #include <linux/i2c.h>
11 #include <linux/gpio.h>
12 #include <asm/intel-mid.h>
14 #define TCA6416_NAME "tca6416"
15 #define TCA6416_BASE "tca6416_base"
16 #define TCA6416_INTR "tca6416_int"
18 static void *tca6416_platform_data(void *info
)
20 static struct pca953x_platform_data tca6416
;
21 struct i2c_board_info
*i2c_info
= info
;
23 char base_pin_name
[SFI_NAME_LEN
+ 1];
24 char intr_pin_name
[SFI_NAME_LEN
+ 1];
26 strcpy(i2c_info
->type
, TCA6416_NAME
);
27 strcpy(base_pin_name
, TCA6416_BASE
);
28 strcpy(intr_pin_name
, TCA6416_INTR
);
30 gpio_base
= get_gpio_by_name(base_pin_name
);
31 intr
= get_gpio_by_name(intr_pin_name
);
35 tca6416
.gpio_base
= gpio_base
;
37 i2c_info
->irq
= intr
+ INTEL_MID_IRQ_OFFSET
;
38 tca6416
.irq_base
= gpio_base
+ INTEL_MID_IRQ_OFFSET
;
41 tca6416
.irq_base
= -1;
46 static const struct devs_id tca6416_dev_id __initconst
= {
48 .type
= SFI_DEV_TYPE_I2C
,
50 .get_platform_data
= &tca6416_platform_data
,
53 sfi_device(tca6416_dev_id
);