Linux-libre 3.18.37-gnu
[librecmc/linux-libre.git] / arch / x86 / platform / intel-mid / device_libs / platform_max3111.c
1 /*
2  * platform_max3111.c: max3111 platform data initilization 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/gpio.h>
14 #include <linux/spi/spi.h>
15 #include <asm/intel-mid.h>
16
17 static void __init *max3111_platform_data(void *info)
18 {
19         struct spi_board_info *spi_info = info;
20         int intr = get_gpio_by_name("max3111_int");
21
22         spi_info->mode = SPI_MODE_0;
23         if (intr == -1)
24                 return NULL;
25         spi_info->irq = intr + INTEL_MID_IRQ_OFFSET;
26         return NULL;
27 }
28
29 static const struct devs_id max3111_dev_id __initconst = {
30         .name = "spi_max3111",
31         .type = SFI_DEV_TYPE_SPI,
32         .get_platform_data = &max3111_platform_data,
33 };
34
35 sfi_device(max3111_dev_id);