GNU Linux-libre 4.14.266-gnu1
[releases.git] / arch / x86 / platform / intel-mid / device_libs / platform_msic_gpio.c
1 /*
2  * platform_msic_gpio.c: MSIC GPIO platform data initialization file
3  *
4  * (C) Copyright 2013 Intel Corporation
5  * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
6  *
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
10  * of the License.
11  */
12
13 #include <linux/kernel.h>
14 #include <linux/interrupt.h>
15 #include <linux/scatterlist.h>
16 #include <linux/sfi.h>
17 #include <linux/init.h>
18 #include <linux/gpio.h>
19 #include <linux/mfd/intel_msic.h>
20 #include <asm/intel-mid.h>
21
22 #include "platform_msic.h"
23
24 static void __init *msic_gpio_platform_data(void *info)
25 {
26         static struct intel_msic_gpio_pdata msic_gpio_pdata;
27
28         int gpio = get_gpio_by_name("msic_gpio_base");
29
30         if (gpio < 0)
31                 return NULL;
32
33         msic_gpio_pdata.gpio_base = gpio;
34         msic_pdata.gpio = &msic_gpio_pdata;
35
36         return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_GPIO);
37 }
38
39 static const struct devs_id msic_gpio_dev_id __initconst = {
40         .name = "msic_gpio",
41         .type = SFI_DEV_TYPE_IPC,
42         .delay = 1,
43         .msic = 1,
44         .get_platform_data = &msic_gpio_platform_data,
45 };
46
47 sfi_device(msic_gpio_dev_id);