perf annotate: Show full source location with 'l' hotkey
[sfrench/cifs-2.6.git] / arch / x86 / platform / intel-mid / device_libs / platform_tca6416.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * platform_tca6416.c: tca6416 platform data initialization file
4  *
5  * (C) Copyright 2013 Intel Corporation
6  * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
7  */
8
9 #include <linux/platform_data/pca953x.h>
10 #include <linux/i2c.h>
11 #include <linux/gpio.h>
12 #include <asm/intel-mid.h>
13
14 #define TCA6416_NAME    "tca6416"
15 #define TCA6416_BASE    "tca6416_base"
16 #define TCA6416_INTR    "tca6416_int"
17
18 static void *tca6416_platform_data(void *info)
19 {
20         static struct pca953x_platform_data tca6416;
21         struct i2c_board_info *i2c_info = info;
22         int gpio_base, intr;
23         char base_pin_name[SFI_NAME_LEN + 1];
24         char intr_pin_name[SFI_NAME_LEN + 1];
25
26         strcpy(i2c_info->type, TCA6416_NAME);
27         strcpy(base_pin_name, TCA6416_BASE);
28         strcpy(intr_pin_name, TCA6416_INTR);
29
30         gpio_base = get_gpio_by_name(base_pin_name);
31         intr = get_gpio_by_name(intr_pin_name);
32
33         if (gpio_base < 0)
34                 return NULL;
35         tca6416.gpio_base = gpio_base;
36         if (intr >= 0) {
37                 i2c_info->irq = intr + INTEL_MID_IRQ_OFFSET;
38                 tca6416.irq_base = gpio_base + INTEL_MID_IRQ_OFFSET;
39         } else {
40                 i2c_info->irq = -1;
41                 tca6416.irq_base = -1;
42         }
43         return &tca6416;
44 }
45
46 static const struct devs_id tca6416_dev_id __initconst = {
47         .name = "tca6416",
48         .type = SFI_DEV_TYPE_I2C,
49         .delay = 1,
50         .get_platform_data = &tca6416_platform_data,
51 };
52
53 sfi_device(tca6416_dev_id);